Module Name: src Committed By: dholland Date: Sun Jul 28 01:27:02 UTC 2013
Modified Files: src/sys/ufs/lfs: lfs_vnops.c Log Message: Merge the extattr VOPs from ffs. As these do nothing besides dispatch to ulfs_extattr.c it wasn't exactly hard. This might just make extended attributes work on lfs... To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/ufs/lfs/lfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/lfs/lfs_vnops.c diff -u src/sys/ufs/lfs/lfs_vnops.c:1.253 src/sys/ufs/lfs/lfs_vnops.c:1.254 --- src/sys/ufs/lfs/lfs_vnops.c:1.253 Sun Jul 28 01:10:49 2013 +++ src/sys/ufs/lfs/lfs_vnops.c Sun Jul 28 01:27:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.253 2013/07/28 01:10:49 dholland Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.254 2013/07/28 01:27:02 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.253 2013/07/28 01:10:49 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.254 2013/07/28 01:27:02 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -105,6 +105,13 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c, extern pid_t lfs_writer_daemon; int lfs_ignore_lazy_sync = 1; +static int lfs_openextattr(void *v); +static int lfs_closeextattr(void *v); +static int lfs_getextattr(void *v); +static int lfs_setextattr(void *v); +static int lfs_listextattr(void *v); +static int lfs_deleteextattr(void *v); + /* Global vfs data structures for lfs. */ int (**lfs_vnodeop_p)(void *); const struct vnodeopv_entry_desc lfs_vnodeop_entries[] = { @@ -150,6 +157,12 @@ const struct vnodeopv_entry_desc lfs_vno { &vop_bwrite_desc, lfs_bwrite }, /* bwrite */ { &vop_getpages_desc, lfs_getpages }, /* getpages */ { &vop_putpages_desc, lfs_putpages }, /* putpages */ + { &vop_openextattr_desc, lfs_openextattr }, /* openextattr */ + { &vop_closeextattr_desc, lfs_closeextattr }, /* closeextattr */ + { &vop_getextattr_desc, lfs_getextattr }, /* getextattr */ + { &vop_setextattr_desc, lfs_setextattr }, /* setextattr */ + { &vop_listextattr_desc, lfs_listextattr }, /* listextattr */ + { &vop_deleteextattr_desc, lfs_deleteextattr }, /* deleteextattr */ { NULL, NULL } }; const struct vnodeopv_desc lfs_vnodeop_opv_desc = @@ -198,6 +211,12 @@ const struct vnodeopv_entry_desc lfs_spe { &vop_bwrite_desc, vn_bwrite }, /* bwrite */ { &vop_getpages_desc, spec_getpages }, /* getpages */ { &vop_putpages_desc, spec_putpages }, /* putpages */ + { &vop_openextattr_desc, lfs_openextattr }, /* openextattr */ + { &vop_closeextattr_desc, lfs_closeextattr }, /* closeextattr */ + { &vop_getextattr_desc, lfs_getextattr }, /* getextattr */ + { &vop_setextattr_desc, lfs_setextattr }, /* setextattr */ + { &vop_listextattr_desc, lfs_listextattr }, /* listextattr */ + { &vop_deleteextattr_desc, lfs_deleteextattr }, /* deleteextattr */ { NULL, NULL } }; const struct vnodeopv_desc lfs_specop_opv_desc = @@ -245,6 +264,12 @@ const struct vnodeopv_entry_desc lfs_fif { &vop_advlock_desc, vn_fifo_bypass }, /* advlock */ { &vop_bwrite_desc, lfs_bwrite }, /* bwrite */ { &vop_putpages_desc, vn_fifo_bypass }, /* putpages */ + { &vop_openextattr_desc, lfs_openextattr }, /* openextattr */ + { &vop_closeextattr_desc, lfs_closeextattr }, /* closeextattr */ + { &vop_getextattr_desc, lfs_getextattr }, /* getextattr */ + { &vop_setextattr_desc, lfs_setextattr }, /* setextattr */ + { &vop_listextattr_desc, lfs_listextattr }, /* listextattr */ + { &vop_deleteextattr_desc, lfs_deleteextattr }, /* deleteextattr */ { NULL, NULL } }; const struct vnodeopv_desc lfs_fifoop_opv_desc = @@ -2456,3 +2481,171 @@ lfs_mmap(void *v) return EOPNOTSUPP; return ulfs_mmap(v); } + +static int +lfs_openextattr(void *v) +{ + struct vop_openextattr_args /* { + struct vnode *a_vp; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct inode *ip = VTOI(ap->a_vp); + struct ulfsmount *ump = ip->i_ump; + //struct lfs *fs = ip->i_lfs; + + /* Not supported for ULFS1 file systems. */ + if (ump->um_fstype == ULFS1) + return (EOPNOTSUPP); + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +} + +static int +lfs_closeextattr(void *v) +{ + struct vop_closeextattr_args /* { + struct vnode *a_vp; + int a_commit; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct inode *ip = VTOI(ap->a_vp); + struct ulfsmount *ump = ip->i_ump; + //struct lfs *fs = ip->i_lfs; + + /* Not supported for ULFS1 file systems. */ + if (ump->um_fstype == ULFS1) + return (EOPNOTSUPP); + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +} + +static int +lfs_getextattr(void *v) +{ + struct vop_getextattr_args /* { + struct vnode *a_vp; + int a_attrnamespace; + const char *a_name; + struct uio *a_uio; + size_t *a_size; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); + struct ulfsmount *ump = ip->i_ump; + //struct lfs *fs = ip->i_lfs; + int error; + + if (ump->um_fstype == ULFS1) { +#ifdef LFS_EXTATTR + fstrans_start(vp->v_mount, FSTRANS_SHARED); + error = ulfs_getextattr(ap); + fstrans_done(vp->v_mount); +#else + error = EOPNOTSUPP; +#endif + return error; + } + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +} + +static int +lfs_setextattr(void *v) +{ + struct vop_setextattr_args /* { + struct vnode *a_vp; + int a_attrnamespace; + const char *a_name; + struct uio *a_uio; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); + struct ulfsmount *ump = ip->i_ump; + //struct lfs *fs = ip->i_lfs; + int error; + + if (ump->um_fstype == ULFS1) { +#ifdef LFS_EXTATTR + fstrans_start(vp->v_mount, FSTRANS_SHARED); + error = ulfs_setextattr(ap); + fstrans_done(vp->v_mount); +#else + error = EOPNOTSUPP; +#endif + return error; + } + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +} + +static int +lfs_listextattr(void *v) +{ + struct vop_listextattr_args /* { + struct vnode *a_vp; + int a_attrnamespace; + struct uio *a_uio; + size_t *a_size; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); + struct ulfsmount *ump = ip->i_ump; + //struct lfs *fs = ip->i_lfs; + int error; + + if (ump->um_fstype == ULFS1) { +#ifdef LFS_EXTATTR + fstrans_start(vp->v_mount, FSTRANS_SHARED); + error = ulfs_listextattr(ap); + fstrans_done(vp->v_mount); +#else + error = EOPNOTSUPP; +#endif + return error; + } + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +} + +static int +lfs_deleteextattr(void *v) +{ + struct vop_deleteextattr_args /* { + struct vnode *a_vp; + int a_attrnamespace; + kauth_cred_t a_cred; + struct proc *a_p; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); + struct ulfsmount *ump = ip->i_ump; + //struct fs *fs = ip->i_lfs; + int error; + + if (ump->um_fstype == ULFS1) { +#ifdef LFS_EXTATTR + fstrans_start(vp->v_mount, FSTRANS_SHARED); + error = ulfs_deleteextattr(ap); + fstrans_done(vp->v_mount); +#else + error = EOPNOTSUPP; +#endif + return error; + } + + /* XXX Not implemented for ULFS2 file systems. */ + return (EOPNOTSUPP); +}