mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
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:
@@ -67,50 +67,29 @@ _attr()
|
||||
return $exit
|
||||
}
|
||||
|
||||
_getfattr()
|
||||
{
|
||||
getfattr $* 2>$tmp.err >$tmp.out
|
||||
exit=$?
|
||||
_filter $tmp.out
|
||||
_filter $tmp.err 1>&2
|
||||
return $exit
|
||||
}
|
||||
|
||||
_attr_list()
|
||||
{
|
||||
file=$1
|
||||
|
||||
echo " *** print attributes"
|
||||
if ! _attr -l $file >$tmp.raw
|
||||
if ! _getfattr -ad $file >$tmp.raw
|
||||
then
|
||||
echo " !!! error return"
|
||||
return 1
|
||||
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
|
||||
|
||||
@@ -161,8 +140,8 @@ done
|
||||
|
||||
echo "*** check"
|
||||
# don't print it all out...
|
||||
attr -l $testfile \
|
||||
| $AWK_PROG '{ l++ } END {print " *** " l " attribute(s)" }'
|
||||
getfattr $testfile \
|
||||
| $AWK_PROG '{ l++ } END {print " *** " (l - 1) " attribute(s)" }'
|
||||
|
||||
echo "*** remove lots of attributes"
|
||||
v=0
|
||||
@@ -170,7 +149,7 @@ while [ $v -lt 1000 ]
|
||||
do
|
||||
if ! attr -r "attribute_$v" $testfile >/dev/null
|
||||
then
|
||||
echo "!!! failed to add \"attribute_$v\""
|
||||
echo "!!! failed to remove \"attribute_$v\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -71,6 +71,15 @@ _attr()
|
||||
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
|
||||
|
||||
_require_scratch
|
||||
@@ -94,7 +103,7 @@ echo "*** make test file 1"
|
||||
touch $testfile.1
|
||||
echo "v1" | _attr -s "a1" $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 }'`
|
||||
|
||||
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 ) \
|
||||
| _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 }'`
|
||||
|
||||
echo "*** unmount FS"
|
||||
|
||||
@@ -86,7 +86,7 @@ rm -f $seq.full
|
||||
_need_to_be_root
|
||||
_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"
|
||||
|
||||
# get dir
|
||||
|
||||
@@ -52,6 +52,8 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
. ./common.filter
|
||||
. ./common.attr
|
||||
|
||||
[ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
|
||||
|
||||
# real QA test starts here
|
||||
_require_scratch
|
||||
_acl_setup_ids
|
||||
|
||||
@@ -103,7 +103,7 @@ rm -f $seq.full
|
||||
_need_to_be_root
|
||||
|
||||
[ -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
|
||||
cd $TEST_DIR
|
||||
|
||||
@@ -59,6 +59,21 @@ _cleanup()
|
||||
}
|
||||
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()
|
||||
{
|
||||
echo "*** create test bed"
|
||||
@@ -70,24 +85,10 @@ _create_test_bed()
|
||||
mknod $SCRATCH_MNT/dev/c c 0 0
|
||||
mknod $SCRATCH_MNT/dev/p p
|
||||
# sanity check
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort
|
||||
}
|
||||
|
||||
getfattr()
|
||||
{
|
||||
/usr/bin/getfattr $@ | sed -e \
|
||||
"s/$SCRATCH_MNT/SCRATCH_MNT/g"
|
||||
}
|
||||
|
||||
setfattr()
|
||||
{
|
||||
/usr/bin/setfattr $@ | sed -e \
|
||||
"s/$SCRATCH_MNT/SCRATCH_MNT/g"
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_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
|
||||
|
||||
# real QA test starts here
|
||||
@@ -102,7 +103,7 @@ for nsp in user xfsroot; do
|
||||
|
||||
echo "*** set/get one initially empty attribute"
|
||||
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"
|
||||
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
|
||||
|
||||
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)"
|
||||
getfattr -al -d -e base64 $SCRATCH_MNT/$inode
|
||||
getfattr -r $nsp -e base64 $SCRATCH_MNT/$inode
|
||||
|
||||
echo "*** shrink value of an existing attribute"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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)"
|
||||
getfattr -als -d $SCRATCH_MNT/$inode
|
||||
getfattr -r '^user|^xfsroot' $SCRATCH_MNT/$inode
|
||||
done
|
||||
done
|
||||
|
||||
@@ -159,26 +160,26 @@ _extend_test_bed()
|
||||
# whack a symlink in the middle, just to be difficult
|
||||
ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
|
||||
# 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
|
||||
|
||||
echo
|
||||
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 "*** 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 "*** 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 "*** 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()
|
||||
{
|
||||
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
|
||||
cat $1 >> $seq.full
|
||||
[ ! -s $1 ] && echo "warning: $1 (backup file) is empty"
|
||||
@@ -200,7 +202,7 @@ _backup $tmp.backup1
|
||||
echo "*** clear out the scratch device"
|
||||
rm -fr $SCRATCH_MNT/*
|
||||
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"
|
||||
_create_test_bed
|
||||
@@ -211,7 +213,7 @@ setfattr -lB $tmp.backup1
|
||||
_backup $tmp.backup2
|
||||
|
||||
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"
|
||||
diff $tmp.backup1 $tmp.backup2
|
||||
|
||||
+10
-3
@@ -1146,9 +1146,16 @@ _get_eas_on_path()
|
||||
{
|
||||
_path=$1
|
||||
|
||||
find $_path -exec attr -l {} \; |\
|
||||
awk '{print $9, $2}' |\
|
||||
sed 's/["]//g' |\
|
||||
# Tim - this is the IRIX way...
|
||||
# find $_path -exec attr -l {} \; |\
|
||||
# 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 |\
|
||||
while read file ea_name; do
|
||||
attr -g $ea_name $file
|
||||
|
||||
+15
-8
@@ -152,14 +152,14 @@ AC_SUBST(libxfs)
|
||||
AC_SUBST(libhdl)
|
||||
|
||||
dnl Checks for Extended Attributes header and library.
|
||||
AC_CHECK_HEADER(attr/attributes.h,, [
|
||||
AC_CHECK_HEADER(attr/xattr.h,, [
|
||||
echo
|
||||
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 'Alternatively, run "make install-dev" from the attr source.'
|
||||
exit 1
|
||||
])
|
||||
AC_CHECK_LIB(attr, attr_get,, [
|
||||
AC_CHECK_LIB(attr, getxattr,, [
|
||||
echo
|
||||
echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
|
||||
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"
|
||||
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,, [
|
||||
echo
|
||||
echo 'FATAL ERROR: could not find a valid Access Control List header.'
|
||||
echo 'Install either the acl-devel (rpm) or the acl-dev (deb) package.'
|
||||
echo 'Alternatively, run "make install-dev" from the acl source.'
|
||||
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
|
||||
])
|
||||
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
|
||||
])
|
||||
AC_CHECK_LIB(acl, acl_init,, [
|
||||
echo
|
||||
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 'Alternatively, run "make install-dev" from the acl source.'
|
||||
echo 'Install either the acl-devel (rpm) or the acl (deb) package.'
|
||||
echo 'Alternatively, run "make install" from the acl source.'
|
||||
exit 1
|
||||
])
|
||||
libacl="-lacl"
|
||||
|
||||
+2
-6
@@ -33,7 +33,7 @@
|
||||
TOPDIR = ..
|
||||
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 \
|
||||
randholes runas truncfile usemem
|
||||
ifeq ($(HAVE_DB), true)
|
||||
@@ -80,10 +80,6 @@ LOGGEN_OBJECTS = loggen.o $(LIBXFS)
|
||||
loggen: $(HFILES) $(LOGGEN_OBJECTS)
|
||||
$(CCF) -o $@ $(LDFLAGS) $(LOGGEN_OBJECTS) $(LDLIBS)
|
||||
|
||||
ACLGET_OBJECTS = acl_get.o $(LIBACL)
|
||||
ACLGET_OBJECTS = acl_get.o $(LIBACL) $(LIBATTR)
|
||||
acl_get: $(HFILES) $(ACLGET_OBJECTS)
|
||||
$(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
@@ -44,6 +44,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/acl.h>
|
||||
#include <acl/libacl.h>
|
||||
|
||||
char *prog;
|
||||
|
||||
@@ -54,7 +55,6 @@ void usage(void)
|
||||
" -a - get access ACL\n"
|
||||
" -d - get default ACL\n"
|
||||
" -f - get access ACL using file descriptor\n"
|
||||
" -i - use irix semantics\n"
|
||||
,prog);
|
||||
|
||||
}
|
||||
@@ -68,15 +68,13 @@ main(int argc, char **argv)
|
||||
char *file;
|
||||
int getaccess = 0;
|
||||
int getdefault = 0;
|
||||
int irixsemantics = 0;
|
||||
int usefd = 0;
|
||||
int fd = -1;
|
||||
acl_t acl;
|
||||
char *buf_acl;
|
||||
|
||||
prog = basename(argv[0]);
|
||||
|
||||
while ((c = getopt(argc, argv, "adif")) != -1) {
|
||||
while ((c = getopt(argc, argv, "adf")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
getaccess = 1;
|
||||
@@ -84,9 +82,6 @@ main(int argc, char **argv)
|
||||
case 'd':
|
||||
getdefault = 1;
|
||||
break;
|
||||
case 'i':
|
||||
irixsemantics = 1;
|
||||
break;
|
||||
case 'f':
|
||||
usefd = 1;
|
||||
break;
|
||||
@@ -110,10 +105,6 @@ main(int argc, char **argv)
|
||||
file = argv[optind];
|
||||
}
|
||||
|
||||
if (irixsemantics) {
|
||||
acl_set_compat(ACL_COMPAT_IRIXGET);
|
||||
}
|
||||
|
||||
if (usefd) {
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
@@ -137,21 +128,9 @@ main(int argc, char **argv)
|
||||
prog, file, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
if (irixsemantics && acl->acl_cnt == ACL_NOT_PRESENT) {
|
||||
buf_acl = strdup("irix-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: access %s\n", file, buf_acl);
|
||||
printf("%s: access ", file);
|
||||
acl_print(stdout, acl, NULL, TEXT_ABBREVIATE||TEXT_NO_ENDOFLINE);
|
||||
acl_free(acl);
|
||||
acl_free(buf_acl);
|
||||
}
|
||||
|
||||
if (getdefault) {
|
||||
@@ -161,24 +140,9 @@ main(int argc, char **argv)
|
||||
prog, file, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
if (irixsemantics && acl->acl_cnt == ACL_NOT_PRESENT) {
|
||||
buf_acl = strdup("irix-empty");
|
||||
}
|
||||
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);
|
||||
printf("%s: default ", file);
|
||||
acl_print(stdout, acl, NULL, TEXT_ABBREVIATE||TEXT_NO_ENDOFLINE);
|
||||
acl_free(acl);
|
||||
acl_free(buf_acl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+25
-33
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include <attr/xattr.h>
|
||||
|
||||
#define XFS_ERRTAG_MAX 17
|
||||
|
||||
@@ -206,8 +207,7 @@ int verbose = 0;
|
||||
|
||||
void add_to_flist(int, int, int);
|
||||
void append_pathname(pathname_t *, char *);
|
||||
int attr_list_path(pathname_t *, char *, const int, int,
|
||||
attrlist_cursor_t *);
|
||||
int attr_list_path(pathname_t *, char *, const int, int);
|
||||
int attr_remove_path(pathname_t *, const char *, int);
|
||||
int attr_set_path(pathname_t *, const char *, const char *, const int, int);
|
||||
void check_cwd(void);
|
||||
@@ -454,20 +454,22 @@ append_pathname(pathname_t *name, char *str)
|
||||
}
|
||||
|
||||
int
|
||||
attr_list_path(pathname_t *name, char *buffer, const int buffersize, int flags,
|
||||
attrlist_cursor_t *cursor)
|
||||
attr_list_path(pathname_t *name, char *buffer, const int buffersize, int flags)
|
||||
{
|
||||
char buf[MAXNAMELEN];
|
||||
pathname_t newname;
|
||||
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)
|
||||
return rval;
|
||||
separate_pathname(name, buf, &newname);
|
||||
if (chdir(buf) == 0) {
|
||||
rval = attr_list_path(&newname, buffer, buffersize, flags,
|
||||
cursor);
|
||||
rval = attr_list_path(&newname, buffer, buffersize, flags);
|
||||
chdir("..");
|
||||
}
|
||||
free_pathname(&newname);
|
||||
@@ -1349,11 +1351,8 @@ allocsp_f(int opno, long r)
|
||||
void
|
||||
attr_remove_f(int opno, long r)
|
||||
{
|
||||
attrlist_ent_t *aep;
|
||||
attrlist_t *alist;
|
||||
char *aname;
|
||||
char *aname, *l;
|
||||
char buf[4096];
|
||||
attrlist_cursor_t cursor;
|
||||
int e;
|
||||
int ent;
|
||||
pathname_t f;
|
||||
@@ -1365,16 +1364,13 @@ attr_remove_f(int opno, long r)
|
||||
if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
|
||||
append_pathname(&f, ".");
|
||||
total = 0;
|
||||
bzero(&cursor, sizeof(cursor));
|
||||
do {
|
||||
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW,
|
||||
&cursor);
|
||||
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW);
|
||||
check_cwd();
|
||||
if (e)
|
||||
break;
|
||||
alist = (attrlist_t *)buf;
|
||||
total += alist->al_count;
|
||||
} while (alist->al_more);
|
||||
if (e > 0) {
|
||||
for (l = buf; l - buf <= e; l += strlen(l)+1)
|
||||
if (strncmp(l, "user.",5) == 0)
|
||||
total++;
|
||||
}
|
||||
if (total == 0) {
|
||||
if (v)
|
||||
printf("%d/%d: attr_remove - no attrs for %s\n",
|
||||
@@ -1383,24 +1379,20 @@ attr_remove_f(int opno, long r)
|
||||
return;
|
||||
}
|
||||
which = (int)(random() % total);
|
||||
bzero(&cursor, sizeof(cursor));
|
||||
ent = 0;
|
||||
aname = NULL;
|
||||
do {
|
||||
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW,
|
||||
&cursor);
|
||||
e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW);
|
||||
check_cwd();
|
||||
if (e)
|
||||
break;
|
||||
alist = (attrlist_t *)buf;
|
||||
if (which < ent + alist->al_count) {
|
||||
aep = (attrlist_ent_t *)
|
||||
&buf[alist->al_offset[which - ent]];
|
||||
aname = aep->a_name;
|
||||
if (e <= 0)
|
||||
return;
|
||||
for (l = buf; l - buf <= e; l += strlen(l)+1) {
|
||||
if (strncmp(l, "user.",5) == 0) {
|
||||
if (++ent == which) {
|
||||
aname = l;
|
||||
break;
|
||||
}
|
||||
ent += alist->al_count;
|
||||
} while (alist->al_more);
|
||||
}
|
||||
}
|
||||
if (aname == NULL) {
|
||||
if (v)
|
||||
printf(
|
||||
|
||||
@@ -15,6 +15,8 @@ ______________________ ______________
|
||||
so it can update itself)
|
||||
- copy an appropriate .config file to
|
||||
$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
|
||||
lets your user su to root/root without a password
|
||||
(if you want to run from cron, it mustn't require
|
||||
|
||||
+2
-2
@@ -333,7 +333,7 @@ do
|
||||
|
||||
*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
|
||||
cd $WORKAREA/cmd/$pkg
|
||||
_log " *** clean $pkg tools"
|
||||
@@ -386,7 +386,7 @@ do
|
||||
|| _fail " !!! build modules failed"
|
||||
|
||||
_log " *** build and install tools"
|
||||
for pkg in attr acl xfsprogs dmapi xfsdump xfstests
|
||||
for pkg in attr xfsprogs dmapi xfsdump xfstests
|
||||
do
|
||||
cd $WORKAREA/cmd/$pkg
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ foreach (@difflist) {
|
||||
}
|
||||
straightdiff 'xfs_cred.h', 'cmd/xfsprogs/include', 'linux/fs/xfs/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.h', 'cmd/dmapi/include', 'linux/include/linux';
|
||||
straightdiff 'arch.h', 'cmd/xfsprogs/include', 'linux/include/linux/xfs_support';
|
||||
|
||||
Reference in New Issue
Block a user