<sys/mount.h>, <sys/statvfs.h>

Change-Id: I98d4f90b6ca74d3898db158d95faf98605c7c1af
This commit is contained in:
Ben Gras 2013-12-10 21:21:49 +01:00 committed by Lionel Sambuc
parent 28b9cb9a52
commit 7df88eaa69
2 changed files with 93 additions and 13 deletions

View file

@ -191,7 +191,15 @@ struct mount {
}
#if defined(_KERNEL)
#include <prop/proplib.h>
struct quotactl_args; /* in sys/quotactl.h */
struct quotastat; /* in sys/quotactl.h */
struct quotaidtypestat; /* in sys/quotactl.h */
struct quotaobjtypestat; /* in sys/quotactl.h */
struct quotakcursor; /* in sys/quotactl.h */
struct quotakey; /* in sys/quota.h */
struct quotaval; /* in sys/quota.h */
#if __STDC__
struct nameidata;
#endif
@ -208,7 +216,7 @@ struct vfsops {
int (*vfs_start) (struct mount *, int);
int (*vfs_unmount) (struct mount *, int);
int (*vfs_root) (struct mount *, struct vnode **);
int (*vfs_quotactl) (struct mount *, prop_dictionary_t);
int (*vfs_quotactl) (struct mount *, struct quotactl_args *);
int (*vfs_statvfs) (struct mount *, struct statvfs *);
int (*vfs_sync) (struct mount *, int, struct kauth_cred *);
int (*vfs_vget) (struct mount *, ino_t, struct vnode **);
@ -243,7 +251,7 @@ int VFS_MOUNT(struct mount *, const char *, void *, size_t *);
int VFS_START(struct mount *, int);
int VFS_UNMOUNT(struct mount *, int);
int VFS_ROOT(struct mount *, struct vnode **);
int VFS_QUOTACTL(struct mount *, prop_dictionary_t);
int VFS_QUOTACTL(struct mount *, struct quotactl_args *);
int VFS_STATVFS(struct mount *, struct statvfs *);
int VFS_SYNC(struct mount *, int, struct kauth_cred *);
int VFS_FHTOVP(struct mount *, struct fid *, struct vnode **);
@ -269,7 +277,7 @@ int fsname##_mount(struct mount *, const char *, void *, \
int fsname##_start(struct mount *, int); \
int fsname##_unmount(struct mount *, int); \
int fsname##_root(struct mount *, struct vnode **); \
int fsname##_quotactl(struct mount *, prop_dictionary_t); \
int fsname##_quotactl(struct mount *, int, struct quotactl_args *); \
int fsname##_statvfs(struct mount *, struct statvfs *); \
int fsname##_sync(struct mount *, int, struct kauth_cred *); \
int fsname##_vget(struct mount *, ino_t, struct vnode **); \
@ -407,6 +415,24 @@ struct mount *vfs_mountalloc(struct vfsops *, struct vnode *);
int vfs_stdextattrctl(struct mount *, int, struct vnode *,
int, const char *);
void vfs_insmntque(struct vnode *, struct mount *);
int vfs_quotactl_stat(struct mount *, struct quotastat *);
int vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *);
int vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *);
int vfs_quotactl_get(struct mount *, const struct quotakey *,
struct quotaval *);
int vfs_quotactl_put(struct mount *, const struct quotakey *,
const struct quotaval *);
int vfs_quotactl_delete(struct mount *, const struct quotakey *);
int vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *);
int vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *);
int vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *,
int);
int vfs_quotactl_cursorget(struct mount *, struct quotakcursor *,
struct quotakey *, struct quotaval *, unsigned, unsigned *);
int vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *);
int vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *);
int vfs_quotactl_quotaon(struct mount *, int, const char *);
int vfs_quotactl_quotaoff(struct mount *, int);
extern CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern struct vfsops *vfssw[]; /* filesystem type table */
@ -450,15 +476,15 @@ int getfh(const char *, void *, size_t *)
__RENAME(__getfh30);
#endif
#if !defined(__minix)
#ifndef __minix
int unmount(const char *, int);
#endif /* !defined(__minix) */
#endif
#if defined(_NETBSD_SOURCE)
#ifndef __LIBC12_SOURCE__
#if !defined(__minix)
/* LSC FIXME: we should remove our definition, and make sure all the tools uses the new one*/
#ifndef __minix
int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
#endif /* !defined(__minix) */
#endif
int fhopen(const void *, size_t, int) __RENAME(__fhopen40);
int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
#endif

View file

@ -69,8 +69,8 @@ struct statvfs {
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, */
/* (in units of f_frsize) */
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 */
@ -106,14 +106,51 @@ struct statvfs {
#endif
#define ST_RDONLY MNT_RDONLY
#define ST_SYNCHRONOUS MNT_SYNCHRONOUS
#define ST_NOEXEC MNT_NOEXEC
#define ST_NOSUID MNT_NOSUID
#ifdef __minix
#define ST_NOTRUNC __MNT_UNUSED1
#endif /* !__minix*/
#define ST_NODEV MNT_NODEV
#define ST_UNION MNT_UNION
#define ST_ASYNC MNT_ASYNC
#define ST_NOCOREDUMP MNT_NOCOREDUMP
#define ST_RELATIME MNT_RELATIME
#define ST_IGNORE MNT_IGNORE
#define ST_NOATIME MNT_NOATIME
#define ST_SYMPERM MNT_SYMPERM
#define ST_NODEVMTIME MNT_NODEVMTIME
#define ST_SOFTDEP MNT_SOFTDEP
#define ST_LOG MNT_LOG
#define ST_EXTATTR MNT_EXTATTR
#define ST_EXRDONLY MNT_EXRDONLY
#define ST_EXPORTED MNT_EXPORTED
#define ST_DEFEXPORTED MNT_DEFEXPORTED
#define ST_EXPORTANON MNT_EXPORTANON
#define ST_EXKERB MNT_EXKERB
#define ST_EXNORESPORT MNT_EXNORESPORT
#define ST_EXPUBLIC MNT_EXPUBLIC
#define ST_LOCAL MNT_LOCAL
#define ST_QUOTA MNT_QUOTA
#define ST_ROOTFS MNT_ROOTFS
#define ST_WAIT MNT_WAIT
#define ST_NOWAIT MNT_NOWAIT
#ifdef __minix
#define ST_NOTRUNC __MNT_UNUSED1
#endif /* !__minix*/
#if defined(_KERNEL) || defined(_STANDALONE)
struct mount;
struct lwp;
int set_statvfs_info(const char *, int, const char *, int,
const char *, struct mount *, struct lwp *);
void copy_statvfs_info(struct statvfs *, const struct mount *);
int dostatvfs(struct mount *, struct statvfs *, struct lwp *, int, int);
#else
__BEGIN_DECLS
int statvfs(const char *__restrict, struct statvfs *__restrict);
int fstatvfs(int, struct statvfs *);
@ -121,9 +158,26 @@ int getvfsstat(struct statvfs *, size_t, int);
#ifndef __LIBC12_SOURCE__
int getmntinfo(struct statvfs **, int) __RENAME(__getmntinfo13);
#endif /* __LIBC12_SOURCE__ */
#if defined(_NETBSD_SOURCE)
#ifndef __LIBC12_SOURCE__
int fhstatvfs(const void *, size_t, struct statvfs *)
__RENAME(__fhstatvfs40);
#endif
int statvfs1(const char *__restrict, struct statvfs *__restrict, int);
int fstatvfs1(int, struct statvfs *, int);
#ifndef __LIBC12_SOURCE__
int fhstatvfs1(const void *, size_t, struct statvfs *, int)
__RENAME(__fhstatvfs140);
#endif
#endif /* _NETBSD_SOURCE */
__END_DECLS
#endif /* _KERNEL || _STANDALONE */
#if defined(_KERNEL)
#include <sys/kmem.h>
#define STATVFSBUF_GET() kmem_alloc(sizeof(struct statvfs), KM_SLEEP)
#define STATVFSBUF_PUT(sb) kmem_free(sb, sizeof(struct statvfs))
#endif /* defined(_KERNEL) */
#endif /* !_SYS_STATVFS_H_ */