VFS Tidbits
VFS Tidbits
- Subject: VFS Tidbits
- From: Quinn <email@hidden>
- Date: Wed, 11 May 2005 11:57:22 +0100
Greetings All
As part of my 'day job'
<http://developer.apple.com/technicalsupport/index.html> I answer
questions from developers who are porting their file systems to
Tiger. As I come up with interesting tidbits about Tiger's VFS KPI,
I'll post it to the list.
* * *
vfs_statfs is a simple accessor function. Here's the Tiger implementation.
struct vfsstatfs * vfs_statfs(mount_t mp)
{
return(&mp->mnt_vfsstat);
}
Obviously the lifetime of the pointer to the returned structure is
based on the lifetime of the mountpoint itself.
* * *
vfs_event_signal is used to generate kqueue events for the volume.
The implementation is /super/ trivial:
void vfs_event_signal(
__unused fsid_t * fsid,
u_int32_t event,
__unused intptr_t data
)
{
KNOTE(&fs_klist, event);
}
However, that's not exactly helpful. What you really want to know is
under what circumstances you should call it and what the parameters
are. I'll start with the second question first.
o fsid is the BSD FSID of your volume. If you don't have this handy,
you can get it using vfs_statfs.
o data is event specific data. AFAIK none of the currently defined
events have any associated data (the __unused in the code above is a
dead giveaway), so you should just pass NULL.
o event is a bitmap of the new events. You can see the definitions
in <sys/mount.h>.
This list of events answers the question as to when you should call
vfs_event_signal. You should call it when one of these events
occurs. This may or may not happen, depending on the specifics of
your file system. For example, HFS only ever sends the VQ_LOWDISK
event. However, network file systems might generate a whole raft of
other events.
* * *
Q: What does 64-bit ready (VFS_TBL64BITREADY) mean?
A: This flag tells VFS whether your file system is prepared to handle
certain requests from a 64-bit processes. These include:
o mount
o ioctl
o sysctl
If this flag isn't set and the call comes from a 64-bit process, VFS
will fail the call. This prevents you from accidentally interpreting
a 64-bit structure (such as the mount arguments) as a 32-bit
structure. If you set the 64-bit ready flag, you're expected to test
whether the caller is a 64-bit process and interpret the structure
appropriately.
* * *
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden