[Libsysio-commit] namespace_assembly: libsysio/tests Makefile.am sysio_stubs.c sysio_tests.c test.h
Brought to you by:
lward
|
From: Lee W. <lw...@us...> - 2004-02-09 13:14:34
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29233/tests Modified Files: Tag: namespace_assembly Makefile.am sysio_stubs.c sysio_tests.c test.h test_copy.c test_driver.c test_driver.h test_getcwd.c test_link.c test_list.c test_path.c test_rename.c test_stats.c test_unlink.c Removed Files: Tag: namespace_assembly test_mounts.c test_namespace.c test_stdfd.c Log Message: Namespace assembly at boot project: Adds the ability to craft an initial, arbitrarily complex, name space. Governed by the presence of the SYSIO_NAMESPACE environment variable formatted per Sonja Tideman's trial specification. For an example, see .../misc/init-env.sh. The mounts, namespace, and stdfd tests were all removed. They've been deprecated or obsoleted by this project. The remaining tests have been updated. They no longer require the complicated initialization they previously used in order to get a root set up. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.16.2.2 retrieving revision 1.16.2.3 diff -u -w -b -B -p -r1.16.2.2 -r1.16.2.3 --- Makefile.am 28 Jan 2004 13:16:57 -0000 1.16.2.2 +++ Makefile.am 9 Feb 2004 13:11:18 -0000 1.16.2.3 @@ -1,6 +1,6 @@ -noinst_PROGRAMS = test_copy test_stats test_path test_mounts test_list \ - test_getcwd test_stdfd test_link test_unlink test_rename \ - test_driver test_namespace +noinst_PROGRAMS = test_copy test_stats test_path test_list \ + test_getcwd test_link test_unlink test_rename \ + test_driver CLEANFILES=drv_data.c @@ -20,14 +20,6 @@ INCORE_DRIVER_NAME=incore INCORE_DRIVER_CFLAGS= endif -if WITH_STDFD_DEV -STDFD_DEV_NAME=stdfd -STDFD_DEV_CFLAGS= -I$(top_srcdir)/dev/stdfd -else -STDFD_DEV_NAME=stdfd -STDFD_DEV_CFLAGS= -endif - if WITH_CPLANT_YOD YOD_DRIVER_NAME=yod YOD_DRIVER_CFLAGS= -DCPLANT_YOD @@ -47,7 +39,7 @@ endif DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) \ $(STFD_DEV_NAME) $(SOCKETS_DRIVER_NAME) -CMNSRC=drv_init_all.c drv_data.c +CMNSRC=startup.c drv_init_all.c drv_data.c BUILT_SOURCES=drv_data.c check_PROGRAMS=test_driver @@ -79,11 +71,6 @@ test_path_CFLAGS=$(CFL) test_path_LDADD=$(LIBS) test_path_DEPENDENCIES=$(LIBS) -test_mounts_SOURCES=test_mounts.c $(CMNSRC) -test_mounts_CFLAGS=$(CFL) -test_mounts_LDADD=$(LIBS) -test_mounts_DEPENDENCIES=$(LIBS) - test_list_SOURCES=test_list.c $(CMNSRC) test_list_CFLAGS=$(CFL) test_list_LDADD=$(LIBS) @@ -94,11 +81,6 @@ test_getcwd_CFLAGS=$(CFL) test_getcwd_LDADD=$(LIBS) test_getcwd_DEPENDENCIES=$(LIBS) -test_stdfd_SOURCES=test_stdfd.c $(CMNSRC) -test_stdfd_CFLAGS=$(CFL) -test_stdfd_LDADD=$(LIBS) -test_stdfd_DEPENDENCIES=$(LIBS) - test_link_SOURCES=test_link.c $(CMNSRC) test_link_CFLAGS=$(CFL) test_link_LDADD=$(LIBS) @@ -114,11 +96,6 @@ test_rename_CFLAGS=$(CFL) test_rename_LDADD=$(LIBS) test_rename_DEPENDENCIES=$(LIBS) -test_namespace_SOURCES=test_namespace.c $(CMNSRC) -test_namespace_CFLAGS=$(CFL) -test_namespace_LDADD=$(LIBS) -test_namespace_DEPENDENCIES=$(LIBS) - test_driver_SOURCES=test_driver.c sysio_tests.c sysio_stubs.c help.c $(CMNSRC) test_driver_CFLAGS=$(CFL) test_driver_LDADD=$(LIBS) Index: sysio_stubs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -w -b -B -p -r1.6.2.1 -r1.6.2.2 --- sysio_stubs.c 28 Jan 2004 13:16:57 -0000 1.6.2.1 +++ sysio_stubs.c 9 Feb 2004 13:11:18 -0000 1.6.2.2 @@ -393,9 +393,8 @@ int test_do_init(int argc, char **argv) DBG(5, fprintf(outfp, "In test_do_init\n")); last_type = SINT; - DBG(3, fprintf(outfp, "Using driver %s, path %s, flags %x\n", - root_driver, mntpath, mntflgs)); - return initilize_sysio(root_driver, mntpath, mntflgs); + DBG(3, fprintf(outfp, "initializing\n")); + return initilize_sysio(); } Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -w -b -B -p -r1.3.2.1 -r1.3.2.2 --- sysio_tests.c 28 Jan 2004 13:16:57 -0000 1.3.2.1 +++ sysio_tests.c 9 Feb 2004 13:11:18 -0000 1.3.2.2 @@ -29,37 +29,23 @@ * # every function document in sysio.h # * ################################################### */ -int initilize_sysio(char *root_driver, char *root_path, int mntflgs) +int initilize_sysio() { int err; char *wd; + extern int _test_sysio_startup(void); /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); - DBG(5, sprintf(output, "%sdrv_init_all: err %d\n", output, err)); + err = _test_sysio_startup(); + DBG(5, sprintf(output, "%s_test_sysio_startup: err %d\n", output, err)); if (err) { my_errno = err; - my_perror("drv_init_all"); + my_perror("sysio startup"); last_ret_val = errno; return SUCCESS; } - err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL); - DBG(5, sprintf(output, "%ssysio_mount_root: err %d\n", output, err)); - if (err) { - my_errno = errno; - my_perror("_sysio_mount_root"); - perror("_sysio_mount_root"); - last_ret_val = err; - return SUCCESS; - } /* * Attempt to set the cwd by getting it out of the Index: test.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test.h,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -u -w -b -B -p -r1.1 -r1.1.20.1 --- test.h 22 Feb 2003 20:30:20 -0000 1.1 +++ test.h 9 Feb 2004 13:11:19 -0000 1.1.20.1 @@ -41,8 +41,6 @@ * le...@sa... */ -#define DEFAULT_DRIVER "native" - extern int (*drvinits[])(void); extern int drv_init_all(void); Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -w -b -B -p -r1.8 -r1.8.2.1 --- test_copy.c 10 Oct 2003 18:50:31 -0000 1.8 +++ test_copy.c 9 Feb 2004 13:11:19 -0000 1.8.2.1 @@ -65,14 +65,12 @@ /* * Copy one file to another. * - * Usage: test_copy [-a] [-r <source>] [-m <root-driver>] <src> <dest> + * Usage: test_copy [-o] <src> <dest> * * Destination will not be overwritten if it already exist. */ -char *root_driver = DEFAULT_DRIVER; -char *mntpath = "/"; -unsigned mntflgs = 0; +static int overwrite = 0; /* over-write? */ void usage(void); int copy_file(const char *spath, const char *dpath); @@ -83,28 +81,19 @@ main(int argc, char * const argv[]) int i; int err; const char *spath, *dpath; + extern int _test_sysio_startup(void); /* * Parse command-line args. */ while ((i = getopt(argc, argv, -#ifdef AUTOMOUNT_FILE_NAME - "a" -#endif - "r:m:")) != -1) + "o" + )) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'r': /* set working dir */ - mntpath = optarg; - break; - case 'm': - root_driver = optarg; + case 'o': + overwrite = 1; break; default: usage(); @@ -112,24 +101,12 @@ main(int argc, char * const argv[]) if (!(argc - optind)) usage(); -#ifndef CPLANT_YOD - if (_sysio_init() != 0) { - perror("init sysio"); - exit(1); - } - err = drv_init_all(); - if (err) { - perror("init drivers"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror(root_driver); + perror("sysio startup"); exit(1); } -#endif - (void )umask(022); /* * Source @@ -146,9 +123,7 @@ main(int argc, char * const argv[]) err = copy_file(spath, dpath); -#ifndef CPLANT_YOD _sysio_shutdown(); -#endif return err; } @@ -159,10 +134,6 @@ usage() (void )fprintf(stderr, "Usage: test_copy " -#ifdef AUTOMOUNT_FILE_NAME - "[-a] " -#endif - "[-r <source>] [-m <fsname>]" " source destination\n"); exit(1); } @@ -183,6 +154,7 @@ int copy_file(const char *spath, const char *dpath) { int sfd, dfd; + int flags; int rtn; static char buf[1024]; ssize_t cc, wcc; @@ -193,7 +165,10 @@ copy_file(const char *spath, const char sfd = open_file(spath, O_RDONLY, 0); if (sfd < 0) goto out; - dfd = open_file(dpath, O_CREAT|O_EXCL|O_WRONLY, 0666); + flags = O_CREAT|O_WRONLY; + if (!overwrite) + flags |= O_EXCL; + dfd = open_file(dpath, flags, 0666); if (dfd < 0) goto out; Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -w -b -B -p -r1.4.2.1 -r1.4.2.2 --- test_driver.c 28 Jan 2004 13:16:57 -0000 1.4.2.1 +++ test_driver.c 9 Feb 2004 13:11:19 -0000 1.4.2.2 @@ -862,10 +862,12 @@ int main(int argc, char *argv[]) print_line = 0; +#if 0 /* sysio defaults */ strcpy(root_driver, DEFAULT_DRIVER); strcpy(mntpath, "/"); mntflgs = 0; +#endif my_errno = 0; Index: test_driver.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.h,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- test_driver.h 10 Oct 2003 18:50:31 -0000 1.3 +++ test_driver.h 9 Feb 2004 13:11:19 -0000 1.3.2.1 @@ -201,7 +201,7 @@ extern int test_do_umount(int argc, char /* Functions defined in sysio_tests.c */ extern int sysio_mount(char *from, char *to); extern int sysio_list(char *path); -extern int initilize_sysio(char *root_driver, char *root_path, int mntflgs); +extern int initilize_sysio(void); extern int sysio_chdir(char *newdir); extern int sysio_chmod(char *mode_arg, const char *path); extern int sysio_chown(char *new_id, char *file); Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- test_getcwd.c 10 Oct 2003 18:50:31 -0000 1.3 +++ test_getcwd.c 9 Feb 2004 13:11:19 -0000 1.3.2.1 @@ -64,7 +64,7 @@ /* * Test getcwd() * - * Usage: test_cwd [-a] [-m <fsname>] [-r <mntpath>] [<working-dir>...] + * Usage: test_cwd [<working-dir>...] * * Without any path arguments, the program reads from standard-in, dealing with * each line as an absolute or relative path until EOF. @@ -73,68 +73,32 @@ static int doit(const char *path); static void usage(void); -static const char *root_driver = DEFAULT_DRIVER; -static const char *mntpath = "/"; -static unsigned mntflgs = 0; - -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char *const argv[]) { int i; int err; int n; + extern int _test_sysio_startup(void); /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'm': - root_driver = optarg; - break; - case 'r': - mntpath = optarg; - break; default: usage(); } -#ifndef CPLANT_YOD /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); - if (err) { - errno = -err; - perror("drv_init_all"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror("_sysio_mount_root"); + perror("sysio startup"); exit(1); } -#endif n = argc - optind; @@ -170,12 +134,10 @@ main(int argc, char *const argv[]) } } -#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); -#endif return 0; } @@ -205,10 +167,6 @@ usage() (void )fprintf(stderr, "Usage: test_getcwd " -#ifdef AUTOMOUNT_FILE_NAME - "[-a] " -#endif - "[-m <driver>] [-r <mntpath>]" " [<path> ...\n]"); exit(1); Index: test_link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_link.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -w -b -B -p -r1.1 -r1.1.4.1 --- test_link.c 20 Oct 2003 16:32:29 -0000 1.1 +++ test_link.c 9 Feb 2004 13:11:19 -0000 1.1.4.1 @@ -64,49 +64,27 @@ /* * Test hard link * - * Usage: link [-a] [-m <fsname>] [-r <mntpath>] oldpath newpath + * Usage: link oldpath newpath * */ static int linkit(const char *old, const char *new); static void usage(void); -static const char *root_driver = DEFAULT_DRIVER; -static const char *mntpath = "/"; -static unsigned mntflgs = 0; - -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char *const argv[]) { int i; int err; int n; + extern int _test_sysio_startup(void); /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'm': - root_driver = optarg; - break; - case 'r': - mntpath = optarg; - break; default: usage(); } @@ -114,22 +92,10 @@ main(int argc, char *const argv[]) /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); - if (err) { - errno = -err; - perror("drv_init_all"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror("_sysio_mount_root"); + perror("sysio startup"); exit(1); } @@ -172,7 +138,7 @@ usage() { (void )fprintf(stderr, - "Usage: unlink [-a] [-m <driver>] [-r <mntpath>]" + "Usage: unlink" " oldpath newpath\n"); exit(1); Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- test_list.c 10 Oct 2003 18:50:31 -0000 1.6 +++ test_list.c 9 Feb 2004 13:11:19 -0000 1.6.2.1 @@ -64,7 +64,7 @@ /* * Stat files. * - * Usage: test_list [-a] [-m <fsname>] [-r <mntpath>] [path...] + * Usage: test_list [path...] * * Without any path arguments, the program reads from standard-in, dealing with * each line as an absolute or relative path until EOF. @@ -73,69 +73,34 @@ static int listit(const char *path); static void usage(void); -static const char *root_driver = DEFAULT_DRIVER; -static const char *mntpath = "/"; -static unsigned mntflgs = 0; - -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char *const argv[]) { int i; int err; int n; + extern int _test_sysio_startup(void); /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'm': - root_driver = optarg; - break; - case 'r': - mntpath = optarg; - break; default: usage(); } -#ifndef CPLANT_YOD /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); - if (err) { - errno = -err; - perror("drv_init_all"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror("_sysio_mount_root"); + perror("sysio startup"); exit(1); } -#endif + n = argc - optind; /* @@ -170,12 +135,10 @@ main(int argc, char *const argv[]) } } -#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); -#endif return 0; } @@ -243,7 +206,7 @@ usage() { (void )fprintf(stderr, - "Usage: list_path [-a] [-m <driver>] [-r <mntpath>]" + "Usage: list_path" " [<path> ...\n]"); exit(1); Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- test_path.c 10 Oct 2003 18:50:31 -0000 1.6 +++ test_path.c 9 Feb 2004 13:11:19 -0000 1.6.2.1 @@ -64,7 +64,7 @@ /* * Stat files. * - * Usage: test_path [-a] [-m <fsname>] [-r <mntpath>] [path...] + * Usage: test_path [path...] * * Without any path arguments, the program reads from standard-in, dealing with * each line as an absolute or relative path until EOF. @@ -73,69 +73,33 @@ static int statit(const char *path); static void usage(void); -static const char *root_driver = DEFAULT_DRIVER; -static const char *mntpath = "/"; -static unsigned mntflgs = 0; - -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char *const argv[]) { int i; int err; int n; + extern _test_sysio_startup(void); /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'm': - root_driver = optarg; - break; - case 'r': - mntpath = optarg; - break; default: usage(); } -#ifndef CPLANT_YOD /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); + err = _test_sysio_startup(); if (err) { errno = -err; - perror("drv_init_all"); + perror("sysio startup"); exit(1); } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); - if (err) { - errno = -err; - perror("_sysio_mount_root"); - exit(1); - } -#endif n = argc - optind; @@ -171,12 +135,10 @@ main(int argc, char *const argv[]) } } -#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); -#endif return 0; } @@ -248,7 +210,7 @@ usage() { (void )fprintf(stderr, - "Usage: test_path [-a] [-m <driver>] [-r <mntpath>]" + "Usage: test_path" " [<path> ...\n]"); exit(1); Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -w -b -B -p -r1.3 -r1.3.4.1 --- test_rename.c 28 Oct 2003 18:54:19 -0000 1.3 +++ test_rename.c 9 Feb 2004 13:11:19 -0000 1.3.4.1 @@ -65,13 +65,9 @@ /* * Rename a file system object. * - * Usage: test_rename [-a] [-r <source>] [-m <root-driver>] <src> <dest> + * Usage: test_rename <src> <dest> */ -char *root_driver = DEFAULT_DRIVER; -char *mntpath = "/"; -unsigned mntflgs = 0; - void usage(void); int rename_file(const char *spath, const char *dpath); @@ -81,52 +77,31 @@ main(int argc, char * const argv[]) int i; int err; const char *spath, *dpath; + extern int _test_sysio_startup(void); /* * Parse command-line args. */ while ((i = getopt(argc, argv, -#ifdef AUTOMOUNT_FILE_NAME - "a" -#endif - "r:m:")) != -1) + "" + )) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'r': /* set working dir */ - mntpath = optarg; - break; - case 'm': - root_driver = optarg; - break; default: usage(); } if (!(argc - optind)) usage(); -#ifndef CPLANT_YOD - if (_sysio_init() != 0) { - perror("init sysio"); - exit(1); - } - err = drv_init_all(); - if (err) { - perror("init drivers"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + + err = _test_sysio_startup(); if (err) { errno = -err; - perror(root_driver); + perror("sysio startup"); exit(1); } -#endif + (void )umask(022); /* @@ -146,9 +121,7 @@ main(int argc, char * const argv[]) if (err) perror("rename"); -#ifndef CPLANT_YOD _sysio_shutdown(); -#endif return err; } @@ -159,10 +132,6 @@ usage() (void )fprintf(stderr, "Usage: test_rename " -#ifdef AUTOMOUNT_FILE_NAME - "[-a] " -#endif - "[-r <source>] [-m <fsname>]" " source destination\n"); exit(1); } Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- test_stats.c 10 Oct 2003 18:50:31 -0000 1.5 +++ test_stats.c 9 Feb 2004 13:11:19 -0000 1.5.2.1 @@ -66,79 +66,45 @@ /* * Get stats of file and file system. * - * Usage: test_stats [-a] [-r <root-path>] [-m <root-driver>] [<path> ...] + * Usage: test_stats [<path> ...] */ -char *root_driver = DEFAULT_DRIVER; -char *root_path = "/"; -unsigned mntflgs = 0; - void usage(void); void do_stats(const char *path); -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char * const argv[]) { int i; int err; + extern int _test_sysio_startup(void); /* * Parse command-line args. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'r': - root_path = optarg; - break; - case 'm': - root_driver = optarg; - break; default: usage(); } -#ifndef CPLANT_YOD - if (_sysio_init() != 0) { - perror("init sysio"); - exit(1); - } - err = drv_init_all(); - if (err) { - perror("init drivers"); - exit(1); - } - err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror(root_driver); + perror("sysio startup"); exit(1); } -#endif + (void )umask(022); while (optind < argc) do_stats(argv[optind++]); -#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); -#endif return 0; } @@ -148,7 +114,7 @@ usage() { (void )fprintf(stderr, - "Usage: test_stats [-a] [-m <fsname>] [-r <root-path>]" + "Usage: test_stats" " source destination\n"); exit(1); } Index: test_unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_unlink.c,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -w -b -B -p -r1.2 -r1.2.4.1 --- test_unlink.c 10 Oct 2003 18:50:32 -0000 1.2 +++ test_unlink.c 9 Feb 2004 13:11:19 -0000 1.2.4.1 @@ -64,7 +64,7 @@ /* * Unlink files. * - * Usage: unlink [-a] [-m <fsname>] [-r <mntpath>] [path...] + * Usage: unlink [path...] * * Without any path arguments, the program unlinks files named * by the ocmmand line args. @@ -73,42 +73,20 @@ static int unlinkit(const char *path); static void usage(void); -static const char *root_driver = DEFAULT_DRIVER; -static const char *mntpath = "/"; -static unsigned mntflgs = 0; - -#ifdef AUTOMOUNT_FILE_NAME -#define EXTRA_AUTOMOUNT_OPT "a" -#else -#define EXTRA_AUTOMOUNT_OPT -#endif - -const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; - int main(int argc, char *const argv[]) { int i; int err; int n; + extern int _test_sysio_startup(void); /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, opts)) != -1) + while ((i = getopt(argc, argv, "")) != -1) switch (i) { -#ifdef AUTOMOUNT_FILE_NAME - case 'a': - mntflgs |= MOUNT_F_AUTO; - break; -#endif - case 'm': - root_driver = optarg; - break; - case 'r': - mntpath = optarg; - break; default: usage(); } @@ -116,22 +94,10 @@ main(int argc, char *const argv[]) /* * Init sysio lib. */ - _sysio_init(); - - /* - * Init native file system driver and request mount of specified - * source directory. - */ - err = drv_init_all(); - if (err) { - errno = -err; - perror("drv_init_all"); - exit(1); - } - err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL); + err = _test_sysio_startup(); if (err) { errno = -err; - perror("_sysio_mount_root"); + perror("sysio startup"); exit(1); } @@ -194,7 +160,7 @@ usage() { (void )fprintf(stderr, - "Usage: unlink [-a] [-m <driver>] [-r <mntpath>]" + "Usage: unlink" " [<path> ...\n]"); exit(1); --- test_mounts.c DELETED --- --- test_namespace.c DELETED --- --- test_stdfd.c DELETED --- |