17ed1ee61SAl Viro #include <linux/syscalls.h> 2630d9c47SPaul Gortmaker #include <linux/export.h> 37ed1ee61SAl Viro #include <linux/fs.h> 47ed1ee61SAl Viro #include <linux/file.h> 5365b1818SChristoph Hellwig #include <linux/mount.h> 67ed1ee61SAl Viro #include <linux/namei.h> 77ed1ee61SAl Viro #include <linux/statfs.h> 87ed1ee61SAl Viro #include <linux/security.h> 97ed1ee61SAl Viro #include <linux/uaccess.h> 104ada54eeSAl Viro #include <linux/compat.h> 11cf31e70dSAl Viro #include "internal.h" 127ed1ee61SAl Viro 13365b1818SChristoph Hellwig static int flags_by_mnt(int mnt_flags) 14365b1818SChristoph Hellwig { 15365b1818SChristoph Hellwig int flags = 0; 16365b1818SChristoph Hellwig 17365b1818SChristoph Hellwig if (mnt_flags & MNT_READONLY) 18365b1818SChristoph Hellwig flags |= ST_RDONLY; 19365b1818SChristoph Hellwig if (mnt_flags & MNT_NOSUID) 20365b1818SChristoph Hellwig flags |= ST_NOSUID; 21365b1818SChristoph Hellwig if (mnt_flags & MNT_NODEV) 22365b1818SChristoph Hellwig flags |= ST_NODEV; 23365b1818SChristoph Hellwig if (mnt_flags & MNT_NOEXEC) 24365b1818SChristoph Hellwig flags |= ST_NOEXEC; 25365b1818SChristoph Hellwig if (mnt_flags & MNT_NOATIME) 26365b1818SChristoph Hellwig flags |= ST_NOATIME; 27365b1818SChristoph Hellwig if (mnt_flags & MNT_NODIRATIME) 28365b1818SChristoph Hellwig flags |= ST_NODIRATIME; 29365b1818SChristoph Hellwig if (mnt_flags & MNT_RELATIME) 30365b1818SChristoph Hellwig flags |= ST_RELATIME; 31365b1818SChristoph Hellwig return flags; 32365b1818SChristoph Hellwig } 33365b1818SChristoph Hellwig 34365b1818SChristoph Hellwig static int flags_by_sb(int s_flags) 35365b1818SChristoph Hellwig { 36365b1818SChristoph Hellwig int flags = 0; 37365b1818SChristoph Hellwig if (s_flags & MS_SYNCHRONOUS) 38365b1818SChristoph Hellwig flags |= ST_SYNCHRONOUS; 39365b1818SChristoph Hellwig if (s_flags & MS_MANDLOCK) 40365b1818SChristoph Hellwig flags |= ST_MANDLOCK; 41a8e2b636SCarlos Maiolino if (s_flags & MS_RDONLY) 42a8e2b636SCarlos Maiolino flags |= ST_RDONLY; 43365b1818SChristoph Hellwig return flags; 44365b1818SChristoph Hellwig } 45365b1818SChristoph Hellwig 46365b1818SChristoph Hellwig static int calculate_f_flags(struct vfsmount *mnt) 47365b1818SChristoph Hellwig { 48365b1818SChristoph Hellwig return ST_VALID | flags_by_mnt(mnt->mnt_flags) | 49365b1818SChristoph Hellwig flags_by_sb(mnt->mnt_sb->s_flags); 50365b1818SChristoph Hellwig } 51365b1818SChristoph Hellwig 52cf31e70dSAl Viro static int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf) 537ed1ee61SAl Viro { 54ebabe9a9SChristoph Hellwig int retval; 557ed1ee61SAl Viro 56ebabe9a9SChristoph Hellwig if (!dentry->d_sb->s_op->statfs) 57ebabe9a9SChristoph Hellwig return -ENOSYS; 58ebabe9a9SChristoph Hellwig 597ed1ee61SAl Viro memset(buf, 0, sizeof(*buf)); 607ed1ee61SAl Viro retval = security_sb_statfs(dentry); 617ed1ee61SAl Viro if (retval) 627ed1ee61SAl Viro return retval; 637ed1ee61SAl Viro retval = dentry->d_sb->s_op->statfs(dentry, buf); 647ed1ee61SAl Viro if (retval == 0 && buf->f_frsize == 0) 657ed1ee61SAl Viro buf->f_frsize = buf->f_bsize; 667ed1ee61SAl Viro return retval; 677ed1ee61SAl Viro } 687ed1ee61SAl Viro 69f0bb5aafSAl Viro int vfs_statfs(const struct path *path, struct kstatfs *buf) 70ebabe9a9SChristoph Hellwig { 71365b1818SChristoph Hellwig int error; 72365b1818SChristoph Hellwig 73365b1818SChristoph Hellwig error = statfs_by_dentry(path->dentry, buf); 74365b1818SChristoph Hellwig if (!error) 75365b1818SChristoph Hellwig buf->f_flags = calculate_f_flags(path->mnt); 76365b1818SChristoph Hellwig return error; 77ebabe9a9SChristoph Hellwig } 787ed1ee61SAl Viro EXPORT_SYMBOL(vfs_statfs); 797ed1ee61SAl Viro 80c8b91accSAl Viro int user_statfs(const char __user *pathname, struct kstatfs *st) 817ed1ee61SAl Viro { 82c8b91accSAl Viro struct path path; 8396948fc6SJeff Layton int error; 8496948fc6SJeff Layton unsigned int lookup_flags = LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT; 8596948fc6SJeff Layton retry: 8696948fc6SJeff Layton error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); 87c8b91accSAl Viro if (!error) { 88c8b91accSAl Viro error = vfs_statfs(&path, st); 89c8b91accSAl Viro path_put(&path); 9096948fc6SJeff Layton if (retry_estale(error, lookup_flags)) { 9196948fc6SJeff Layton lookup_flags |= LOOKUP_REVAL; 9296948fc6SJeff Layton goto retry; 9396948fc6SJeff Layton } 94c8b91accSAl Viro } 95c8b91accSAl Viro return error; 96c8b91accSAl Viro } 977ed1ee61SAl Viro 98c8b91accSAl Viro int fd_statfs(int fd, struct kstatfs *st) 99c8b91accSAl Viro { 1009d05746eSLinus Torvalds struct fd f = fdget_raw(fd); 101c8b91accSAl Viro int error = -EBADF; 1022903ff01SAl Viro if (f.file) { 1032903ff01SAl Viro error = vfs_statfs(&f.file->f_path, st); 1042903ff01SAl Viro fdput(f); 105c8b91accSAl Viro } 106c8b91accSAl Viro return error; 107c8b91accSAl Viro } 1087ed1ee61SAl Viro 109c8b91accSAl Viro static int do_statfs_native(struct kstatfs *st, struct statfs __user *p) 110c8b91accSAl Viro { 111c8b91accSAl Viro struct statfs buf; 112c8b91accSAl Viro 113c8b91accSAl Viro if (sizeof(buf) == sizeof(*st)) 114c8b91accSAl Viro memcpy(&buf, st, sizeof(*st)); 1157ed1ee61SAl Viro else { 116c8b91accSAl Viro if (sizeof buf.f_blocks == 4) { 117c8b91accSAl Viro if ((st->f_blocks | st->f_bfree | st->f_bavail | 118c8b91accSAl Viro st->f_bsize | st->f_frsize) & 1197ed1ee61SAl Viro 0xffffffff00000000ULL) 1207ed1ee61SAl Viro return -EOVERFLOW; 1217ed1ee61SAl Viro /* 1227ed1ee61SAl Viro * f_files and f_ffree may be -1; it's okay to stuff 1237ed1ee61SAl Viro * that into 32 bits 1247ed1ee61SAl Viro */ 125c8b91accSAl Viro if (st->f_files != -1 && 126c8b91accSAl Viro (st->f_files & 0xffffffff00000000ULL)) 1277ed1ee61SAl Viro return -EOVERFLOW; 128c8b91accSAl Viro if (st->f_ffree != -1 && 129c8b91accSAl Viro (st->f_ffree & 0xffffffff00000000ULL)) 1307ed1ee61SAl Viro return -EOVERFLOW; 1317ed1ee61SAl Viro } 1327ed1ee61SAl Viro 133c8b91accSAl Viro buf.f_type = st->f_type; 134c8b91accSAl Viro buf.f_bsize = st->f_bsize; 135c8b91accSAl Viro buf.f_blocks = st->f_blocks; 136c8b91accSAl Viro buf.f_bfree = st->f_bfree; 137c8b91accSAl Viro buf.f_bavail = st->f_bavail; 138c8b91accSAl Viro buf.f_files = st->f_files; 139c8b91accSAl Viro buf.f_ffree = st->f_ffree; 140c8b91accSAl Viro buf.f_fsid = st->f_fsid; 141c8b91accSAl Viro buf.f_namelen = st->f_namelen; 142c8b91accSAl Viro buf.f_frsize = st->f_frsize; 143c8b91accSAl Viro buf.f_flags = st->f_flags; 144c8b91accSAl Viro memset(buf.f_spare, 0, sizeof(buf.f_spare)); 1457ed1ee61SAl Viro } 146c8b91accSAl Viro if (copy_to_user(p, &buf, sizeof(buf))) 147c8b91accSAl Viro return -EFAULT; 1487ed1ee61SAl Viro return 0; 1497ed1ee61SAl Viro } 1507ed1ee61SAl Viro 151c8b91accSAl Viro static int do_statfs64(struct kstatfs *st, struct statfs64 __user *p) 1527ed1ee61SAl Viro { 153c8b91accSAl Viro struct statfs64 buf; 154c8b91accSAl Viro if (sizeof(buf) == sizeof(*st)) 155c8b91accSAl Viro memcpy(&buf, st, sizeof(*st)); 1567ed1ee61SAl Viro else { 157c8b91accSAl Viro buf.f_type = st->f_type; 158c8b91accSAl Viro buf.f_bsize = st->f_bsize; 159c8b91accSAl Viro buf.f_blocks = st->f_blocks; 160c8b91accSAl Viro buf.f_bfree = st->f_bfree; 161c8b91accSAl Viro buf.f_bavail = st->f_bavail; 162c8b91accSAl Viro buf.f_files = st->f_files; 163c8b91accSAl Viro buf.f_ffree = st->f_ffree; 164c8b91accSAl Viro buf.f_fsid = st->f_fsid; 165c8b91accSAl Viro buf.f_namelen = st->f_namelen; 166c8b91accSAl Viro buf.f_frsize = st->f_frsize; 167c8b91accSAl Viro buf.f_flags = st->f_flags; 168c8b91accSAl Viro memset(buf.f_spare, 0, sizeof(buf.f_spare)); 1697ed1ee61SAl Viro } 170c8b91accSAl Viro if (copy_to_user(p, &buf, sizeof(buf))) 171c8b91accSAl Viro return -EFAULT; 1727ed1ee61SAl Viro return 0; 1737ed1ee61SAl Viro } 1747ed1ee61SAl Viro 1757ed1ee61SAl Viro SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf) 1767ed1ee61SAl Viro { 177c8b91accSAl Viro struct kstatfs st; 178c8b91accSAl Viro int error = user_statfs(pathname, &st); 179c8b91accSAl Viro if (!error) 180c8b91accSAl Viro error = do_statfs_native(&st, buf); 1817ed1ee61SAl Viro return error; 1827ed1ee61SAl Viro } 1837ed1ee61SAl Viro 1847ed1ee61SAl Viro SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf) 1857ed1ee61SAl Viro { 186c8b91accSAl Viro struct kstatfs st; 187c8b91accSAl Viro int error; 1887ed1ee61SAl Viro if (sz != sizeof(*buf)) 1897ed1ee61SAl Viro return -EINVAL; 190c8b91accSAl Viro error = user_statfs(pathname, &st); 191c8b91accSAl Viro if (!error) 192c8b91accSAl Viro error = do_statfs64(&st, buf); 1937ed1ee61SAl Viro return error; 1947ed1ee61SAl Viro } 1957ed1ee61SAl Viro 1967ed1ee61SAl Viro SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf) 1977ed1ee61SAl Viro { 198c8b91accSAl Viro struct kstatfs st; 199c8b91accSAl Viro int error = fd_statfs(fd, &st); 200c8b91accSAl Viro if (!error) 201c8b91accSAl Viro error = do_statfs_native(&st, buf); 2027ed1ee61SAl Viro return error; 2037ed1ee61SAl Viro } 2047ed1ee61SAl Viro 2057ed1ee61SAl Viro SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf) 2067ed1ee61SAl Viro { 207c8b91accSAl Viro struct kstatfs st; 2087ed1ee61SAl Viro int error; 2097ed1ee61SAl Viro 2107ed1ee61SAl Viro if (sz != sizeof(*buf)) 2117ed1ee61SAl Viro return -EINVAL; 2127ed1ee61SAl Viro 213c8b91accSAl Viro error = fd_statfs(fd, &st); 214c8b91accSAl Viro if (!error) 215c8b91accSAl Viro error = do_statfs64(&st, buf); 2167ed1ee61SAl Viro return error; 2177ed1ee61SAl Viro } 2187ed1ee61SAl Viro 219*53fd88abSAl Viro static int vfs_ustat(dev_t dev, struct kstatfs *sbuf) 2207ed1ee61SAl Viro { 221cf31e70dSAl Viro struct super_block *s = user_get_super(dev); 2227ed1ee61SAl Viro int err; 2237ed1ee61SAl Viro if (!s) 2247ed1ee61SAl Viro return -EINVAL; 2257ed1ee61SAl Viro 226cf31e70dSAl Viro err = statfs_by_dentry(s->s_root, sbuf); 2277ed1ee61SAl Viro drop_super(s); 228cf31e70dSAl Viro return err; 229cf31e70dSAl Viro } 230cf31e70dSAl Viro 231cf31e70dSAl Viro SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf) 232cf31e70dSAl Viro { 233cf31e70dSAl Viro struct ustat tmp; 234cf31e70dSAl Viro struct kstatfs sbuf; 235cf31e70dSAl Viro int err = vfs_ustat(new_decode_dev(dev), &sbuf); 2367ed1ee61SAl Viro if (err) 2377ed1ee61SAl Viro return err; 2387ed1ee61SAl Viro 2397ed1ee61SAl Viro memset(&tmp,0,sizeof(struct ustat)); 2407ed1ee61SAl Viro tmp.f_tfree = sbuf.f_bfree; 2417ed1ee61SAl Viro tmp.f_tinode = sbuf.f_ffree; 2427ed1ee61SAl Viro 2437ed1ee61SAl Viro return copy_to_user(ubuf, &tmp, sizeof(struct ustat)) ? -EFAULT : 0; 2447ed1ee61SAl Viro } 2454ada54eeSAl Viro 2464ada54eeSAl Viro #ifdef CONFIG_COMPAT 2474ada54eeSAl Viro static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *kbuf) 2484ada54eeSAl Viro { 249ae2a9762SAl Viro struct compat_statfs buf; 2504ada54eeSAl Viro if (sizeof ubuf->f_blocks == 4) { 2514ada54eeSAl Viro if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail | 2524ada54eeSAl Viro kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL) 2534ada54eeSAl Viro return -EOVERFLOW; 2544ada54eeSAl Viro /* f_files and f_ffree may be -1; it's okay 2554ada54eeSAl Viro * to stuff that into 32 bits */ 2564ada54eeSAl Viro if (kbuf->f_files != 0xffffffffffffffffULL 2574ada54eeSAl Viro && (kbuf->f_files & 0xffffffff00000000ULL)) 2584ada54eeSAl Viro return -EOVERFLOW; 2594ada54eeSAl Viro if (kbuf->f_ffree != 0xffffffffffffffffULL 2604ada54eeSAl Viro && (kbuf->f_ffree & 0xffffffff00000000ULL)) 2614ada54eeSAl Viro return -EOVERFLOW; 2624ada54eeSAl Viro } 263ae2a9762SAl Viro memset(&buf, 0, sizeof(struct compat_statfs)); 264ae2a9762SAl Viro buf.f_type = kbuf->f_type; 265ae2a9762SAl Viro buf.f_bsize = kbuf->f_bsize; 266ae2a9762SAl Viro buf.f_blocks = kbuf->f_blocks; 267ae2a9762SAl Viro buf.f_bfree = kbuf->f_bfree; 268ae2a9762SAl Viro buf.f_bavail = kbuf->f_bavail; 269ae2a9762SAl Viro buf.f_files = kbuf->f_files; 270ae2a9762SAl Viro buf.f_ffree = kbuf->f_ffree; 271ae2a9762SAl Viro buf.f_namelen = kbuf->f_namelen; 272ae2a9762SAl Viro buf.f_fsid.val[0] = kbuf->f_fsid.val[0]; 273ae2a9762SAl Viro buf.f_fsid.val[1] = kbuf->f_fsid.val[1]; 274ae2a9762SAl Viro buf.f_frsize = kbuf->f_frsize; 275ae2a9762SAl Viro buf.f_flags = kbuf->f_flags; 276ae2a9762SAl Viro if (copy_to_user(ubuf, &buf, sizeof(struct compat_statfs))) 2774ada54eeSAl Viro return -EFAULT; 2784ada54eeSAl Viro return 0; 2794ada54eeSAl Viro } 2804ada54eeSAl Viro 2814ada54eeSAl Viro /* 2824ada54eeSAl Viro * The following statfs calls are copies of code from fs/statfs.c and 2834ada54eeSAl Viro * should be checked against those from time to time 2844ada54eeSAl Viro */ 2854ada54eeSAl Viro COMPAT_SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct compat_statfs __user *, buf) 2864ada54eeSAl Viro { 2874ada54eeSAl Viro struct kstatfs tmp; 2884ada54eeSAl Viro int error = user_statfs(pathname, &tmp); 2894ada54eeSAl Viro if (!error) 2904ada54eeSAl Viro error = put_compat_statfs(buf, &tmp); 2914ada54eeSAl Viro return error; 2924ada54eeSAl Viro } 2934ada54eeSAl Viro 2944ada54eeSAl Viro COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, buf) 2954ada54eeSAl Viro { 2964ada54eeSAl Viro struct kstatfs tmp; 2974ada54eeSAl Viro int error = fd_statfs(fd, &tmp); 2984ada54eeSAl Viro if (!error) 2994ada54eeSAl Viro error = put_compat_statfs(buf, &tmp); 3004ada54eeSAl Viro return error; 3014ada54eeSAl Viro } 3024ada54eeSAl Viro 3034ada54eeSAl Viro static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf) 3044ada54eeSAl Viro { 305ae2a9762SAl Viro struct compat_statfs64 buf; 3064ada54eeSAl Viro if (sizeof(ubuf->f_bsize) == 4) { 3074ada54eeSAl Viro if ((kbuf->f_type | kbuf->f_bsize | kbuf->f_namelen | 3084ada54eeSAl Viro kbuf->f_frsize | kbuf->f_flags) & 0xffffffff00000000ULL) 3094ada54eeSAl Viro return -EOVERFLOW; 3104ada54eeSAl Viro /* f_files and f_ffree may be -1; it's okay 3114ada54eeSAl Viro * to stuff that into 32 bits */ 3124ada54eeSAl Viro if (kbuf->f_files != 0xffffffffffffffffULL 3134ada54eeSAl Viro && (kbuf->f_files & 0xffffffff00000000ULL)) 3144ada54eeSAl Viro return -EOVERFLOW; 3154ada54eeSAl Viro if (kbuf->f_ffree != 0xffffffffffffffffULL 3164ada54eeSAl Viro && (kbuf->f_ffree & 0xffffffff00000000ULL)) 3174ada54eeSAl Viro return -EOVERFLOW; 3184ada54eeSAl Viro } 319ae2a9762SAl Viro memset(&buf, 0, sizeof(struct compat_statfs64)); 320ae2a9762SAl Viro buf.f_type = kbuf->f_type; 321ae2a9762SAl Viro buf.f_bsize = kbuf->f_bsize; 322ae2a9762SAl Viro buf.f_blocks = kbuf->f_blocks; 323ae2a9762SAl Viro buf.f_bfree = kbuf->f_bfree; 324ae2a9762SAl Viro buf.f_bavail = kbuf->f_bavail; 325ae2a9762SAl Viro buf.f_files = kbuf->f_files; 326ae2a9762SAl Viro buf.f_ffree = kbuf->f_ffree; 327ae2a9762SAl Viro buf.f_namelen = kbuf->f_namelen; 328ae2a9762SAl Viro buf.f_fsid.val[0] = kbuf->f_fsid.val[0]; 329ae2a9762SAl Viro buf.f_fsid.val[1] = kbuf->f_fsid.val[1]; 330ae2a9762SAl Viro buf.f_frsize = kbuf->f_frsize; 331ae2a9762SAl Viro buf.f_flags = kbuf->f_flags; 332ae2a9762SAl Viro if (copy_to_user(ubuf, &buf, sizeof(struct compat_statfs64))) 3334ada54eeSAl Viro return -EFAULT; 3344ada54eeSAl Viro return 0; 3354ada54eeSAl Viro } 3364ada54eeSAl Viro 3374ada54eeSAl Viro COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf) 3384ada54eeSAl Viro { 3394ada54eeSAl Viro struct kstatfs tmp; 3404ada54eeSAl Viro int error; 3414ada54eeSAl Viro 3424ada54eeSAl Viro if (sz != sizeof(*buf)) 3434ada54eeSAl Viro return -EINVAL; 3444ada54eeSAl Viro 3454ada54eeSAl Viro error = user_statfs(pathname, &tmp); 3464ada54eeSAl Viro if (!error) 3474ada54eeSAl Viro error = put_compat_statfs64(buf, &tmp); 3484ada54eeSAl Viro return error; 3494ada54eeSAl Viro } 3504ada54eeSAl Viro 3514ada54eeSAl Viro COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf) 3524ada54eeSAl Viro { 3534ada54eeSAl Viro struct kstatfs tmp; 3544ada54eeSAl Viro int error; 3554ada54eeSAl Viro 3564ada54eeSAl Viro if (sz != sizeof(*buf)) 3574ada54eeSAl Viro return -EINVAL; 3584ada54eeSAl Viro 3594ada54eeSAl Viro error = fd_statfs(fd, &tmp); 3604ada54eeSAl Viro if (!error) 3614ada54eeSAl Viro error = put_compat_statfs64(buf, &tmp); 3624ada54eeSAl Viro return error; 3634ada54eeSAl Viro } 3644ada54eeSAl Viro 3654ada54eeSAl Viro /* 3664ada54eeSAl Viro * This is a copy of sys_ustat, just dealing with a structure layout. 3674ada54eeSAl Viro * Given how simple this syscall is that apporach is more maintainable 3684ada54eeSAl Viro * than the various conversion hacks. 3694ada54eeSAl Viro */ 3704ada54eeSAl Viro COMPAT_SYSCALL_DEFINE2(ustat, unsigned, dev, struct compat_ustat __user *, u) 3714ada54eeSAl Viro { 3724ada54eeSAl Viro struct compat_ustat tmp; 3734ada54eeSAl Viro struct kstatfs sbuf; 3744ada54eeSAl Viro int err = vfs_ustat(new_decode_dev(dev), &sbuf); 3754ada54eeSAl Viro if (err) 3764ada54eeSAl Viro return err; 3774ada54eeSAl Viro 3784ada54eeSAl Viro memset(&tmp, 0, sizeof(struct compat_ustat)); 3794ada54eeSAl Viro tmp.f_tfree = sbuf.f_bfree; 3804ada54eeSAl Viro tmp.f_tinode = sbuf.f_ffree; 3814ada54eeSAl Viro if (copy_to_user(u, &tmp, sizeof(struct compat_ustat))) 3824ada54eeSAl Viro return -EFAULT; 3834ada54eeSAl Viro return 0; 3844ada54eeSAl Viro } 3854ada54eeSAl Viro #endif 386