Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Restore binary compatibility by using the statvfs90 structur...
details: https://anonhg.NetBSD.org/src/rev/8ad010dc1fb8
branches: trunk
changeset: 454630:8ad010dc1fb8
user: christos <christos%NetBSD.org@localhost>
date: Mon Sep 23 12:00:57 2019 +0000
description:
Restore binary compatibility by using the statvfs90 structure internally.
diffstat:
lib/libp2k/p2k.c | 12 ++-
lib/libperfuse/ops.c | 4 +-
lib/libperfuse/perfuse_priv.h | 4 +-
lib/libpuffs/null.c | 11 +-
lib/libpuffs/puffs.h | 11 +-
lib/libpuffs/subr.c | 8 +-
lib/librefuse/refuse.c | 14 ++-
sys/fs/puffs/puffs_msgif.h | 119 +++++++++++++++++++++++++++++++++++-
sys/fs/puffs/puffs_vfsops.c | 20 +++--
tests/fs/puffs/h_dtfs/dtfs_vfsops.c | 6 +-
usr.sbin/puffs/mount_psshfs/fs.c | 6 +-
11 files changed, 170 insertions(+), 45 deletions(-)
diffs (truncated from 490 to 300 lines):
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libp2k/p2k.c Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p2k.c,v 1.70 2017/04/26 03:02:48 riastradh Exp $ */
+/* $NetBSD: p2k.c,v 1.71 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@@ -157,7 +157,7 @@
static void
dumpmp(struct puffs_usermount *pu)
{
- struct statvfs svfsb;
+ struct puffs_statvfs svfsb;
if (dodump && p2k_fs_statvfs(pu, &svfsb) == 0) {
rump_pub_vfs_mount_print(svfsb.f_mntonname, dodump-1);
@@ -586,12 +586,14 @@
}
int
-p2k_fs_statvfs(struct puffs_usermount *pu, struct statvfs *sbp)
+p2k_fs_statvfs(struct puffs_usermount *pu, struct puffs_statvfs *sbp)
{
struct p2k_mount *p2m = puffs_getspecific(pu);
struct mount *mp = p2m->p2m_mp;
+ struct statvfs sb;
+ puffs_statvfs_to_statvfs(sbp, &sb);
- return rump_pub_vfs_statvfs(mp, sbp);
+ return rump_pub_vfs_statvfs(mp, &sb);
}
/*ARGSUSED*/
@@ -606,7 +608,7 @@
if (fs) {
if (ukfs_release(fs, 0) != 0) {
- struct statvfs svfsb;
+ struct puffs_statvfs svfsb;
if (p2m->p2m_hasdebug
&& p2k_fs_statvfs(pu, &svfsb) == 0) {
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libperfuse/ops.c Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.87 2019/08/10 07:08:11 manu Exp $ */
+/* $NetBSD: ops.c,v 1.88 2019/09/23 12:00:57 christos Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -955,7 +955,7 @@
}
int
-perfuse_fs_statvfs(struct puffs_usermount *pu, struct statvfs *svfsb)
+perfuse_fs_statvfs(struct puffs_usermount *pu, struct puffs_statvfs *svfsb)
{
struct perfuse_state *ps;
perfuse_msg_t *pm;
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libperfuse/perfuse_priv.h
--- a/lib/libperfuse/perfuse_priv.h Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libperfuse/perfuse_priv.h Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfuse_priv.h,v 1.37 2018/11/16 02:39:02 manu Exp $ */
+/* $NetBSD: perfuse_priv.h,v 1.38 2019/09/23 12:00:57 christos Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -195,7 +195,7 @@
* ops.c - filesystem operations
*/
int perfuse_fs_unmount(struct puffs_usermount *, int);
-int perfuse_fs_statvfs(struct puffs_usermount *, struct statvfs *);
+int perfuse_fs_statvfs(struct puffs_usermount *, struct puffs_statvfs *);
int perfuse_fs_sync(struct puffs_usermount *, int,
const struct puffs_cred *);
int perfuse_fs_fhtonode(struct puffs_usermount *, void *, size_t,
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libpuffs/null.c
--- a/lib/libpuffs/null.c Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libpuffs/null.c Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: null.c,v 1.33 2011/11/25 15:02:02 manu Exp $ */
+/* $NetBSD: null.c,v 1.34 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: null.c,v 1.33 2011/11/25 15:02:02 manu Exp $");
+__RCSID("$NetBSD: null.c,v 1.34 2019/09/23 12:00:57 christos Exp $");
#endif /* !lint */
/*
@@ -191,11 +191,12 @@
/*ARGSUSED*/
int
-puffs_null_fs_statvfs(struct puffs_usermount *pu, struct statvfs *svfsb)
+puffs_null_fs_statvfs(struct puffs_usermount *pu, struct puffs_statvfs *svfsb)
{
-
- if (statvfs(PNPATH(puffs_getroot(pu)), svfsb) == -1)
+ struct statvfs sb;
+ if (statvfs(PNPATH(puffs_getroot(pu)), &sb) == -1)
return errno;
+ statvfs_to_puffs_statvfs(&sb, svfsb);
return 0;
}
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libpuffs/puffs.h Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.h,v 1.127 2015/11/12 17:51:05 christos Exp $ */
+/* $NetBSD: puffs.h,v 1.128 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -162,7 +162,8 @@
/* callbacks for operations */
struct puffs_ops {
int (*puffs_fs_unmount)(struct puffs_usermount *, int);
- int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
+ int (*puffs_fs_statvfs)(struct puffs_usermount *,
+ struct puffs_statvfs *);
int (*puffs_fs_sync)(struct puffs_usermount *, int,
const struct puffs_cred *);
int (*puffs_fs_fhtonode)(struct puffs_usermount *, void *, size_t,
@@ -316,7 +317,7 @@
#define PUFFSOP_PROTOS(fsname) \
int fsname##_fs_unmount(struct puffs_usermount *, int); \
int fsname##_fs_statvfs(struct puffs_usermount *, \
- struct statvfs *); \
+ struct puffs_statvfs *); \
int fsname##_fs_sync(struct puffs_usermount *, int, \
const struct puffs_cred *cred); \
int fsname##_fs_fhtonode(struct puffs_usermount *, void *, \
@@ -559,8 +560,8 @@
* generic/dummy routines applicable for some file systems
*/
int puffs_fsnop_unmount(struct puffs_usermount *, int);
-int puffs_fsnop_statvfs(struct puffs_usermount *, struct statvfs *);
-void puffs_zerostatvfs(struct statvfs *);
+int puffs_fsnop_statvfs(struct puffs_usermount *, struct puffs_statvfs *);
+void puffs_zerostatvfs(struct puffs_statvfs *);
int puffs_fsnop_sync(struct puffs_usermount *, int waitfor,
const struct puffs_cred *);
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/libpuffs/subr.c
--- a/lib/libpuffs/subr.c Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/libpuffs/subr.c Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr.c,v 1.27 2011/02/17 17:55:36 pooka Exp $ */
+/* $NetBSD: subr.c,v 1.28 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: subr.c,v 1.27 2011/02/17 17:55:36 pooka Exp $");
+__RCSID("$NetBSD: subr.c,v 1.28 2019/09/23 12:00:57 christos Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -99,7 +99,7 @@
/*ARGSUSED*/
int
-puffs_fsnop_statvfs(struct puffs_usermount *dontuse1, struct statvfs *sbp)
+puffs_fsnop_statvfs(struct puffs_usermount *dontuse1, struct puffs_statvfs *sbp)
{
sbp->f_bsize = sbp->f_frsize = sbp->f_iosize = DEV_BSIZE;
@@ -142,7 +142,7 @@
* NULLs from application code
*/
void
-puffs_zerostatvfs(struct statvfs *sbp)
+puffs_zerostatvfs(struct puffs_statvfs *sbp)
{
puffs_fsnop_statvfs(NULL, sbp);
diff -r bdd0d442239e -r 8ad010dc1fb8 lib/librefuse/refuse.c
--- a/lib/librefuse/refuse.c Mon Sep 23 09:17:19 2019 +0000
+++ b/lib/librefuse/refuse.c Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refuse.c,v 1.100 2019/04/10 21:42:52 maya Exp $ */
+/* $NetBSD: refuse.c,v 1.101 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright © 2007 Alistair Crooks. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: refuse.c,v 1.100 2019/04/10 21:42:52 maya Exp $");
+__RCSID("$NetBSD: refuse.c,v 1.101 2019/09/23 12:00:57 christos Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -1100,19 +1100,21 @@
/* ARGSUSED2 */
static int
-puffs_fuse_fs_statvfs(struct puffs_usermount *pu, struct statvfs *svfsb)
+puffs_fuse_fs_statvfs(struct puffs_usermount *pu, struct puffs_statvfs *svfsb)
{
struct fuse *fuse;
int ret;
+ struct statvfs sb;
fuse = puffs_getspecific(pu);
if (fuse->op.statfs == NULL) {
- if ((ret = statvfs(PNPATH(puffs_getroot(pu)), svfsb)) == -1) {
+ if ((ret = statvfs(PNPATH(puffs_getroot(pu)), &sb)) == -1) {
return errno;
}
} else {
- ret = fuse->op.statfs(PNPATH(puffs_getroot(pu)), svfsb);
+ ret = fuse->op.statfs(PNPATH(puffs_getroot(pu)), &sb);
}
+ statvfs_to_puffs_statvfs(&sb, svfsb);
return -ret;
}
@@ -1200,7 +1202,7 @@
struct puffs_node *pn_root;
struct refusenode *rn_root;
struct stat st;
- struct statvfs svfsb;
+ struct puffs_statvfs svfsb;
pn_root = newrn(fuse->pu);
puffs_setroot(fuse->pu, pn_root);
diff -r bdd0d442239e -r 8ad010dc1fb8 sys/fs/puffs/puffs_msgif.h
--- a/sys/fs/puffs/puffs_msgif.h Mon Sep 23 09:17:19 2019 +0000
+++ b/sys/fs/puffs/puffs_msgif.h Mon Sep 23 12:00:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.h,v 1.84 2015/02/15 20:21:29 manu Exp $ */
+/* $NetBSD: puffs_msgif.h,v 1.85 2019/09/23 12:00:57 christos Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -112,6 +112,119 @@
#define PUFFS_TYPELEN (_VFS_NAMELEN - (sizeof(PUFFS_TYPEPREFIX)+1))
#define PUFFS_NAMELEN (_VFS_MNAMELEN-1)
+/* really statvfs90 */
+struct puffs_statvfs {
+ unsigned long f_flag; /* copy of mount exported flags */
+ unsigned long f_bsize; /* file system block size */
+ unsigned long f_frsize; /* fundamental file system block size */
+ unsigned long f_iosize; /* optimal file system block size */
+
+ /* The following are in units of f_frsize */
+ fsblkcnt_t f_blocks; /* number of blocks in file system, */
+ fsblkcnt_t f_bfree; /* free blocks avail in file system */
+ fsblkcnt_t f_bavail; /* free blocks avail to non-root */
+ fsblkcnt_t f_bresvd; /* blocks reserved for root */
+
+ fsfilcnt_t f_files; /* total file nodes in file system */
+ fsfilcnt_t f_ffree; /* free file nodes in file system */
+ fsfilcnt_t f_favail; /* free file nodes avail to non-root */
+ fsfilcnt_t f_fresvd; /* file nodes reserved for root */
+
+ uint64_t f_syncreads; /* count of sync reads since mount */
+ uint64_t f_syncwrites; /* count of sync writes since mount */
+
+ uint64_t f_asyncreads; /* count of async reads since mount */
+ uint64_t f_asyncwrites; /* count of async writes since mount */
+
+ fsid_t f_fsidx; /* NetBSD compatible fsid */
+ unsigned long f_fsid; /* Posix compatible fsid */
+ unsigned long f_namemax; /* maximum filename length */
+ uid_t f_owner; /* user that mounted the file system */
+
+ uint32_t f_spare[4]; /* spare space */
+
+ char f_fstypename[_VFS_NAMELEN]; /* fs type name */
+ char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */
+};
+
+#ifndef _KERNEL
+#include <string.h>
+#endif
+
+static __inline void
+statvfs_to_puffs_statvfs(const struct statvfs *s, struct puffs_statvfs *ps)
+{
+ ps->f_flag = s->f_flag;
+ ps->f_bsize = s->f_bsize;
+ ps->f_frsize = s->f_frsize;
Home |
Main Index |
Thread Index |
Old Index