Re: Find if mounted volume is Local or Network?
Re: Find if mounted volume is Local or Network?
- Subject: Re: Find if mounted volume is Local or Network?
- From: Jim Luther <email@hidden>
- Date: Fri, 6 Nov 2009 08:26:08 -0800
The common alternatives:
FSRef: Pass the FSRef to FSRefMakePath() to get a POSIX path. Then pass the path to statfs(2) and look at the statfs.f_flags field. If the MNT_LOCAL flag is set, the volume is local.
FSVolumeRefNum: Pass the FSVolumeRefNum to FSGetVolumeParms() and look at the GetVolParmsInfoBuffer.vMServerAdr field. If vMServerAdr is 0, the volume is local (on Mac OS X, vMServerAdr doesn't ever contain a server address - it's just a boolean indicating remote (true) or local (false)). Of course, you can also get the FSVolumeRefNum from the FSRef using FSGetCatalogInfo().
CFURL (a file URL): Pass the CFURL to CFURLGetFileSystemRepresentation() to get a POSIX path (pass TRUE for the resolveAgainstBase parameter). Then pass the path to statfs(2) and look at the statfs.f_flags field. If the MNT_LOCAL flag is set, the volume is local.
- Jim
On Nov 6, 2009, at 4:29 AM, Quinn wrote:
> At 05:12 -0800 6/11/09, Jerry Krinock wrote:
>> How can I determine whether or not SomeVolume is a Local or Network mount?
>
> There are lots of good way to do this. If you're starting with a path as a C string, just call <x-man-page://2/statfs> and check f_flags to MNT_LOCAL.
>
> If you're starting with something else, let me know your start point and I can described the various alternatives.
>
> S+E
> --
> Quinn "The Eskimo!" <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden