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.
This commit is contained in:
phk 2002-08-13 10:33:57 +00:00
parent 4eec5270bc
commit 088460429a
2 changed files with 65 additions and 7 deletions

View File

@ -74,6 +74,7 @@ static void ffs_oldfscompat_read(struct fs *, struct ufsmount *,
static void ffs_oldfscompat_write(struct fs *, struct ufsmount *); static void ffs_oldfscompat_write(struct fs *, struct ufsmount *);
static vfs_init_t ffs_init; static vfs_init_t ffs_init;
static vfs_uninit_t ffs_uninit; static vfs_uninit_t ffs_uninit;
static vfs_extattrctl_t ffs_extattrctl;
static struct vfsops ufs_vfsops = { static struct vfsops ufs_vfsops = {
ffs_mount, ffs_mount,
@ -89,11 +90,7 @@ static struct vfsops ufs_vfsops = {
ffs_vptofh, ffs_vptofh,
ffs_init, ffs_init,
ffs_uninit, ffs_uninit,
#ifdef UFS_EXTATTR ffs_extattrctl,
ufs_extattrctl,
#else
vfs_stdextattrctl,
#endif
}; };
VFS_SET(ufs_vfsops, ufs, 0); VFS_SET(ufs_vfsops, ufs, 0);
@ -1453,3 +1450,17 @@ ffs_sbupdate(mp, waitfor)
allerror = error; allerror = error;
return (allerror); 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
}

View File

@ -43,8 +43,6 @@
* $FreeBSD$ * $FreeBSD$
*/ */
#include "opt_ufs.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/resourcevar.h> #include <sys/resourcevar.h>
@ -82,6 +80,8 @@ static int ffs_read(struct vop_read_args *);
static int ffs_write(struct vop_write_args *); static int ffs_write(struct vop_write_args *);
static int ffs_extread(struct vop_read_args *); static int ffs_extread(struct vop_read_args *);
static int ffs_extwrite(struct vop_write_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. */ /* 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_read_desc, (vop_t *) ffs_read },
{ &vop_reallocblks_desc, (vop_t *) ffs_reallocblks }, { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks },
{ &vop_write_desc, (vop_t *) ffs_write }, { &vop_write_desc, (vop_t *) ffs_write },
{ &vop_getextattr_desc, (vop_t *) ffs_getextattr },
{ &vop_setextattr_desc, (vop_t *) ffs_setextattr },
{ NULL, NULL } { NULL, NULL }
}; };
static struct vnodeopv_desc ffs_vnodeop_opv_desc = 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[] = { static struct vnodeopv_entry_desc ffs_specop_entries[] = {
{ &vop_default_desc, (vop_t *) ufs_vnoperatespec }, { &vop_default_desc, (vop_t *) ufs_vnoperatespec },
{ &vop_fsync_desc, (vop_t *) ffs_fsync }, { &vop_fsync_desc, (vop_t *) ffs_fsync },
{ &vop_getextattr_desc, (vop_t *) ffs_getextattr },
{ &vop_setextattr_desc, (vop_t *) ffs_setextattr },
{ NULL, NULL } { NULL, NULL }
}; };
static struct vnodeopv_desc ffs_specop_opv_desc = 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[] = { static struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
{ &vop_default_desc, (vop_t *) ufs_vnoperatefifo }, { &vop_default_desc, (vop_t *) ufs_vnoperatefifo },
{ &vop_fsync_desc, (vop_t *) ffs_fsync }, { &vop_fsync_desc, (vop_t *) ffs_fsync },
{ &vop_getextattr_desc, (vop_t *) ffs_getextattr },
{ &vop_setextattr_desc, (vop_t *) ffs_setextattr },
{ NULL, NULL } { NULL, NULL }
}; };
static struct vnodeopv_desc ffs_fifoop_opv_desc = static struct vnodeopv_desc ffs_fifoop_opv_desc =
@ -1299,3 +1305,44 @@ ffs_extwrite(ap)
error = UFS_UPDATE(vp, 1); error = UFS_UPDATE(vp, 1);
return (error); 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));
}