From d6fe88e4757d4cf7c9997b2f73c80e2469430e7c Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 13 Aug 2002 10:33:57 +0000 Subject: [PATCH] Unravel the UFS_EXTATTR incest between FFS and UFS: UFS_EXTATTR is an UFS only thing, and FFS should in principle not know if it is enabled or not. This commit cleans ffs_vnops.c for such knowledge, but not ffs_vfsops.c Sponsored by: DARPA and NAI Labs. --- sys/ufs/ffs/ffs_vfsops.c | 21 +++++++++++++---- sys/ufs/ffs/ffs_vnops.c | 51 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 18fa4b8b94ed..5f87f325ac1e 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -74,6 +74,7 @@ static void ffs_oldfscompat_read(struct fs *, struct ufsmount *, static void ffs_oldfscompat_write(struct fs *, struct ufsmount *); static vfs_init_t ffs_init; static vfs_uninit_t ffs_uninit; +static vfs_extattrctl_t ffs_extattrctl; static struct vfsops ufs_vfsops = { ffs_mount, @@ -89,11 +90,7 @@ static struct vfsops ufs_vfsops = { ffs_vptofh, ffs_init, ffs_uninit, -#ifdef UFS_EXTATTR - ufs_extattrctl, -#else - vfs_stdextattrctl, -#endif + ffs_extattrctl, }; VFS_SET(ufs_vfsops, ufs, 0); @@ -1453,3 +1450,17 @@ ffs_sbupdate(mp, waitfor) allerror = error; return (allerror); } + +static int +ffs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, + int attrnamespace, const char *attrname, struct thread *td) +{ + +#ifdef UFS_EXTATTR + return (ufs_extattrctl(mp, cmd, filename_vp, attrnamespace, + attrname, td)); +#else + return (vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, + attrname, td)); +#endif +} diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 350536aed53b..0d177f058522 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -43,8 +43,6 @@ * $FreeBSD$ */ -#include "opt_ufs.h" - #include #include #include @@ -82,6 +80,8 @@ static int ffs_read(struct vop_read_args *); static int ffs_write(struct vop_write_args *); static int ffs_extread(struct vop_read_args *); static int ffs_extwrite(struct vop_write_args *); +static int ffs_getextattr(struct vop_getextattr_args *); +static int ffs_setextattr(struct vop_setextattr_args *); /* Global vfs data structures for ufs. */ @@ -93,6 +93,8 @@ static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_read_desc, (vop_t *) ffs_read }, { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks }, { &vop_write_desc, (vop_t *) ffs_write }, + { &vop_getextattr_desc, (vop_t *) ffs_getextattr }, + { &vop_setextattr_desc, (vop_t *) ffs_setextattr }, { NULL, NULL } }; static struct vnodeopv_desc ffs_vnodeop_opv_desc = @@ -102,6 +104,8 @@ vop_t **ffs_specop_p; static struct vnodeopv_entry_desc ffs_specop_entries[] = { { &vop_default_desc, (vop_t *) ufs_vnoperatespec }, { &vop_fsync_desc, (vop_t *) ffs_fsync }, + { &vop_getextattr_desc, (vop_t *) ffs_getextattr }, + { &vop_setextattr_desc, (vop_t *) ffs_setextattr }, { NULL, NULL } }; static struct vnodeopv_desc ffs_specop_opv_desc = @@ -111,6 +115,8 @@ vop_t **ffs_fifoop_p; static struct vnodeopv_entry_desc ffs_fifoop_entries[] = { { &vop_default_desc, (vop_t *) ufs_vnoperatefifo }, { &vop_fsync_desc, (vop_t *) ffs_fsync }, + { &vop_getextattr_desc, (vop_t *) ffs_getextattr }, + { &vop_setextattr_desc, (vop_t *) ffs_setextattr }, { NULL, NULL } }; static struct vnodeopv_desc ffs_fifoop_opv_desc = @@ -1299,3 +1305,44 @@ ffs_extwrite(ap) error = UFS_UPDATE(vp, 1); return (error); } + +/* + * Vnode operating to retrieve a named extended attribute. + */ +int +ffs_getextattr(struct vop_getextattr_args *ap) +/* +vop_getextattr { + IN struct vnode *a_vp; + IN int a_attrnamespace; + IN const char *a_name; + INOUT struct uio *a_uio; + OUT struct size_t *a_size; + IN struct ucred *a_cred; + IN struct thread *a_td; +}; +*/ +{ + + return (ufs_vnoperate((struct vop_generic_args *)ap)); +} + +/* + * Vnode operation to set a named attribute. + */ +int +ffs_setextattr(struct vop_setextattr_args *ap) +/* +vop_setextattr { + IN struct vnode *a_vp; + IN int a_attrnamespace; + IN const char *a_name; + INOUT struct uio *a_uio; + IN struct ucred *a_cred; + IN struct thread *a_td; +}; +*/ +{ + + return (ufs_vnoperate((struct vop_generic_args *)ap)); +}