Locating Disk Geometry

Discussion in 'Mac Programming' started by jimmiller962, Aug 27, 2010.

  1. jimmiller962 macrumors newbie

    Jul 3, 2008
    I have been assigned a project to port an internal Windows and Linux utility to OS X. All has gone well up to this point, however, I have the requirement to locate the disk geometry for any given disk... which I am unable to locate. I expected to find an ioctl or deviceio function to grab this information, but so far nothing. I suspect I am overlooking something simple, but just can't find what I am missing.

    Thoughts? Suggestions? Any help, even a nudge in the right direction would be greatly appreciated!


    After further research I have located DIOCGDINFO, which seems like it should grab the correct info. I have located the definitions in disklabel.h, which is buried deep in System/Library/Frameworks/Kernal.framework/Versions/A/Headers/sys/disklabel.h, unfortunately I am unable to locate a form of #include that finds the file. For example, the following all fail:

    #include <disklabel.h>
    #include <sys/disklabel.h>, and even
    #include <System/Library/Frameworks/Kernal.framework/Versions/A/Headers/sys/disklabel.h>

    Of 10+ include files this is the only one that is eluding capture.

  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    FWIW, you've misspelled "Kernel". It contains no a's.

    #include <System/Library/Frameworks/Kernal.framework/Versions/A/Headers/sys/disklabel.h>
    This is a relative path, not an absolute path. It's also enclosed in <>'s which means "search system directories". Double-quotes should be used for an absolute path.

    I'm not saying this will fix things, just listing the most obvious errors.
  3. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR
    Well, it'd be Kernel, not Kernal... but even then it might only be accessible from a kext; not sure.

Share This Page