"
# names of tests to run (change as you like)
# Will take $MYTESTS list of tests from the environment
-#TESTS2RUN=${MYTESTS:-$ALL_TESTS}
-
-#Hardcoding this to test only 'create'
-TESTS2RUN="create"
+TESTS2RUN=${MYTESTS:-$ALL_TESTS}
# Running On-Disk Format (ODF) ? 1=yes, 0=no
ODF=1
ODF_FS="ext2"
ODF_DEV="/dev/loop4"
ODF_DIR="/n/odf"
+#Branch permissions
+ODF_BRANCH_RW=6
+ODF_BRANCH_RO=4
# name of four devices to use
DEV0=/dev/loop0
CFLAGS=-g -Wall -Werror -luuid
MOUNTPOINT=.
BINS=open-unlink flock-copyup fsync truncate bug418 rmdircheckinode \
- creat-open rename mapper queryfile make_sb
+ creat-open rename mapper queryfile mkodf_sb
all: $(BINS)
+++ /dev/null
-/*
- * 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>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <uuid/uuid.h>
-#include <string.h>
-
-#define UUID_LEN 16
-#define MAX_NO_BRANCHES 4
-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];
- char path[MAX_NO_BRANCHES][100];
- unsigned int permission[MAX_NO_BRANCHES];
- unsigned char uuid[MAX_NO_BRANCHES*UUID_LEN];
- int i;
- size_t bytes;
-
-
- for (i = 0; i < no_branches; i++) {
- strcpy(path[i], argv[2*i+2]);
- pathlength[i] = strlen(path[i]);
- permission[i] = atoi(argv[2*i+3]);
- 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);
-
- for (i = 0; i < no_branches; i++) {
- bytes = write(fd, (char *)&bid[i], 4);
- 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);
- bytes = write(fd, uuid + i*UUID_LEN, UUID_LEN);
- }
-
- close(fd);
- return 0;
-}
--- /dev/null
+/*
+ * 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>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <uuid/uuid.h>
+#include <string.h>
+
+#define UUID_LEN 16
+#define MAX_NO_BRANCHES 4
+int main(int argc, char *argv[])
+{
+ int fd;
+ unsigned int version = 2;
+ unsigned int no_branches = atoi(argv[2]);
+ 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];
+ int i;
+ size_t bytes;
+
+
+ for (i = 0; i < no_branches; i++) {
+ strcpy(path[i], argv[2*i+3]);
+ pathlength[i] = strlen(path[i]);
+ permission[i] = atoi(argv[2*i+4]);
+ bid[i] = i;
+ }
+
+ fd = open(argv[1], O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+ bytes = write(fd, (char *)&version, 4);
+ bytes = write(fd, (char *)&no_branches, 4);
+
+ for (i = 0; i < no_branches; i++) {
+ bytes = write(fd, (char *)&bid[i], 4);
+ 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);
+ bytes = write(fd, uuid + i*UUID_LEN, UUID_LEN);
+ }
+
+ close(fd);
+ return 0;
+}
# Export the type of file systems, as some tests need to know.
# For example: jffs2, cramfs, and squashfs.
export FS0 FS1 FS2 FS3 DEV0 DEV1 DEV2 DEV3 SPECIAL_FS delay OUTPUT_COLOR
- export ODF ODF_FS ODF_DEV ODF_DIR POPULATE_ODF
+ export ODF ODF_FS ODF_DEV ODF_DIR POPULATE_ODF ODF_BRANCH_RW ODF_BRANCH_RO
# run actual test and abort on error (test script tries to umount unionfs)
runcmd bash $t
return $ERR
}
-function setup_odf {
+function init_odf {
+ # Noop for Non ODF unionfs
+ if [ $ODF -eq 0 ]; then
+ return
+ fi
+
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
fi
runcmd mount -t $ODF_FS $ODF_DEV $ODF_DIR
+ if [ "$#" -gt 0 ]; then
+ fill_odf
+ no_branches="$#"
+ ARG_LIST=$ODF_DIR"/sb "$no_branches
+ while [ "$#" -gt 0 ]; do
+ branch=`echo $1 | cut -d= -f 1`
+ ( echo $1 | grep '=' >/dev/null )
+ ERR=$?
+ if [ $ERR -eq 0 ]; then
+ perm=`echo $1 | cut -d= -f 2`
+ else
+ perm="rw"
+ fi
+ if [ "$perm" == "ro" ]; then
+ perm="$ODF_BRANCH_RO"
+ elif [ "$perm" == "rw" ]; then
+ perm="$ODF_BRANCH_RW"
+ fi
+ ARG_LIST=$ARG_LIST" "$branch" "$perm
+ shift
+ done
+ ./progs/mkodf_sb $ARG_LIST
+ fi
}
function fill_odf {