cleanup some odf-specific code. 1st code review done.
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 13 Oct 2007 19:57:46 +0000 (15:57 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 13 Oct 2007 19:57:46 +0000 (15:57 -0400)
default.conf
progs/Makefile
progs/make_sb.c
run-tests
scaffold
t-chmod.sh [changed mode: 0755->0644]
t-create.sh
t-flock.sh
t-lookup.sh

index 90e6f250d5ca2dbc3700ce5f7b3d6d0c6913be41..ccbfd37761834d915c4f98c9bcc65dc05a2a4373 100644 (file)
@@ -38,7 +38,7 @@ BROKEN_TESTS="
 TESTS2RUN=${MYTESTS:-$ALL_TESTS}
 
 # Running On-Disk Format (ODF) ? 1=yes, 0=no
-ODF=1
+ODF=0
 
 # name of four devices to use
 DEV0=/dev/loop0
index 298866bed18cca429fe7c9acfe8ce852beae78ba..3fad4b75d5a5848622395d30055a0bc4a4a9dca0 100644 (file)
@@ -16,7 +16,7 @@
 #
 # This Copyright notice must be kept intact and distributed with all sources.
 
-CFLAGS=-g -Wall -Werror -L /usr/lib/ -luuid# -lefence
+CFLAGS=-g -Wall -Werror -luuid
 MOUNTPOINT=.
 BINS=open-unlink flock-copyup fsync truncate bug418 rmdircheckinode \
        creat-open rename mapper queryfile make_sb
index 304b8ea771a1f547babb13975d50a7c0d4ab37ea..b4ddf8e258def3ac948867b2e2fd25378353d6d2 100644 (file)
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2007-2007 Erez Zadok
+ * Copyright (c) 2007-2007 Rachita Kothiyal
+ * Copyright (c) 2007-2007 Stony Brook University
+ * Copyright (c) 2007-2007 The Research Foundation of SUNY
+ *
+ * For specific licensing information, see the COPYING file distributed with
+ * this package.
+ *
+ * This Copyright notice must be kept intact and distributed with all sources.
+ */
+
+/* create the /odf/sb state file */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -14,8 +28,8 @@ int main(int argc, char *argv[])
        int fd;
        unsigned int version = 2;
        unsigned int no_branches = atoi(argv[1]);
-       unsigned int bid[MAX_NO_BRANCHES]; 
-       unsigned int pathlength[MAX_NO_BRANCHES]; 
+       unsigned int bid[MAX_NO_BRANCHES];
+       unsigned int pathlength[MAX_NO_BRANCHES];
        char path[MAX_NO_BRANCHES][100];
        unsigned int permission[MAX_NO_BRANCHES];
        unsigned char uuid[MAX_NO_BRANCHES*UUID_LEN];
@@ -30,7 +44,6 @@ int main(int argc, char *argv[])
                bid[i] = i;
        }
 
-               
        fd = open("/n/odf/sb", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
        bytes = write(fd, (char *)&version, 4);
        bytes = write(fd, (char *)&no_branches, 4);
@@ -40,7 +53,7 @@ int main(int argc, char *argv[])
                bytes = write(fd, (char *)&pathlength[i], 4);
                bytes = write(fd, path[i], pathlength[i]);
                bytes = write(fd, (char *)&permission[i], 4);
-               uuid_generate_random(uuid + i*UUID_LEN);        
+               uuid_generate_random(uuid + i*UUID_LEN);
                bytes = write(fd, uuid + i*UUID_LEN, UUID_LEN);
        }
 
index c9fbdfa0baf275d7e7ae3f5f797671654b3eb0e2..1e9773649276df2850cbb9c4b955951429edd8e8 100755 (executable)
--- a/run-tests
+++ b/run-tests
@@ -161,15 +161,15 @@ function setup_lower
     done
 }
 
-
 function do_umount
 {
     branch=$1
     dev=$2
     fs=$3
 
+    # first, unmount main branch
     runcmd umount /n/lower/b$branch
-    
+
     case "$fs" in
        nfs* )
            runcmd exportfs -u localhost:/n/export/b$branch
@@ -253,7 +253,7 @@ do
   fi
 
   # test if file systems are supported by this kernel, and skip if not
-  test_fs $MYFS $FS0 $FS1 $FS2 $FS3 $FS4 $SPECIAL_FS
+  test_fs $MYFS $FS0 $FS1 $FS2 $FS3 $ODF_FS $SPECIAL_FS
 
   delay=$DELAY
   echo "Sleeping for "$delay" seconds between each command."
@@ -261,7 +261,8 @@ do
 
   # Export the type of file systems, as some tests need to know.
   # For example: jffs2, cramfs, and squashfs.
-  export FS0 FS1 FS2 FS3 ODF_FS DEV0 DEV1 DEV2 DEV3 ODF_DEV ODF_DIR SPECIAL_FS delay OUTPUT_COLOR ODF POPULATE_ODF
+  export FS0 FS1 FS2 FS3 DEV0 DEV1 DEV2 DEV3 SPECIAL_FS delay OUTPUT_COLOR
+  export ODF ODF_FS ODF_DEV ODF_DIR POPULATE_ODF
 
   # run actual test and abort on error (test script tries to umount unionfs)
   runcmd bash $t
@@ -275,7 +276,7 @@ do
   runcmd sync
 
   # try to unmount lower file systems (check if we leak anything)
-  for i in 0 1 2 3 ; do 
+  for i in 0 1 2 3 ; do
       do_umount $i $(eval echo \$DEV$i) $(eval echo \$FS$i)
   done
   # unload unionfs module (check if we leak anything)
index 6538373f113b83c31ac5cc34042e8294cc4f2f0a..a003c705839a1367a81dc389ba10e9c703780d87 100644 (file)
--- a/scaffold
+++ b/scaffold
@@ -7,7 +7,6 @@ echo -n "$0: "
 
 TOP_LOWER_DIR=/n/lower
 
-
 test -z "$MOUNTPOINT" && MOUNTPOINT=/mnt/unionfs
 test -z "$LOWER_DIR0" && LOWER_DIR0=$TOP_LOWER_DIR/b0
 test -z "$LOWER_DIR1" && LOWER_DIR1=$TOP_LOWER_DIR/b1
@@ -61,7 +60,7 @@ function create_hierarchy {
                if [ "$TYPE" = "w" ]; then
                        WH_LOC=`echo $LINE | cut -d' ' -f 2`
                        NAME=`echo $LINE | cut -d' ' -f 3`
-               else    
+               else
                        NAME=`echo $LINE | cut -d' ' -f 2`
                fi
 
@@ -121,7 +120,7 @@ function create_hierarchy {
                        else
                                if [ $POPULATE_ODF -eq 1 ]; then
                                        touch $NAME || exit $?
-                               else    
+                               else
                                        echo $NAME > $NAME || exit $?
                                fi
                        fi
@@ -146,7 +145,6 @@ function create_hierarchy {
                 if [ ! -z "$IMMUTABLE" ] ; then
                        chattr +i $NAME || exit $?
                fi
-
         done
 }
 
@@ -199,7 +197,14 @@ function uncramit {
 }
 
 function check_hierarchy {
-        ( find $1 -type d -printf 'd %p\n' ; find $1 -type f -links 1 -printf 'f %p\n' ; find $1 -type f -links +1 -printf 'w %p\n'; find $1 -type b -printf 'b %p\n' ; find $1 -type c -printf 'c %p\n' ; find $1 -type l -printf 'l %p\n') | sort > /tmp/check-$$
+        (
+           find $1 -type d -printf 'd %p\n'
+           find $1 -type f -links 1 -printf 'f %p\n'
+           find $1 -type f -links +1 -printf 'w %p\n'
+           find $1 -type b -printf 'b %p\n'
+           find $1 -type c -printf 'c %p\n'
+           find $1 -type l -printf 'l %p\n'
+       ) | sort > /tmp/check-$$
 
         grep -v '^$' | sort | diff -u - /tmp/check-$$
         ERR=$?
@@ -207,11 +212,10 @@ function check_hierarchy {
         return $ERR
 }
 
-function setup_odf 
-{
+function setup_odf {
        runcmd dd if=/dev/zero of=/tmp/fs.odf bs=1024k count=1 seek=100 2> /dev/null
        runcmd losetup $ODF_DEV /tmp/fs.odf
-       
+
        runcmd mkfs -t $ODF_FS -q $ODF_DEV
        if [ ! -d $ODF_DIR ]; then
                runcmd mkdir -p $ODF_DIR
@@ -221,11 +225,11 @@ function setup_odf
 }
 
 function fill_odf {
-mkdir $ODF_DIR/ic      
-mkdir $ODF_DIR/ns
-mkdir $ODF_DIR/reclaim
-mkdir $ODF_DIR/sr
-touch $ODF_DIR/whiteout
+       mkdir $ODF_DIR/ic
+       mkdir $ODF_DIR/ns
+       mkdir $ODF_DIR/reclaim
+       mkdir $ODF_DIR/sr
+       touch $ODF_DIR/whiteout
 }
 
 function mount_union {
@@ -245,7 +249,7 @@ function mount_union {
         else
                if [ -z "$2" ] ; then
                        OPTION="$1"
-               else    
+               else
                        OPTION="$1,dirs="
                fi
         fi
@@ -262,12 +266,13 @@ function mount_union {
                done
 
         mount -t unionfs -o $OPTION none $MOUNTPOINT
+
        MOUNTS=$((MOUNTS + 1))
 
         return $?
 }
 
-function discard_odf 
+function discard_odf
 {
        runcmd umount $ODF_DIR
        runcmd losetup -d $ODF_DEV
@@ -278,9 +283,8 @@ function discard_odf
 }
 
 function unmount_union {
-
        umount $MOUNTPOINT
-       
+
        # support compressed ram/rom file systems
        if test -n "$CRAMFS_BRANCHES" ; then
            uncramit
old mode 100755 (executable)
new mode 100644 (file)
index 40b9d12..aea8d7e
@@ -69,7 +69,7 @@ if [ $ODF -eq 1 ]; then
 else
        mount_union "" $LOWER_DIR0 $LOWER_DIR1
 fi
-       
+
 do_chmod $MOUNTPOINT/a
 do_chmod $MOUNTPOINT/b
 do_chmod $MOUNTPOINT/c
@@ -78,6 +78,7 @@ do_chmod $MOUNTPOINT/e
 do_chmod $MOUNTPOINT/f
 
 unmount_union
+
 ( beforefiles )  | check_hierarchy $TOP_LOWER_DIR
 echo -n "[rw] "
 
index c3b8b507e72e20ee6dda7d650c1b837d7ed99f06..45e5bcdb7a8da7fa52c1269e4976218d7d8ed1f8 100644 (file)
@@ -26,7 +26,7 @@ d $LOWER_DIR0/d6
 d $LOWER_DIR1
 d $LOWER_DIR1/d5
 d $LOWER_DIR1/d1
-f $LOWER_DIR1/d1/x
+d $LOWER_DIR1/d1/x
 d $LOWER_DIR1/d1/d2
 d $LOWER_DIR1/d1/d2/d3
 d $LOWER_DIR2
@@ -224,7 +224,7 @@ function BUG383 {
 
 
 #function fill_odf {
-#      mkdir $ODF_DIR/ic       
+#      mkdir $ODF_DIR/ic
 #      mkdir $ODF_DIR/ns
 #      mkdir $ODF_DIR/reclaim
 #      mkdir $ODF_DIR/sr
index 53a1bfdf42d382e411c5591b229f6745fa1b4636..7a62d68cea9aad49a7c92c1acaf9aabfa8ec98ce 100755 (executable)
@@ -36,6 +36,7 @@ f $LOWER_DIR1/a
 FILES
 }
 
+
 if [ $ODF -eq 1 ]; then
        POPULATE_ODF=0
 fi
index f70ec8077dfeb90bdacabbd0260ac8aa43bf4536..8ae1b3099833f16b5411be98abcf86c414df0520 100755 (executable)
@@ -72,7 +72,6 @@ if [ $ODF -eq 1 ]; then
        discard_odf
 else
        ( files ; beforefiles ) | check_hierarchy $TOP_LOWER_DIR
-fi     
+fi
 
 complete_test
-