Lines Matching refs:dev
155 _amiga_read_block (const PedDevice *dev, struct AmigaBlock *blk,
158 if (!ped_device_read (dev, blk, block, 1))
172 if (!ped_device_write ((PedDevice*)dev, blk, block, 1))
236 _amiga_find_rdb (const PedDevice *dev, struct RigidDiskBlock *rdb) {
243 if (!_amiga_read_block (dev, AMIGA(rdb), i, ids)) {
327 amiga_probe (const PedDevice *dev)
331 PED_ASSERT(dev != NULL, return 0);
333 if ((rdb=RDSK(ped_malloc(dev->sector_size)))==NULL)
335 found = _amiga_find_rdb (dev, rdb);
342 amiga_alloc (const PedDevice* dev)
349 PED_ASSERT(dev != NULL, return NULL);
350 cyl_size = dev->hw_geom.sectors * dev->hw_geom.heads;
352 if (!(disk = _ped_disk_alloc (dev, &amiga_disk_type)))
377 rdb->rdb_Cylinders = PED_CPU_TO_BE32 (dev->hw_geom.cylinders);
378 rdb->rdb_Sectors = PED_CPU_TO_BE32 (dev->hw_geom.sectors);
379 rdb->rdb_Heads = PED_CPU_TO_BE32 (dev->hw_geom.heads);
381 rdb->rdb_Park = PED_CPU_TO_BE32 (dev->hw_geom.cylinders);
382 rdb->rdb_WritePreComp = PED_CPU_TO_BE32 (dev->hw_geom.cylinders);
383 rdb->rdb_ReducedWrite = PED_CPU_TO_BE32 (dev->hw_geom.cylinders);
393 rdb->rdb_HiCylinder = PED_CPU_TO_BE32 (dev->hw_geom.cylinders -1);
401 _amiga_set_bstr(dev->model, rdb->rdb_DiskProduct, 16);
420 PED_ASSERT(disk->dev != NULL, return NULL);
425 if (!(new_disk = ped_disk_new_fresh (disk->dev, &amiga_disk_type)))
445 amiga_clobber (PedDevice* dev)
450 PED_ASSERT(dev != NULL, return 0);
455 while ((i = _amiga_find_rdb (dev, rdb)) != AMIGA_RDB_NOT_FOUND) {
457 result = ped_device_write (dev, (void*) rdb, i, 1);
492 PED_ASSERT(disk->dev != NULL, return 0);
493 PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
498 if (_amiga_find_rdb (disk->dev, rdb) == AMIGA_RDB_NOT_FOUND) {
504 /* Let's copy the rdb read geometry to the dev */
505 /* FIXME: should this go into disk->dev->bios_geom instead? */
506 disk->dev->hw_geom.cylinders = PED_BE32_TO_CPU (rdb->rdb_Cylinders);
507 disk->dev->hw_geom.heads = PED_BE32_TO_CPU (rdb->rdb_Heads);
508 disk->dev->hw_geom.sectors = PED_BE32_TO_CPU (rdb->rdb_Sectors);
516 if (!(partition = ped_malloc (disk->dev->sector_size)))
536 if (!_amiga_read_block (disk->dev, AMIGA(partition),
579 PED_ASSERT(disk->dev != NULL, return 0);
598 if (!_amiga_read_block (disk->dev, AMIGA(block), next, NULL)) {
653 PED_ASSERT (disk->dev != NULL, return 0);
660 if ((rdb_num = _amiga_find_rdb (disk->dev, rdb)) == AMIGA_RDB_NOT_FOUND) {
752 if (!ped_device_write (disk->dev, (void*) partition, block_num, 1)) {
771 if (!ped_device_write (disk->dev, (void*) disk->disk_specific, rdb_num, 1))
776 return ped_device_sync (disk->dev);
791 PedDevice *dev;
797 PED_ASSERT(disk->dev != NULL, return NULL);
799 dev = disk->dev;
800 cyl = (PedSector) (dev->hw_geom.sectors * dev->hw_geom.heads);
825 partition->de_Surfaces = PED_CPU_TO_BE32(dev->hw_geom.heads);
828 = PED_CPU_TO_BE32(dev->hw_geom.sectors);
1027 PedDevice *dev = disk->dev;
1030 PedSector cyl_size = dev->hw_geom.sectors * dev->hw_geom.heads;
1036 if (!ped_geometry_init(&max_geom, dev, MAX_RDB_BLOCK + 1,
1037 dev->length - MAX_RDB_BLOCK - 1))
1041 &max_geom, &max_geom, 1, dev->length);
1096 PED_ASSERT (disk->dev != NULL, goto error);
1098 constraint_any = ped_constraint_any (disk->dev);