PERFORCE change 31286 for review
Robert Watson
rwatson at FreeBSD.org
Fri May 16 03:14:38 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=31286
Change 31286 by rwatson at rwatson_tislabs on 2003/05/15 20:13:54
Remove code to implement UFS1 extended attribute configuration
listing; we'll have it in the Perforce history should we need
it later, but we're no longer supporting UFS1 configurations
for MAC, making it less useful. This greatly reduces diffs
between the FreeBSD head and MAC tree.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/fs/nullfs/null_vfsops.c#10 edit
.. //depot/projects/trustedbsd/mac/sys/fs/umapfs/umap_vfsops.c#11 edit
.. //depot/projects/trustedbsd/mac/sys/kern/syscalls.master#49 edit
.. //depot/projects/trustedbsd/mac/sys/kern/vfs_default.c#21 edit
.. //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#103 edit
.. //depot/projects/trustedbsd/mac/sys/sys/extattr.h#8 edit
.. //depot/projects/trustedbsd/mac/sys/sys/mount.h#26 edit
.. //depot/projects/trustedbsd/mac/sys/ufs/ffs/ffs_vfsops.c#35 edit
.. //depot/projects/trustedbsd/mac/sys/ufs/ufs/extattr.h#5 edit
.. //depot/projects/trustedbsd/mac/sys/ufs/ufs/ufs_extattr.c#27 edit
.. //depot/projects/trustedbsd/mac/usr.sbin/extattrctl/extattrctl.8#7 edit
.. //depot/projects/trustedbsd/mac/usr.sbin/extattrctl/extattrctl.c#12 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/fs/nullfs/null_vfsops.c#10 (text+ko) ====
@@ -79,7 +79,7 @@
static int nullfs_extattrctl(struct mount *mp, int cmd,
struct vnode *filename_vp,
int namespace, const char *attrname,
- void *extended, struct thread *td);
+ struct thread *td);
/*
* Mount null layer
@@ -395,17 +395,16 @@
}
static int
-nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, extended, td)
+nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td)
struct mount *mp;
int cmd;
struct vnode *filename_vp;
int namespace;
const char *attrname;
- void *extended;
struct thread *td;
{
return VFS_EXTATTRCTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, filename_vp,
- namespace, attrname, extended, td);
+ namespace, attrname, td);
}
==== //depot/projects/trustedbsd/mac/sys/fs/umapfs/umap_vfsops.c#11 (text+ko) ====
@@ -77,7 +77,7 @@
static int umapfs_extattrctl(struct mount *mp, int cmd,
struct vnode *filename_vp,
int namespace, const char *attrname,
- void *extended, struct thread *td);
+ struct thread *td);
/*
* Mount umap layer
@@ -423,18 +423,17 @@
}
static int
-umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, extended, td)
+umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td)
struct mount *mp;
int cmd;
struct vnode *filename_vp;
int namespace;
const char *attrname;
- void *extended;
struct thread *td;
{
return (VFS_EXTATTRCTL(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, cmd,
- filename_vp, namespace, attrname, extended, td));
+ filename_vp, namespace, attrname, td));
}
static struct vfsops umap_vfsops = {
==== //depot/projects/trustedbsd/mac/sys/kern/syscalls.master#49 (text+ko) ====
@@ -515,7 +515,7 @@
struct acl *aclp); }
355 STD BSD { int extattrctl(const char *path, int cmd, \
const char *filename, int attrnamespace, \
- const char *attrname, void *extended); }
+ const char *attrname); }
356 STD BSD { int extattr_set_file(const char *path, \
int attrnamespace, const char *attrname, \
void *data, size_t nbytes); }
==== //depot/projects/trustedbsd/mac/sys/kern/vfs_default.c#21 (text+ko) ====
@@ -983,13 +983,12 @@
}
int
-vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, extended, td)
+vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, td)
struct mount *mp;
int cmd;
struct vnode *filename_vp;
int attrnamespace;
const char *attrname;
- void *extended;
struct thread *td;
{
if (filename_vp != NULL)
==== //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#103 (text+ko) ====
@@ -3821,7 +3821,6 @@
const char *filename;
int attrnamespace;
const char *attrname;
- void *extended;
} */ *uap;
{
struct vnode *filename_vp;
@@ -3874,7 +3873,7 @@
}
error = VFS_EXTATTRCTL(mp, uap->cmd, filename_vp, uap->attrnamespace,
- uap->attrname != NULL ? attrname : NULL, uap->extended, td);
+ uap->attrname != NULL ? attrname : NULL, td);
vn_finished_write(mp_writable);
/*
==== //depot/projects/trustedbsd/mac/sys/sys/extattr.h#8 (text+ko) ====
@@ -56,7 +56,7 @@
__BEGIN_DECLS
int extattrctl(const char *_path, int _cmd, const char *_filename,
- int _attrnamespace, const char *_attrname, void *_extended);
+ int _attrnamespace, const char *_attrname);
int extattr_delete_fd(int _fd, int _attrnamespace, const char *_attrname);
int extattr_delete_file(const char *_path, int _attrnamespace,
const char *_attrname);
==== //depot/projects/trustedbsd/mac/sys/sys/mount.h#26 (text+ko) ====
@@ -393,7 +393,7 @@
typedef int vfs_uninit_t(struct vfsconf *);
typedef int vfs_extattrctl_t(struct mount *mp, int cmd,
struct vnode *filename_vp, int attrnamespace,
- const char *attrname, void *extended, struct thread *td);
+ const char *attrname, struct thread *td);
typedef int vfs_nmount_t(struct mount *mp, struct nameidata *ndp,
struct thread *td);
@@ -432,8 +432,8 @@
#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
-#define VFS_EXTATTRCTL(MP, C, FN, NS, N, P, E) \
- (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N, P, E)
+#define VFS_EXTATTRCTL(MP, C, FN, NS, N, P) \
+ (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N, P)
#include <sys/module.h>
==== //depot/projects/trustedbsd/mac/sys/ufs/ffs/ffs_vfsops.c#35 (text+ko) ====
@@ -1524,16 +1524,15 @@
static int
ffs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
- int attrnamespace, const char *attrname, void *extended,
- struct thread *td)
+ int attrnamespace, const char *attrname, struct thread *td)
{
#ifdef UFS_EXTATTR
return (ufs_extattrctl(mp, cmd, filename_vp, attrnamespace,
- attrname, extended, td));
+ attrname, td));
#else
return (vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace,
- attrname, extended, td));
+ attrname, td));
#endif
}
==== //depot/projects/trustedbsd/mac/sys/ufs/ufs/extattr.h#5 (text+ko) ====
@@ -55,17 +55,7 @@
#define UFS_EXTATTR_CMD_STOP 0x00000002
#define UFS_EXTATTR_CMD_ENABLE 0x00000003
#define UFS_EXTATTR_CMD_DISABLE 0x00000004
-#define UFS_EXTATTR_CMD_ENUM 0x00000005
-struct ufs_extattr_enum_cmd {
- struct ufs_extattr_desc {
- u_int ued_size;
- int ued_attrnamespace;
- char ued_attrname[UFS_EXTATTR_MAXEXTATTRNAME];
- } *ueec_buf; /* pointer to user buffer of descs */
- size_t ueec_len; /* size of ueec_buf */
-};
-
struct ufs_extattr_fileheader {
u_int uef_magic; /* magic number for sanity checking */
u_int uef_version; /* version of attribute file */
@@ -110,8 +100,7 @@
int ufs_extattr_autostart(struct mount *mp, struct thread *td);
int ufs_extattr_stop(struct mount *mp, struct thread *td);
int ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename,
- int attrnamespace, const char *attrname, void *extended,
- struct thread *td);
+ int attrnamespace, const char *attrname, struct thread *td);
int ufs_getextattr(struct vop_getextattr_args *ap);
int ufs_setextattr(struct vop_setextattr_args *ap);
void ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td);
==== //depot/projects/trustedbsd/mac/sys/ufs/ufs/ufs_extattr.c#27 (text+ko) ====
@@ -699,91 +699,27 @@
*/
int
ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
- int attrnamespace, const char *attrname, void *extended, struct thread *td)
+ int attrnamespace, const char *attrname, struct thread *td)
{
struct ufsmount *ump = VFSTOUFS(mp);
- struct ufs_extattr_enum_cmd enumcmd;
- struct ufs_extattr_list_entry *uele;
int error;
/*
* Processes with privilege, but in jail, are not allowed to
* configure extended attributes.
*/
- switch(cmd) {
- case UFS_EXTATTR_CMD_ENUM:
+ if ((error = suser(td))) {
if (filename_vp != NULL)
VOP_UNLOCK(filename_vp, 0, td);
- error = copyin(extended, &enumcmd, sizeof(enumcmd));
- if (error)
- return (error);
- if (attrnamespace == 0 ||
- attrnamespace == EXTATTR_NAMESPACE_SYSTEM) {
- error = suser_cred(td->td_ucred, 0);
- if (error)
- return (error);
- }
- ufs_extattr_uepm_lock(ump, td);
- if (enumcmd.ueec_len == 0) {
- LIST_FOREACH(uele, &ump->um_extattr.uepm_list,
- uele_entries) {
- if ((attrnamespace != 0 &&
- attrnamespace != uele->uele_attrnamespace)
- || (attrname != NULL &&
- strcmp(attrname, uele->uele_attrname) != 0))
- continue;
- enumcmd.ueec_len +=
- sizeof(struct ufs_extattr_desc);
- }
- error = copyout(&enumcmd, extended, sizeof(enumcmd));
- } else {
- struct ufs_extattr_desc *descp;
- size_t totsize = 0;
-
- descp = enumcmd.ueec_buf;
- LIST_FOREACH(uele, &ump->um_extattr.uepm_list,
- uele_entries) {
- if ((attrnamespace != 0 &&
- attrnamespace != uele->uele_attrnamespace)
- || (attrname != NULL &&
- strcmp(attrname, uele->uele_attrname) != 0))
- continue;
- if (totsize + sizeof(struct ufs_extattr_desc) >
- enumcmd.ueec_len) {
- error = ENOMEM;
- break;
- }
- if (copyout(&uele->uele_fileheader.uef_size,
- &descp->ued_size,
- sizeof(descp->ued_size)) != 0 ||
- copyout(&uele->uele_attrnamespace,
- &descp->ued_attrnamespace,
- sizeof(descp->ued_attrnamespace)) != 0 ||
- copyout(&uele->uele_attrname,
- &descp->ued_attrname,
- sizeof(descp->ued_attrname)) != 0) {
- error = EFAULT;
- break;
- }
- descp++;
- totsize += sizeof(struct ufs_extattr_desc);
- }
- if (error == 0) {
- enumcmd.ueec_len = totsize;
- error = copyout(&enumcmd, extended,
- sizeof(enumcmd));
- }
- }
- ufs_extattr_uepm_unlock(ump, td);
return (error);
+ }
+ switch(cmd) {
case UFS_EXTATTR_CMD_START:
if (filename_vp != NULL) {
VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
- if ((error = suser_cred(td->td_ucred, 0)))
- return (error);
if (attrname != NULL)
return (EINVAL);
@@ -796,8 +732,6 @@
VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
- if ((error = suser_cred(td->td_ucred, 0)))
- return (error);
if (attrname != NULL)
return (EINVAL);
@@ -813,8 +747,6 @@
VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
- if ((error = suser_cred(td->td_ucred, 0)))
- return (error);
/*
* ufs_extattr_enable_with_open() will always unlock the
@@ -824,7 +756,6 @@
error = ufs_extattr_enable_with_open(ump, filename_vp,
attrnamespace, attrname, td);
ufs_extattr_uepm_unlock(ump, td);
- VOP_UNLOCK(filename_vp, 0, td);
return (error);
@@ -834,8 +765,6 @@
VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
- if ((error = suser_cred(td->td_ucred, 0)))
- return (error);
if (attrname == NULL)
return (EINVAL);
==== //depot/projects/trustedbsd/mac/usr.sbin/extattrctl/extattrctl.8#7 (text+ko) ====
@@ -44,9 +44,6 @@
.Cm stop
.Ar path
.Nm
-.Cm lsattr
-.Ar path
-.Nm
.Cm initattr
.Op Fl f
.Op Fl p Ar path
@@ -72,8 +69,8 @@
utility
is the management utility for extended attributes over the UFS1 file system.
It allows the starting and stopping of extended attributes on a file system,
-as well as initialization of attribute backing files, and enabling,
-querying, and disabling of specific extended attributes on a file system.
+as well as initialization of attribute backing files, and enabling and
+disabling of specific extended attributes on a file system.
.Pp
The first argument on the command line indicates the operation to be
performed.
@@ -88,10 +85,6 @@
Stop extended attribute support on the file system named using
.Ar path .
Extended attribute support must previously have been started.
-.It Cm lsattr Ar path
-List extended attributes currently supported and enabled on the file system
-named by
-.Ar path .
.It Xo
.Cm initattr
.Op Fl f
==== //depot/projects/trustedbsd/mac/usr.sbin/extattrctl/extattrctl.c#12 (text+ko) ====
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1999-2001 Robert N. M. Watson
+ * Copyright (c) 1999-2002 Robert N. M. Watson
* All rights reserved.
*
* This software was developed by Robert Watson for the TrustedBSD Project.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/usr.sbin/extattrctl/extattrctl.c,v 1.17 2001/12/31 18:21:24 rwatson Exp $
+ * $FreeBSD: src/usr.sbin/extattrctl/extattrctl.c,v 1.19 2002/04/19 01:42:55 rwatson Exp $
*/
/*
* Developed by the TrustedBSD Project.
@@ -61,7 +61,6 @@
"usage:\n"
" extattrctl start path\n"
" extattrctl stop path\n"
- " extattrctl lsattr [-n name] [-s namespace] path\n"
" extattrctl initattr [-f] [-p path] attrsize attrfile\n"
" extattrctl showattr attrfile\n"
" extattrctl enable path attrnamespace attrname attrfile\n"
@@ -223,7 +222,7 @@
if (argc != 3)
usage();
error = extattrctl(argv[2], UFS_EXTATTR_CMD_START, NULL, 0,
- NULL, NULL);
+ NULL);
if (error) {
perror("extattrctl start");
return (-1);
@@ -232,69 +231,11 @@
if (argc != 3)
usage();
error = extattrctl(argv[2], UFS_EXTATTR_CMD_STOP, NULL, 0,
- NULL, NULL);
+ NULL);
if (error) {
perror("extattrctl stop");
return (-1);
}
- } else if (!strcmp(argv[1], "lsattr")) {
- struct ufs_extattr_enum_cmd enumcmd;
- struct ufs_extattr_desc *ued;
- char *name = NULL, *ns;
- int namespace = 0;
- int c;
-
- optind = 2;
- while ((c = getopt(argc, argv, "n:s:")) != -1) {
- switch (c) {
- case 'n':
- name = optarg;
- break;
- case 's':
- if (extattr_string_to_namespace(optarg,
- &namespace))
- usage();
- break;
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
- if (argc != 1)
- usage();
- enumcmd.ueec_buf = NULL;
- enumcmd.ueec_len = 0;
- error = extattrctl(argv[0], UFS_EXTATTR_CMD_ENUM, NULL,
- namespace, name, &enumcmd);
- if (error) {
- perror("extattrctl lsattr");
- return (-1);
- }
- ued = malloc(enumcmd.ueec_len);
- if (ued == NULL) {
- perror("extattrctl lsattr");
- return (-1);
- }
- enumcmd.ueec_buf = ued;
- error = extattrctl(argv[0], UFS_EXTATTR_CMD_ENUM, NULL,
- namespace, name, &enumcmd);
- if (error) {
- perror("extattrctl lsattr");
- return (-1);
- }
- while ((char *)ued <
- (char *)enumcmd.ueec_buf + enumcmd.ueec_len) {
- if (extattr_namespace_to_string(ued->ued_attrnamespace,
- &ns) == -1) {
- perror("extattrctl lsattr");
- return (-1);
- }
- (void)printf("attrname: %s, namespace: %s, size: %u\n",
- ued->ued_attrname, ns, ued->ued_size);
- free(ns);
- ued++;
- }
} else if (!strcmp(argv[1], "enable")) {
if (argc != 6)
usage();
@@ -304,7 +245,7 @@
return (-1);
}
error = extattrctl(argv[2], UFS_EXTATTR_CMD_ENABLE, argv[5],
- attrnamespace, argv[4], NULL);
+ attrnamespace, argv[4]);
if (error) {
perror("extattrctl enable");
return (-1);
@@ -318,7 +259,7 @@
return (-1);
}
error = extattrctl(argv[2], UFS_EXTATTR_CMD_DISABLE, NULL,
- attrnamespace, argv[4], NULL);
+ attrnamespace, argv[4]);
if (error) {
perror("extattrctl disable");
return (-1);
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list