New QFSInfo level

Steve French smfltc at us.ibm.com
Wed Mar 9 16:04:33 GMT 2005


In order to properly handle statfs or equivalent, Unix-like OS need to
be able fill in something similar to what in Linux is called
struct kstatfs {
        long f_type;
        long f_bsize;
        sector_t f_blocks;
        sector_t f_bfree;
        sector_t f_bavail;
        sector_t f_files;
        sector_t f_ffree;
        __kernel_fsid_t f_fsid;
        long f_namelen;
        long f_frsize;
        long f_spare[5];
};

Which means that these OS don't have a way to retrieve to POSIX apps -
blocks available (to non-superuser), files, files free, fsid, and frsize
(the two block size fields are named similarly in BSD and Linux but
slightly differently as "iosize" in MacOS).

BSD also seems to need flags which indicate whether read-only etc. which
flags can mostly be obtained from existing Windows QFSInfo levels.

What I have put in for the time being (unless I hear objections from
Apple, HP etc.) is the following for the new infolevel

#define SMB_QUERY_POSIX_FS_INFO  0x201

with wire format:	

typedef struct {
   /* For undefined values return -1 in that field */
   __le32 OptimalTransferSize; /* bsize on some os, iosize on others */
   __le32 BlockSize; /* Volume size in bytes = BlockSize*TotalBlocks */
   __le64 TotalBlocks; /* redundant with existing info levels, but easy
to return here */
   __le64 BlocksAvail; /* redundant but easy to return */
   __le64 UserBlocksAvail;      /* bavail */
   __le64 TotalFileNodes;
   __le64 FreeFileNodes;
   __le64 FileSysIdentifier;   /* fsid */
   /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
   /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
} FILE_SYSTEM_POSIX_INFO;

Presumably support for this new infolevel (possibly with some of the
other new calls) can be indicated by one of the Unix extension
capability bits returned by the existing level 0x200 QFSInfo.

Comments?



More information about the samba-technical mailing list