Lines Matching refs:host_dev
36 struct host_block_dev *host_dev = dev_get_priv(dev); local
45 struct host_block_dev *host_dev = find_host_device(dev);
47 if (!host_dev)
51 if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) ==
56 ssize_t len = os_read(host_dev->fd, buffer, blkcnt * block_dev->blksz);
67 struct host_block_dev *host_dev = dev_get_priv(dev); local
75 struct host_block_dev *host_dev = find_host_device(dev);
78 if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) ==
83 ssize_t len = os_write(host_dev->fd, buffer, blkcnt * block_dev->blksz);
92 struct host_block_dev *host_dev; local
140 host_dev = dev_get_priv(dev);
141 host_dev->fd = fd;
142 host_dev->filename = fname;
155 struct host_block_dev *host_dev = find_host_device(dev); local
157 if (!host_dev)
159 if (host_dev->blk_dev.priv) {
160 os_close(host_dev->fd);
161 host_dev->blk_dev.priv = NULL;
163 if (host_dev->filename)
164 free(host_dev->filename);
166 host_dev->filename = strdup(filename);
168 host_dev->filename = NULL;
172 host_dev->fd = os_open(host_dev->filename, OS_O_RDWR);
173 if (host_dev->fd == -1) {
175 host_dev->filename);
179 struct blk_desc *blk_dev = &host_dev->blk_dev;
181 blk_dev->priv = host_dev;
183 blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz;
205 struct host_block_dev *host_dev = find_host_device(devnum);
207 if (!host_dev)
210 if (!host_dev->blk_dev.priv)
213 *blk_devp = &host_dev->blk_dev;