|
Q: I'm writing a custom file system (VFS plug-in). I can mount my volume just fine at the BSD level, but its icon doesn't show up on the desktop. How can I make my file system's volumes show up on the desktop?A: If you're developing a local file system (using the terminology from Technical Q&A QA1242, 'Developing for VFS'), you need to create a file system bundle and install it in This is, however, not sufficient for a network file system. A network file system must have a file system bundle (this allows the Finder to show the correct localized name in the Format field of the Get Info window), but that's not sufficient for your volumes to show up on the desktop automatically. For a network file system, the user typically does some explicit operation to mount a volume. For the built-in network file systems (AppleShare, SMB, and so on), the users mounts a volume using the Connect to Server dialog in the Finder, or by browsing If you follow the advice from that document and create your own mounting application, your volumes will still not show up on the desktop. You must explicitly notify the sytem when you mount a new volume. The mechanism for doing this is documented below. In this context a cluster file system works the same way as a network file system. New Volume Mount NotificationWhen you mount a new network volume, you must tell the system about it. You do this by calling the DiskArbitration routine Listing 1: DiskArbDiskAppearedWithMountpointPing_auto prototype extern kern_return_t DiskArbDiskAppearedWithMountpointPing_auto( char * disk, unsigned flags, char * mountpoint ) __attribute__((weak_import)); enum { kDiskArbDiskAppearedEjectableMask = 1 << 1, kDiskArbDiskAppearedNetworkDiskMask = 1 << 3 }; The parameters to this routine are:
This routine is part of the old (pre-Mac OS X 10.3), private, DiskArbitration framework interface. When we introduced a new, public DiskArbitration interface in Mac OS X 10.3, we didn't introduce a replacement for this routine because, in the long term, DiskArbitration will automatically learn about new network volumes by way of a kernel notification. So, ultimately, you won't need to call this routine for your volume to appear on the desktop. For that reason, we strongly recommend that you weak link against this symbol and, if it's not present, just don't call it. IMPORTANT: The prototype in Listing 1 causes For more information about this technique, see Technical Note TN2064, 'Ensuring Backwards Binary Compatibility - Weak Linking and Availability Macros on Mac OS X'. Finally, because you're calling the old, private DiskArbitration framework interface, you have to explicitly initialize that interface. You do this by calling Listing 2: DiskArbInit prototype extern kern_return_t DiskArbInit(void) __attribute__((weak_import)); As with Document Revision History
Posted: 2006-12-20 |
|