• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Distinguishing between HFS and HFS+
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distinguishing between HFS and HFS+


  • Subject: Re: Distinguishing between HFS and HFS+
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Tue, 24 Dec 2002 09:46:33 -0200

>From: Guy Jonathan <email@hidden>
>Date: Tue, 24 Dec 2002 01:28:05 -0000
>
>Hi folks
> Does anyone know how to tell the difference between hfs and hfs+. I've
>dabbled about with FSGetVolumeInfo but the FSVolumeInfo I get back for the
>root volume seems to be giving me funny results. I tried using this piece of
>code (modified slightly) I found earlier from a guy called Rainer
>Brockerhoff.
>
>void getInfoForPath(NSString *path) //path being the path to the volume
>{
> int vRefNum = getVolumeNumberForPath(path);
> UInt32 blockSize;
> UInt32 dataClumpSize;
> UInt8 finderInfo;
> UInt16 filesystemID;
> UInt16 signature;
> unsigned long long returnValue = 0;
> OSErr osErr;
> FSVolumeInfo info;
> osErr = FSGetVolumeInfo(vRefNum, 0, NULL, kFSVolInfoSizes, &info, NULL,
>NULL);
> if (osErr == noErr) {
> signature = info.signature;
> filesystemID = info.filesystemID;
> printf("Volume path = %s \tVolume Signature = %d\tfilesystemID = %d\r",
>[path cString],signature,filesystemID);
> }
>}

Hi Jonathan,

You declared signature and filesystemID as UInt16, not int - so your %d format fails to print correctly.
Declare them as int (or SInt32, or OSType as I prefer) and print them with X.

>As far as I know "Volume Signature" should be "0" and filesystemID should be
>"BD" for hfs and "H+" for hfs+.

Future values for both fields might use all four bytes, so it's safer not to truncate them.
HFS will return '\000\000BD' (decimal value 16964) in filesystemID, and HFS+ will return '\000\000H+' (decimal value 18475).

--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ now with forums for XRay, Zingg! et al.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: NSCFNumber, no pool in place - just leaking
  • Next by Date: Re: Iterating over a classes methods?
  • Previous by thread: Distinguishing between HFS and HFS+
  • Next by thread: Iterating over a classes methods?
  • Index(es):
    • Date
    • Thread