Lines Matching refs:dev
55 struct disk_devdesc *dev;
78 disk_lookup(struct disk_devdesc *dev)
85 if (entry->d_dev != dev->d_dev ||
86 entry->d_unit != dev->d_unit)
88 dev->d_opendata = entry->od;
89 if (entry->d_slice == dev->d_slice &&
90 entry->d_partition == dev->d_partition) {
91 dev->d_offset = entry->d_offset;
92 DEBUG("%s offset %lld", disk_fmtdev(dev),
93 (long long)dev->d_offset);
105 disk_insert(struct disk_devdesc *dev)
114 entry->d_dev = dev->d_dev;
115 entry->d_unit = dev->d_unit;
116 entry->d_slice = dev->d_slice;
117 entry->d_partition = dev->d_partition;
118 entry->od = (struct open_disk *)dev->d_opendata;
120 entry->d_offset = dev->d_offset;
125 DEBUG("%s cached", disk_fmtdev(dev));
135 struct disk_devdesc dev;
139 dev.d_dev = (struct devsw *)entry->d_dev;
140 dev.d_unit = entry->d_unit;
141 dev.d_slice = entry->d_slice;
142 dev.d_partition = entry->d_partition;
143 printf("%s %d => %p [%d]\n", disk_fmtdev(&dev), entry->count,
176 struct disk_devdesc *dev;
179 dev = (struct disk_devdesc *)d;
180 od = (struct open_disk *)dev->d_opendata;
181 return (dev->d_dev->dv_strategy(dev, F_READ, offset, 0,
196 od = (struct open_disk *)pa->dev->d_opendata;
209 pa->dev->d_offset = part->start;
210 table = ptable_open(pa->dev, part->end - part->start + 1,
215 bsd.dev = pa->dev;
227 disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
233 od = (struct open_disk *)dev->d_opendata;
234 pa.dev = dev;
241 disk_read(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
246 od = (struct open_disk *)dev->d_opendata;
247 ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, 0,
254 disk_write(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
259 od = (struct open_disk *)dev->d_opendata;
260 ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, 0,
267 disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *buf)
270 if (dev->d_dev->dv_ioctl)
271 return ((*dev->d_dev->dv_ioctl)(dev->d_opendata, cmd, buf));
277 disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize,
287 rc = disk_lookup(dev);
295 dev->d_offset = 0;
297 slice = dev->d_slice;
298 partition = dev->d_partition;
305 od = (struct open_disk *)dev->d_opendata;
307 disk_fmtdev(dev), dev->d_unit, dev->d_slice,
308 dev->d_partition, od);
316 dev->d_opendata = od;
323 disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od);
326 od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
340 dev->d_offset = part.start;
349 dev->d_offset = part.start;
371 table = ptable_open(dev, part.end - part.start + 1,
391 dev->d_offset += part.start;
403 DEBUG("%s could not open", disk_fmtdev(dev));
406 disk_insert(dev);
407 /* Save the slice and partition number to the dev */
408 dev->d_slice = slice;
409 dev->d_partition = partition;
410 DEBUG("%s offset %lld => %p", disk_fmtdev(dev),
411 (long long)dev->d_offset, od);
417 disk_close(struct disk_devdesc *dev)
421 od = (struct open_disk *)dev->d_opendata;
422 DEBUG("%s closed => %p [%d]", disk_fmtdev(dev), od, od->rcnt);
434 struct disk_devdesc dev;
443 dev.d_dev = (struct devsw *)entry->d_dev;
444 dev.d_unit = entry->d_unit;
445 dev.d_slice = entry->d_slice;
446 dev.d_partition = entry->d_partition;
447 DEBUG("%s was freed => %p [%d]", disk_fmtdev(&dev),
461 disk_fmtdev(struct disk_devdesc *dev)
466 cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit);
467 if (dev->d_slice >= 0) {
469 if (dev->d_partition == 255) {
470 sprintf(cp, "p%d:", dev->d_slice);
475 cp += sprintf(cp, "s%d", dev->d_slice);
478 if (dev->d_partition >= 0)
479 cp += sprintf(cp, "%c", dev->d_partition + 'a');
485 disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path)
528 dev->d_unit = unit;
529 dev->d_slice = slice;
530 dev->d_partition = partition;