[comp.sys.mac.programmer] MFS vs. HFS -- Help wanted

svpillay@phoenix.Princeton.EDU (Kanthan Pillay) (08/19/89)

Can anyone out there tell me a quick and dirty way of checking
whether a diskette is MFS or HFS?
	Ideally, I would like to know how big the diskette is, but
knowing whether it is MFS will do for now. Pascal or C? Yes.
					Kanthan.

blob@apple.com (Brian Bechtel) (08/21/89)

In article <10002@phoenix.Princeton.EDU> svpillay@phoenix.Princeton.EDU 
(Kanthan Pillay) writes:
> Can anyone out there tell me a quick and dirty way of checking
> whether a diskette is MFS or HFS?

To check if a volume is HFS or MFS, call PBHGetVInfo.  In the field 
ioVSigWord, the two values you're looking for are $42$44 (HFS) or $D2$D7 
(MFS).


>         Ideally, I would like to know how big the diskette is, but
> knowing whether it is MFS will do for now.

To find the size of a volume, call PBHGetVInfo.  The size is the product 
of the number of allocation blocks and the allocation block size. 
(ioVNmAlBlks * ioVAlBlkSiz)

See page IV-130 and IV-123-124 of Inside Macintosh for more details.

--Brian Bechtel     blob@apple.com     "My opinion, not Apple's"

keith@Apple.COM (Keith Rollin) (08/22/89)

In article <3716@internal.Apple.COM> blob@apple.com (Brian Bechtel) writes:
>In article <10002@phoenix.Princeton.EDU> svpillay@phoenix.Princeton.EDU 
>(Kanthan Pillay) writes:
>
>>         Ideally, I would like to know how big the diskette is, but
>> knowing whether it is MFS will do for now.
>
>To find the size of a volume, call PBHGetVInfo.  The size is the product 
>of the number of allocation blocks and the allocation block size. 
>(ioVNmAlBlks * ioVAlBlkSiz)
>
>See page IV-130 and IV-123-124 of Inside Macintosh for more details.

Thanks for the tip on this Brian. I just wanted to add on thing. We get a lot
of developers who try to use this equation, and get upset when it doesn't work
in all cases. It is important to remember - especially in Pascal - that
ioVNmAlBlks is an UNSIGNED quantity. If you don't take that into account, you
often get negative results.

This is shown in DTS Sample Code #018: StdFile (plug, plug).


------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions