Lines Matching refs:fd
142 #define IOCTL(fd, request, ...) \ argument
145 ret = ioctl((fd), (request), ##__VA_ARGS__); \
156 static int fd = -1; in mmc_rpmb_fd() local
160 if (fd < 0) { in mmc_rpmb_fd()
166 fd = open(path, O_RDWR); in mmc_rpmb_fd()
167 if (fd < 0) { in mmc_rpmb_fd()
177 return fd; in mmc_rpmb_fd()
183 int fd = 0; in mmc_fd() local
192 fd = open(path, O_RDONLY); in mmc_fd()
193 if (fd < 0) in mmc_fd()
196 return fd; in mmc_fd()
199 static void close_mmc_fd(int fd) in close_mmc_fd() argument
201 close(fd); in close_mmc_fd()
211 int fd = 0; in read_cid() local
216 fd = open(path, O_RDONLY); in read_cid()
217 if (fd < 0) { in read_cid()
223 st = read(fd, hex, 2); in read_cid()
233 close(fd); in read_cid()
239 #define IOCTL(fd, request, ...) ioctl_emu((fd), (request), ##__VA_ARGS__) argument
266 static struct rpmb_emu *mem_for_fd(int fd) in mem_for_fd() argument
271 sfd = fd; in mem_for_fd()
272 if (sfd != fd) { in mem_for_fd()
495 static int ioctl_emu_cmd(int fd, struct mmc_ioc_cmd *cmd) in ioctl_emu_cmd() argument
499 struct rpmb_emu *mem = mem_for_fd(fd); in ioctl_emu_cmd()
573 static int ioctl_emu(int fd, unsigned long request, ...) in ioctl_emu() argument
586 res = ioctl_emu_cmd(fd, cmd); in ioctl_emu()
593 res = ioctl_emu_cmd(fd, &mcmd->cmds[i]); in ioctl_emu()
620 static void close_mmc_fd(int fd) in close_mmc_fd() argument
622 (void)fd; in close_mmc_fd()
631 static uint32_t read_ext_csd(int fd, uint8_t *ext_csd) in read_ext_csd() argument
643 st = IOCTL(fd, MMC_IOC_CMD, &cmd); in read_ext_csd()
660 static uint32_t rpmb_data_req(int fd, struct rpmb_data_frame *req_frm, in rpmb_data_req() argument
761 st = IOCTL(fd, MMC_IOC_MULTI_CMD, mcmd); in rpmb_data_req()
773 int fd = 0; in rpmb_get_dev_info() local
781 fd = mmc_fd(dev_id); in rpmb_get_dev_info()
782 if (fd < 0) in rpmb_get_dev_info()
785 res = read_ext_csd(fd, ext_csd); in rpmb_get_dev_info()
794 close_mmc_fd(fd); in rpmb_get_dev_info()
810 int fd = 0; in rpmb_process_request_unlocked() local
819 fd = mmc_rpmb_fd(sreq->dev_id); in rpmb_process_request_unlocked()
820 if (fd < 0) in rpmb_process_request_unlocked()
822 res = rpmb_data_req(fd, RPMB_REQ_DATA(req), req_nfrm, rsp, in rpmb_process_request_unlocked()