From: David van Moolenbroek Date: Mon, 19 Aug 2013 22:55:49 +0000 (+0200) Subject: VFS/FS: remove fstatfs(2) and REQ_FSTATFS X-Git-Tag: v3.3.0~629 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/index.css?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F929%2F2;p=minix.git VFS/FS: remove fstatfs(2) and REQ_FSTATFS The fstatfs(3) call now uses fstatvfs(2). Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index bcb574ccd..db2372e2f 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -74,7 +74,6 @@ #define SYSUNAME 78 #define GETDENTS_321 80 /* to VFS */ #define LLSEEK 81 /* to VFS */ -#define FSTATFS 82 /* to VFS */ #define STATVFS 83 /* to VFS */ #define FSTATVFS 84 /* to VFS */ #define SELECT 85 /* to VFS */ diff --git a/include/minix/vfsif.h b/include/minix/vfsif.h index 8049917ec..75a0c1165 100644 --- a/include/minix/vfsif.h +++ b/include/minix/vfsif.h @@ -124,7 +124,7 @@ typedef u32_t pino_t; /* Protocol version of ino_t */ #define REQ_INHIBREAD (VFS_BASE + 7) #define REQ_STAT (VFS_BASE + 8) #define REQ_UTIME (VFS_BASE + 9) -#define REQ_FSTATFS (VFS_BASE + 10) +#define REQ_STATVFS (VFS_BASE + 10) #define REQ_BREAD (VFS_BASE + 11) #define REQ_BWRITE (VFS_BASE + 12) #define REQ_UNLINK (VFS_BASE + 13) @@ -146,11 +146,10 @@ typedef u32_t pino_t; /* Protocol version of ino_t */ #define REQ_NEWNODE (VFS_BASE + 29) #define REQ_RDLINK (VFS_BASE + 30) #define REQ_GETDENTS (VFS_BASE + 31) -#define REQ_STATVFS (VFS_BASE + 32) -#define REQ_PEEK (VFS_BASE + 33) -#define REQ_BPEEK (VFS_BASE + 34) +#define REQ_PEEK (VFS_BASE + 32) +#define REQ_BPEEK (VFS_BASE + 33) -#define NREQS 35 +#define NREQS 34 #define IS_VFS_RQ(type) (((type) & ~0xff) == VFS_BASE) diff --git a/lib/libc/sys-minix/fstatfs.c b/lib/libc/sys-minix/fstatfs.c index 82ec2e044..89c0349eb 100644 --- a/lib/libc/sys-minix/fstatfs.c +++ b/lib/libc/sys-minix/fstatfs.c @@ -4,6 +4,7 @@ #include #include +#include #ifdef __weak_alias __weak_alias(fstatfs, _fstatfs) @@ -11,9 +12,13 @@ __weak_alias(fstatfs, _fstatfs) int fstatfs(int fd, struct statfs *buffer) { - message m; + struct statvfs svbuffer; + int r; - m.m1_i1 = fd; - m.m1_p1 = (char *) buffer; - return(_syscall(VFS_PROC_NR, FSTATFS, &m)); + if ((r = fstatvfs(fd, &svbuffer)) != 0) + return r; + + buffer->f_bsize = svbuffer.f_bsize; + + return 0; } diff --git a/lib/libpuffs/proto.h b/lib/libpuffs/proto.h index c3758a7b7..10ecfcd49 100644 --- a/lib/libpuffs/proto.h +++ b/lib/libpuffs/proto.h @@ -57,7 +57,6 @@ int fs_breadwrite(void); int fs_readwrite(void); /* stadir.c */ -int fs_fstatfs(void); int fs_stat(void); int fs_statvfs(void); diff --git a/lib/libpuffs/stadir.c b/lib/libpuffs/stadir.c index 8b3d5a8fc..f232aae0b 100644 --- a/lib/libpuffs/stadir.c +++ b/lib/libpuffs/stadir.c @@ -4,7 +4,6 @@ #include "fs.h" #include -#include #include #include @@ -12,30 +11,6 @@ #include "puffs_priv.h" -/*===========================================================================* - * fs_fstatfs * - *===========================================================================*/ -int fs_fstatfs() -{ - int r; - struct statvfs st_vfs; - struct statfs st; - - if (global_pu->pu_ops.puffs_fs_statvfs(global_pu, &st_vfs) != 0) { - lpuffs_debug("statfs failed\n"); - return(EINVAL); - } - - st.f_bsize = st_vfs.f_bsize; - - /* Copy the struct to user space. */ - r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT, - (vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st)); - - return(r); -} - - /*===========================================================================* * fs_stat * *===========================================================================*/ diff --git a/lib/libpuffs/table.c b/lib/libpuffs/table.c index b28cf6766..d00ede2c4 100644 --- a/lib/libpuffs/table.c +++ b/lib/libpuffs/table.c @@ -20,7 +20,7 @@ int (*fs_call_vec[])(void) = { fs_inhibread, /* 7 */ fs_stat, /* 8 */ fs_utime, /* 9 */ - fs_fstatfs, /* 10 */ + fs_statvfs, /* 10 */ fs_breadwrite, /* 11 */ fs_breadwrite, /* 12 */ fs_unlink, /* 13 */ @@ -42,7 +42,6 @@ int (*fs_call_vec[])(void) = { no_sys, /* 29 */ /* Was: fs_newnode */ fs_rdlink, /* 30 */ fs_getdents, /* 31 */ - fs_statvfs, /* 32 */ - no_sys, /* 33 peek */ - no_sys, /* 34 bpeek */ + no_sys, /* 32 peek */ + no_sys, /* 33 bpeek */ }; diff --git a/lib/libsffs/const.h b/lib/libsffs/const.h index ca6c37886..1064f13e7 100644 --- a/lib/libsffs/const.h +++ b/lib/libsffs/const.h @@ -8,8 +8,8 @@ /* Number of entries in the name hashtable. */ #define NUM_HASH_SLOTS 1023 -/* Arbitrary block size constant returned by fstatfs and statvfs. - * Also used by getdents. This is not the underlying data transfer unit size. +/* Arbitrary block size constant returned by statvfs. Also used by getdents. + * This is not the underlying data transfer unit size. */ #define BLOCK_SIZE 4096 diff --git a/lib/libsffs/misc.c b/lib/libsffs/misc.c index fe48d84cf..acb06c8b3 100644 --- a/lib/libsffs/misc.c +++ b/lib/libsffs/misc.c @@ -1,7 +1,6 @@ /* This file contains miscellaneous file system call handlers. * * The entry points into this file are: - * do_fstatfs perform the FSTATFS file system call * do_statvfs perform the STATVFS file system call * * Created: @@ -10,24 +9,8 @@ #include "inc.h" -#include #include -/*===========================================================================* - * do_fstatfs * - *===========================================================================*/ -int do_fstatfs() -{ -/* Retrieve file system statistics. - */ - struct statfs statfs; - - statfs.f_bsize = BLOCK_SIZE; /* arbitrary block size constant */ - - return sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, 0, - (vir_bytes) &statfs, sizeof(statfs)); -} - /*===========================================================================* * do_statvfs * *===========================================================================*/ diff --git a/lib/libsffs/proto.h b/lib/libsffs/proto.h index 2f95eb4df..fb4e119ac 100644 --- a/lib/libsffs/proto.h +++ b/lib/libsffs/proto.h @@ -37,7 +37,6 @@ int do_lookup(void); int main(int argc, char *argv[]); /* misc.c */ -int do_fstatfs(void); int do_statvfs(void); /* mount.c */ diff --git a/lib/libsffs/table.c b/lib/libsffs/table.c index 35e778dec..125b6041b 100644 --- a/lib/libsffs/table.c +++ b/lib/libsffs/table.c @@ -18,7 +18,7 @@ int (*call_vec[])(void) = { do_noop, /* 7 inhibread */ do_stat, /* 8 stat */ do_utime, /* 9 utime */ - do_fstatfs, /* 10 fstatfs */ + do_statvfs, /* 10 statvfs */ no_sys, /* 11 bread */ no_sys, /* 12 bwrite */ do_unlink, /* 13 unlink */ @@ -40,8 +40,7 @@ int (*call_vec[])(void) = { no_sys, /* 29 newnode */ no_sys, /* 30 rdlink */ do_getdents, /* 31 getdents */ - do_statvfs, /* 32 statvfs */ - no_sys, /* 33 peek */ + no_sys, /* 32 peek */ no_sys, /* 33 bpeek */ }; diff --git a/lib/libvtreefs/proto.h b/lib/libvtreefs/proto.h index 354e81608..0dc0e7cf2 100644 --- a/lib/libvtreefs/proto.h +++ b/lib/libvtreefs/proto.h @@ -32,7 +32,6 @@ long sdbm_hash(char *str, int len); /* stadir.c */ int fs_stat(void); -int fs_fstatfs(void); int fs_statvfs(void); /* utility.c */ diff --git a/lib/libvtreefs/stadir.c b/lib/libvtreefs/stadir.c index c2f9a1e50..35b720391 100644 --- a/lib/libvtreefs/stadir.c +++ b/lib/libvtreefs/stadir.c @@ -3,7 +3,6 @@ #include "inc.h" #include -#include #include #include @@ -56,23 +55,7 @@ int fs_stat(void) } /*===========================================================================* - * fs_fstatfs * - *===========================================================================*/ -int fs_fstatfs(void) -{ - /* Retrieve file system statistics. - */ - struct statfs statfs; - - memset(&statfs, 0, sizeof(statfs)); - - /* Copy the struct to user space. */ - return sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, - (vir_bytes) &statfs, (phys_bytes) sizeof(statfs)); -} - -/*===========================================================================* - * fs_fstatfs * + * fs_statvfs * *===========================================================================*/ int fs_statvfs(void) { diff --git a/lib/libvtreefs/table.c b/lib/libvtreefs/table.c index d3f20fac5..468dccba7 100644 --- a/lib/libvtreefs/table.c +++ b/lib/libvtreefs/table.c @@ -14,7 +14,7 @@ int (*fs_call_vec[])(void) = { do_noop, /* 7 inhibread */ fs_stat, /* 8 stat */ no_sys, /* 9 utime */ - fs_fstatfs, /* 10 fstatfs */ + fs_statvfs, /* 10 statvfs */ no_sys, /* 11 bread */ no_sys, /* 12 bwrite */ no_sys, /* 13 unlink */ @@ -36,9 +36,8 @@ int (*fs_call_vec[])(void) = { no_sys, /* 29 newnode */ fs_rdlink, /* 30 rdlink */ fs_getdents, /* 31 getdents */ - fs_statvfs, /* 32 statvfs */ - no_sys, /* 33 peek */ - no_sys, /* 34 bpeek */ + no_sys, /* 32 peek */ + no_sys, /* 33 bpeek */ }; /* This should not fail with "array size is negative": */ diff --git a/servers/ext2/proto.h b/servers/ext2/proto.h index b97fe6475..2f4682687 100644 --- a/servers/ext2/proto.h +++ b/servers/ext2/proto.h @@ -81,7 +81,6 @@ block_t read_map(struct inode *rip, off_t pos, int opportunistic); struct buf *get_block_map(register struct inode *rip, u64_t position); /* stadir.c */ -int fs_fstatfs(void); int fs_stat(void); int fs_statvfs(void); diff --git a/servers/ext2/stadir.c b/servers/ext2/stadir.c index f9bff7d90..c675dfd56 100644 --- a/servers/ext2/stadir.c +++ b/servers/ext2/stadir.c @@ -5,7 +5,6 @@ #include "fs.h" #include #include -#include #include #include "inode.h" #include "super.h" @@ -60,28 +59,6 @@ static int stat_inode( } -/*===========================================================================* - * fs_fstatfs * - *===========================================================================*/ -int fs_fstatfs() -{ - struct statfs st; - struct inode *rip; - int r; - - if((rip = find_inode(fs_dev, ROOT_INODE)) == NULL) - return(EINVAL); - - st.f_bsize = rip->i_sp->s_block_size; - - /* Copy the struct to user space. */ - r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT, - (vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st)); - - return(r); -} - - /*===========================================================================* * fs_stat * *===========================================================================*/ diff --git a/servers/ext2/table.c b/servers/ext2/table.c index 1d779a9a6..7f3528427 100644 --- a/servers/ext2/table.c +++ b/servers/ext2/table.c @@ -23,7 +23,7 @@ int (*fs_call_vec[])(void) = { fs_inhibread, /* 7 */ fs_stat, /* 8 */ fs_utime, /* 9 */ - fs_fstatfs, /* 10 */ + fs_statvfs, /* 10 */ fs_breadwrite, /* 11 */ fs_breadwrite, /* 12 */ fs_unlink, /* 13 */ @@ -45,7 +45,6 @@ int (*fs_call_vec[])(void) = { no_sys, /* 29 */ /* Was: fs_newnode */ fs_rdlink, /* 30 */ fs_getdents, /* 31 */ - fs_statvfs, /* 32 */ - fs_readwrite, /* 33 */ - fs_bpeek, /* 34 */ + fs_readwrite, /* 32 */ + fs_bpeek, /* 33 */ }; diff --git a/servers/iso9660fs/proto.h b/servers/iso9660fs/proto.h index 63003c9ae..e9185f29e 100644 --- a/servers/iso9660fs/proto.h +++ b/servers/iso9660fs/proto.h @@ -53,7 +53,6 @@ int read_chunk(struct dir_record *rip, u64_t position, unsigned off, int /* stadir.c */ int fs_stat(void); -int fs_fstatfs(void); int fs_statvfs(void); /* super.c */ diff --git a/servers/iso9660fs/stadir.c b/servers/iso9660fs/stadir.c index bde482f8b..bffe2221e 100644 --- a/servers/iso9660fs/stadir.c +++ b/servers/iso9660fs/stadir.c @@ -1,7 +1,6 @@ #include "inc.h" #include #include -#include #include #include #include @@ -93,24 +92,6 @@ int fs_stat() } -/*===========================================================================* - * fs_fstatfs * - *===========================================================================*/ -int fs_fstatfs() -{ - struct statfs st; - int r; - - st.f_bsize = v_pri.logical_block_size_l; - - /* Copy the struct to user space. */ - r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, - (vir_bytes) &st, (phys_bytes) sizeof(st)); - - return(r); -} - - /*===========================================================================* * fs_statvfs * *===========================================================================*/ diff --git a/servers/iso9660fs/table.c b/servers/iso9660fs/table.c index 12ac2f79a..6f9297c51 100644 --- a/servers/iso9660fs/table.c +++ b/servers/iso9660fs/table.c @@ -18,7 +18,7 @@ int (*fs_call_vec[])(void) = { do_noop, /* 7 */ fs_stat, /* 8 */ no_sys, /* 9: not used */ - fs_fstatfs, /* 10 */ + fs_statvfs, /* 10 */ fs_bread, /* 11 */ no_sys, /* 12: not used */ no_sys, /* 13: not used */ @@ -40,12 +40,11 @@ int (*fs_call_vec[])(void) = { no_sys, /* 29: not used */ no_sys, /* 30: not used */ fs_getdents, /* 31 */ - fs_statvfs, /* 32 */ #if 0 - fs_read, /* 33 */ - no_sys, + fs_read, /* 32 */ + no_sys, /* 33 */ #else - no_sys, - no_sys, + no_sys, /* 32 */ + no_sys, /* 33 */ #endif }; diff --git a/servers/mfs/proto.h b/servers/mfs/proto.h index 8c4712487..91dfb6cb3 100644 --- a/servers/mfs/proto.h +++ b/servers/mfs/proto.h @@ -80,7 +80,6 @@ struct buf *get_block_map(register struct inode *rip, u64_t position); zone_t rd_indir(struct buf *bp, int index); /* stadir.c */ -int fs_fstatfs(void); int fs_stat(void); int fs_statvfs(void); diff --git a/servers/mfs/stadir.c b/servers/mfs/stadir.c index 9678bf60a..9597acf99 100644 --- a/servers/mfs/stadir.c +++ b/servers/mfs/stadir.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include "inode.h" #include "super.h" @@ -86,28 +85,6 @@ static int stat_inode( return(r); } -/*===========================================================================* - * fs_fstatfs * - *===========================================================================*/ -int fs_fstatfs() -{ - struct statfs st; - struct inode *rip; - int r; - - if((rip = find_inode(fs_dev, ROOT_INODE)) == NULL) - return(EINVAL); - - st.f_bsize = rip->i_sp->s_block_size; - - /* Copy the struct to user space. */ - r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT, - (vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st)); - - return(r); -} - - /*===========================================================================* * fs_statvfs * *===========================================================================*/ diff --git a/servers/mfs/table.c b/servers/mfs/table.c index 1fb73334e..058aa23d8 100644 --- a/servers/mfs/table.c +++ b/servers/mfs/table.c @@ -23,7 +23,7 @@ int (*fs_call_vec[])(void) = { fs_inhibread, /* 7 */ fs_stat, /* 8 */ fs_utime, /* 9 */ - fs_fstatfs, /* 10 */ + fs_statvfs, /* 10 */ fs_breadwrite, /* 11 */ fs_breadwrite, /* 12 */ fs_unlink, /* 13 */ @@ -45,8 +45,7 @@ int (*fs_call_vec[])(void) = { no_sys, /* 29 */ /* Was: fs_newnode */ fs_rdlink, /* 30 */ fs_getdents, /* 31 */ - fs_statvfs, /* 32 */ - fs_readwrite, /* 33 */ - fs_bpeek, /* 34 */ + fs_readwrite, /* 32 */ + fs_bpeek, /* 33 */ }; diff --git a/servers/pm/table.c b/servers/pm/table.c index b9007553b..6873ff2b7 100644 --- a/servers/pm/table.c +++ b/servers/pm/table.c @@ -93,7 +93,7 @@ int (*call_vec[])(void) = { no_sys, /* 79 = unused */ no_sys, /* 80 = (getdents) */ no_sys, /* 81 = unused */ - no_sys, /* 82 = (fstatfs) */ + no_sys, /* 82 = unused */ no_sys, /* 83 = unused */ no_sys, /* 84 = unused */ no_sys, /* 85 = (select) */ diff --git a/servers/vfs/README b/servers/vfs/README index a6ee74d5e..bb9751a59 100644 --- a/servers/vfs/README +++ b/servers/vfs/README @@ -38,7 +38,7 @@ it supports a few calls necessary for libc. The following system calls are handled by VFS: access, chdir, chmod, chown, chroot, close, creat, fchdir, fcntl, fstat, -fstatfs, fstatvfs, fsync, ftruncate getdents, ioctl, link, llseek, lseek, +fstatvfs, fsync, ftruncate getdents, ioctl, link, llseek, lseek, lstat, mkdir, mknod, mount, open, pipe, read, readlink, rename, rmdir, select, stat, statvfs, symlink, sync, truncate, umask, umount, unlink, utime, write. @@ -572,8 +572,6 @@ REQ_INODE_NR field in requests, unless the notes say otherwise. | REQ_FLUSH | | | Mutually exclusive to REQ_BREAD and | | | | | REQ_BWRITE | +--------------+---------+---------+-----------------------------------------+ -| REQ_FSTATFS | | | | -+--------------+---------+---------+-----------------------------------------+ | REQ_FTRUNC | READ | WRITE | vmnt is only locked if file is not | | | | | already opened | +--------------+---------+---------+-----------------------------------------+ diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index 1aa35123e..3b503a000 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -238,7 +238,6 @@ int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid, int req_create(endpoint_t fs_e, ino_t inode_nr, int omode, uid_t uid, gid_t gid, char *path, node_details_t *res); int req_flush(endpoint_t fs_e, dev_t dev); -int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf); int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf); int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end); int req_getdents(endpoint_t fs_e, ino_t inode_nr, off_t pos, char *buf, @@ -285,7 +284,6 @@ int do_fchdir(message *m_out); int do_chroot(message *m_out); int do_fstat(message *m_out); int do_stat(message *m_out); -int do_fstatfs(message *m_out); int do_statvfs(message *m_out); int do_fstatvfs(message *m_out); int do_rdlink(message *m_out); diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 355516ace..ba97b373b 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -224,32 +223,6 @@ int req_flush(endpoint_t fs_e, dev_t dev) } -/*===========================================================================* - * req_fstatfs * - *===========================================================================*/ -int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf) -{ - int r; - cp_grant_id_t grant_id; - message m; - - grant_id = cpf_grant_magic(fs_e, proc_e, buf, sizeof(struct statfs), - CPF_WRITE); - if (grant_id == GRANT_INVALID) - panic("req_fstatfs: cpf_grant_magic failed"); - - /* Fill in request message */ - m.m_type = REQ_FSTATFS; - m.REQ_GRANT = grant_id; - - /* Send/rec request */ - r = fs_sendrec(fs_e, &m); - cpf_revoke(grant_id); - - return(r); -} - - /*===========================================================================* * req_statvfs * *===========================================================================*/ diff --git a/servers/vfs/stadir.c b/servers/vfs/stadir.c index 09763f41b..0977d9ec4 100644 --- a/servers/vfs/stadir.c +++ b/servers/vfs/stadir.c @@ -7,14 +7,12 @@ * do_lstat: perform the LSTAT system call * do_stat: perform the STAT system call * do_fstat: perform the FSTAT system call - * do_fstatfs: perform the FSTATFS system call * do_statvfs: perform the STATVFS system call * do_fstatvfs: perform the FSTATVFS system call */ #include "fs.h" #include -#include #include #include #include @@ -210,29 +208,6 @@ int do_fstat(message *UNUSED(m_out)) return(r); } -/*===========================================================================* - * do_fstatfs * - *===========================================================================*/ -int do_fstatfs(message *UNUSED(m_out)) -{ -/* Perform the fstatfs(fd, buf) system call. */ - struct filp *rfilp; - int r, rfd; - vir_bytes statbuf; - - rfd = job_m_in.fd; - statbuf = (vir_bytes) job_m_in.buffer; - - /* Is the file descriptor valid? */ - if( (rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code); - - r = req_fstatfs(rfilp->filp_vno->v_fs_e, who_e, statbuf); - - unlock_filp(rfilp); - - return(r); -} - /*===========================================================================* * do_statvfs * *===========================================================================*/ diff --git a/servers/vfs/table.c b/servers/vfs/table.c index a4408106f..3492aae38 100644 --- a/servers/vfs/table.c +++ b/servers/vfs/table.c @@ -97,7 +97,7 @@ int (*call_vec[])(message *m_out) = { no_sys, /* 79 = unused */ do_getdents, /* 80 = getdents_321 (to be phased out) */ do_lseek, /* 81 = llseek */ - do_fstatfs, /* 82 = fstatfs */ + no_sys, /* 82 = unused */ do_statvfs, /* 83 = fstatvfs */ do_fstatvfs, /* 84 = statvfs */ do_select, /* 85 = select */