Lines Matching defs:dev

52 	struct disk_devdesc	*dev;
83 struct disk_devdesc *dev;
86 dev = (struct disk_devdesc *)d;
87 od = (struct open_disk *)dev->d_opendata;
99 return (dev->d_dev->dv_strategy(dev, F_READ | F_NORA , offset,
107 struct disk_devdesc dev;
115 od = (struct open_disk *)pa->dev->d_opendata;
128 dev.d_dev = pa->dev->d_dev;
129 dev.d_unit = pa->dev->d_unit;
130 dev.d_slice = part->index;
131 dev.d_partition = -1;
132 if (disk_open(&dev, part->end - part->start + 1,
134 table = ptable_open(&dev, part->end - part->start + 1,
138 bsd.dev = &dev;
144 disk_close(&dev);
152 disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
158 od = (struct open_disk *)dev->d_opendata;
159 pa.dev = dev;
166 disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
171 od = (struct open_disk *)dev->d_opendata;
172 ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
179 disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
184 od = (struct open_disk *)dev->d_opendata;
185 ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
192 disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data)
194 struct open_disk *od = dev->d_opendata;
204 if (dev->d_offset == 0)
217 disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
229 dev->d_offset = 0;
231 slice = dev->d_slice;
232 partition = dev->d_partition;
238 dev->d_opendata = od;
243 disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od);
246 od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
267 dev->d_offset = part.start;
278 dev->d_offset = part.start;
301 table = ptable_open(dev, part.end - part.start + 1,
322 dev->d_offset += part.start;
333 DEBUG("%s could not open", disk_fmtdev(dev));
335 /* Save the slice and partition number to the dev */
336 dev->d_slice = slice;
337 dev->d_partition = partition;
338 DEBUG("%s offset %lld => %p", disk_fmtdev(dev),
339 (long long)dev->d_offset, od);
345 disk_close(struct disk_devdesc *dev)
349 od = (struct open_disk *)dev->d_opendata;
350 DEBUG("%s closed => %p", disk_fmtdev(dev), od);
357 disk_fmtdev(struct disk_devdesc *dev)
362 cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit);
363 if (dev->d_slice >= 0) {
365 if (dev->d_partition == 255) {
366 sprintf(cp, "p%d:", dev->d_slice);
371 cp += sprintf(cp, "s%d", dev->d_slice);
374 if (dev->d_partition >= 0)
375 cp += sprintf(cp, "%c", dev->d_partition + 'a');
381 disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path)
424 dev->d_unit = unit;
425 dev->d_slice = slice;
426 dev->d_partition = partition;