Thread: [Libsysio-commit] HEAD: libsysio/tests startup.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-06-30 13:40:53
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26025 Modified Files: startup.c Log Message: If the envriornment does not contain a value for SYSIO_NAMESPACE now try SYSIO_NATIVE. If that is found, the native root becomes the sysio root. In other words, a 1:1 mapping with the localhost. If neither is defined do nothing, providing compatibility for the older tests. Are any of these still hanging around? Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- startup.c 14 Feb 2004 19:42:59 -0000 1.2 +++ startup.c 30 Jun 2004 13:40:43 -0000 1.3 @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/queue.h> @@ -20,8 +21,13 @@ _test_sysio_startup() if (err) return err; s = getenv("SYSIO_NAMESPACE"); - err = s ? _sysio_boot(s) : -ENOTTY; - if (err) - return err; + if (s) + return _sysio_boot(s); + s = getenv("SYSIO_NATIVE"); + if (s) + return _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + /* + * Compatibility with the older tests: They did it all themselves. + */ return 0; } |
From: Lee W. <lw...@us...> - 2004-07-03 05:52:16
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11652 Modified Files: startup.c Log Message: Nope. Changed it to mount native file system root unless SYSIO_MANUAL is set in the environment. We just don't have the manual thing around in the tests anymore. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- startup.c 3 Jul 2004 05:47:13 -0000 1.4 +++ startup.c 3 Jul 2004 05:52:07 -0000 1.5 @@ -24,13 +24,13 @@ _test_sysio_startup() s = getenv("SYSIO_NAMESPACE"); if (s) return _sysio_boot(s); - s = getenv("SYSIO_NATIVE"); + s = getenv("SYSIO_MANUAL"); if (s) - return _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + return 0; /* - * Compatibility with the older tests: They did it all themselves. + * Assume a native mount at root. */ - return 0; + return _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); } void |
From: Lee W. <lw...@us...> - 2004-08-09 15:33:12
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21795 Modified Files: startup.c Log Message: If SYSIO_CWD is set in the environment, the internal current working directory will be set to the value. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- startup.c 3 Jul 2004 05:52:07 -0000 1.5 +++ startup.c 9 Aug 2004 15:33:03 -0000 1.6 @@ -23,14 +23,24 @@ _test_sysio_startup() return err; s = getenv("SYSIO_NAMESPACE"); if (s) - return _sysio_boot(s); - s = getenv("SYSIO_MANUAL"); - if (s) - return 0; + err = _sysio_boot(s); + else if (!(s = getenv("SYSIO_MANUAL"))) { /* * Assume a native mount at root. */ - return _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + err = _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + } + if (err) + return err; + + s = getenv("SYSIO_CWD"); + if (s) { + err = chdir(s); + if (err) + return err; + } + + return 0; } void |
From: Lee W. <lw...@us...> - 2004-11-18 13:00:57
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26352/tests Modified Files: startup.c Log Message: Enabled trace logging. Added the --with-tracing option at build time. By default, it's enabled. Altered _sysio_boot to accommodate. It now takes a struct _sysio_boot_ctl record to control the various things instead of an argument list. If you want trace logging turned on, set the tracing field to a non-zero value. In the test directory, recognize the SYSIO_TRACING environment variable at startup and enable trace logging if found. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- startup.c 14 Oct 2004 14:59:29 -0000 1.7 +++ startup.c 18 Nov 2004 13:00:46 -0000 1.8 @@ -14,7 +14,7 @@ _test_sysio_startup() { int err; const char *cwd; - const char *s; + struct _sysio_boot_ctl control; err = _sysio_init(); if (err) @@ -22,26 +22,28 @@ _test_sysio_startup() err = drv_init_all(); if (err) return err; - s = getenv("SYSIO_NAMESPACE"); - if (!(s || (s = getenv("SYSIO_MANUAL")))) { + control.buf = getenv("SYSIO_NAMESPACE"); + if (!(control.buf || (control.buf = getenv("SYSIO_MANUAL")))) { /* * Assume a native mount at root. */ - s = "{mnt,dev=\"native:/\",dir=/,fl=0}"; + control.buf = "{mnt,dev=\"native:/\",dir=/,fl=0}"; } cwd = getenv("SYSIO_CWD"); + if (!cwd) + cwd = "/"; #if DEFER_INIT_CWD - err = _sysio_boot(s, cwd ? cwd : "/"); -#else - err = _sysio_boot(s); + control.path = cwd; +#endif +#if SYSIO_TRACING + control.tracing = getenv("SYSIO_TRACING") ? 1 : 0; #endif + err = _sysio_boot(&control); if (err) return err; #if !DEFER_INIT_CWD - if (!cwd) - s = "/"; - err = chdir(s); + err = chdir(cwd); if (err) return err; #endif |
From: Lee W. <lw...@us...> - 2004-11-29 23:55:16
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1404/tests Modified Files: startup.c Log Message: Ok, round 3 with the _sysio_boot function. Every time I add a new little option, I'm going to break the Cray crt0 build. New deal, then. Now, _sysio_boot takes a name and value pair. We call it repeatedly for different pairs, then. To support legacy, the name/value pairs are: "namespace" and the buffer is the argument "cwd" and the deferred, initial path is the argument Since it's now 2 calls, I suggest "namespace" first, then "cwd" to preserve the older behavior. As previously, _sysio_boot still returns 0 on success or a, negated, error number. Now, though, you know which failed :-) You decide if it's fatal. I've also added a new pair identified by "tracing" that enables tracing if configured for it. The value is a readable string, expected to parse as a number by strtol. Then, it should turn into a 0 or positive. Zero, being off and positive being on. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- startup.c 18 Nov 2004 13:00:46 -0000 1.8 +++ startup.c 29 Nov 2004 23:55:01 -0000 1.9 @@ -13,8 +13,7 @@ int _test_sysio_startup() { int err; - const char *cwd; - struct _sysio_boot_ctl control; + char *arg; err = _sysio_init(); if (err) @@ -22,32 +21,36 @@ _test_sysio_startup() err = drv_init_all(); if (err) return err; - control.buf = getenv("SYSIO_NAMESPACE"); - if (!(control.buf || (control.buf = getenv("SYSIO_MANUAL")))) { - /* - * Assume a native mount at root. - */ - control.buf = "{mnt,dev=\"native:/\",dir=/,fl=0}"; - } - cwd = getenv("SYSIO_CWD"); - if (!cwd) - cwd = "/"; -#if DEFER_INIT_CWD - control.path = cwd; -#endif #if SYSIO_TRACING - control.tracing = getenv("SYSIO_TRACING") ? 1 : 0; -#endif - err = _sysio_boot(&control); + arg = getenv("SYSIO_TRACING"); + err = _sysio_boot("trace", arg); if (err) return err; - -#if !DEFER_INIT_CWD - err = chdir(cwd); +#endif +#if DEFER_INIT_CWD + arg = getenv("SYSIO_CWD"); + if (!arg) + arg = "/"; + err = _sysio_boot("cwd", arg); if (err) return err; #endif - + /* + * tracing + */ + /* + * namespace + */ + arg = getenv("SYSIO_NAMESPACE"); + if (!(arg || (arg = getenv("SYSIO_MANUAL")))) { + /* + * Assume a native mount at root. + */ + arg = "{mnt,dev=\"native:/\",dir=/,fl=0}"; + } + err = _sysio_boot("namespace", arg); + if (err) + return err; return 0; } |
From: Lee W. <lw...@us...> - 2005-02-03 20:05:27
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17047 Modified Files: startup.c Log Message: The default namespace initialization now enables automounts. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- startup.c 25 Jan 2005 00:37:19 -0000 1.10 +++ startup.c 3 Feb 2005 20:05:13 -0000 1.11 @@ -44,9 +44,9 @@ _test_sysio_startup() arg = getenv("SYSIO_NAMESPACE"); if (!(arg || (arg = getenv("SYSIO_MANUAL")))) { /* - * Assume a native mount at root. + * Assume a native mount at root with automounts enabled. */ - arg = "{mnt,dev=\"native:/\",dir=/,fl=0}"; + arg = "{mnt,dev=\"native:/\",dir=/,fl=2}"; } err = _sysio_boot("namespace", arg); if (err) |
From: Lee W. <lw...@us...> - 2006-02-08 17:17:51
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3483/tests Modified Files: startup.c Log Message: The startup code in the tests directory should process the namespace initialization variable before the initial working directory. Fixed. From ClusterFS bugzilla #10114; When compiled to support an initial working directory that is deferred until needed, a chdir to a non-existent directory would cause an abort. This behavior is per design. Not technically a bug. However, it's very unfriendly. Especially so, since the accepted thing to do in this situation is to just leave the current working directory at the root of the namespace. This change, then, alters the behavior to the commonly accepted. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- startup.c 3 Feb 2005 20:05:13 -0000 1.11 +++ startup.c 8 Feb 2006 17:17:43 -0000 1.12 @@ -22,22 +22,14 @@ _test_sysio_startup() if (err) return err; #if SYSIO_TRACING + /* + * tracing + */ arg = getenv("SYSIO_TRACING"); err = _sysio_boot("trace", arg); if (err) return err; #endif -#if DEFER_INIT_CWD - arg = getenv("SYSIO_CWD"); - if (!arg) - arg = "/"; - err = _sysio_boot("cwd", arg); - if (err) - return err; -#endif - /* - * tracing - */ /* * namespace */ @@ -51,6 +43,17 @@ _test_sysio_startup() err = _sysio_boot("namespace", arg); if (err) return err; +#if DEFER_INIT_CWD + /* + * Current working directory. + */ + arg = getenv("SYSIO_CWD"); + if (!arg) + arg = "/"; + err = _sysio_boot("cwd", arg); + if (err) + return err; +#endif return 0; } |