o Add a 'showattr' function the extattrctl, allowing a backing file to
be inspected to show the maximum attribute size and file.
This commit is contained in:
parent
9c4d63da6d
commit
566726db95
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88740
@ -50,6 +50,9 @@
|
|||||||
.Ar attrsize
|
.Ar attrsize
|
||||||
.Ar attrfile
|
.Ar attrfile
|
||||||
.Nm
|
.Nm
|
||||||
|
.Cm showattr
|
||||||
|
.Ar attrfile
|
||||||
|
.Nm
|
||||||
.Cm enable
|
.Cm enable
|
||||||
.Ar path
|
.Ar path
|
||||||
.Ar attrnamespace
|
.Ar attrnamespace
|
||||||
@ -109,6 +112,9 @@ from denying attribute service.
|
|||||||
.Pp
|
.Pp
|
||||||
This file should not exist before running
|
This file should not exist before running
|
||||||
.Cm initattr .
|
.Cm initattr .
|
||||||
|
.It Cm showattr Ar attrfile
|
||||||
|
Show the attribute header values in the attribute file named by
|
||||||
|
.Ar attrfile .
|
||||||
.It Cm enable Ar path attrnamespace attrname attrfile
|
.It Cm enable Ar path attrnamespace attrname attrfile
|
||||||
Enable an attribute named
|
Enable an attribute named
|
||||||
.Ar attrname
|
.Ar attrname
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int initattr(int argc, char *argv[]);
|
int initattr(int argc, char *argv[]);
|
||||||
|
int showattr(int argc, char *argv[]);
|
||||||
long num_inodes_by_path(char *path);
|
long num_inodes_by_path(char *path);
|
||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ usage()
|
|||||||
" extattrctl start [path]\n"
|
" extattrctl start [path]\n"
|
||||||
" extattrctl stop [path]\n"
|
" extattrctl stop [path]\n"
|
||||||
" extattrctl initattr [-f] [-p path] [attrsize] [attrfile]\n"
|
" extattrctl initattr [-f] [-p path] [attrsize] [attrfile]\n"
|
||||||
|
" extattrctl showattr [attrfile]\n"
|
||||||
" extattrctl enable [path] [attrnamespace] [attrname] [attrfile]\n"
|
" extattrctl enable [path] [attrnamespace] [attrname] [attrfile]\n"
|
||||||
" extattrctl disable [path] [attrnamespace] [attrname]\n");
|
" extattrctl disable [path] [attrnamespace] [attrname]\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@ -160,6 +162,42 @@ initattr(int argc, char *argv[])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
showattr(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct ufs_extattr_fileheader uef;
|
||||||
|
int i, fd;
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
fd = open(argv[0], O_RDONLY);
|
||||||
|
if (fd == -1) {
|
||||||
|
perror(argv[0]);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = read(fd, &uef, sizeof(uef));
|
||||||
|
if (i == -1) {
|
||||||
|
perror(argv[0]);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (i != sizeof(uef)) {
|
||||||
|
fprintf(stderr, "%s: invalid file header\n", argv[0]);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uef.uef_magic != UFS_EXTATTR_MAGIC) {
|
||||||
|
fprintf(stderr, "%s: bad magic\n", argv[0]);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s: version %d, size %d\n", argv[0], uef.uef_version,
|
||||||
|
uef.uef_size);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -220,6 +258,12 @@ main(int argc, char *argv[])
|
|||||||
error = initattr(argc, argv);
|
error = initattr(argc, argv);
|
||||||
if (error)
|
if (error)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
} else if (!strcmp(argv[1], "showattr")) {
|
||||||
|
argc -= 2;
|
||||||
|
argv += 2;
|
||||||
|
error = showattr(argc, argv);
|
||||||
|
if (error)
|
||||||
|
return (-1);
|
||||||
} else
|
} else
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user