The fstatfs(3) call now uses fstatvfs(2).
Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460
#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 */
#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)
#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)
#include <sys/stat.h>
#include <sys/statfs.h>
+#include <sys/statvfs.h>
#ifdef __weak_alias
__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;
}
int fs_readwrite(void);
/* stadir.c */
-int fs_fstatfs(void);
int fs_stat(void);
int fs_statvfs(void);
#include "fs.h"
#include <sys/stat.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <minix/vfsif.h>
#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 *
*===========================================================================*/
fs_inhibread, /* 7 */
fs_stat, /* 8 */
fs_utime, /* 9 */
- fs_fstatfs, /* 10 */
+ fs_statvfs, /* 10 */
fs_breadwrite, /* 11 */
fs_breadwrite, /* 12 */
fs_unlink, /* 13 */
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 */
};
/* 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
/* 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:
#include "inc.h"
-#include <sys/statfs.h>
#include <sys/statvfs.h>
-/*===========================================================================*
- * 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 *
*===========================================================================*/
int main(int argc, char *argv[]);
/* misc.c */
-int do_fstatfs(void);
int do_statvfs(void);
/* mount.c */
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 */
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 */
};
/* stadir.c */
int fs_stat(void);
-int fs_fstatfs(void);
int fs_statvfs(void);
/* utility.c */
#include "inc.h"
#include <time.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <string.h>
}
/*===========================================================================*
- * 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)
{
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 */
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": */
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);
#include "fs.h"
#include <string.h>
#include <sys/stat.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include "inode.h"
#include "super.h"
}
-/*===========================================================================*
- * 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 *
*===========================================================================*/
fs_inhibread, /* 7 */
fs_stat, /* 8 */
fs_utime, /* 9 */
- fs_fstatfs, /* 10 */
+ fs_statvfs, /* 10 */
fs_breadwrite, /* 11 */
fs_breadwrite, /* 12 */
fs_unlink, /* 13 */
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 */
};
/* stadir.c */
int fs_stat(void);
-int fs_fstatfs(void);
int fs_statvfs(void);
/* super.c */
#include "inc.h"
#include <assert.h>
#include <sys/stat.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <minix/com.h>
#include <string.h>
}
-/*===========================================================================*
- * 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 *
*===========================================================================*/
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 */
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
};
zone_t rd_indir(struct buf *bp, int index);
/* stadir.c */
-int fs_fstatfs(void);
int fs_stat(void);
int fs_statvfs(void);
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include "inode.h"
#include "super.h"
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 *
*===========================================================================*/
fs_inhibread, /* 7 */
fs_stat, /* 8 */
fs_utime, /* 9 */
- fs_fstatfs, /* 10 */
+ fs_statvfs, /* 10 */
fs_breadwrite, /* 11 */
fs_breadwrite, /* 12 */
fs_unlink, /* 13 */
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 */
};
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) */
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.
| 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 |
+--------------+---------+---------+-----------------------------------------+
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,
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);
#include <minix/vfsif.h>
#include <sys/dirent.h>
#include <sys/stat.h>
-#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <assert.h>
#include <stddef.h>
}
-/*===========================================================================*
- * 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 *
*===========================================================================*/
* 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 <sys/stat.h>
-#include <sys/statfs.h>
#include <minix/com.h>
#include <minix/u64.h>
#include <string.h>
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 *
*===========================================================================*/
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 */