X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/bdb99a3d02fb2fe162952f789579f72663dabfa5..28623bf96348e242220bd887d979bcc6543aa7f3:/sys/sys/mount.h diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 2a2d74a594..dece19260d 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -32,7 +32,7 @@ * * @(#)mount.h 8.21 (Berkeley) 5/20/95 * $FreeBSD: src/sys/sys/mount.h,v 1.89.2.7 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/sys/mount.h,v 1.16 2004/12/29 02:40:03 dillon Exp $ + * $DragonFly: src/sys/sys/mount.h,v 1.30 2006/10/27 04:56:33 dillon Exp $ */ #ifndef _SYS_MOUNT_H_ @@ -46,10 +46,17 @@ #endif /* !_POSIX_C_SOURCE */ #endif /* !_KERNEL */ +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) +#ifndef _SYS_QUEUE_H_ #include -#ifdef _KERNEL +#endif +#ifndef _SYS_LOCK_H_ #include #endif +#ifndef _SYS_NAMECACHE_H_ +#include +#endif +#endif struct thread; struct journal; @@ -115,16 +122,6 @@ struct statfs { * list. Filesystem kld's syncing code should remain compatible since * they only need to scan the dirty vnode list (nvnodelist -> dirtyvnodelist). * - * NOTE: mnt_fsmanage structures. These structures are required by the new - * vnode operations vector abstraction. Each one contains its own operations - * vector which is registered just like VNODEOP_SET/vnodeopv_desc except it - * is done in the mount code rather then on vfs initialization. This - * structure is responsible for per-mount management, including vfs threading, - * journaling, and so forth. - * - * NOTE: Any vnode marked VPLACEMARKER is a placemarker and should ALWAYS BE - * SKIPPED. NO OTHER FIELDS IN SUCH VNODES ARE VALID. - * * NOTE: All VFSs must at least populate mnt_vn_ops or those VOP ops that * only take namecache pointers will not be able to find their operations * vector via namecache->nc_mount. @@ -136,7 +133,7 @@ struct mount { TAILQ_ENTRY(mount) mnt_list; /* mount list */ struct vfsops *mnt_op; /* operations on fs */ struct vfsconf *mnt_vfc; /* configuration info */ - struct vnode *mnt_vnodecovered; /* vnode we mounted on */ + void *mnt_unused01; struct vnode *mnt_syncer; /* syncer vnode */ struct vnodelst mnt_nvnodelist; /* list of vnodes this mount */ struct lock mnt_lock; /* mount structure lock */ @@ -163,9 +160,13 @@ struct mount { struct vop_ops *mnt_vn_norm_ops; /* for use by the VFS */ struct vop_ops *mnt_vn_spec_ops; /* for use by the VFS */ struct vop_ops *mnt_vn_fifo_ops; /* for use by the VFS */ - struct namecache *mnt_ncp; /* NCF_MNTPT ncp */ + struct nchandle mnt_ncmountpt; /* mount point */ + struct nchandle mnt_ncmounton; /* mounted on */ + int mnt_refs; /* nchandle references */ struct journallst mnt_jlist; /* list of active journals */ + u_int8_t *mnt_jbitmap; /* streamid bitmap */ + int16_t mnt_streamid; /* last streamid */ }; #endif /* _KERNEL || _KERNEL_STRUCTURES */ @@ -244,9 +245,21 @@ struct mount { * with the unmount attempt (used by NFS). */ #define MNTK_UNMOUNTF 0x00000001 /* forced unmount in progress */ +#define MNTK_NCALIASED 0x00800000 /* namecached aliased */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_WANTRDWR 0x04000000 /* upgrade to read/write requested */ +#define MNTK_FSMID 0x08000000 /* getattr supports FSMIDs */ + +/* + * mountlist_*() defines + */ +#define MNTSCAN_FORWARD 0x0001 +#define MNTSCAN_REVERSE 0x0002 +#define MNTSCAN_NOBUSY 0x0004 + +#define MNTINS_FIRST 0x0001 +#define MNTINS_LAST 0x0002 /* * Sysctl CTL_VFS definitions. @@ -273,7 +286,7 @@ struct mount { */ #define MNT_WAIT 1 /* synchronously wait for I/O to complete */ #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ -#define MNT_LAZY 3 /* push data not written by filesystem syncer */ +#define MNT_LAZY 4 /* be lazy and do not necessarily push it all */ /* * Generic file handle @@ -366,50 +379,61 @@ struct nlookupdata; struct mbuf; #endif -struct vfsops { - int (*vfs_mount) (struct mount *mp, char *path, caddr_t data, - struct thread *td); - int (*vfs_start) (struct mount *mp, int flags, - struct thread *td); - int (*vfs_unmount) (struct mount *mp, int mntflags, - struct thread *td); - int (*vfs_root) (struct mount *mp, struct vnode **vpp); - int (*vfs_quotactl) (struct mount *mp, int cmds, uid_t uid, - caddr_t arg, struct thread *td); - int (*vfs_statfs) (struct mount *mp, struct statfs *sbp, - struct thread *td); - int (*vfs_sync) (struct mount *mp, int waitfor, - struct thread *td); - int (*vfs_vget) (struct mount *mp, ino_t ino, - struct vnode **vpp); - int (*vfs_fhtovp) (struct mount *mp, struct fid *fhp, +typedef int vfs_mount_t(struct mount *mp, char *path, caddr_t data, + struct ucred *cred); +typedef int vfs_start_t(struct mount *mp, int flags); +typedef int vfs_unmount_t(struct mount *mp, int mntflags); +typedef int vfs_root_t(struct mount *mp, struct vnode **vpp); +typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, caddr_t arg, + struct ucred *cred); +typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp, + struct ucred *cred); +typedef int vfs_sync_t(struct mount *mp, int waitfor); +typedef int vfs_vget_t(struct mount *mp, ino_t ino, struct vnode **vpp); +typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp); - int (*vfs_checkexp) (struct mount *mp, struct sockaddr *nam, +typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp); - int (*vfs_vptofh) (struct vnode *vp, struct fid *fhp); - int (*vfs_init) (struct vfsconf *); - int (*vfs_uninit) (struct vfsconf *); - int (*vfs_extattrctl) (struct mount *mp, int cmd, - const char *attrname, caddr_t arg, - struct thread *td); +typedef int vfs_vptofh_t(struct vnode *vp, struct fid *fhp); +typedef int vfs_init_t(struct vfsconf *); +typedef int vfs_uninit_t(struct vfsconf *); +typedef int vfs_extattrctl_t(struct mount *mp, int cmd,const char *attrname, + caddr_t arg, struct ucred *cred); + +struct vfsops { + vfs_mount_t *vfs_mount; + vfs_start_t *vfs_start; + vfs_unmount_t *vfs_unmount; + vfs_root_t *vfs_root; + vfs_quotactl_t *vfs_quotactl; + vfs_statfs_t *vfs_statfs; + vfs_sync_t *vfs_sync; + vfs_vget_t *vfs_vget; + vfs_fhtovp_t *vfs_fhtovp; + vfs_checkexp_t *vfs_checkexp; + vfs_vptofh_t *vfs_vptofh; + vfs_init_t *vfs_init; + vfs_uninit_t *vfs_uninit; + vfs_extattrctl_t *vfs_extattrctl; }; -#define VFS_MOUNT(MP, PATH, DATA, P) \ - (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, P) -#define VFS_START(MP, FLAGS, P) (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P) -#define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P) +#define VFS_MOUNT(MP, PATH, DATA, CRED) \ + (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, CRED) +#define VFS_START(MP, FLAGS) (*(MP)->mnt_op->vfs_start)(MP, FLAGS) +#define VFS_UNMOUNT(MP, FORCE) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE) #define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP) -#define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P) -#define VFS_STATFS(MP, SBP, P) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P) -#define VFS_SYNC(MP, WAIT, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, P) +#define VFS_QUOTACTL(MP,C,U,A,CRED) \ + (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, CRED) +#define VFS_STATFS(MP, SBP, CRED) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, CRED) +#define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT) #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) -#define VFS_FHTOVP(MP, FIDP, VPP) \ +#define VFS_FHTOVP(MP, FIDP, VPP) \ (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP) #define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \ (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED) -#define VFS_EXTATTRCTL(MP, C, N, A, P) \ - (*(MP)->mnt_op->vfs_extattrctl)(MP, C, N, A, P) +#define VFS_EXTATTRCTL(MP, C, N, A, CRED) \ + (*(MP)->mnt_op->vfs_extattrctl)(MP, C, N, A, CRED) #endif @@ -467,13 +491,13 @@ extern char *mountrootfsname; /* * exported vnode operations */ -int dounmount (struct mount *, int, struct thread *); +int dounmount (struct mount *, int); int vfs_setpublicfs /* set publicly exported fs */ (struct mount *, struct netexport *, struct export_args *); int vfs_lock (struct mount *); /* lock a vfs */ void vfs_msync (struct mount *, int); void vfs_unlock (struct mount *); /* unlock a vfs */ -int vfs_busy (struct mount *, int, struct lwkt_tokref *, struct thread *); +int vfs_busy (struct mount *, int); void vfs_bufstats(void); int vfs_export /* process mount export info */ (struct mount *, struct netexport *, struct export_args *); @@ -481,17 +505,15 @@ struct netcred *vfs_export_lookup /* lookup host in fs export list */ (struct mount *, struct netexport *, struct sockaddr *); int vfs_allocate_syncvnode (struct mount *); void vfs_getnewfsid (struct mount *); -dev_t vfs_getrootfsid (struct mount *); +cdev_t vfs_getrootfsid (struct mount *); struct mount *vfs_getvfs (fsid_t *); /* return vfs given fsid */ int vfs_modevent (module_t, int, void *); int vfs_mountedon (struct vnode *); /* is a vfs mounted on vp */ int vfs_rootmountalloc (char *, char *, struct mount **); -void vfs_unbusy (struct mount *, struct thread *); +void vfs_unbusy (struct mount *); void vfs_unmountall (void); int vfs_register (struct vfsconf *); int vfs_unregister (struct vfsconf *); -extern struct mntlist mountlist; /* mounted filesystem list */ -extern struct lwkt_token mountlist_token; extern struct nfs_public nfs_pub; /* @@ -499,25 +521,30 @@ extern struct nfs_public nfs_pub; * kern/vfs_default.c, they should be used instead of making "dummy" * functions or casting entries in the VFS op table to "enopnotsupp()". */ -int vfs_stdmount (struct mount *mp, char *path, caddr_t data, - struct nlookupdata *ndp, struct thread *p); -int vfs_stdstart (struct mount *mp, int flags, struct thread *p); -int vfs_stdunmount (struct mount *mp, int mntflags, struct thread *p); -int vfs_stdroot (struct mount *mp, struct vnode **vpp); -int vfs_stdquotactl (struct mount *mp, int cmds, uid_t uid, - caddr_t arg, struct thread *p); -int vfs_stdstatfs (struct mount *mp, struct statfs *sbp, struct thread *p); -int vfs_stdsync (struct mount *mp, int waitfor, struct thread *td); -int vfs_stdvget (struct mount *mp, ino_t ino, struct vnode **vpp); -int vfs_stdfhtovp (struct mount *mp, struct fid *fhp, struct vnode **vpp); -int vfs_stdcheckexp (struct mount *mp, struct sockaddr *nam, - int *extflagsp, struct ucred **credanonp); -int vfs_stdvptofh (struct vnode *vp, struct fid *fhp); -int vfs_stdinit (struct vfsconf *); -int vfs_stduninit (struct vfsconf *); -int vfs_stdextattrctl (struct mount *mp, int cmd, const char *attrname, - caddr_t arg, struct thread *p); +vfs_start_t vfs_stdstart; +vfs_mount_t vfs_stdmount; +vfs_unmount_t vfs_stdunmount; +vfs_root_t vfs_stdroot; +vfs_quotactl_t vfs_stdquotactl; +vfs_statfs_t vfs_stdstatfs; +vfs_sync_t vfs_stdsync; +vfs_sync_t vfs_stdnosync; +vfs_vget_t vfs_stdvget; +vfs_fhtovp_t vfs_stdfhtovp; +vfs_checkexp_t vfs_stdcheckexp; +vfs_vptofh_t vfs_stdvptofh; +vfs_init_t vfs_stdinit; +vfs_uninit_t vfs_stduninit; +vfs_extattrctl_t vfs_stdextattrctl; + int journal_mountctl(struct vop_mountctl_args *ap); +void journal_remove_all_journals(struct mount *mp, int flags); + +void mountlist_insert(struct mount *, int); +int mountlist_interlock(int (*callback)(struct mount *), struct mount *); +struct mount *mountlist_boot_getfirst(void); +void mountlist_remove(struct mount *mp); +int mountlist_scan(int (*callback)(struct mount *, void *), void *, int); #else /* !_KERNEL */