VFS/FS: remove fstatfs(2) and REQ_FSTATFS

The fstatfs(3) call now uses fstatvfs(2).

Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460
This commit is contained in:
David van Moolenbroek
2013-08-20 00:55:49 +02:00
committed by Lionel Sambuc
parent 474b24f91c
commit f10229eafb
28 changed files with 38 additions and 227 deletions

View File

@@ -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);

View File

@@ -5,7 +5,6 @@
#include "fs.h"
#include <string.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#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 *
*===========================================================================*/

View File

@@ -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 */
};

View File

@@ -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 */

View File

@@ -1,7 +1,6 @@
#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>
@@ -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 *
*===========================================================================*/

View File

@@ -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
};

View File

@@ -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);

View File

@@ -2,7 +2,6 @@
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#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 *
*===========================================================================*/

View File

@@ -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 */
};

View File

@@ -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) */

View File

@@ -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 |
+--------------+---------+---------+-----------------------------------------+

View File

@@ -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);

View File

@@ -13,7 +13,6 @@
#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>
@@ -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 *
*===========================================================================*/

View File

@@ -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 <sys/stat.h>
#include <sys/statfs.h>
#include <minix/com.h>
#include <minix/u64.h>
#include <string.h>
@@ -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 *
*===========================================================================*/

View File

@@ -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 */