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 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
}

View File

@ -43,8 +43,6 @@
* $FreeBSD$
*/
#include "opt_ufs.h"
#include <sys/param.h>
#include <sys/systm.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_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));
}