On Apr 3, 2017, at 10:30 AM, Jim Luther <
email@hidden> wrote:
Once a file system is mounted, the kernel sends out a VQ_MOUNT kernel event and that's what causes the kNotifyVFSMount BSD notification to be sent. At that time, file systems must be ready to respond to requests correctly. If they don't, they have a bug.
You could test my theory by writing a program that:
• listens for kNotifyVFSMount BSD notifications (see man 3 notify and the notify.h and notify_keys.h headers)
• when it gets the kNotifyVFSMount notification, call getmntinfo(3) to get the array of statfs structures for each currently mounted file system.
• finds your file system in the array and pass its path (f_mntonname) to the getMaxFileSize() function and see what it does.
If the statfs struct from getmntinfo() for your file system doesn't look correct, check to make sure your file system's data for the vfs_statfs callback is initialized before your file system's vfs_mount callback returns. One way to do that is to have your file system's vfs_mount code call your file system's vfs_statfs callback (that's the approach I took in the WebDAV file system long ago when I wrote it).
If getattrlist() fails or returns the wrong value, check the code for your file system's vfs_getattr callback to make sure it is prepared to handle requests before your file system's vfs_mount callback returns. Look at where the vfs_getattr callback handles f_capabilities.
Also, you can add _PC_FILESIZEBITS support to your file system's vnop_pathconf callback so that pathconf() with _PC_FILESIZEBITS will return a more exact value. VOL_CAP_FMT_2TB_FILESIZE is the "big dumb hammer" fallback if we cannot get a value from pathconf().
- Jim
On Apr 12, 2017, at 1:27 PM, Scott Talbert <
email@hidden> wrote:
OK, we have found something interesting. When we mount our filesystem with the MNT_LOCAL flag, the NSURLVolumeMaximumFileSizeKey starts reporting correctly.
Do you have any thoughts on why it works only with MNT_LOCAL? Using MNT_LOCAL might be a workaround for us, but I'm not sure of the implications of doing so as our filesystem is actually remote. How do AFP, NFS, SMB, etc. do it, as they don't have the local flag set?
Scott