Merge of xfs-cmds-2.4.18:slinx:111140a by nathans.

minor changes to xfstests as we transition to new EA/ACL interfaces.
This commit is contained in:
Nathan Scott
2002-02-25 22:12:17 +00:00
parent 04cbb967db
commit 958b881b08
14 changed files with 129 additions and 171 deletions
+15 -36
View File
@@ -67,50 +67,29 @@ _attr()
return $exit return $exit
} }
_getfattr()
{
getfattr $* 2>$tmp.err >$tmp.out
exit=$?
_filter $tmp.out
_filter $tmp.err 1>&2
return $exit
}
_attr_list() _attr_list()
{ {
file=$1 file=$1
echo " *** print attributes" echo " *** print attributes"
if ! _attr -l $file >$tmp.raw if ! _getfattr -ad $file >$tmp.raw
then then
echo " !!! error return" echo " !!! error return"
return 1 return 1
fi fi
$AWK_PROG -v file=$file '
{
print substr($2,2,length($2)-2)
count++
}
END {
exit count
}
' <$tmp.raw >$tmp.list
echo " *** $? attribute(s)"
for l in `cat $tmp.list`
do
if ! _attr -g $l $file >$tmp.raw
then
echo " *** $l"
echo " !!! error return"
return 1
fi
$AWK_PROG '
NR==1 {
print " *** field: " substr($2,2,length($2)-2) \
" length: " $5
next
}
{
print " ::: " $0
}
' <$tmp.raw
done
} }
[ -x /usr/bin/attr ] || _notrun "attr is not installed"
[ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
# real QA test starts here # real QA test starts here
@@ -161,8 +140,8 @@ done
echo "*** check" echo "*** check"
# don't print it all out... # don't print it all out...
attr -l $testfile \ getfattr $testfile \
| $AWK_PROG '{ l++ } END {print " *** " l " attribute(s)" }' | $AWK_PROG '{ l++ } END {print " *** " (l - 1) " attribute(s)" }'
echo "*** remove lots of attributes" echo "*** remove lots of attributes"
v=0 v=0
@@ -170,7 +149,7 @@ while [ $v -lt 1000 ]
do do
if ! attr -r "attribute_$v" $testfile >/dev/null if ! attr -r "attribute_$v" $testfile >/dev/null
then then
echo "!!! failed to add \"attribute_$v\"" echo "!!! failed to remove \"attribute_$v\""
exit 1 exit 1
fi fi
+11 -2
View File
@@ -71,6 +71,15 @@ _attr()
return $exit return $exit
} }
_getfattr()
{
getfattr $* 2>$tmp.err >$tmp.out
exit=$?
sed "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g; s#$tmp[^ :]*#<TMPFILE>#g;" $tmp.out
sed "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g; s#$tmp[^ :]*#<TMPFILE>#g;" $tmp.err 1>&2
return $exit
}
# real QA test starts here # real QA test starts here
_require_scratch _require_scratch
@@ -94,7 +103,7 @@ echo "*** make test file 1"
touch $testfile.1 touch $testfile.1
echo "v1" | _attr -s "a1" $testfile.1 >/dev/null echo "v1" | _attr -s "a1" $testfile.1 >/dev/null
echo "v2--" | _attr -s "a2--" $testfile.1 >/dev/null echo "v2--" | _attr -s "a2--" $testfile.1 >/dev/null
_attr -l $testfile.1 _getfattr -a $testfile.1
inum_1=`ls -li $testfile.1 | $AWK_PROG '{ print $1 }'` inum_1=`ls -li $testfile.1 | $AWK_PROG '{ print $1 }'`
echo "*** make test file 2" echo "*** make test file 2"
@@ -106,7 +115,7 @@ echo "value_2" | _attr -s "a2-----" $testfile.2 >/dev/null
(echo start ; dd if=/dev/zero bs=65525 count=1 ; echo end ) \ (echo start ; dd if=/dev/zero bs=65525 count=1 ; echo end ) \
| _attr -s "a3" $testfile.2 >/dev/null | _attr -s "a3" $testfile.2 >/dev/null
_attr -l $testfile.2 _getfattr -a $testfile.2
inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'` inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'`
echo "*** unmount FS" echo "*** unmount FS"
+1 -1
View File
@@ -86,7 +86,7 @@ rm -f $seq.full
_need_to_be_root _need_to_be_root
_acl_setup_ids _acl_setup_ids
[ -x /bin/chacl ] || _notrun "chacl command not found" [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
[ -x $runas ] || _notrun "$runas executable not found" [ -x $runas ] || _notrun "$runas executable not found"
# get dir # get dir
+2
View File
@@ -52,6 +52,8 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
. ./common.filter . ./common.filter
. ./common.attr . ./common.attr
[ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
# real QA test starts here # real QA test starts here
_require_scratch _require_scratch
_acl_setup_ids _acl_setup_ids
+1 -1
View File
@@ -103,7 +103,7 @@ rm -f $seq.full
_need_to_be_root _need_to_be_root
[ -x $acl_get ] || _notrun "$acl_get command not found" [ -x $acl_get ] || _notrun "$acl_get command not found"
[ -x /bin/chacl ] || _notrun "chacl command not found" [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
# get dir # get dir
cd $TEST_DIR cd $TEST_DIR
+34 -32
View File
@@ -59,6 +59,21 @@ _cleanup()
} }
trap "_cleanup; exit \$status" 0 1 2 3 15 trap "_cleanup; exit \$status" 0 1 2 3 15
_filter_scratch()
{
sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
}
getfattr()
{
/usr/bin/getfattr -adl $@ 2>&1 | _filter_scratch
}
setfattr()
{
/usr/bin/setfattr $@
}
_create_test_bed() _create_test_bed()
{ {
echo "*** create test bed" echo "*** create test bed"
@@ -70,24 +85,10 @@ _create_test_bed()
mknod $SCRATCH_MNT/dev/c c 0 0 mknod $SCRATCH_MNT/dev/c c 0 0
mknod $SCRATCH_MNT/dev/p p mknod $SCRATCH_MNT/dev/p p
# sanity check # sanity check
find $SCRATCH_MNT | LC_COLLATE=POSIX sort find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
}
getfattr()
{
/usr/bin/getfattr $@ | sed -e \
"s/$SCRATCH_MNT/SCRATCH_MNT/g"
}
setfattr()
{
/usr/bin/setfattr $@ | sed -e \
"s/$SCRATCH_MNT/SCRATCH_MNT/g"
} }
_require_scratch _require_scratch
[ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
[ -x /usr/bin/setfattr ] || _notrun "setfattr is not installed"
rm -f $tmp.backup1 $tmp.backup2 $seq.full rm -f $tmp.backup1 $tmp.backup2 $seq.full
# real QA test starts here # real QA test starts here
@@ -102,7 +103,7 @@ for nsp in user xfsroot; do
echo "*** set/get one initially empty attribute" echo "*** set/get one initially empty attribute"
setfattr -l -n $nsp.name $SCRATCH_MNT/$inode setfattr -l -n $nsp.name $SCRATCH_MNT/$inode
getfattr -al -d $SCRATCH_MNT/$inode getfattr -r $nsp $SCRATCH_MNT/$inode
echo "*** overwrite empty, set several new attributes" echo "*** overwrite empty, set several new attributes"
setfattr -l -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode setfattr -l -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +111,33 @@ for nsp in user xfsroot; do
setfattr -l -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode setfattr -l -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
echo "*** fetch several attribute names and values (hex)" echo "*** fetch several attribute names and values (hex)"
getfattr -al -d -e hex $SCRATCH_MNT/$inode getfattr -r $nsp -e hex $SCRATCH_MNT/$inode
echo "*** fetch several attribute names and values (base64)" echo "*** fetch several attribute names and values (base64)"
getfattr -al -d -e base64 $SCRATCH_MNT/$inode getfattr -r $nsp -e base64 $SCRATCH_MNT/$inode
echo "*** shrink value of an existing attribute" echo "*** shrink value of an existing attribute"
setfattr -l -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode setfattr -l -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
getfattr -al -d -e hex $SCRATCH_MNT/$inode getfattr -r $nsp -e hex $SCRATCH_MNT/$inode
echo "*** grow value of existing attribute" echo "*** grow value of existing attribute"
setfattr -l -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode setfattr -l -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
getfattr -al -d -e hex $SCRATCH_MNT/$inode getfattr -r $nsp -e hex $SCRATCH_MNT/$inode
echo "*** set an empty value for second attribute" echo "*** set an empty value for second attribute"
setfattr -l -n $nsp.name2 $SCRATCH_MNT/$inode setfattr -l -n $nsp.name2 $SCRATCH_MNT/$inode
getfattr -al -d -n $nsp.name2 $SCRATCH_MNT/$inode getfattr -r $nsp -n $nsp.name2 $SCRATCH_MNT/$inode
echo "*** overwrite empty value" echo "*** overwrite empty value"
setfattr -l -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode setfattr -l -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
getfattr -al -d -e hex -n $nsp.name2 $SCRATCH_MNT/$inode getfattr -r $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode
echo "*** remove attribute" echo "*** remove attribute"
setfattr -l -x $nsp.name2 $SCRATCH_MNT/$inode setfattr -l -x $nsp.name2 $SCRATCH_MNT/$inode
getfattr -al -d -n $nsp.name2 $SCRATCH_MNT/$inode getfattr -r $nsp -n $nsp.name2 $SCRATCH_MNT/$inode
echo "*** final list (strings, type=$inode, nsp=$nsp)" echo "*** final list (strings, type=$inode, nsp=$nsp)"
getfattr -als -d $SCRATCH_MNT/$inode getfattr -r '^user|^xfsroot' $SCRATCH_MNT/$inode
done done
done done
@@ -159,26 +160,26 @@ _extend_test_bed()
# whack a symlink in the middle, just to be difficult # whack a symlink in the middle, just to be difficult
ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
# dump out our new starting point # dump out our new starting point
find $SCRATCH_MNT | LC_COLLATE=POSIX sort find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
} }
_extend_test_bed _extend_test_bed
echo echo
echo "*** forward directory descent with us following symlinks" echo "*** forward directory descent with us following symlinks"
getfattr -L -R -adls -e hex $SCRATCH_MNT getfattr -L -R -r '^user|^xfsroot' -e hex $SCRATCH_MNT
echo echo
echo "*** reverse directory descent with us following symlinks" echo "*** reverse directory descent with us following symlinks"
getfattr -L -R -5 -adls -e hex $SCRATCH_MNT getfattr -L -R -5 -r '^user|^xfsroot' -e hex $SCRATCH_MNT
echo echo
echo "*** forward directory descent without following symlinks" echo "*** forward directory descent without following symlinks"
getfattr -P -R -adls -e hex $SCRATCH_MNT getfattr -P -R -r '^user|^xfsroot' -e hex $SCRATCH_MNT
echo echo
echo "*** reverse directory descent without following symlinks" echo "*** reverse directory descent without following symlinks"
getfattr -P -R -5 -adls -e hex $SCRATCH_MNT getfattr -P -R -5 -r '^user|^xfsroot' -e hex $SCRATCH_MNT
# #
@@ -188,7 +189,8 @@ echo; echo
_backup() _backup()
{ {
getfattr -a -sdlR $SCRATCH_MNT >$1 # NB: no filtering of scratch here... (need to restore too)
/usr/bin/getfattr -adl -sR $SCRATCH_MNT >$1
echo BACKUP $1 >>$seq.full echo BACKUP $1 >>$seq.full
cat $1 >> $seq.full cat $1 >> $seq.full
[ ! -s $1 ] && echo "warning: $1 (backup file) is empty" [ ! -s $1 ] && echo "warning: $1 (backup file) is empty"
@@ -200,7 +202,7 @@ _backup $tmp.backup1
echo "*** clear out the scratch device" echo "*** clear out the scratch device"
rm -fr $SCRATCH_MNT/* rm -fr $SCRATCH_MNT/*
echo "AFTER REMOVE" >>$seq.full echo "AFTER REMOVE" >>$seq.full
getfattr -L -R -adls $SCRATCH_MNT >>$seq.full getfattr -L -R -r '^user|^xfsroot' $SCRATCH_MNT >>$seq.full
echo "*** reset test bed with no extended attributes" echo "*** reset test bed with no extended attributes"
_create_test_bed _create_test_bed
@@ -211,7 +213,7 @@ setfattr -lB $tmp.backup1
_backup $tmp.backup2 _backup $tmp.backup2
echo "AFTER RESTORE" >>$seq.full echo "AFTER RESTORE" >>$seq.full
getfattr -L -R -adls $SCRATCH_MNT >>$seq.full getfattr -L -R -r '^user|^xfsroot' $SCRATCH_MNT >>$seq.full
echo "*** compare before and after backups" echo "*** compare before and after backups"
diff $tmp.backup1 $tmp.backup2 diff $tmp.backup1 $tmp.backup2
+10 -3
View File
@@ -1146,9 +1146,16 @@ _get_eas_on_path()
{ {
_path=$1 _path=$1
find $_path -exec attr -l {} \; |\ # Tim - this is the IRIX way...
awk '{print $9, $2}' |\ # find $_path -exec attr -l {} \; |\
sed 's/["]//g' |\ # awk '{print $9, $2}' |\
# sed 's/["]//g' |\
# sort |\
# and this is now the Linux way...
getfattr -Rla $_path |\
perl -wn -e '
if (m/^# file: (\S+)/) { $file = $1 }
elsif (m/^user\.(\w+)/) { print $file, " ",$1,"\n" }' |\
sort |\ sort |\
while read file ea_name; do while read file ea_name; do
attr -g $ea_name $file attr -g $ea_name $file
+15 -8
View File
@@ -152,14 +152,14 @@ AC_SUBST(libxfs)
AC_SUBST(libhdl) AC_SUBST(libhdl)
dnl Checks for Extended Attributes header and library. dnl Checks for Extended Attributes header and library.
AC_CHECK_HEADER(attr/attributes.h,, [ AC_CHECK_HEADER(attr/xattr.h,, [
echo echo
echo 'FATAL ERROR: could not find a valid Extended Attributes header.' echo 'FATAL ERROR: could not find a valid Extended Attributes header.'
echo 'Install either the attr-devel (rpm) or the attr-dev (deb) package.' echo 'Install either the attr-devel (rpm) or the attr-dev (deb) package.'
echo 'Alternatively, run "make install-dev" from the attr source.' echo 'Alternatively, run "make install-dev" from the attr source.'
exit 1 exit 1
]) ])
AC_CHECK_LIB(attr, attr_get,, [ AC_CHECK_LIB(attr, getxattr,, [
echo echo
echo 'FATAL ERROR: could not find a valid Extended Attributes library.' echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
echo 'Install either the attr-devel (rpm) or the attr-dev (deb) package.' echo 'Install either the attr-devel (rpm) or the attr-dev (deb) package.'
@@ -169,19 +169,26 @@ AC_CHECK_LIB(attr, attr_get,, [
libattr="-lattr" libattr="-lattr"
AC_SUBST(libattr) AC_SUBST(libattr)
dnl Checks for Access Control List header and library. dnl Checks for Access Control List headers and library.
AC_CHECK_HEADER(sys/acl.h,, [ AC_CHECK_HEADER(sys/acl.h,, [
echo echo
echo 'FATAL ERROR: could not find a valid Access Control List header.' echo 'FATAL ERROR: could not find a valid Access Control List headers.'
echo 'Install either the acl-devel (rpm) or the acl-dev (deb) package.' echo 'Install either the acl-devel (rpm) or the acl (deb) package.'
echo 'Alternatively, run "make install-dev" from the acl source.' echo 'Alternatively, run "make install" from the acl source.'
exit 1
])
AC_CHECK_HEADER(acl/libacl.h,, [
echo
echo 'FATAL ERROR: could not find a valid Access Control List headers.'
echo 'Install either the acl-devel (rpm) or the acl (deb) package.'
echo 'Alternatively, run "make install" from the acl source.'
exit 1 exit 1
]) ])
AC_CHECK_LIB(acl, acl_init,, [ AC_CHECK_LIB(acl, acl_init,, [
echo echo
echo 'FATAL ERROR: could not find a valid Access Control List library.' echo 'FATAL ERROR: could not find a valid Access Control List library.'
echo 'Install either the acl-devel (rpm) or the acl-dev (deb) package.' echo 'Install either the acl-devel (rpm) or the acl (deb) package.'
echo 'Alternatively, run "make install-dev" from the acl source.' echo 'Alternatively, run "make install" from the acl source.'
exit 1 exit 1
]) ])
libacl="-lacl" libacl="-lacl"
+2 -6
View File
@@ -33,7 +33,7 @@
TOPDIR = .. TOPDIR = ..
include $(TOPDIR)/include/builddefs include $(TOPDIR)/include/builddefs
TARGETS = alloc acl_get acl_test bstat devzero dirstress fault feature \ TARGETS = alloc acl_get bstat devzero dirstress fault feature \
fsstress fill fill2 holes ioctl loggen lstat64 nametest permname \ fsstress fill fill2 holes ioctl loggen lstat64 nametest permname \
randholes runas truncfile usemem randholes runas truncfile usemem
ifeq ($(HAVE_DB), true) ifeq ($(HAVE_DB), true)
@@ -80,10 +80,6 @@ LOGGEN_OBJECTS = loggen.o $(LIBXFS)
loggen: $(HFILES) $(LOGGEN_OBJECTS) loggen: $(HFILES) $(LOGGEN_OBJECTS)
$(CCF) -o $@ $(LDFLAGS) $(LOGGEN_OBJECTS) $(LDLIBS) $(CCF) -o $@ $(LDFLAGS) $(LOGGEN_OBJECTS) $(LDLIBS)
ACLGET_OBJECTS = acl_get.o $(LIBACL) ACLGET_OBJECTS = acl_get.o $(LIBACL) $(LIBATTR)
acl_get: $(HFILES) $(ACLGET_OBJECTS) acl_get: $(HFILES) $(ACLGET_OBJECTS)
$(CCF) -o $@ $(LDFLAGS) $(ACLGET_OBJECTS) $(LDLIBS) $(CCF) -o $@ $(LDFLAGS) $(ACLGET_OBJECTS) $(LDLIBS)
ACLTEST_OBJECTS = acl_test.o $(LIBACL)
acl_test: $(HFILES) $(ACLTEST_OBJECTS)
$(CCF) -o $@ $(LDFLAGS) $(ACLTEST_OBJECTS) $(LDLIBS)
+6 -42
View File
@@ -44,6 +44,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/acl.h> #include <sys/acl.h>
#include <acl/libacl.h>
char *prog; char *prog;
@@ -54,7 +55,6 @@ void usage(void)
" -a - get access ACL\n" " -a - get access ACL\n"
" -d - get default ACL\n" " -d - get default ACL\n"
" -f - get access ACL using file descriptor\n" " -f - get access ACL using file descriptor\n"
" -i - use irix semantics\n"
,prog); ,prog);
} }
@@ -68,15 +68,13 @@ main(int argc, char **argv)
char *file; char *file;
int getaccess = 0; int getaccess = 0;
int getdefault = 0; int getdefault = 0;
int irixsemantics = 0;
int usefd = 0; int usefd = 0;
int fd = -1; int fd = -1;
acl_t acl; acl_t acl;
char *buf_acl;
prog = basename(argv[0]); prog = basename(argv[0]);
while ((c = getopt(argc, argv, "adif")) != -1) { while ((c = getopt(argc, argv, "adf")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
getaccess = 1; getaccess = 1;
@@ -84,9 +82,6 @@ main(int argc, char **argv)
case 'd': case 'd':
getdefault = 1; getdefault = 1;
break; break;
case 'i':
irixsemantics = 1;
break;
case 'f': case 'f':
usefd = 1; usefd = 1;
break; break;
@@ -110,10 +105,6 @@ main(int argc, char **argv)
file = argv[optind]; file = argv[optind];
} }
if (irixsemantics) {
acl_set_compat(ACL_COMPAT_IRIXGET);
}
if (usefd) { if (usefd) {
fd = open(file, O_RDONLY); fd = open(file, O_RDONLY);
if (fd < 0) { if (fd < 0) {
@@ -137,21 +128,9 @@ main(int argc, char **argv)
prog, file, strerror(errno)); prog, file, strerror(errno));
return 0; return 0;
} }
if (irixsemantics && acl->acl_cnt == ACL_NOT_PRESENT) { printf("%s: access ", file);
buf_acl = strdup("irix-empty"); acl_print(stdout, acl, NULL, TEXT_ABBREVIATE||TEXT_NO_ENDOFLINE);
}
else {
buf_acl = acl_to_short_text (acl, (ssize_t *) NULL);
if (buf_acl == NULL) {
fprintf (stderr, "%s: error converting ACL to short text "
"for file \"%s\": %s\n",
prog, file, strerror(errno));
return 0;
}
}
printf("%s: access %s\n", file, buf_acl);
acl_free(acl); acl_free(acl);
acl_free(buf_acl);
} }
if (getdefault) { if (getdefault) {
@@ -161,24 +140,9 @@ main(int argc, char **argv)
prog, file, strerror(errno)); prog, file, strerror(errno));
return 0; return 0;
} }
if (irixsemantics && acl->acl_cnt == ACL_NOT_PRESENT) { printf("%s: default ", file);
buf_acl = strdup("irix-empty"); acl_print(stdout, acl, NULL, TEXT_ABBREVIATE||TEXT_NO_ENDOFLINE);
}
else if (!irixsemantics && acl->acl_cnt == 0) {
buf_acl = strdup("linux-empty");
}
else {
buf_acl = acl_to_short_text (acl, (ssize_t *) NULL);
if (buf_acl == NULL) {
fprintf (stderr, "%s: error converting ACL to short text "
"for file \"%s\": %s\n",
prog, file, strerror(errno));
return 0;
}
}
printf("%s: default %s\n", file, buf_acl);
acl_free(acl); acl_free(acl);
acl_free(buf_acl);
} }
return 0; return 0;
+28 -36
View File
@@ -31,6 +31,7 @@
*/ */
#include "global.h" #include "global.h"
#include <attr/xattr.h>
#define XFS_ERRTAG_MAX 17 #define XFS_ERRTAG_MAX 17
@@ -206,8 +207,7 @@ int verbose = 0;
void add_to_flist(int, int, int); void add_to_flist(int, int, int);
void append_pathname(pathname_t *, char *); void append_pathname(pathname_t *, char *);
int attr_list_path(pathname_t *, char *, const int, int, int attr_list_path(pathname_t *, char *, const int, int);
attrlist_cursor_t *);
int attr_remove_path(pathname_t *, const char *, int); int attr_remove_path(pathname_t *, const char *, int);
int attr_set_path(pathname_t *, const char *, const char *, const int, int); int attr_set_path(pathname_t *, const char *, const char *, const int, int);
void check_cwd(void); void check_cwd(void);
@@ -454,20 +454,22 @@ append_pathname(pathname_t *name, char *str)
} }
int int
attr_list_path(pathname_t *name, char *buffer, const int buffersize, int flags, attr_list_path(pathname_t *name, char *buffer, const int buffersize, int flags)
attrlist_cursor_t *cursor)
{ {
char buf[MAXNAMELEN]; char buf[MAXNAMELEN];
pathname_t newname; pathname_t newname;
int rval; int rval;
rval = attr_list(name->path, buffer, buffersize, flags, cursor); if (flags != ATTR_DONTFOLLOW) {
errno = EINVAL;
return -1;
}
rval = llistxattr(name->path, buffer, buffersize);
if (rval >= 0 || errno != ENAMETOOLONG) if (rval >= 0 || errno != ENAMETOOLONG)
return rval; return rval;
separate_pathname(name, buf, &newname); separate_pathname(name, buf, &newname);
if (chdir(buf) == 0) { if (chdir(buf) == 0) {
rval = attr_list_path(&newname, buffer, buffersize, flags, rval = attr_list_path(&newname, buffer, buffersize, flags);
cursor);
chdir(".."); chdir("..");
} }
free_pathname(&newname); free_pathname(&newname);
@@ -1349,11 +1351,8 @@ allocsp_f(int opno, long r)
void void
attr_remove_f(int opno, long r) attr_remove_f(int opno, long r)
{ {
attrlist_ent_t *aep; char *aname, *l;
attrlist_t *alist;
char *aname;
char buf[4096]; char buf[4096];
attrlist_cursor_t cursor;
int e; int e;
int ent; int ent;
pathname_t f; pathname_t f;
@@ -1365,16 +1364,13 @@ attr_remove_f(int opno, long r)
if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
append_pathname(&f, "."); append_pathname(&f, ".");
total = 0; total = 0;
bzero(&cursor, sizeof(cursor)); e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW);
do { check_cwd();
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, if (e > 0) {
&cursor); for (l = buf; l - buf <= e; l += strlen(l)+1)
check_cwd(); if (strncmp(l, "user.",5) == 0)
if (e) total++;
break; }
alist = (attrlist_t *)buf;
total += alist->al_count;
} while (alist->al_more);
if (total == 0) { if (total == 0) {
if (v) if (v)
printf("%d/%d: attr_remove - no attrs for %s\n", printf("%d/%d: attr_remove - no attrs for %s\n",
@@ -1383,24 +1379,20 @@ attr_remove_f(int opno, long r)
return; return;
} }
which = (int)(random() % total); which = (int)(random() % total);
bzero(&cursor, sizeof(cursor));
ent = 0; ent = 0;
aname = NULL; aname = NULL;
do { e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW);
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, check_cwd();
&cursor); if (e <= 0)
check_cwd(); return;
if (e) for (l = buf; l - buf <= e; l += strlen(l)+1) {
break; if (strncmp(l, "user.",5) == 0) {
alist = (attrlist_t *)buf; if (++ent == which) {
if (which < ent + alist->al_count) { aname = l;
aep = (attrlist_ent_t *) break;
&buf[alist->al_offset[which - ent]]; }
aname = aep->a_name;
break;
} }
ent += alist->al_count; }
} while (alist->al_more);
if (aname == NULL) { if (aname == NULL) {
if (v) if (v)
printf( printf(
+2
View File
@@ -15,6 +15,8 @@ ______________________ ______________
so it can update itself) so it can update itself)
- copy an appropriate .config file to - copy an appropriate .config file to
$HOME/qa/$HOSTNAME.config $HOME/qa/$HOSTNAME.config
- You'll need to maunally install the "quota" and "acl"
userspace tools, rest will be installed automatically.
- You'll need a hacked version of 'su' in $HOME/qa that - You'll need a hacked version of 'su' in $HOME/qa that
lets your user su to root/root without a password lets your user su to root/root without a password
(if you want to run from cron, it mustn't require (if you want to run from cron, it mustn't require
+2 -2
View File
@@ -333,7 +333,7 @@ do
*clean) *clean)
# we need to configure or else we might fail to clean # we need to configure or else we might fail to clean
for pkg in attr acl xfsprogs dmapi xfsdump xfstests for pkg in attr xfsprogs dmapi xfsdump xfstests
do do
cd $WORKAREA/cmd/$pkg cd $WORKAREA/cmd/$pkg
_log " *** clean $pkg tools" _log " *** clean $pkg tools"
@@ -386,7 +386,7 @@ do
|| _fail " !!! build modules failed" || _fail " !!! build modules failed"
_log " *** build and install tools" _log " *** build and install tools"
for pkg in attr acl xfsprogs dmapi xfsdump xfstests for pkg in attr xfsprogs dmapi xfsdump xfstests
do do
cd $WORKAREA/cmd/$pkg cd $WORKAREA/cmd/$pkg
-2
View File
@@ -78,8 +78,6 @@ foreach (@difflist) {
} }
straightdiff 'xfs_cred.h', 'cmd/xfsprogs/include', 'linux/fs/xfs/linux'; straightdiff 'xfs_cred.h', 'cmd/xfsprogs/include', 'linux/fs/xfs/linux';
straightdiff 'xfs_fs.h', 'cmd/xfsprogs/include', 'linux/include/linux'; straightdiff 'xfs_fs.h', 'cmd/xfsprogs/include', 'linux/include/linux';
straightdiff 'attr_kern.h', 'cmd/attr/include', 'linux/fs/xfs/linux';
straightdiff 'attributes.h', 'cmd/attr/include', 'linux/include/linux';
straightdiff 'dmapi_kern.h', 'cmd/dmapi/include', 'linux/include/linux'; straightdiff 'dmapi_kern.h', 'cmd/dmapi/include', 'linux/include/linux';
straightdiff 'dmapi.h', 'cmd/dmapi/include', 'linux/include/linux'; straightdiff 'dmapi.h', 'cmd/dmapi/include', 'linux/include/linux';
straightdiff 'arch.h', 'cmd/xfsprogs/include', 'linux/include/linux/xfs_support'; straightdiff 'arch.h', 'cmd/xfsprogs/include', 'linux/include/linux/xfs_support';