Add mount -o extattr option to enable extended attributs (corrently only
for UFS1). Remove kernel option for EA backing store autocreation and do it by default. Add a sysctl so that autocreated attriutr size can be modified.
This commit is contained in:
parent
772633be86
commit
448e1c49b2
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mntopts.h,v 1.13 2009/01/12 18:14:20 pooka Exp $ */
|
||||
/* $NetBSD: mntopts.h,v 1.14 2011/06/17 14:23:50 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
@ -57,6 +57,7 @@ struct mntopt {
|
||||
#define MOPT_SOFTDEP { "softdep", 0, MNT_SOFTDEP, 0 }
|
||||
#define MOPT_LOG { "log", 0, MNT_LOG, 0 }
|
||||
#define MOPT_IGNORE { "hidden", 0, MNT_IGNORE, 0 }
|
||||
#define MOPT_EXTATTR { "extattr", 0, MNT_EXTATTR, 0 }
|
||||
|
||||
/* Control flags. */
|
||||
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: mount.2,v 1.45 2010/05/31 12:16:20 njoly Exp $
|
||||
.\" $NetBSD: mount.2,v 1.46 2011/06/17 14:23:50 manu Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1989, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -119,6 +119,9 @@ causes a journal (or log) to be created in the
|
||||
filesystem, creating a record of meta-data writes to be
|
||||
performed, allowing the actual writes to be deferred.
|
||||
This improves performance in most cases.
|
||||
.It MNT_EXTATTR
|
||||
Enable extended attributes, if the filesystem supports them and do not enable
|
||||
them by default. Currently this is only the case for UFS1.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: mount.8,v 1.70 2010/11/21 18:33:08 pooka Exp $
|
||||
.\" $NetBSD: mount.8,v 1.71 2011/06/17 14:23:51 manu Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1989, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -190,6 +190,9 @@ recovery mechanism, or are willing to recreate the file system from scratch.
|
||||
Clear
|
||||
.Cm async
|
||||
mode.
|
||||
.It Cm extattr
|
||||
Enable extended attributes, if the filesystem supports them and do not enable
|
||||
them by default. Currently this is only the case for UFS1.
|
||||
.It Cm force
|
||||
The same as
|
||||
.Fl f ;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mount_ffs.c,v 1.25 2008/08/05 20:57:45 pooka Exp $ */
|
||||
/* $NetBSD: mount_ffs.c,v 1.26 2011/06/17 14:23:51 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_ffs.c,v 1.25 2008/08/05 20:57:45 pooka Exp $");
|
||||
__RCSID("$NetBSD: mount_ffs.c,v 1.26 2011/06/17 14:23:51 manu Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -74,6 +74,7 @@ static const struct mntopt mopts[] = {
|
||||
MOPT_SOFTDEP,
|
||||
MOPT_LOG,
|
||||
MOPT_GETARGS,
|
||||
MOPT_EXTATTR,
|
||||
MOPT_NULL,
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: options.4,v 1.406 2011/06/07 20:23:14 wiz Exp $
|
||||
.\" $NetBSD: options.4,v 1.407 2011/06/17 14:23:51 manu Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996
|
||||
.\" Perry E. Metzger. All rights reserved.
|
||||
@ -959,6 +959,8 @@ Disable the
|
||||
support in FFS file systems.
|
||||
Maybe useful for install media kernels, small memory systems and
|
||||
embedded systems which don't require the snapshot support.
|
||||
.It Cd options UFS_EXTATTR
|
||||
Enable extended attribute support for UFS1 filesystems.
|
||||
.It Cd options WAPBL
|
||||
Enable
|
||||
.Dq Write Ahead Physical Block Logging file system journaling .
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.429 2011/06/12 03:35:57 rmind Exp $ */
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.430 2011/06/17 14:23:51 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.429 2011/06/12 03:35:57 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.430 2011/06/17 14:23:51 manu Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_fileassoc.h"
|
||||
@ -97,6 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.429 2011/06/12 03:35:57 rmind Exp
|
||||
#ifdef FILEASSOC
|
||||
#include <sys/fileassoc.h>
|
||||
#endif /* FILEASSOC */
|
||||
#include <sys/extattr.h>
|
||||
#include <sys/verified_exec.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/atomic.h>
|
||||
@ -232,12 +233,12 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
|
||||
~(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
|
||||
MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
|
||||
MNT_LOG);
|
||||
MNT_LOG | MNT_EXTATTR);
|
||||
mp->mnt_flag |= flags &
|
||||
(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
|
||||
MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
|
||||
MNT_LOG | MNT_IGNORE);
|
||||
MNT_LOG | MNT_EXTATTR | MNT_IGNORE);
|
||||
|
||||
error = VFS_MOUNT(mp, path, data, data_len);
|
||||
|
||||
@ -275,6 +276,25 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
vfs_unbusy(mp, false, NULL);
|
||||
|
||||
if ((error == 0) && !(saved_flags & MNT_EXTATTR) &&
|
||||
(flags & MNT_EXTATTR)) {
|
||||
if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START,
|
||||
NULL, 0, NULL) != 0) {
|
||||
printf("%s: failed to start extattr, error = %d",
|
||||
vp->v_mount->mnt_stat.f_mntonname, error);
|
||||
mp->mnt_flag &= ~MNT_EXTATTR;
|
||||
}
|
||||
}
|
||||
|
||||
if ((error == 0) && (saved_flags & MNT_EXTATTR) &&
|
||||
!(flags & MNT_EXTATTR)) {
|
||||
if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_STOP,
|
||||
NULL, 0, NULL) != 0) {
|
||||
printf("%s: failed to stop extattr, error = %d",
|
||||
vp->v_mount->mnt_stat.f_mntonname, error);
|
||||
mp->mnt_flag |= MNT_RDONLY;
|
||||
}
|
||||
}
|
||||
out:
|
||||
return (error);
|
||||
}
|
||||
@ -448,6 +468,14 @@ do_sys_mount(struct lwp *l, struct vfsops *vfsops, const char *type,
|
||||
error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
|
||||
&data_len);
|
||||
vfsopsrele = false;
|
||||
|
||||
if ((error == 0) && (flags & MNT_EXTATTR)) {
|
||||
if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START,
|
||||
NULL, 0, NULL) != 0)
|
||||
printf("%s: failed to start extattr",
|
||||
vp->v_mount->mnt_stat.f_mntonname);
|
||||
/* XXX remove flag */
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extattr.h,v 1.4 2006/05/14 21:38:18 elad Exp $ */
|
||||
/* $NetBSD: extattr.h,v 1.5 2011/06/17 14:23:51 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2001 Robert N. M. Watson
|
||||
@ -46,6 +46,10 @@
|
||||
#define EXTATTR_NAMESPACE_SYSTEM 0x00000002
|
||||
#define EXTATTR_NAMESPACE_SYSTEM_STRING "system"
|
||||
|
||||
/* for sys_extattrctl */
|
||||
#define EXTATTR_CMD_START 0x00000001
|
||||
#define EXTATTR_CMD_STOP 0x00000002
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <sys/syslimits.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fstypes.h,v 1.28 2011/01/13 07:25:50 pooka Exp $ */
|
||||
/* $NetBSD: fstypes.h,v 1.29 2011/06/17 14:23:51 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -86,7 +86,6 @@ typedef struct fhandle fhandle_t;
|
||||
#define __MNT_UNUSED1 0x00020000
|
||||
#define __MNT_UNUSED2 0x00200000
|
||||
#define __MNT_UNUSED3 0x00800000
|
||||
#define __MNT_UNUSED4 0x01000000
|
||||
|
||||
#define MNT_RDONLY 0x00000001 /* read only filesystem */
|
||||
#define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
|
||||
@ -97,6 +96,7 @@ typedef struct fhandle fhandle_t;
|
||||
#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
|
||||
#define MNT_NOCOREDUMP 0x00008000 /* don't write core dumps to this FS */
|
||||
#define MNT_IGNORE 0x00100000 /* don't show entry in df */
|
||||
#define MNT_EXTATTR 0x01000000 /* enable extended attributes */
|
||||
#define MNT_LOG 0x02000000 /* Use logging */
|
||||
#define MNT_NOATIME 0x04000000 /* Never update access times in fs */
|
||||
#define MNT_SYMPERM 0x20000000 /* recognize symlink permission */
|
||||
@ -117,7 +117,8 @@ typedef struct fhandle fhandle_t;
|
||||
{ MNT_SYMPERM, 0, "symperm" }, \
|
||||
{ MNT_NODEVMTIME, 0, "nodevmtime" }, \
|
||||
{ MNT_SOFTDEP, 0, "soft dependencies" }, \
|
||||
{ MNT_LOG, 0, "log" },
|
||||
{ MNT_LOG, 0, "log" }, \
|
||||
{ MNT_EXTATTR, 0, "extattr" },
|
||||
|
||||
/*
|
||||
* exported mount flags.
|
||||
@ -178,7 +179,8 @@ typedef struct fhandle fhandle_t;
|
||||
MNT_LOCAL | \
|
||||
MNT_QUOTA | \
|
||||
MNT_ROOTFS | \
|
||||
MNT_LOG)
|
||||
MNT_LOG | \
|
||||
MNT_EXTATTR)
|
||||
|
||||
/*
|
||||
* External filesystem control flags.
|
||||
@ -227,7 +229,7 @@ typedef struct fhandle fhandle_t;
|
||||
"\34MNT_EXNORESPORT" \
|
||||
"\33MNT_NOATIME" \
|
||||
"\32MNT_LOG" \
|
||||
"\31MNT_UNUSED" \
|
||||
"\31MNT_EXTATTR" \
|
||||
"\30MNT_UNUSED" \
|
||||
"\27MNT_GETARGS" \
|
||||
"\26MNT_UNUSED" \
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: statvfs.h,v 1.15 2008/07/31 05:38:06 simonb Exp $ */
|
||||
/* $NetBSD: statvfs.h,v 1.16 2011/06/17 14:23:51 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
@ -119,6 +119,7 @@ struct statvfs {
|
||||
#define ST_NODEVMTIME MNT_NODEVMTIME
|
||||
#define ST_SOFTDEP MNT_SOFTDEP
|
||||
#define ST_LOG MNT_LOG
|
||||
#define ST_EXTATTR MNT_EXTATTR
|
||||
|
||||
#define ST_EXRDONLY MNT_EXRDONLY
|
||||
#define ST_EXPORTED MNT_EXPORTED
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_extern.h,v 1.77 2011/04/27 07:24:52 hannken Exp $ */
|
||||
/* $NetBSD: ffs_extern.h,v 1.78 2011/06/17 14:23:52 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -42,7 +42,8 @@
|
||||
#define FFS_REALLOCBLKS 3 /* block reallocation enabled */
|
||||
#define FFS_ASYNCFREE 4 /* asynchronous block freeing enabled */
|
||||
#define FFS_LOG_CHANGEOPT 5 /* log optimalization strategy change */
|
||||
#define FFS_MAXID 6 /* number of valid ffs ids */
|
||||
#define FFS_EXTATTR_AUTOCREATE 6 /* size for backing file autocreation */
|
||||
#define FFS_MAXID 7 /* number of valid ffs ids */
|
||||
|
||||
struct buf;
|
||||
struct fid;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.267 2011/06/12 03:36:00 rmind Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.268 2011/06/17 14:23:52 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.267 2011/06/12 03:36:00 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.268 2011/06/17 14:23:52 manu Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -180,6 +180,9 @@ ffs_modcmd(modcmd_t cmd, void *arg)
|
||||
|
||||
#if 0
|
||||
extern int doasyncfree;
|
||||
#endif
|
||||
#ifdef UFS_EXTATTR
|
||||
extern int ufs_extattr_autocreate;
|
||||
#endif
|
||||
extern int ffs_log_changeopt;
|
||||
|
||||
@ -200,7 +203,6 @@ ffs_modcmd(modcmd_t cmd, void *arg)
|
||||
SYSCTL_DESCR("Berkeley Fast File System"),
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_VFS, 1, CTL_EOL);
|
||||
|
||||
/*
|
||||
* @@@ should we even bother with these first three?
|
||||
*/
|
||||
@ -233,6 +235,17 @@ ffs_modcmd(modcmd_t cmd, void *arg)
|
||||
SYSCTL_DESCR("Log changes in optimization strategy"),
|
||||
NULL, 0, &ffs_log_changeopt, 0,
|
||||
CTL_VFS, 1, FFS_LOG_CHANGEOPT, CTL_EOL);
|
||||
#ifdef UFS_EXTATTR
|
||||
sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||
CTLTYPE_INT, "extattr_autocreate",
|
||||
SYSCTL_DESCR("Size of attribute for "
|
||||
"backing file autocreation"),
|
||||
NULL, 0, &ufs_extattr_autocreate, 0,
|
||||
CTL_VFS, 1, FFS_EXTATTR_AUTOCREATE, CTL_EOL);
|
||||
|
||||
#endif /* UFS_EXTATTR */
|
||||
|
||||
break;
|
||||
case MODULE_CMD_FINI:
|
||||
error = vfs_detach(&ffs_vfsops);
|
||||
@ -1255,24 +1268,16 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef UFS_EXTATTR
|
||||
/*
|
||||
* Initialize file-backed extended attributes on UFS1 file
|
||||
* systems.
|
||||
*/
|
||||
if (ump->um_fstype == UFS1) {
|
||||
ufs_extattr_uepm_init(&ump->um_extattr);
|
||||
#ifdef UFS_EXTATTR_AUTOSTART
|
||||
/*
|
||||
* XXX Just ignore errors. Not clear that we should
|
||||
* XXX fail the mount in this case.
|
||||
*/
|
||||
(void) ufs_extattr_autostart(mp, l);
|
||||
#endif
|
||||
}
|
||||
if (ump->um_fstype == UFS1)
|
||||
ufs_extattr_uepm_init(&ump->um_extattr);
|
||||
#endif /* UFS_EXTATTR */
|
||||
|
||||
return (0);
|
||||
out:
|
||||
#ifdef WAPBL
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extattr.h,v 1.8 2008/01/30 14:54:01 ad Exp $ */
|
||||
/* $NetBSD: extattr.h,v 1.9 2011/06/17 14:23:52 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2001 Robert N. M. Watson
|
||||
@ -54,8 +54,8 @@
|
||||
#define UFS_EXTATTR_UEPM_INITIALIZED 0x00000001
|
||||
#define UFS_EXTATTR_UEPM_STARTED 0x00000002
|
||||
|
||||
#define UFS_EXTATTR_CMD_START 0x00000001
|
||||
#define UFS_EXTATTR_CMD_STOP 0x00000002
|
||||
#define UFS_EXTATTR_CMD_START EXTATTR_CMD_START
|
||||
#define UFS_EXTATTR_CMD_STOP EXTATTR_CMD_STOP
|
||||
#define UFS_EXTATTR_CMD_ENABLE 0x00000003
|
||||
#define UFS_EXTATTR_CMD_DISABLE 0x00000004
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_extattr.c,v 1.31 2011/06/15 12:54:32 manu Exp $ */
|
||||
/* $NetBSD: ufs_extattr.c,v 1.32 2011/06/17 14:23:52 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2002 Robert N. M. Watson
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.31 2011/06/15 12:54:32 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.32 2011/06/17 14:23:52 manu Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ffs.h"
|
||||
@ -80,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.31 2011/06/15 12:54:32 manu Exp $"
|
||||
static MALLOC_JUSTDEFINE(M_UFS_EXTATTR, "ufs_extattr","ufs extended attribute");
|
||||
|
||||
int ufs_extattr_sync = 1;
|
||||
int ufs_extattr_autocreate = 1024;
|
||||
|
||||
static int ufs_extattr_valid_attrname(int attrnamespace,
|
||||
const char *attrname);
|
||||
@ -149,7 +150,6 @@ ufs_extattr_valid_attrname(int attrnamespace, const char *attrname)
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef UFS_EXTATTR_AUTOCREATE
|
||||
/*
|
||||
* Autocreate an attribute storage
|
||||
*/
|
||||
@ -236,7 +236,7 @@ ufs_extattr_autocreate_attr(struct vnode *vp, int attrnamespace,
|
||||
|
||||
uef.uef_magic = UFS_EXTATTR_MAGIC;
|
||||
uef.uef_version = UFS_EXTATTR_VERSION;
|
||||
uef.uef_size = UFS_EXTATTR_AUTOCREATE;
|
||||
uef.uef_size = ufs_extattr_autocreate;
|
||||
|
||||
error = vn_rdwr(UIO_WRITE, backing_vp, &uef, sizeof(uef), 0,
|
||||
UIO_SYSSPACE, IO_NODELOCKED|IO_APPEND,
|
||||
@ -283,7 +283,6 @@ ufs_extattr_autocreate_attr(struct vnode *vp, int attrnamespace,
|
||||
|
||||
return uele;
|
||||
}
|
||||
#endif /* UFS_EXTATTR_AUTOCREATE */
|
||||
|
||||
/*
|
||||
* Locate an attribute given a name and mountpoint.
|
||||
@ -380,7 +379,6 @@ ufs_extattr_start(struct mount *mp, struct lwp *l)
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef UFS_EXTATTR_AUTOSTART
|
||||
/*
|
||||
* Helper routine: given a locked parent directory and filename, return
|
||||
* the locked vnode of the inode associated with the name. Will not
|
||||
@ -442,7 +440,6 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, const char *dirname,
|
||||
*vp = target_vp;
|
||||
return (0);
|
||||
}
|
||||
#endif /* !UFS_EXTATTR_AUTOSTART */
|
||||
|
||||
/*
|
||||
* Enable an EA using the passed filesystem, backing vnode, attribute name,
|
||||
@ -479,7 +476,6 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef UFS_EXTATTR_AUTOSTART
|
||||
/*
|
||||
* Given a locked directory vnode, iterate over the names in the directory
|
||||
* and use ufs_extattr_lookup() to retrieve locked vnodes of potential
|
||||
@ -680,7 +676,6 @@ ufs_extattr_autostart(struct mount *mp, struct lwp *l)
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* !UFS_EXTATTR_AUTOSTART */
|
||||
|
||||
/*
|
||||
* Stop extended attribute support on an FS.
|
||||
@ -879,11 +874,7 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
|
||||
if (attrname != NULL)
|
||||
return (EINVAL);
|
||||
|
||||
#ifdef UFS_EXTATTR_AUTOSTART
|
||||
error = ufs_extattr_autostart(mp, l);
|
||||
#else
|
||||
error = ufs_extattr_start(mp, l);
|
||||
#endif
|
||||
return (error);
|
||||
|
||||
case UFS_EXTATTR_CMD_STOP:
|
||||
@ -1207,14 +1198,10 @@ ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
|
||||
|
||||
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
|
||||
if (!attribute) {
|
||||
#ifdef UFS_EXTATTR_AUTOCREATE
|
||||
attribute = ufs_extattr_autocreate_attr(vp, attrnamespace,
|
||||
name, l);
|
||||
if (!attribute)
|
||||
return (ENOATTR);
|
||||
#else /* UFS_EXTATTR_AUTOCREATE */
|
||||
return (ENOATTR);
|
||||
#endif /* UFS_EXTATTR_AUTOCREATE */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: extattrctl.8,v 1.3 2009/03/11 18:05:37 joerg Exp $
|
||||
.\" $NetBSD: extattrctl.8,v 1.4 2011/06/17 14:23:52 manu Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000-2001 Robert N. M. Watson
|
||||
.\" All rights reserved.
|
||||
@ -82,7 +82,17 @@ Start extended attribute support on the file system named using
|
||||
.Ar path .
|
||||
The file system must be a UFS1 file system, and the
|
||||
.Dv UFS_EXTATTR
|
||||
kernel option must have been enabled.
|
||||
kernel option must have been enabled. If
|
||||
.Pa .attribute/user
|
||||
and
|
||||
.Pa .attribute/system
|
||||
exist at the filesystem root, extended attribute backed by files
|
||||
in theses directories will be automatically enabled. Note that
|
||||
extended attributes can be automatically started at mount time
|
||||
by using the
|
||||
.Cm -o extattr
|
||||
option to
|
||||
.Xr mount 8 .
|
||||
.It Cm stop Ar path
|
||||
Stop extended attribute support on the file system named using
|
||||
.Ar path .
|
||||
@ -110,6 +120,17 @@ from denying attribute service.
|
||||
.Pp
|
||||
This file should not exist before running
|
||||
.Cm initattr .
|
||||
.Pp
|
||||
When a user attempt to set a
|
||||
.Dq user
|
||||
or
|
||||
.Dq system
|
||||
extended attribute that lacks a backing file,
|
||||
the kernel will attempt to automatically create it, provided
|
||||
.Pa .attribute/user
|
||||
or
|
||||
.Pa .attribute/system
|
||||
exist and are writtable by the requesting user.
|
||||
.It Cm showattr Ar attrfile
|
||||
Show the attribute header values in the attribute file named by
|
||||
.Ar attrfile .
|
||||
@ -146,25 +167,6 @@ The file system must have attributes started on it, and the attribute
|
||||
most have been enabled using
|
||||
.Cm enable .
|
||||
.El
|
||||
.Pp
|
||||
The kernel also includes support for automatic starting of extended
|
||||
attributes on a file system at mount time once configured with
|
||||
.Nm .
|
||||
If the kernel is built with the
|
||||
.Dv UFS_EXTATTR_AUTOSTART
|
||||
option, UFS will search for a
|
||||
.Pa .attribute
|
||||
sub-directory of the file system root during the mount operation.
|
||||
If found, extended attribute support will be started for the file system.
|
||||
UFS will then search for
|
||||
.Pa system
|
||||
and
|
||||
.Pa user
|
||||
sub-directories of the
|
||||
.Pa .attribute
|
||||
directory for any potential backing files and enable an extended attribute
|
||||
for each valid backing file with the backing file name as the attribute
|
||||
name.
|
||||
.Sh EXAMPLES
|
||||
.Dl extattrctl start /
|
||||
.Pp
|
||||
@ -201,7 +203,9 @@ Project, and introduced in
|
||||
and
|
||||
.Nx 4.0 .
|
||||
It was developed to support security extensions requiring additional
|
||||
labels to be associated with each file or directory.
|
||||
labels to be associated with each file or directory. Backing file
|
||||
autocreation was added in
|
||||
.Nx 6.0
|
||||
.Sh AUTHORS
|
||||
.An Robert N M Watson
|
||||
.Sh BUGS
|
||||
|
Loading…
Reference in New Issue
Block a user