Lines Matching refs:dev

54 	struct disk_devdesc	*dev;
85 struct disk_devdesc *dev;
88 dev = (struct disk_devdesc *)d;
89 od = (struct open_disk *)dev->dd.d_opendata;
101 return (dev->dd.d_dev->dv_strategy(dev, F_READ | F_NORA, offset,
108 struct disk_devdesc dev;
118 od = (struct open_disk *)pa->dev->dd.d_opendata;
129 dev.dd.d_dev = pa->dev->dd.d_dev;
130 dev.dd.d_unit = pa->dev->dd.d_unit;
131 dev.d_slice = part->index;
132 dev.d_partition = -1;
133 if (disk_open(&dev, partsize, sectsize) == 0) {
139 dev.d_partition = -1;
140 dev.d_offset = part->start;
141 table = ptable_open(&dev, partsize, sectsize, ptblread);
144 bsd.dev = pa->dev;
150 disk_close(&dev);
158 disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
164 od = (struct open_disk *)dev->dd.d_opendata;
165 pa.dev = dev;
172 disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
177 od = (struct open_disk *)dev->dd.d_opendata;
178 ret = dev->dd.d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
185 disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
190 od = (struct open_disk *)dev->dd.d_opendata;
191 ret = dev->dd.d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
198 disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data)
200 struct open_disk *od = dev->dd.d_opendata;
210 if (dev->d_offset == 0)
223 disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
241 dev->dd.d_opendata = od;
249 memcpy(&partdev, dev, sizeof(partdev));
254 dev->d_offset = 0;
256 slice = dev->d_slice;
257 partition = dev->d_partition;
260 disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, od);
282 dev->d_offset = part.start;
286 dev->d_offset = 0;
296 dev->d_offset = part.start;
319 table = ptable_open(dev, part.end - part.start + 1,
339 dev->d_offset += part.start;
350 DPRINTF("%s could not open", disk_fmtdev(dev));
352 /* Save the slice and partition number to the dev */
353 dev->d_slice = slice;
354 dev->d_partition = partition;
355 DPRINTF("%s offset %lld => %p", disk_fmtdev(dev),
356 (long long)dev->d_offset, od);
362 disk_close(struct disk_devdesc *dev)
366 od = (struct open_disk *)dev->dd.d_opendata;
367 DPRINTF("%s closed => %p", disk_fmtdev(dev), od);
374 disk_fmtdev(struct disk_devdesc *dev)
379 cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit);
380 if (dev->d_slice >= 0) {
382 if (dev->d_partition == 255) {
383 sprintf(cp, "p%d:", dev->d_slice);
388 cp += sprintf(cp, "s%d", dev->d_slice);
391 if (dev->d_partition >= 0)
392 cp += sprintf(cp, "%c", dev->d_partition + 'a');
398 disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path)
441 dev->dd.d_unit = unit;
442 dev->d_slice = slice;
443 dev->d_partition = partition;