Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/sys/mount.h,v rcsdiff: /ftp/cvs/cvsroot/src/sys/sys/mount.h,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.207.6.6 retrieving revision 1.208 diff -u -p -r1.207.6.6 -r1.208 --- src/sys/sys/mount.h 2017/12/03 11:39:20 1.207.6.6 +++ src/sys/sys/mount.h 2012/11/05 17:16:18 1.208 @@ -1,4 +1,4 @@ -/* $NetBSD: mount.h,v 1.207.6.6 2017/12/03 11:39:20 jdolecek Exp $ */ +/* $NetBSD: mount.h,v 1.208 2012/11/05 17:16:18 dholland Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -44,16 +44,14 @@ #ifndef _STANDALONE #include /* precautionary upon removal from ucred.h */ #include +#include #include #include -#include -#if defined(_KERNEL) || defined(__EXPOSE_MOUNT) -#include #include #include +#include #include #include -#endif /* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */ #endif /* !_STANDALONE */ /* @@ -99,51 +97,31 @@ #define MOUNT_RUMPFS "rumpfs" /* rump virtual file system */ #define MOUNT_V7FS "v7fs" /* 7th Edition of Unix Filesystem */ -/* - * Sysctl CTL_VFS definitions. - * - * Second level identifier specifies which filesystem. Second level - * identifier VFS_GENERIC returns information about all filesystems. - * - * Note the slightly non-flat nature of these sysctl numbers. Oh for - * a better sysctl interface. - */ -#define VFS_GENERIC 0 /* generic filesystem information */ -#define VFS_MAXTYPENUM 1 /* int: highest defined fs type */ -#define VFS_CONF 2 /* struct: vfsconf for filesystem given - as next argument */ -#define VFS_USERMOUNT 3 /* enable/disable fs mnt by non-root */ -#define VFS_MAGICLINKS 4 /* expand 'magic' symlinks */ -#define VFSGEN_MAXID 5 /* number of valid vfs.generic ids */ - #ifndef _STANDALONE -#if defined(_KERNEL) || defined(__EXPOSE_MOUNT) - struct vnode; -struct vnode_impl; -struct vattr; /* * Structure per mounted file system. Each mounted file system has an - * array of operations and an instance record. + * array of operations and an instance record. The file systems are + * put on a doubly linked list. */ struct mount { - TAILQ_HEAD(, vnode_impl) mnt_vnodelist; /* list of vnodes this mount */ + CIRCLEQ_ENTRY(mount) mnt_list; /* mount list */ + TAILQ_HEAD(, vnode) mnt_vnodelist; /* list of vnodes this mount */ struct vfsops *mnt_op; /* operations on fs */ struct vnode *mnt_vnodecovered; /* vnode we mounted on */ - struct mount *mnt_lower; /* fs mounted on */ - int mnt_synclist_slot; /* synclist slot index */ + struct vnode *mnt_syncer; /* syncer vnode */ void *mnt_transinfo; /* for FS-internal use */ void *mnt_data; /* private data */ + krwlock_t mnt_unmounting; /* to prevent new activity */ kmutex_t mnt_renamelock; /* per-fs rename lock */ int mnt_refcnt; /* ref count on this structure */ + int mnt_recursecnt; /* count of write locks */ int mnt_flag; /* flags */ int mnt_iflag; /* internal flags */ int mnt_fs_bshift; /* offset shift for lblkno */ int mnt_dev_bshift; /* shift for device sectors */ - unsigned int mnt_dev_serial; /* when maxphys etc. updated */ - uint32_t mnt_maxphys; /* largest xfer allowed */ struct statvfs mnt_stat; /* cache of filesystem stats */ specificdata_reference mnt_specdataref; /* subsystem specific data */ @@ -156,9 +134,22 @@ struct mount { uint64_t mnt_gen; }; -#endif /* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */ - -#ifdef _KERNEL +/* + * Sysctl CTL_VFS definitions. + * + * Second level identifier specifies which filesystem. Second level + * identifier VFS_GENERIC returns information about all filesystems. + * + * Note the slightly non-flat nature of these sysctl numbers. Oh for + * a better sysctl interface. + */ +#define VFS_GENERIC 0 /* generic filesystem information */ +#define VFS_MAXTYPENUM 1 /* int: highest defined fs type */ +#define VFS_CONF 2 /* struct: vfsconf for filesystem given + as next argument */ +#define VFS_USERMOUNT 3 /* enable/disable fs mnt by non-root */ +#define VFS_MAGICLINKS 4 /* expand 'magic' symlinks */ +#define VFSGEN_MAXID 5 /* number of valid vfs.generic ids */ /* * USE THE SAME NAMES AS MOUNT_*! @@ -199,6 +190,8 @@ struct mount { { "magiclinks", CTLTYPE_INT }, \ } +#if defined(_KERNEL) + struct quotactl_args; /* in sys/quotactl.h */ struct quotastat; /* in sys/quotactl.h */ struct quotaidtypestat; /* in sys/quotactl.h */ @@ -207,6 +200,10 @@ struct quotakcursor; /* in sys/quotactl struct quotakey; /* in sys/quota.h */ struct quotaval; /* in sys/quota.h */ +#if __STDC__ +struct nameidata; +#endif + /* * Operations supported on mounted file system. */ @@ -223,11 +220,6 @@ struct vfsops { 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 **); - int (*vfs_loadvnode) (struct mount *, struct vnode *, - const void *, size_t, const void **); - int (*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *, - struct vattr *, kauth_cred_t, - size_t *, const void **); int (*vfs_fhtovp) (struct mount *, struct fid *, struct vnode **); int (*vfs_vptofh) (struct vnode *, struct fid *, size_t *); @@ -250,10 +242,6 @@ struct vfsops { /* XXX vget is actually file system internal. */ #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) -#define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \ - (*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY) -#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) \ - (*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) #define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP) #define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP) @@ -272,8 +260,14 @@ int VFS_SNAPSHOT(struct mount *, struct int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *); int VFS_SUSPENDCTL(struct mount *, int); +#endif /* _KERNEL */ + +#ifdef _KERNEL +#if __STDC__ +struct mbuf; struct vnodeopv_desc; struct kauth_cred; +#endif #define VFS_MAX_MOUNT_DATA 8192 @@ -287,11 +281,6 @@ int fsname##_quotactl(struct mount *, st 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 **); \ -int fsname##_loadvnode(struct mount *, struct vnode *, \ - const void *, size_t, const void **); \ -int fsname##_newvnode(struct mount *, struct vnode *, \ - struct vnode *, struct vattr *, kauth_cred_t, \ - size_t *, const void **); \ int fsname##_fhtovp(struct mount *, struct fid *, struct vnode **); \ int fsname##_vptofh(struct vnode *, struct fid *, size_t *); \ void fsname##_init(void); \ @@ -412,17 +401,16 @@ void vfs_sync_all(struct lwp *); bool vfs_unmountall(struct lwp *); /* unmount file systems */ bool vfs_unmountall1(struct lwp *, bool, bool); bool vfs_unmount_forceone(struct lwp *); -int vfs_busy(struct mount *); -int vfs_trybusy(struct mount *); +int vfs_busy(struct mount *, struct mount **); int vfs_rootmountalloc(const char *, const char *, struct mount **); -void vfs_unbusy(struct mount *); +void vfs_unbusy(struct mount *, bool, struct mount **); int vfs_attach(struct vfsops *); int vfs_detach(struct vfsops *); void vfs_reinit(void); struct vfsops *vfs_getopsbyname(const char *); void vfs_delref(struct vfsops *); -void vfs_ref(struct mount *); -void vfs_rele(struct mount *); +void vfs_destroy(struct mount *); +void vfs_scrubvnlist(struct mount *); struct mount *vfs_mountalloc(struct vfsops *, struct vnode *); int vfs_stdextattrctl(struct mount *, int, struct vnode *, int, const char *); @@ -434,7 +422,7 @@ int vfs_quotactl_get(struct mount *, con struct quotaval *); int vfs_quotactl_put(struct mount *, const struct quotakey *, const struct quotaval *); -int vfs_quotactl_del(struct mount *, const struct quotakey *); +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 *, @@ -446,23 +434,10 @@ int vfs_quotactl_cursorrewind(struct mou int vfs_quotactl_quotaon(struct mount *, int, const char *); int vfs_quotactl_quotaoff(struct mount *, int); -struct vnode_iterator; /* Opaque. */ -void vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **); -void vfs_vnode_iterator_destroy(struct vnode_iterator *); -struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *, - bool (*)(void *, struct vnode *), void *); - -/* Syncer */ -extern int syncer_maxdelay; -extern time_t syncdelay; -extern time_t filedelay; -extern time_t dirdelay; -extern time_t metadelay; -void vfs_syncer_add_to_worklist(struct mount *); -void vfs_syncer_remove_from_worklist(struct mount *); - +extern CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */ extern struct vfsops *vfssw[]; /* filesystem type table */ extern int nvfssw; +extern kmutex_t mountlist_lock; extern kmutex_t vfs_list_lock; void vfs_mount_sysinit(void); @@ -470,7 +445,7 @@ long makefstype(const char *); int mount_domount(struct lwp *, struct vnode **, struct vfsops *, const char *, int, void *, size_t *); int dounmount(struct mount *, int, struct lwp *); -int do_sys_mount(struct lwp *, const char *, enum uio_seg, const char *, +int do_sys_mount(struct lwp *, struct vfsops *, const char *, const char *, int, void *, enum uio_seg, size_t, register_t *); void vfsinit(void); void vfs_opv_init(const struct vnodeopv_desc * const *); @@ -488,15 +463,6 @@ void mount_setspecific(struct mount *, s int usermount_common_policy(struct mount *, u_long); -typedef struct mount_iterator mount_iterator_t; /* Opaque. */ -void mountlist_iterator_init(mount_iterator_t **); -void mountlist_iterator_destroy(mount_iterator_t *); -struct mount *mountlist_iterator_next(mount_iterator_t *); -struct mount *mountlist_iterator_trynext(mount_iterator_t *); -struct mount *_mountlist_next(struct mount *); -void mountlist_append(struct mount *); -void mountlist_remove(struct mount *); - LIST_HEAD(vfs_list_head, vfsops); extern struct vfs_list_head vfs_list;