Copyright clean-up (part 1):
[AROS.git] / arch / all-darwin / hostdisk / geometry.c
blobf4e5d6dfb59500fdc942ac94d26471f0118163b1
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /* This routine differs in different UNIX variants (using different IOCTLs) */
8 #include <aros/debug.h>
9 #include <devices/trackdisk.h>
10 #include <exec/memory.h>
11 #include <proto/hostlib.h>
13 #include <sys/disk.h>
15 #include "hostdisk_host.h"
16 #include "hostdisk_device.h"
18 ULONG Host_DeviceGeometry(int file, struct DriveGeometry *dg, struct HostDiskBase *hdskBase)
20 int ret, err;
22 HostLib_Lock();
24 ret = hdskBase->iface->ioctl(file, DKIOCGETBLOCKSIZE, &dg->dg_SectorSize);
26 if (ret != -1)
27 ret = hdskBase->iface->ioctl(file, DKIOCGETBLOCKCOUNT, &dg->dg_TotalSectors);
29 err = *hdskBase->errnoPtr;
31 HostLib_Unlock();
33 if (ret == -1)
35 D(bug("hostdisk: Error %d\n", err));
37 return err;
40 D(bug("hostdisk: %u sectors per %u bytes\n", dg->dg_TotalSectors, dg->dg_SectorSize));
43 * This is all we can do on Darwin. They dropped CHS completely,
44 * so we stay with LBA (CylSectors == 1)
46 dg->dg_Cylinders = dg->dg_TotalSectors;
48 return 0;