• 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: mount() from Cocoa App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mount() from Cocoa App


  • Subject: Re: mount() from Cocoa App
  • From: Jim Luther <email@hidden>
  • Date: Mon, 31 Oct 2005 08:43:31 -0800

Dalton, let me start with quick explanation of the File Manager routines that have been discussed in this thread:

* Either PBHGetVInfo (deprecated) or FSGetVolumeInfo can be used to index through the list of volumes the File Manager knows about. The MoreFilesX sample code <http://developer.apple.com/samplecode/ MoreFilesX/MoreFilesX.html> includes a routine named FSGetMountedVolumes that shows how to get the list of volumes using FSGetVolumeInfo.

* PBHGetVolParms is used to determine what features (attributes) are supported by a specific File Manager volume. The attributes are returned in the two bit fields vMAttrib and vMExtendedAttributes. I recommend using the GetVolParmsInfoBuffer macros in the MoreFilesX sample code because those macros correctly check the structure version before testing the attribute bits. MoreFilesX has a high level function, FSGetVolParms, which you can use instead of PBHGetVolParms.

* Together, PBGetVolMountInfoSize and PBGetVolMountInfo can be used to get the remount info for the volume. This info is returned in a VolumeMountInfoHeader structure which consists of a defined header followed by a variable length glob of opaque data which is file system specific. The "variable length glob of opaque data" is not opaque for the AFP file system because its structure was defined as the AFPXVolMountInfo structure -- it is opaque for all other file systems. However, for future compatibility it would be best to look at it as an opaque data structure. MoreFilesX has a high level functions, FSGetVolMountInfoSize and FSGetVolMountInfo, which you can use instead of PBGetVolMountInfoSize and PBGetVolMountInfo.

* FSCopyURLForVolume will return a CFURLRef to a File Manager volume. The DisplayURL sample code <http://developer.apple.com/samplecode/ DisplayURL/DisplayURL.html> shows how to use FSCopyURLForVolume and the CFURL routines to parse a CFURL into its various components. You'll be able to get the scheme (afp. nfs, http, smb, etc.), the host name (the net location), the path and more from the CFURL.

After I call PBGetVolMountInfo() I then call PBHGetVolParmsSync() trying to get the GetVolParmsInfoBuff.vMServerAdr field. The PBHGetVolParmsSync() returns noErr but I don't know how to interpret the OTAddress structure.

In Mac OS X, vMServerAdr is only useful for determining if a File Manager volume is a network volume (a non-zero value) or not (a zero value). You'll find a macro named VolIsNetworkVolume in MoreFilesX that shows how it is used.


I'd think the best solution for getting the server addresses (and it's very likely that there will be more than one address for a net location) for a particular volume would be to get the volume's URL with FSCopyURLForVolume and then parse the net location out of the URL (see the DisplayURL sample). You can then use the CFHost routines to get the addresses for that net location. Then, you can compare those addresses to the address of the server you are about to mount.

- Jim

On Oct 30, 2005, at 10:15 AM, Dalton Hamilton wrote:

typo -- One sentence below, I meant to say but this is NOT gethostbyname() resolvable -- but I'm sure you knew that.


On Oct 30, 2005, at 6:25 PM, Dalton Hamilton wrote:

Thanks, guys. I'm close on the AFP - I think. I'm still trying to get the IP address. I think I have the OTAddress returned but don't know how to interpret it.
I get through all of these success (with noErr) PBHGetVInfoSync(), then get through PBGetVolMountInfoSize() which then lets me call PBGetVolMountInfo().
I then have the data I need to tell that the FS is actually an AppleShare, I also have the correct server name (this is the server's computer name as typed in System Prefs -> sharing -- but this is gethostbyname() resolvable) and also have the correct volume/share name returned in the ParamBlockRec. After I call PBGetVolMountInfo() I then call PBHGetVolParmsSync() trying to get the GetVolParmsInfoBuff.vMServerAdr field. The PBHGetVolParmsSync () returns noErr but I don't know how to interpret the OTAddress structure.
Your email below makes me think the PBGetVolMountInfo() would give the IP address of the AFP server but I don't see it anywhere -- so I then tried to use PBHGetVolParmsSync(). Apple Developer page says I need to copy the vMServerAdr before I have access to it -- but I don't understand this.




_______________________________________________ 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
  • Follow-Ups:
    • Re: mount() from Cocoa App
      • From: Jim Luther <email@hidden>
References: 
 >Re: mount() from Cocoa App (From: Jim Luther <email@hidden>)
 >Re: mount() from Cocoa App (From: Quinn <email@hidden>)
 >Re: mount() from Cocoa App (From: Jim Luther <email@hidden>)
 >Re: mount() from Cocoa App (From: Dalton Hamilton <email@hidden>)
 >Re: mount() from Cocoa App (From: "Philip D. Wasson" <email@hidden>)
 >Re: mount() from Cocoa App (From: Dalton Hamilton <email@hidden>)
 >Re: mount() from Cocoa App (From: Dalton Hamilton <email@hidden>)

  • Prev by Date: Re: mount() from Cocoa App
  • Next by Date: Re: mount() from Cocoa App
  • Previous by thread: Re: mount() from Cocoa App
  • Next by thread: Re: mount() from Cocoa App
  • Index(es):
    • Date
    • Thread