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

@@ -4,6 +4,7 @@
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,7 +3,6 @@
#include "inc.h"
#include <time.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <string.h>
@@ -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)
{

View File

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