Lines Matching defs:disk

43    disk - mass storage device
51 Mass storage devices such as a hard-disk or cdrom-drive are not
57 a <<cdrom>>, <<disk>> or <<floppy>> are created as children of of a
67 interpreted as an offset from the start of the disk.
70 disk that provides access to any of the physical media, a disk
71 partition, or even a file within a partition. The <<disk-label>>
89 The name of the file that contains an image of the disk. For
90 <<disk>> and <<floppy>> devices, the image will be opened for both
116 If this property is present, the disk file image is always opened
124 | $ psim -t 'disk-device' \
127 Add a CDROM and disk to an IDE bus. Specify the host operating
130 | -o '/pci/ide/disk@0/file "disk-image' \
150 | device_create_instance(root, "/pci/ide/disk:,\netbsd.elf");
164 interface) depends on the implementation of <<disk-label>> package.
167 The disk does not know its size. Hence it relies on the failure of
170 The disk size is limited by the addressable range covered by
174 The method #blocks should `stat' the disk to determine the number
193 hw_disk_device *disk;
199 hw_disk_device *disk,
202 if (disk->image != NULL)
203 fclose(disk->image);
204 if (disk->name != NULL)
205 free(disk->name);
206 disk->name = strdup(name);
207 disk->image = fopen(disk->name, disk->read_only ? "r" : "r+");
208 if (disk->image == NULL) {
210 device_error(me, "open %s failed\n", disk->name);
213 DTRACE(disk, ("image %s (%s)\n",
214 disk->name,
215 (disk->read_only ? "read-only" : "read-write")));
221 hw_disk_device *disk = device_data(me);
234 /* Tell the world we are a disk. */
237 /* get the name of the file specifying the disk image */
238 disk->name_index = 0;
239 disk->nr_names = device_find_string_array_property(me, "file",
240 disk->name_index, &name);
241 if (!disk->nr_names)
245 disk->read_only =
246 (strcmp(device_name(me), "disk") != 0
251 open_disk_image(me, disk, name);
264 hw_disk_device *disk = device_data(me);
267 disk->name_index = -1;
270 disk->name_index = (disk->name_index + 1) % disk->nr_names;
272 disk->name_index, &name))
275 open_disk_image(me, disk, name);
298 hw_disk_device *disk = device_data(me);
301 device_error(me, "read - extended disk addressing unimplemented");
304 else if (fseek(disk->image, addr, SEEK_SET) < 0)
306 else if (fread(dest, nr_bytes, 1, disk->image) != 1)
310 DTRACE(disk, ("io-read - address 0x%lx, nr-bytes-read %d, requested %d\n",
325 hw_disk_device *disk = device_data(me);
328 device_error(me, "write - extended disk addressing unimplemented");
329 if (disk->read_only)
333 else if (fseek(disk->image, addr, SEEK_SET) < 0)
335 else if (fwrite(source, nr_bytes, 1, disk->image) != 1)
339 DTRACE(disk, ("io-write - address 0x%lx, nr-bytes-written %d, requested %d\n",
351 DITRACE(disk, ("delete - instance=%ld\n",
362 DITRACE(disk, ("read - instance=%ld len=%ld\n",
367 if (fseek(data->disk->image, data->pos, SEEK_SET) < 0)
369 if (fread(buf, len, 1, data->disk->image) != 1)
371 data->pos = ftell(data->disk->image);
381 DITRACE(disk, ("write - instance=%ld len=%ld\n",
386 if (data->disk->read_only)
388 if (fseek(data->disk->image, data->pos, SEEK_SET) < 0)
390 if (fwrite(buf, len, 1, data->disk->image) != 1)
392 data->pos = ftell(data->disk->image);
405 DITRACE(disk, ("seek - instance=%ld pos_hi=%ld pos_lo=%ld\n",
431 DITRACE(disk, ("max-transfer - instance=%ld max-transfer=%ld\n",
458 DITRACE(disk, ("block-size - instance=%ld block-size=%ld\n",
485 DITRACE(disk, ("#blocks - instance=%ld #blocks=%ld\n",
514 hw_disk_device *disk = device_data(me);
516 data->disk = disk;
522 DITRACE(disk, ("create - path=%s(%s) instance=%ld\n",
553 { "disk", hw_disk_create, &hw_disk_callbacks },