libsysio-commit Mailing List for libsysio (Page 20)
Brought to you by:
lward
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(25) |
May
(28) |
Jun
(25) |
Jul
(30) |
Aug
(60) |
Sep
(52) |
Oct
(100) |
Nov
(15) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(89) |
Feb
(48) |
Mar
(22) |
Apr
(59) |
May
(16) |
Jun
(15) |
Jul
(50) |
Aug
(26) |
Sep
(40) |
Oct
(27) |
Nov
(12) |
Dec
|
2005 |
Jan
(24) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(6) |
Jul
|
Aug
(14) |
Sep
(21) |
Oct
(10) |
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
(5) |
Mar
(2) |
Apr
(6) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2007 |
Jan
(3) |
Feb
(5) |
Mar
(20) |
Apr
(41) |
May
(21) |
Jun
(3) |
Jul
(5) |
Aug
(12) |
Sep
(21) |
Oct
(5) |
Nov
(16) |
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(23) |
May
|
Jun
(22) |
Jul
(13) |
Aug
|
Sep
|
Oct
(9) |
Nov
(3) |
Dec
(13) |
2009 |
Jan
(14) |
Feb
(10) |
Mar
(2) |
Apr
(11) |
May
(7) |
Jun
(1) |
Jul
(1) |
Aug
(36) |
Sep
(12) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Lee W. <lw...@us...> - 2004-11-29 23:55:16
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1404/src Modified Files: init.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: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- init.c 19 Nov 2004 17:49:54 -0000 1.19 +++ init.c 29 Nov 2004 23:55:01 -0000 1.20 @@ -89,6 +89,17 @@ int _sysio_tracing = 0; #define IGNORE_WHITE " \t\r\n" /* + * Check if long overflows integer range. + */ +#if LONG_MAX <= INT_MAX +#define _irecheck(_l, _e) \ + ((_l) == LONG_MAX && (_e) == ERANGE) +#else +#define _irecheck(_l, _e) \ + ((_l) > INT_MAX) +#endif + +/* * Sysio library initialization. Must be called before anything else in the * library. */ @@ -682,17 +693,6 @@ do_open(char *args) int err; struct file *fil; -/* - * Check if long overflows integer range. - */ -#if LONG_MAX <= INT_MAX -#define _irecheck(_l, _e) \ - ((_l) == LONG_MAX && (_e) == ERANGE) -#else -#define _irecheck(_l, _e) \ - ((_l) > INT_MAX) -#endif - len = strlen(args); if (_sysio_get_args(args, v) - args != (ssize_t )len || !(v[0].ovi_value && v[1].ovi_value && v[2].ovi_value)) @@ -735,8 +735,6 @@ do_open(char *args) if (pno) P_RELE(pno); return err; - -#undef _irecheck } /* @@ -769,30 +767,41 @@ do_command(char *buf) return -EINVAL; } +#if SYSIO_TRACING /* - * Given a command sequence buffer, parse it and run the given - * commands + * Set/Unset tracing. */ -int -_sysio_boot(struct _sysio_boot_ctl *ctl) +static int +_sysio_boot_tracing(const char *arg) +{ + long l; + char *cp; + + l = 0; + if (arg) { + l = strtol(arg, (char **)&cp, 0); + if (*cp || !(l == 0 || l == 1)) + return -EINVAL; + } + _sysio_tracing = (int )l; + return 0; +} +#endif + +/* + * Initialize the namespace. + */ +static int +_sysio_boot_namespace(const char *arg) { - const char *buf; char c, *tok; ssize_t len; int err; unsigned count; - -#if SYSIO_TRACING - _sysio_tracing = ctl->tracing; -#endif - - buf = ctl->buf; - if (!buf) - buf = ""; /* * Allocate token buffer. */ - len = strlen(buf); + len = strlen(arg); tok = malloc(len ? len : 1); if (!tok) return -ENOMEM; @@ -802,9 +811,9 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) /* * Discard leading white space. */ - while ((c = *buf) != '\0' && + while ((c = *arg) != '\0' && !(c == '{' || strchr(IGNORE_WHITE, c) == NULL)) - buf++; + arg++; if (c == '\0') break; if (c != '{') { @@ -815,13 +824,13 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) * Get the command. */ *tok = '\0'; - buf = - (char *)_sysio_get_token(buf + 1, + arg = + (char *)_sysio_get_token(arg + 1, 0, "}", IGNORE_WHITE, tok); - if (!buf) { + if (!arg) { err = -EINVAL; break; } @@ -841,10 +850,55 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) strerror(-err)); #endif free(tok); -#if DEFER_INIT_CWD - if (err) return err; - _sysio_init_cwd = ctl->path; +} + +#if DEFER_INIT_CWD +/* + * Set deferred initial working directory. + */ +static int +_sysio_boot_cwd(const char *arg) +{ + + _sysio_init_cwd = arg; + return 0; +} #endif - return err; + +/* + * Given an identifier and it's arguments, perform optional initializations. + */ +int +_sysio_boot(const char *opt, const char *arg) +{ + struct option_value_info vec[] = { +#if SYSIO_TRACING + { "trace", NULL }, /* tracing? */ +#endif + { "namespace", NULL }, /* init namespace? */ +#if DEFER_INIT_CWD + { "cwd", NULL }, /* init working dir */ +#endif + { NULL, NULL } + }; + struct option_value_info *v; + unsigned u; + static int (*f[])(const char *) = { +#if SYSIO_TRACING + _sysio_boot_tracing, +#endif + _sysio_boot_namespace, +#if DEFER_INIT_CWD + _sysio_boot_cwd, +#endif + NULL /* can't happen */ + }; + + for (v = vec, u = 0; v->ovi_name; v++, u++) + if (strcmp(v->ovi_name, opt) == 0) + break; + if (!v->ovi_name) + return -EINVAL; + return (*f[u])(arg); } |
From: Lee W. <lw...@us...> - 2004-11-29 23:55:16
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1404/include Modified Files: sysio.h 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: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -w -b -B -p -r1.30 -r1.31 --- sysio.h 19 Nov 2004 17:49:54 -0000 1.30 +++ sysio.h 29 Nov 2004 23:54:51 -0000 1.31 @@ -114,17 +114,14 @@ extern mode_t _sysio_umask; extern int _sysio_init(void); extern void _sysio_shutdown(void); +#if 0 struct _sysio_boot_ctl { - const char *buf; -#if DEFER_INIT_CWD - const char *path; -#endif -#if SYSIO_TRACING - int tracing; -#endif + const char *onam; + const char *oarg; }; +#endif -extern int _sysio_boot(struct _sysio_boot_ctl *ctl); +extern int _sysio_boot(const char *opt, const char *arg); /* * Option-value pair information. |
From: Lee W. <lw...@us...> - 2004-11-19 17:50:05
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19149/tests Modified Files: sysio-run-start.c Log Message: Implemented _sysio_cprintf, a console printf function. Changed ENTER and LEAVE macros to call this new function directly, instead of _sysio_enter and _sysio_leave. Got rid of the aforementioned functions. Enhanced _sysio_boot to report failures, via _sysio_cprintf, when processing the namespace initialization buffer. Debugging the silent failures was taking way too much time. Index: sysio-run-start.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio-run-start.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- sysio-run-start.c 14 Oct 2004 14:59:29 -0000 1.2 +++ sysio-run-start.c 19 Nov 2004 17:49:54 -0000 1.3 @@ -17,10 +17,10 @@ _sysio_startup() if (err) { errno = -err; perror("sysio startup"); - exit(1); + abort(); } if (atexit(_test_sysio_shutdown) != 0) { perror("atexit"); - exit(1); + abort(); } } |
From: Lee W. <lw...@us...> - 2004-11-19 17:50:05
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19149/include Modified Files: sysio-cmn.h sysio.h Log Message: Implemented _sysio_cprintf, a console printf function. Changed ENTER and LEAVE macros to call this new function directly, instead of _sysio_enter and _sysio_leave. Got rid of the aforementioned functions. Enhanced _sysio_boot to report failures, via _sysio_cprintf, when processing the namespace initialization buffer. Debugging the silent failures was taking way too much time. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- sysio-cmn.h 18 Nov 2004 13:00:45 -0000 1.2 +++ sysio-cmn.h 19 Nov 2004 17:49:53 -0000 1.3 @@ -150,14 +150,11 @@ struct iovec; #if SYSIO_TRACING extern int _sysio_tracing; -extern void _sysio_enter(const char *fname); -extern void _sysio_leave(const char *fname); - #define SYSIO_ENTER \ - if (_sysio_tracing) _sysio_enter(__func__) + if (_sysio_tracing) _sysio_cprintf("+ENTER+ %s\n", __func__) #define SYSIO_LEAVE \ - if (_sysio_tracing) _sysio_leave(__func__) + if (_sysio_tracing) _sysio_cprintf("+LEAVE+ %s\n", __func__) #else #define SYSIO_ENTER #define SYSIO_LEAVE Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -w -b -B -p -r1.29 -r1.30 --- sysio.h 18 Nov 2004 13:00:45 -0000 1.29 +++ sysio.h 19 Nov 2004 17:49:54 -0000 1.30 @@ -145,6 +145,10 @@ extern char * _sysio_get_args(char *buf, extern time_t _sysio_local_time(void); +#if SYSIO_TRACING +extern void _sysio_cprintf(const char *fmt, ...); +#endif + /* * The following should be defined by the system includes, and probably are, * but it's not illegal to have multiple externs, so long as they are the |
From: Lee W. <lw...@us...> - 2004-11-19 17:50:05
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19149/src Modified Files: init.c Log Message: Implemented _sysio_cprintf, a console printf function. Changed ENTER and LEAVE macros to call this new function directly, instead of _sysio_enter and _sysio_leave. Got rid of the aforementioned functions. Enhanced _sysio_boot to report failures, via _sysio_cprintf, when processing the namespace initialization buffer. Debugging the silent failures was taking way too much time. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- init.c 18 Nov 2004 13:21:21 -0000 1.18 +++ init.c 19 Nov 2004 17:49:54 -0000 1.19 @@ -163,13 +163,17 @@ static int vasprintf(char **strp, const char *fmt, va_list ap) { size_t siz; + int oerrno; char *s; va_list aq; int n; siz = 50; - if (!(s = malloc(siz))) + oerrno = errno; + if (!(s = malloc(siz))) { + errno = oerrno; return -1; + } for (;;) { va_copy(aq, ap); n = vsnprintf (s, siz, fmt, aq); @@ -184,9 +188,11 @@ vasprintf(char **strp, const char *fmt, break; } *strp = s; + errno = oerrno; return n; } +#if 0 static int asprintf(char **strp, const char *fmt, ...) { @@ -198,49 +204,37 @@ asprintf(char **strp, const char *fmt, . va_end(ap); return n; } +#endif #endif /* !(defined(_HAVE_ASPRINTF) && _HAVE_ASPRINTF) */ static void _sysio_cwrite(const char *buf, size_t len) { - - (void )syscall(SYSIO_SYS_write, STDERR_FILENO, buf, len); -} - -void -_sysio_enter(const char *fname) -{ int oerrno; - int len; - char *buf; oerrno = errno; - do { - len = asprintf(&buf, "+ENTER+ %s\n", fname); - if (len < 0) - break; - _sysio_cwrite(buf, (size_t )len); - free(buf); - } while (0); + (void )syscall(SYSIO_SYS_write, STDERR_FILENO, buf, len); errno = oerrno; } +/* + * Console printf. + */ void -_sysio_leave(const char *fname) +_sysio_cprintf(const char *fmt, ...) { - int oerrno; + va_list ap; int len; char *buf; - oerrno = errno; - do { - len = asprintf(&buf, "+LEAVE+ %s\n", fname); + va_start(ap, fmt); + buf = NULL; + len = vasprintf(&buf, fmt, ap); + va_end(ap); if (len < 0) - break; - _sysio_cwrite(buf, (size_t )len); + return; + _sysio_cwrite(buf, len); free(buf); - } while (0); - errno = oerrno; } #endif /* defined(SYSIO_TRACING) */ @@ -786,6 +780,11 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) char c, *tok; ssize_t len; int err; + unsigned count; + +#if SYSIO_TRACING + _sysio_tracing = ctl->tracing; +#endif buf = ctl->buf; if (!buf) @@ -798,6 +797,7 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) if (!tok) return -ENOMEM; err = 0; + count = 0; while (1) { /* * Discard leading white space. @@ -814,6 +814,7 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) /* * Get the command. */ + *tok = '\0'; buf = (char *)_sysio_get_token(buf + 1, 0, @@ -824,6 +825,7 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) err = -EINVAL; break; } + count++; /* * Perform. */ @@ -831,14 +833,18 @@ _sysio_boot(struct _sysio_boot_ctl *ctl) if (err) break; } +#if SYSIO_TRACING + if (err) + _sysio_cprintf("+NS init+ failed at expr %u (last = %s): %s\n", + count, + tok && *tok ? tok : "NULL", + strerror(-err)); +#endif free(tok); #if DEFER_INIT_CWD if (err) return err; _sysio_init_cwd = ctl->path; #endif -#if SYSIO_TRACING - _sysio_tracing = ctl->tracing; -#endif return err; } |
From: Lee W. <lw...@us...> - 2004-11-18 13:21:40
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31684 Modified Files: init.c Log Message: Let's go ahead and make asprintf and vasprintf static. They aren't used anywhere else. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- init.c 18 Nov 2004 13:00:45 -0000 1.17 +++ init.c 18 Nov 2004 13:21:21 -0000 1.18 @@ -159,7 +159,7 @@ _sysio_shutdown() /* * Print a string to allocated memory. */ -int +static int vasprintf(char **strp, const char *fmt, va_list ap) { size_t siz; @@ -187,7 +187,7 @@ vasprintf(char **strp, const char *fmt, return n; } -int +static int asprintf(char **strp, const char *fmt, ...) { va_list ap; |
From: Lee W. <lw...@us...> - 2004-11-18 13:00:58
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26352/src Modified Files: init.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: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- init.c 24 Oct 2004 20:41:19 -0000 1.16 +++ init.c 18 Nov 2004 13:00:45 -0000 1.17 @@ -43,10 +43,19 @@ #define _BSD_SOURCE +#if SYSIO_TRACING +#include <stdio.h> +#endif #include <stdlib.h> +#if SYSIO_TRACING +#include <sys/syscall.h> +#endif #include <unistd.h> #include <string.h> #include <errno.h> +#if SYSIO_TRACING +#include <stdarg.h> +#endif #include <limits.h> #include <assert.h> #include <sys/types.h> @@ -57,6 +66,9 @@ #include "xtio.h" #include "sysio.h" +#if SYSIO_TRACING +#include "native.h" +#endif #include "inode.h" #include "fs.h" #include "mount.h" @@ -67,6 +79,10 @@ #include "stdfd.h" #endif +#if SYSIO_TRACING +int _sysio_tracing = 0; +#endif + /* * White space characters. */ @@ -81,7 +97,7 @@ _sysio_init() { int err; #ifdef WITH_SOCKETS - int _sysio_sockets_init(void); + extern int _sysio_sockets_init(void); #endif err = _sysio_ioctx_init(); @@ -137,6 +153,97 @@ _sysio_shutdown() #endif } +#if SYSIO_TRACING + +#if !(defined(_HAVE_ASPRINTF) && _HAVE_ASPRINTF) +/* + * Print a string to allocated memory. + */ +int +vasprintf(char **strp, const char *fmt, va_list ap) +{ + size_t siz; + char *s; + va_list aq; + int n; + + siz = 50; + if (!(s = malloc(siz))) + return -1; + for (;;) { + va_copy(aq, ap); + n = vsnprintf (s, siz, fmt, aq); + va_end(aq); + if (n > -1 && (size_t )n < siz) + break; + if (n > -1) /* glibc 2.1 */ + siz = n+1; /* precise */ + else /* glibc 2.0 */ + siz *= 2; /* twice the old */ + if (!(s = realloc (s, siz))) + break; + } + *strp = s; + return n; +} + +int +asprintf(char **strp, const char *fmt, ...) +{ + va_list ap; + int n; + + va_start(ap, fmt); + n = vasprintf(strp, fmt, ap); + va_end(ap); + return n; +} +#endif /* !(defined(_HAVE_ASPRINTF) && _HAVE_ASPRINTF) */ + +static void +_sysio_cwrite(const char *buf, size_t len) +{ + + (void )syscall(SYSIO_SYS_write, STDERR_FILENO, buf, len); +} + +void +_sysio_enter(const char *fname) +{ + int oerrno; + int len; + char *buf; + + oerrno = errno; + do { + len = asprintf(&buf, "+ENTER+ %s\n", fname); + if (len < 0) + break; + _sysio_cwrite(buf, (size_t )len); + free(buf); + } while (0); + errno = oerrno; +} + +void +_sysio_leave(const char *fname) +{ + int oerrno; + int len; + char *buf; + + oerrno = errno; + do { + len = asprintf(&buf, "+LEAVE+ %s\n", fname); + if (len < 0) + break; + _sysio_cwrite(buf, (size_t )len); + free(buf); + } while (0); + errno = oerrno; +} +#endif /* defined(SYSIO_TRACING) */ + /* * (kind of)Duplicates strtok function. * @@ -673,16 +780,14 @@ do_command(char *buf) * commands */ int -_sysio_boot(const char *buf -#if DEFER_INIT_CWD - , const char *path -#endif - ) +_sysio_boot(struct _sysio_boot_ctl *ctl) { + const char *buf; char c, *tok; ssize_t len; int err; + buf = ctl->buf; if (!buf) buf = ""; /* @@ -730,7 +835,10 @@ _sysio_boot(const char *buf #if DEFER_INIT_CWD if (err) return err; - _sysio_init_cwd = path; + _sysio_init_cwd = ctl->path; +#endif +#if SYSIO_TRACING + _sysio_tracing = ctl->tracing; #endif return err; } |
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-18 13:00:57
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26352/include Modified Files: sysio-cmn.h sysio.h 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: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- sysio-cmn.h 25 Oct 2004 14:29:16 -0000 1.1 +++ sysio-cmn.h 18 Nov 2004 13:00:45 -0000 1.2 @@ -147,19 +147,17 @@ struct iovec; } while(0) /* Interface enter/leave hook functions */ -#if 0 -extern void _sysio_sysenter(); -extern void _sysio_sysleave(); +#if SYSIO_TRACING +extern int _sysio_tracing; + +extern void _sysio_enter(const char *fname); +extern void _sysio_leave(const char *fname); #define SYSIO_ENTER \ - do { \ - _sysio_sysenter(); \ - } while(0) + if (_sysio_tracing) _sysio_enter(__func__) #define SYSIO_LEAVE \ - do { \ - _sysio_sysleave(); \ - } while(0) + if (_sysio_tracing) _sysio_leave(__func__) #else #define SYSIO_ENTER #define SYSIO_LEAVE Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -b -B -p -r1.28 -r1.29 --- sysio.h 25 Oct 2004 14:29:16 -0000 1.28 +++ sysio.h 18 Nov 2004 13:00:45 -0000 1.29 @@ -113,11 +113,18 @@ extern mode_t _sysio_umask; extern int _sysio_init(void); extern void _sysio_shutdown(void); + +struct _sysio_boot_ctl { + const char *buf; #if DEFER_INIT_CWD -extern int _sysio_boot(const char *buf, const char *path); -#else -extern int _sysio_boot(const char *buf); + const char *path; +#endif +#if SYSIO_TRACING + int tracing; #endif +}; + +extern int _sysio_boot(struct _sysio_boot_ctl *ctl); /* * Option-value pair information. |
From: Lee W. <lw...@us...> - 2004-11-18 13:00:56
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26352 Modified Files: Rules.make configure.in 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: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- Rules.make 14 Oct 2004 14:59:27 -0000 1.9 +++ Rules.make 18 Nov 2004 13:00:44 -0000 1.10 @@ -15,5 +14,6 @@ DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) AM_CPPFLAGS = \ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=600 \ + $(TRACING) \ $(AUTOMOUNT) $(ZERO_SUM_MEMORY) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ $(DEFER_INIT_CWD) -I$(top_srcdir)/include Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- configure.in 14 Oct 2004 14:59:28 -0000 1.18 +++ configure.in 18 Nov 2004 13:00:44 -0000 1.19 @@ -112,6 +112,17 @@ AC_ARG_WITH(defer-init-cwd, [with_defer_init_cwd=no]) AC_SUBST(DEFER_INIT_CWD) +AC_ARG_WITH(tracing, + AC_HELP_STRING([--with-tracing], + [enable tracing support]), + [ case "${withval}" in + yes) TRACING=-DSYSIO_TRACING=${withval} ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;; + esac], + [TRACING=-DSYSIO_TRACING=1]) +AC_SUBST(TRACING) + AC_ARG_WITH(cplant_yod, AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]), [ case "${withval}" in |
From: Lee W. <lw...@us...> - 2004-10-25 14:29:25
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32050/src Modified Files: ioctx.c module.mk Added Files: reconcile.c Log Message: Split ioctx.c into ioctx.c and reconcile.c and sysio.h into sysio.h and sysio-cmn.h in order to enable support for the linux SYSIO extensions library build. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2004 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #include <stdlib.h> #include <string.h> #include <errno.h> #include <assert.h> #include <sys/uio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" #include "xtio.h" /* * Extent-vector IO support. */ /* * Arguments to IO vector enumerator callback when used by _sysio_doio(). */ struct doio_helper_args { ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *); /* base func */ void *arg; /* caller arg */ }; /* * General help validating strided-IO vectors. * * A driver may call this to make sure underflow/overflow of an off_t can't * occur and overflow of a ssize_t can't occur when writing. The sum * of the reconciled transfer length is returned or some appropriate * error depending on underflow/overflow. * * The following algorithm assumes: * * a) sizeof(size_t) >= sizeof(ssize_t) * b) 2's complement arithmetic * c) The compiler won't optimize away code because it's developers * believed that something with an undefined result in `C' can't happen. */ ssize_t _sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, _SYSIO_OFF_T limit) { ssize_t acc, cc; struct iovec iovec; struct intnl_xtvec xtvec; _SYSIO_OFF_T off; if (!(xtvlen && iovlen)) return -EINVAL; acc = 0; xtvec.xtv_len = iovec.iov_len = 0; do { while (!xtvec.xtv_len) { if (!xtvlen--) break; if (!xtv->xtv_len) { xtv++; continue; } xtvec = *xtv++; if (xtvec.xtv_off < 0) return -EINVAL; } if (!xtvec.xtv_len) break; do { while (!iovec.iov_len) { if (!iovlen--) break; if (!iov->iov_len) { iov++; continue; } iovec = *iov++; } if (!iovec.iov_len) break; cc = iovec.iov_len; if (cc < 0) return -EINVAL; if ((size_t )cc > xtvec.xtv_len) cc = xtvec.xtv_len; xtvec.xtv_len -= cc; iovec.iov_len -= cc; off = xtvec.xtv_off + cc; if (xtvec.xtv_off && off <= xtvec.xtv_off) return off < 0 ? -EINVAL : -EOVERFLOW; if (off > limit) return -EFBIG; xtvec.xtv_off = off; cc += acc; if (acc && (cc <= acc)) return -EINVAL; acc = cc; } while (xtvec.xtv_len && iovlen); } while ((xtvlen || xtvec.xtv_len) && iovlen); return acc; } /* */ ssize_t _sysio_enumerate_extents(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, ssize_t (*f)(const struct iovec *, int, _SYSIO_OFF_T, ssize_t, void *), void *arg) { ssize_t acc, tmp, cc; struct iovec iovec; struct intnl_xtvec xtvec; const struct iovec *start; _SYSIO_OFF_T off; size_t n; size_t remain; acc = 0; iovec.iov_len = 0; while (xtvlen) { /* * Coalesce contiguous extent vector entries. */ off = xtvec.xtv_off = xtv->xtv_off; off += xtvec.xtv_len = xtv->xtv_len; while (++xtv, --xtvlen) { if (off != xtv->xtv_off) { /* * Not contiguous. */ break; } if (!xtv->xtv_len) { /* * Zero length. */ continue; } off += xtv->xtv_len; xtvec.xtv_len += xtv->xtv_len; } while (xtvec.xtv_len) { if (iovec.iov_len) { tmp = iovec.iov_len; if (iovec.iov_len > xtvec.xtv_len) iovec.iov_len = xtvec.xtv_len; cc = (*f)(&iovec, 1, xtvec.xtv_off, xtvec.xtv_len, arg); if (cc <= 0) { if (acc) return acc; return cc; } iovec.iov_base = (char *)iovec.iov_base + cc; iovec.iov_len = tmp - cc; tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ acc = tmp; } else if (iovlen) { start = iov; n = xtvec.xtv_len; do { if (iov->iov_len > n) { /* * That'll do. */ break; } n -= iov->iov_len; iov++; } while (--iovlen); if (iov == start) { iovec = *iov++; iovlen--; continue; } remain = xtvec.xtv_len - n; cc = (*f)(start, iov - start, xtvec.xtv_off, remain, arg); if (cc <= 0) { if (acc) return acc; return cc; } tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ acc = tmp; remain -= cc; if (remain) return acc; /* short */ } else return acc; /* short out */ xtvec.xtv_off += cc; xtvec.xtv_len -= cc; } } return acc; } ssize_t _sysio_enumerate_iovec(const struct iovec *iov, size_t count, _SYSIO_OFF_T off, ssize_t limit, ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), void *arg) { ssize_t acc, cc; size_t n; unsigned indx; size_t remain; if (!count) return -EINVAL; assert(limit >= 0); acc = 0; n = limit; for (indx = 0; n && indx < count; indx++) { if (iov[indx].iov_len < n) { cc = (ssize_t )iov[indx].iov_len; if (cc < 0) return -EINVAL; } else cc = (ssize_t )n; if (!cc) continue; n -= cc; cc += acc; if (acc && cc <= acc) return -EINVAL; acc = cc; } if (!acc) return 0; acc = 0; do { if (!iov->iov_len) { iov++; continue; } n = iov->iov_len < (size_t )limit ? iov->iov_len : (size_t )limit; cc = (*f)(iov->iov_base, n, off, arg); if (cc <= 0) { if (acc) return acc; return cc; } off += cc; limit -= cc; remain = iov->iov_len - cc; cc += acc; if (acc && cc <= acc) abort(); /* bad driver! */ acc = cc; if (remain || !limit) break; /* short/limited read */ iov++; } while (--count); return acc; } static ssize_t _sysio_doio_helper(const struct iovec *iov, int count, _SYSIO_OFF_T off, ssize_t limit, struct doio_helper_args *args) { return _sysio_enumerate_iovec(iov, count, off, limit, args->f, args->arg); } /* * A meta-driver for the whole strided-io process. Appropriate when * the driver can't handle anything but simple p{read,write}-like * interface. */ ssize_t _sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), void *arg) { struct doio_helper_args arguments; arguments.f = f; arguments.arg = arg; return _sysio_enumerate_extents(xtv, xtvlen, iov, iovlen, (ssize_t (*)(const struct iovec *, int, _SYSIO_OFF_T, ssize_t, void *))_sysio_doio_helper, &arguments); } Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- ioctx.c 21 Sep 2004 16:18:31 -0000 1.20 +++ ioctx.c 25 Oct 2004 14:29:16 -0000 1.21 @@ -65,14 +64,6 @@ */ /* - * Arguments to IO vector enumerator callback when used by _sysio_doio(). - */ -struct doio_helper_args { - ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *); /* base func */ - void *arg; /* caller arg */ -}; - -/* * List of all outstanding (in-flight) asynch IO requests tracked * by the system. */ @@ -260,293 +251,3 @@ _sysio_ioctx_complete(struct ioctx *ioct free(ioctx); } - -/* - * General help validating strided-IO vectors. - * - * A driver may call this to make sure underflow/overflow of an off_t can't - * occur and overflow of a ssize_t can't occur when writing. The sum - * of the reconciled transfer length is returned or some appropriate - * error depending on underflow/overflow. - * - * The following algorithm assumes: - * - * a) sizeof(size_t) >= sizeof(ssize_t) - * b) 2's complement arithmetic - * c) The compiler won't optimize away code because it's developers - * believed that something with an undefined result in `C' can't happen. - */ -ssize_t -_sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - _SYSIO_OFF_T limit) -{ - ssize_t acc, cc; - struct iovec iovec; - struct intnl_xtvec xtvec; - _SYSIO_OFF_T off; - - if (!(xtvlen && iovlen)) - return -EINVAL; - - acc = 0; - xtvec.xtv_len = iovec.iov_len = 0; - do { - while (!xtvec.xtv_len) { - if (!xtvlen--) - break; - if (!xtv->xtv_len) { - xtv++; - continue; - } - xtvec = *xtv++; - if (xtvec.xtv_off < 0) - return -EINVAL; - } - if (!xtvec.xtv_len) - break; - do { - while (!iovec.iov_len) { - if (!iovlen--) - break; - if (!iov->iov_len) { - iov++; - continue; - } - iovec = *iov++; - } - if (!iovec.iov_len) - break; - cc = iovec.iov_len; - if (cc < 0) - return -EINVAL; - if ((size_t )cc > xtvec.xtv_len) - cc = xtvec.xtv_len; - xtvec.xtv_len -= cc; - iovec.iov_len -= cc; - off = xtvec.xtv_off + cc; - if (xtvec.xtv_off && off <= xtvec.xtv_off) - return off < 0 ? -EINVAL : -EOVERFLOW; - if (off > limit) - return -EFBIG; - xtvec.xtv_off = off; - cc += acc; - if (acc && (cc <= acc)) - return -EINVAL; - acc = cc; - } while (xtvec.xtv_len && iovlen); - } while ((xtvlen || xtvec.xtv_len) && iovlen); - return acc; -} - -/* - */ -ssize_t -_sysio_enumerate_extents(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - ssize_t (*f)(const struct iovec *, int, - _SYSIO_OFF_T, - ssize_t, - void *), - void *arg) -{ - ssize_t acc, tmp, cc; - struct iovec iovec; - struct intnl_xtvec xtvec; - const struct iovec *start; - _SYSIO_OFF_T off; - size_t n; - size_t remain; - - acc = 0; - iovec.iov_len = 0; - while (xtvlen) { - /* - * Coalesce contiguous extent vector entries. - */ - off = xtvec.xtv_off = xtv->xtv_off; - off += xtvec.xtv_len = xtv->xtv_len; - while (++xtv, --xtvlen) { - if (off != xtv->xtv_off) { - /* - * Not contiguous. - */ - break; - } - if (!xtv->xtv_len) { - /* - * Zero length. - */ - continue; - } - off += xtv->xtv_len; - xtvec.xtv_len += xtv->xtv_len; - } - while (xtvec.xtv_len) { - if (iovec.iov_len) { - tmp = iovec.iov_len; - if (iovec.iov_len > xtvec.xtv_len) - iovec.iov_len = xtvec.xtv_len; - cc = - (*f)(&iovec, 1, - xtvec.xtv_off, - xtvec.xtv_len, - arg); - if (cc <= 0) { - if (acc) - return acc; - return cc; - } - iovec.iov_base = (char *)iovec.iov_base + cc; - iovec.iov_len = tmp - cc; - tmp = cc + acc; - if (acc && tmp <= acc) - abort(); /* paranoia */ - acc = tmp; - } else if (iovlen) { - start = iov; - n = xtvec.xtv_len; - do { - if (iov->iov_len > n) { - /* - * That'll do. - */ - break; - } - n -= iov->iov_len; - iov++; - } while (--iovlen); - if (iov == start) { - iovec = *iov++; - iovlen--; - continue; - } - remain = xtvec.xtv_len - n; - cc = - (*f)(start, iov - start, - xtvec.xtv_off, - remain, - arg); - if (cc <= 0) { - if (acc) - return acc; - return cc; - } - - tmp = cc + acc; - if (acc && tmp <= acc) - abort(); /* paranoia */ - acc = tmp; - - remain -= cc; - if (remain) - return acc; /* short */ - } else - return acc; /* short out */ - xtvec.xtv_off += cc; - xtvec.xtv_len -= cc; - } - } - return acc; -} - -ssize_t -_sysio_enumerate_iovec(const struct iovec *iov, size_t count, - _SYSIO_OFF_T off, - ssize_t limit, - ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), - void *arg) -{ - ssize_t acc, cc; - size_t n; - unsigned indx; - size_t remain; - - if (!count) - return -EINVAL; - assert(limit >= 0); - acc = 0; - n = limit; - for (indx = 0; n && indx < count; indx++) { - if (iov[indx].iov_len < n) { - cc = (ssize_t )iov[indx].iov_len; - if (cc < 0) - return -EINVAL; - } else - cc = (ssize_t )n; - if (!cc) - continue; - n -= cc; - cc += acc; - if (acc && cc <= acc) - return -EINVAL; - acc = cc; - } - if (!acc) - return 0; - acc = 0; - do { - if (!iov->iov_len) { - iov++; - continue; - } - n = - iov->iov_len < (size_t )limit - ? iov->iov_len - : (size_t )limit; - cc = (*f)(iov->iov_base, n, off, arg); - if (cc <= 0) { - if (acc) - return acc; - return cc; - } - off += cc; - limit -= cc; - remain = iov->iov_len - cc; - cc += acc; - if (acc && cc <= acc) - abort(); /* bad driver! */ - acc = cc; - if (remain || !limit) - break; /* short/limited read */ - iov++; - } while (--count); - return acc; -} - -static ssize_t -_sysio_doio_helper(const struct iovec *iov, int count, - _SYSIO_OFF_T off, - ssize_t limit, - struct doio_helper_args *args) -{ - - return _sysio_enumerate_iovec(iov, count, - off, limit, - args->f, - args->arg); -} - -/* - * A meta-driver for the whole strided-io process. Appropriate when - * the driver can't handle anything but simple p{read,write}-like - * interface. - */ -ssize_t -_sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), - void *arg) -{ - struct doio_helper_args arguments; - - arguments.f = f; - arguments.arg = arg; - return _sysio_enumerate_extents(xtv, xtvlen, - iov, iovlen, - (ssize_t (*)(const struct iovec *, int, - _SYSIO_OFF_T, - ssize_t, - void *))_sysio_doio_helper, - &arguments); -} Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/module.mk,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- module.mk 30 Aug 2004 15:58:00 -0000 1.9 +++ module.mk 25 Oct 2004 14:29:16 -0000 1.10 @@ -22,7 +22,7 @@ SRCDIR_SRCS = src/access.c src/chdir.c s src/ioctl.c src/ioctx.c src/iowait.c \ src/link.c src/lseek.c src/mkdir.c \ src/mknod.c src/mount.c src/namei.c \ - src/open.c src/rw.c src/rename.c \ + src/open.c src/rw.c src/reconcile.c src/rename.c \ src/rmdir.c src/stat64.c src/stat.c \ src/stddir.c src/readdir.c src/readdir64.c \ src/symlink.c src/readlink.c \ |
From: Lee W. <lw...@us...> - 2004-10-25 14:29:25
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32050/include Modified Files: inode.h sysio.h Added Files: sysio-cmn.h Log Message: Split ioctx.c into ioctx.c and reconcile.c and sysio.h into sysio.h and sysio-cmn.h in order to enable support for the linux SYSIO extensions library build. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2004 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ /* * System IO common information. */ #if !defined(__IS_UNUSED) && defined(__GNUC__) #define __IS_UNUSED __attribute__ ((unused)) #else #define __IS_UNUSED #endif #ifndef _LARGEFILE64_SOURCE /* * Not glibc I guess. Define this ourselves. */ #define _LARGEFILE64_SOURCE 0 #endif /* * Define internal file-offset type and it's maximum value. */ #if _LARGEFILE64_SOURCE #define _SYSIO_OFF_T off64_t #ifdef LLONG_MAX #define _SYSIO_OFF_T_MAX (LLONG_MAX) #else /* * Don't have LLONG_MAX before C99. We'll need to define it ourselves. */ #define _SYSIO_OFF_T_MAX (9223372036854775807LL) #endif #else #define _SYSIO_OFF_T off_t #define _SYSIO_OFF_T_MAX LONG_MAX #endif /* * Internally, all file status is carried in the 64-bit capable * structure. */ #if _LARGEFILE64_SOURCE #define intnl_xtvec xtvec64 #else #define intnl_xtvec xtvec #endif struct intnl_xtvec; struct iovec; /* * SYSIO name label macros */ #define XPREPEND(p,x) p ## x #define PREPEND(p,x) XPREPEND(p,x) #define SYSIO_LABEL_NAMES 0 #if SYSIO_LABEL_NAMES #define SYSIO_INTERFACE_NAME(x) PREPEND(sysio__, x) #else #define SYSIO_INTERFACE_NAME(x) x #endif /* for debugging */ #if 0 #define ASSERT(cond) \ if (!(cond)) { \ printf("ASSERTION(" #cond ") failed: " __FILE__ ":" \ __FUNCTION__ ":%d\n", __LINE__); \ abort(); \ } #define ERROR(fmt, a...) \ do { \ printf("ERROR(" __FILE__ ":%d):" fmt, __LINE__, ##a); \ while(0) #else #define ERROR(fmt) do{}while(0) #define ASSERT do{}while(0) #endif /* * SYSIO interface frame macros * * + DISPLAY_BLOCK; Allocates storage on the stack for use by the set of * macros. * + ENTER; Performs entry point work * + RETURN; Returns a value and performs exit point work * * NB: For RETURN, the arguments are the return value and value for errno. * If the value for errno is non-zero then that value, *negated*, is set * into errno. */ #define SYSIO_INTERFACE_DISPLAY_BLOCK \ int _saved_errno; #define SYSIO_INTERFACE_ENTER \ do { \ _saved_errno = errno; \ SYSIO_ENTER; \ } while (0) #define SYSIO_INTERFACE_RETURN(rtn, err) \ do { \ SYSIO_LEAVE; \ errno = (err) ? -(err) : _saved_errno; \ return (rtn); \ } while(0) /* Interface enter/leave hook functions */ #if 0 extern void _sysio_sysenter(); extern void _sysio_sysleave(); #define SYSIO_ENTER \ do { \ _sysio_sysenter(); \ } while(0) #define SYSIO_LEAVE \ do { \ _sysio_sysleave(); \ } while(0) #else #define SYSIO_ENTER #define SYSIO_LEAVE #endif /* accounting for IO stats read and write char count */ #if defined(REDSTORM) #define _SYSIO_UPDACCT(w, cc) \ do { \ if ((cc) < 0) \ break; \ if (!w) \ _add_iostats(0, (size_t )(cc)); \ else \ _add_iostats((size_t )(cc), 0); \ } while(0) #else #define _SYSIO_UPDACCT(w, cc) #endif extern ssize_t _sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, _SYSIO_OFF_T limit); extern ssize_t _sysio_enumerate_extents(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, ssize_t (*f)(const struct iovec *, int, _SYSIO_OFF_T, ssize_t, void *), void *arg); extern ssize_t _sysio_enumerate_iovec(const struct iovec *iov, size_t count, _SYSIO_OFF_T off, ssize_t limit, ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), void *arg); extern ssize_t _sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, const struct iovec *iov, size_t iovlen, ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), void *arg); Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- inode.h 21 Sep 2004 16:18:30 -0000 1.22 +++ inode.h 25 Oct 2004 14:29:16 -0000 1.23 @@ -485,30 +485,4 @@ extern void _sysio_ioctx_cb_free(struct extern struct ioctx *_sysio_ioctx_find(void *id); extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx); extern void _sysio_ioctx_complete(struct ioctx *ioctx); -extern ssize_t _sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - _SYSIO_OFF_T limit); -extern ssize_t _sysio_enumerate_extents(const struct intnl_xtvec *xtv, - size_t xtvlen, - const struct iovec *iov, - size_t iovlen, - ssize_t (*f)(const struct iovec *, - int, - _SYSIO_OFF_T, - ssize_t, - void *), - void *arg); -extern ssize_t _sysio_enumerate_iovec(const struct iovec *iov, - size_t count, - _SYSIO_OFF_T off, - ssize_t limit, - ssize_t (*f)(void *, - size_t, - _SYSIO_OFF_T, - void *), - void *arg); -extern ssize_t _sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), - void *arg); extern int _sysio_open(struct pnode *pno, int flags, mode_t mode); Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- sysio.h 14 Oct 2004 14:59:28 -0000 1.27 +++ sysio.h 25 Oct 2004 14:29:16 -0000 1.28 @@ -48,11 +48,7 @@ #include <limits.h> #include <stdarg.h> -#if !defined(__IS_UNUSED) && defined(__GNUC__) -#define __IS_UNUSED __attribute__ ((unused)) -#else -#define __IS_UNUSED -#endif +#include "sysio-cmn.h" #ifndef PATH_SEPARATOR /* @@ -68,31 +64,6 @@ #define MAX_SYMLINK 250 #endif -#ifndef _LARGEFILE64_SOURCE -/* - * Not glibc I guess. Define this ourselves. - */ -#define _LARGEFILE64_SOURCE 0 -#endif - -/* - * Define internal file-offset type and it's maximum value. - */ -#if _LARGEFILE64_SOURCE -#define _SYSIO_OFF_T off64_t -#ifdef LLONG_MAX -#define _SYSIO_OFF_T_MAX (LLONG_MAX) -#else -/* - * Don't have LLONG_MAX before C99. We'll need to define it ourselves. - */ -#define _SYSIO_OFF_T_MAX (9223372036854775807LL) -#endif -#else -#define _SYSIO_OFF_T off_t -#define _SYSIO_OFF_T_MAX LONG_MAX -#endif - /* * Internally, all directory entries are carried in the 64-bit capable * structure. @@ -126,19 +97,6 @@ struct statvfs; struct intnl_statvfs; #endif -/* - * Internally, all file status is carried in the 64-bit capable - * structure. - */ -#if _LARGEFILE64_SOURCE -#define intnl_xtvec xtvec64 -#else -#define intnl_xtvec xtvec -#endif -struct intnl_xtvec; - -struct iovec; - struct utimbuf; struct intnl_stat; @@ -181,18 +139,6 @@ extern char * _sysio_get_args(char *buf, extern time_t _sysio_local_time(void); /* - * SYSIO name label macros - */ -#define XPREPEND(p,x) p ## x -#define PREPEND(p,x) XPREPEND(p,x) -#define SYSIO_LABEL_NAMES 0 -#if SYSIO_LABEL_NAMES -#define SYSIO_INTERFACE_NAME(x) PREPEND(sysio__, x) -#else -#define SYSIO_INTERFACE_NAME(x) x -#endif - -/* * The following should be defined by the system includes, and probably are, * but it's not illegal to have multiple externs, so long as they are the * same. It helps when building the library in a standalone fashion. @@ -283,83 +229,3 @@ extern int SYSIO_INTERFACE_NAME(mount)(c unsigned long mountflags, const void *data); extern int SYSIO_INTERFACE_NAME(umount)(const char *target); - -/* for debugging */ -#if 0 -#define ASSERT(cond) \ - if (!(cond)) { \ - printf("ASSERTION(" #cond ") failed: " __FILE__ ":" \ - __FUNCTION__ ":%d\n", __LINE__); \ - abort(); \ - } - -#define ERROR(fmt, a...) \ - do { \ - printf("ERROR(" __FILE__ ":%d):" fmt, __LINE__, ##a); \ - while(0) - -#else -#define ERROR(fmt) do{}while(0) -#define ASSERT do{}while(0) -#endif - -/* - * SYSIO interface frame macros - * - * + DISPLAY_BLOCK; Allocates storage on the stack for use by the set of - * macros. - * + ENTER; Performs entry point work - * + RETURN; Returns a value and performs exit point work - * - * NB: For RETURN, the arguments are the return value and value for errno. - * If the value for errno is non-zero then that value, *negated*, is set - * into errno. - */ -#define SYSIO_INTERFACE_DISPLAY_BLOCK \ - int _saved_errno; -#define SYSIO_INTERFACE_ENTER \ - do { \ - _saved_errno = errno; \ - SYSIO_ENTER; \ - } while (0) -#define SYSIO_INTERFACE_RETURN(rtn, err) \ - do { \ - SYSIO_LEAVE; \ - errno = (err) ? -(err) : _saved_errno; \ - return (rtn); \ - } while(0) - -/* Interface enter/leave hook functions */ -#if 0 -extern void _sysio_sysenter(); -extern void _sysio_sysleave(); - -#define SYSIO_ENTER \ - do { \ - _sysio_sysenter(); \ - } while(0) - -#define SYSIO_LEAVE \ - do { \ - _sysio_sysleave(); \ - } while(0) -#else -#define SYSIO_ENTER -#define SYSIO_LEAVE - -#endif - -/* accounting for IO stats read and write char count */ -#if defined(REDSTORM) -#define _SYSIO_UPDACCT(w, cc) \ - do { \ - if ((cc) < 0) \ - break; \ - if (!w) \ - _add_iostats(0, (size_t )(cc)); \ - else \ - _add_iostats((size_t )(cc), 0); \ - } while(0) -#else -#define _SYSIO_UPDACCT(w, cc) -#endif |
From: Lee W. <lw...@us...> - 2004-10-24 20:53:56
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16408/tests Modified Files: Makefile.am Log Message: The changes to internalize the initialization of the sockets driver means the, similar, init in the test code was redundant. That's fatal. Fixed with this mod. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- Makefile.am 14 Oct 2004 14:59:29 -0000 1.21 +++ Makefile.am 24 Oct 2004 20:53:46 -0000 1.22 @@ -28,16 +28,8 @@ YOD_DRIVER_NAME= YOD_DRIVER_CFLAGS= endif -if WITH_SOCKETS_DRIVER -SOCKETS_DRIVER_NAME=sockets -SOCKETS_DRIVER_CFLAGS= -I$(top_srcdir)/drivers/sockets -else -SOCKETS_DRIVER_NAME= -SOCKETS_DRIVER_CFLAGS= -endif - DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) \ - $(STFD_DEV_NAME) $(SOCKETS_DRIVER_NAME) + $(STFD_DEV_NAME) CMNSRC=startup.c drv_init_all.c drv_data.c |
From: Lee W. <lw...@us...> - 2004-10-24 20:41:29
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722 Modified Files: init.c Log Message: Changes from Kevin Pedretti to internalize the initialization of the sockets driver when --with-sockets is supplied. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- init.c 14 Oct 2004 14:59:29 -0000 1.15 +++ init.c 24 Oct 2004 20:41:19 -0000 1.16 @@ -80,6 +80,9 @@ int _sysio_init() { int err; +#ifdef WITH_SOCKETS + int _sysio_sockets_init(void); +#endif err = _sysio_ioctx_init(); if (err) @@ -99,6 +102,11 @@ _sysio_init() if (err) goto error; #endif +#ifdef WITH_SOCKETS + err = _sysio_sockets_init(); + if (err) + goto error; +#endif goto out; error: |
From: Lee W. <lw...@us...> - 2004-10-19 22:24:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9909 Modified Files: mount.c Log Message: Added the tiniest bit of paranoia to _sysio_do_mount. Basically, just want to make sure we aren't somehow, strangely, mounting on a pnode that is already mounted on. I can't see how this could happen but I like explicit failures instead of weird behavior. Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- mount.c 19 Oct 2004 15:32:38 -0000 1.19 +++ mount.c 19 Oct 2004 22:23:50 -0000 1.20 @@ -187,6 +187,7 @@ _sysio_do_mount(struct filesys *fs, */ mnt->mnt_covers = tocover = mnt->mnt_root; } + assert(!tocover->p_cover); tocover->p_cover = mnt->mnt_root; LIST_INSERT_HEAD(&mounts, mnt, mnt_link); |
From: Lee W. <lw...@us...> - 2004-10-19 15:32:57
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31126/src Modified Files: mount.c Log Message: Added a pseudo-filesystem that allows the mounting of a sub-tree of the namespace onto another place. This is similar to Linux's "bind" mounts. One cannot mount into the same tree. In other words, neither the source nor the target may appear as an ancestor of the other. The FS type name is "sub". Example: mount("/vol/lustre/home", "/home", "sub", 0, NULL); Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- mount.c 14 Oct 2004 14:59:29 -0000 1.18 +++ mount.c 19 Oct 2004 15:32:38 -0000 1.19 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-2004 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -76,18 +76,36 @@ struct qstr _sysio_mount_file_name = { " */ static LIST_HEAD(, mount) mounts; +static int _sysio_sub_fsswop_mount(const char *source, + unsigned flags, + const void *data, + struct pnode *tocover, + struct mount **mntp); + +static struct fssw_ops _sysio_sub_fssw_ops = { + _sysio_sub_fsswop_mount +}; + /* * Initialization. Must be called before any other routine in this module. */ int _sysio_mount_init() { + int err; LIST_INIT(&mounts); #ifdef AUTOMOUNT_FILE_NAME _sysio_next_component(AUTOMOUNT_FILE_NAME, &_sysio_mount_file_name); #endif + /* + * Register the sub-trees "file system" driver. + */ + err = _sysio_fssw_register("sub", &_sysio_sub_fssw_ops); + if (err) + return err; + return 0; } @@ -421,6 +439,52 @@ _sysio_unmount_all() return err; } +static int +_sysio_sub_fsswop_mount(const char *source, + unsigned flags, + const void *data __IS_UNUSED, + struct pnode *tocover, + struct mount **mntp) +{ + int err; + struct nameidata nameidata; + struct mount *mnt; + + /* + * How can we make a sub-mount from nothing? + */ + if (!_sysio_root) + return -EBUSY; + + /* + * Lookup the source. + */ + ND_INIT(&nameidata, 0, source, _sysio_root, NULL); + err = _sysio_path_walk(_sysio_root, &nameidata); + if (err) + return err; + + /* + * Mount the rooted sub-tree at the given position. + */ + err = + _sysio_do_mount(nameidata.nd_pno->p_mount->mnt_fs, + nameidata.nd_pno->p_base, + nameidata.nd_pno->p_mount->mnt_flags & flags, + tocover, + &mnt); + + /* + * Clean up and return. + */ + if (!err) { + FS_REF(nameidata.nd_pno->p_mount->mnt_fs); + *mntp = mnt; + } + P_RELE(nameidata.nd_pno); + return err; +} + #ifdef AUTOMOUNT_FILE_NAME /* * Parse automount specification formatted as: |
From: Ruth K. <rk...@us...> - 2004-10-14 16:16:54
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26835 Modified Files: fs_native.c Log Message: fix typo Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -w -b -B -p -r1.52 -r1.53 --- fs_native.c 14 Oct 2004 14:59:28 -0000 1.52 +++ fs_native.c 14 Oct 2004 16:16:45 -0000 1.53 @@ -766,9 +766,9 @@ _ut(const char *path, time_t actime, tim struct timeval tv[2]; tv[0].tv_sec = actime; - tv[0].tv_nsec = 0; + tv[0].tv_usec = 0; tv[1].tv_sec = modtime; - tv[1].tv_nsec = 0; + tv[1].tv_usec = 0; return syscall(SYSIO_SYS_utimes, path, &tv); } #endif |
From: Ruth K. <rk...@us...> - 2004-10-14 15:52:09
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21489/include Modified Files: module.mk Log Message: add native.h to make dist list Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/module.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- module.mk 30 Aug 2004 15:58:00 -0000 1.3 +++ module.mk 14 Oct 2004 15:51:57 -0000 1.4 @@ -1,4 +1,5 @@ INCLUDE_EXTRA = include/dev.h include/file.h include/fs.h \ include/inode.h include/mount.h include/sysio.h \ include/sysio-symbols.h include/cplant-yod.h \ - include/module.mk include/xtio.h include/stddir.h + include/module.mk include/xtio.h include/stddir.h \ + include/native.h |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:49
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/src Modified Files: chdir.c fcntl.c init.c inode.c lseek.c mount.c namei.c readlink.c rename.c stat.c stat64.c utime.c Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- chdir.c 21 Sep 2004 16:18:30 -0000 1.22 +++ chdir.c 14 Oct 2004 14:59:29 -0000 1.23 @@ -79,6 +79,10 @@ #include "file.h" #include "sysio-symbols.h" +#if DEFER_INIT_CWD +const char *_sysio_init_cwd = NULL; +#endif + struct pnode *_sysio_cwd = NULL; /* @@ -238,6 +242,19 @@ SYSIO_INTERFACE_NAME(getcwd)(char *buf, SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; +#if DEFER_INIT_CWD + if (!_sysio_cwd) { + struct pnode *pno; + + /* + * Can no longer defer initialization of the current working + * directory. Force namei to make it happen now. + */ + if (_sysio_namei(NULL, ".", 0, NULL, &pno) != 0) + abort(); + P_RELE(pno); + } +#endif err = _sysio_p_path(_sysio_cwd, &buf, buf ? size : 0); SYSIO_INTERFACE_RETURN(err ? NULL : buf, err); } Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- fcntl.c 5 Aug 2004 18:29:57 -0000 1.21 +++ fcntl.c 14 Oct 2004 14:59:29 -0000 1.22 @@ -55,13 +55,14 @@ #ifdef HAVE_LUSTRE_HACK #include <syscall.h> +#include <native.h> static int _sysio_fcntl(int fd, int cmd, va_list ap, int *rtn) { long arg = va_arg(ap, long); - *rtn = syscall(SYS_fcntl, fd, cmd, arg); + *rtn = syscall(SYSIO_SYS_fcntl, fd, cmd, arg); return *rtn == -1 ? -errno : 0; } #endif Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- init.c 30 Aug 2004 19:06:34 -0000 1.14 +++ init.c 14 Oct 2004 14:59:29 -0000 1.15 @@ -68,16 +68,6 @@ #endif /* - * The namespace assembly buffer passes args with a `name'=`value' - * syntax. We use the following to record that in various - * routines below. - */ -struct named_argument { - const char *name; /* arg name */ - char *value; /* arg value */ -}; - -/* * White space characters. */ #define IGNORE_WHITE " \t\r\n" @@ -90,9 +80,6 @@ int _sysio_init() { int err; -#ifdef WITH_SOCKETS - int _sysio_sockets_init(void); -#endif err = _sysio_ioctx_init(); if (err) @@ -112,11 +99,6 @@ _sysio_init() if (err) goto error; #endif -#ifdef WITH_SOCKETS - err = _sysio_sockets_init(); - if (err) - goto error; -#endif goto out; error: @@ -160,8 +142,8 @@ _sysio_shutdown() * or NUL character is success. * */ -static const char * -get_token(const char *buf, +const char * +_sysio_get_token(const char *buf, int accepts, const char *delim, const char *ignore, @@ -210,15 +192,20 @@ get_token(const char *buf, * * NB: Alters the passed buffer. */ -static char * -get_args(char *buf, struct named_argument *vec) +char * +_sysio_get_args(char *buf, struct option_value_info *vec) { char *nxt; char *name, *value; - struct named_argument *v; + struct option_value_info *v; for (;;) { - nxt = (char *)get_token(buf, 1, "=,", IGNORE_WHITE, name = buf); + nxt = + (char *)_sysio_get_token(buf, + 1, + "=,", + IGNORE_WHITE, + name = buf); if (!nxt || (nxt != buf && *name == '\0' && buf + strlen(buf) == nxt)) { buf = NULL; @@ -226,15 +213,20 @@ get_args(char *buf, struct named_argumen } if (*name == '\0') break; - buf = (char *)get_token(nxt, 1, ",", IGNORE_WHITE, value = nxt); + buf = + (char *)_sysio_get_token(nxt, + 1, + ",", + IGNORE_WHITE, + value = nxt); if (*value == '\0') value = NULL; - for (v = vec; v->name; v++) - if (strcmp(v->name, name) == 0) + for (v = vec; v->ovi_name; v++) + if (strcmp(v->ovi_name, name) == 0) break; - if (!v->name) + if (!v->ovi_name) return NULL; - v->value = value; + v->ovi_value = value; } return buf; @@ -269,7 +261,7 @@ static int do_creat(char *args) { size_t len; - struct named_argument v[] = { + struct option_value_info v[] = { { "ft", NULL }, /* file type */ { "nm", NULL }, /* name */ { "pm", NULL }, /* permissions */ @@ -289,27 +281,27 @@ do_creat(char *args) int err; len = strlen(args); - if (get_args(args, v) - args != (ssize_t )len || - !(v[0].value && - v[1].value && - v[2].value)) + if (_sysio_get_args(args, v) - args != (ssize_t )len || + !(v[0].ovi_value && + v[1].ovi_value && + v[2].ovi_value)) return -EINVAL; - perms = strtol(v[2].value, (char **)&cp, 0); + perms = strtol(v[2].ovi_value, (char **)&cp, 0); if (*cp || perms < 0 || (perms == LONG_MAX && errno == ERANGE) || ((unsigned)perms & ~07777)) return -EINVAL; - if (v[3].value) { - owner = strtol(v[3].value, (char **)&cp, 0); + if (v[3].ovi_value) { + owner = strtol(v[3].ovi_value, (char **)&cp, 0); if (*cp || ((owner == LONG_MIN || owner == LONG_MAX) && errno == ERANGE)) return -EINVAL; } else owner = getuid(); - if (v[4].value) { - group = strtol(v[4].value, (char **)&cp, 0); + if (v[4].ovi_value) { + group = strtol(v[4].ovi_value, (char **)&cp, 0); if (*cp || ((group == LONG_MIN || group == LONG_MAX) && errno == ERANGE)) @@ -321,9 +313,10 @@ do_creat(char *args) return -ENOENT; err = 0; mode = perms; - if (strcmp(v[0].value, "dir") == 0) { + if (strcmp(v[0].ovi_value, "dir") == 0) { INTENT_INIT(&intent, INT_CREAT, &mode, 0); - err = _sysio_namei(dir, v[1].value, ND_NEGOK, &intent, &pno); + err = + _sysio_namei(dir, v[1].ovi_value, ND_NEGOK, &intent, &pno); if (err) return err; if (pno->p_base->pb_ino) @@ -338,12 +331,13 @@ do_creat(char *args) err = (*ino->i_ops.inop_mkdir)(pno, mode); } P_RELE(pno); - } else if (strcmp(v[0].value, "chr") == 0) { - if (!(v[5].value && parse_mm(v[5].value, &dev) == 0)) + } else if (strcmp(v[0].ovi_value, "chr") == 0) { + if (!(v[5].ovi_value && parse_mm(v[5].ovi_value, &dev) == 0)) return -EINVAL; mode |= S_IFCHR; INTENT_INIT(&intent, INT_CREAT, &mode, 0); - err = _sysio_namei(dir, v[1].value, ND_NEGOK, &intent, &pno); + err = + _sysio_namei(dir, v[1].ovi_value, ND_NEGOK, &intent, &pno); if (err) return err; if (pno->p_base->pb_ino) @@ -358,18 +352,19 @@ do_creat(char *args) err = (*ino->i_ops.inop_mknod)(pno, mode, dev); } P_RELE(pno); - } else if (strcmp(v[0].value, "blk") == 0) { + } else if (strcmp(v[0].ovi_value, "blk") == 0) { /* * We don't support block special files yet. */ return -EINVAL; - } else if (strcmp(v[0].value, "file") == 0) { + } else if (strcmp(v[0].ovi_value, "file") == 0) { int i; struct inode *ino; i = O_CREAT|O_EXCL; INTENT_INIT(&intent, INT_CREAT, &mode, &i); - err = _sysio_namei(dir, v[1].value, ND_NEGOK, &intent, &pno); + err = + _sysio_namei(dir, v[1].ovi_value, ND_NEGOK, &intent, &pno); if (err) return err; err = _sysio_open(pno, O_CREAT|O_EXCL, mode); @@ -378,7 +373,7 @@ do_creat(char *args) return err; } ino = pno->p_base->pb_ino; - if (!err && v[6].value) { + if (!err && v[6].ovi_value) { struct iovec iovec; struct intnl_xtvec xtvec; struct ioctx io_context; @@ -386,8 +381,8 @@ do_creat(char *args) /* * Deposit optional file content. */ - iovec.iov_base = v[6].value; - iovec.iov_len = strlen(v[6].value); + iovec.iov_base = v[6].ovi_value; + iovec.iov_len = strlen(v[6].ovi_value); xtvec.xtv_off = 0; xtvec.xtv_len = iovec.iov_len; IOCTX_INIT(&io_context, @@ -430,7 +425,7 @@ static int do_mnt(char *args) { size_t len; - struct named_argument v[] = { + struct option_value_info v[] = { { "dev", NULL }, /* source (type:dev) */ { "dir", NULL }, /* target dir */ { "fl", NULL }, /* flags */ @@ -442,35 +437,46 @@ do_mnt(char *args) struct pnode *dir; len = strlen(args); - if (get_args(args, v) - args != (ssize_t )len || - !(v[0].value && v[1].value)) + if (_sysio_get_args(args, v) - args != (ssize_t )len || + !(v[0].ovi_value && v[1].ovi_value)) return -EINVAL; - ty = (char *)get_token(v[0].value, 1, ":", "", name = v[0].value); + ty = + (char *)_sysio_get_token(v[0].ovi_value, + 1, + ":", + "", + name = v[0].ovi_value); flags = 0; - if (v[2].value) { + if (v[2].ovi_value) { char *cp; /* * Optional flags. */ - flags = strtoul(v[2].value, &cp, 0); + flags = strtoul(v[2].ovi_value, &cp, 0); if (*cp || (flags == ULONG_MAX && errno == ERANGE)) return -EINVAL; } - if (strlen(v[1].value) == 1 && v[1].value[0] == PATH_SEPARATOR) { + if (strlen(v[1].ovi_value) == 1 && v[1].ovi_value[0] == PATH_SEPARATOR) { /* * Aha! It's root they want. Have to do that special. */ - return _sysio_mount_root(ty, name, flags, v[3].value); + return _sysio_mount_root(ty, name, flags, v[3].ovi_value); } if (!(dir = _sysio_cwd) && !(dir = _sysio_root)) return -ENOENT; - return _sysio_mount(dir, ty, v[1].value, name, flags, v[3].value); + return _sysio_mount(dir, + ty, + v[1].ovi_value, + name, + flags, + v[3].ovi_value); } +#if 0 /* * Chdir * @@ -480,7 +486,7 @@ static int do_cd(char *args) { size_t len; - struct named_argument v[] = { + struct option_value_info v[] = { { "dir", NULL }, /* directory */ { NULL, NULL } }; @@ -488,12 +494,12 @@ do_cd(char *args) struct pnode *dir, *pno; len = strlen(args); - if (get_args(args, v) - args != (ssize_t )len || !v[0].value) + if (_sysio_get_args(args, v) - args != (ssize_t )len || !v[0].ovi_value) return -EINVAL; if (!(dir = _sysio_cwd) && !(dir = _sysio_root)) return -ENOENT; - err = _sysio_namei(dir, v[0].value, 0, NULL, &pno); + err = _sysio_namei(dir, v[0].ovi_value, 0, NULL, &pno); if (err) return err; err = _sysio_p_chdir(pno); @@ -501,6 +507,7 @@ do_cd(char *args) P_RELE(pno); return err; } +#endif /* * Does a chmod @@ -511,7 +518,7 @@ static int do_chmd(char *args) { size_t len; - struct named_argument v[] = { + struct option_value_info v[] = { { "src", NULL }, /* path */ { "pm", NULL }, /* perms */ { NULL, NULL } @@ -523,10 +530,10 @@ do_chmd(char *args) struct pnode *dir, *pno; len = strlen(args); - if (get_args(args, v) - args != (ssize_t )len || - !(v[0].value && v[1].value)) + if (_sysio_get_args(args, v) - args != (ssize_t )len || + !(v[0].ovi_value && v[1].ovi_value)) return -EINVAL; - perms = strtol(v[1].value, &cp, 0); + perms = strtol(v[1].ovi_value, &cp, 0); if (*cp || perms < 0 || (perms == LONG_MAX && errno == ERANGE) || @@ -537,7 +544,7 @@ do_chmd(char *args) if (!(dir = _sysio_cwd) && !(dir = _sysio_root)) return -ENOENT; - err = _sysio_namei(dir, v[0].value, 0, NULL, &pno); + err = _sysio_namei(dir, v[0].ovi_value, 0, NULL, &pno); if (err) return err; err = _sysio_setattr(pno, pno->p_base->pb_ino, SETATTR_MODE, &stbuf); @@ -550,7 +557,7 @@ static int do_open(char *args) { size_t len; - struct named_argument v[] = { + struct option_value_info v[] = { { "nm", NULL }, /* path */ { "fd", NULL }, /* fildes */ { "m", NULL }, /* mode */ @@ -578,14 +585,14 @@ do_open(char *args) #endif len = strlen(args); - if (get_args(args, v) - args != (ssize_t )len || - !(v[0].value && v[1].value && v[2].value)) + if (_sysio_get_args(args, v) - args != (ssize_t )len || + !(v[0].ovi_value && v[1].ovi_value && v[2].ovi_value)) return -EINVAL; - l = strtol(v[1].value, (char **)&cp, 0); + l = strtol(v[1].ovi_value, (char **)&cp, 0); if (*cp || l < 0 || _irecheck(l, errno)) return -EINVAL; fd = (int )l; - ul = strtoul(v[1].value, (char **)&cp, 0); + ul = strtoul(v[1].ovi_value, (char **)&cp, 0); if (*cp || (ul == ULONG_MAX && errno == ERANGE)) return -EINVAL; @@ -595,7 +602,7 @@ do_open(char *args) return -ENOENT; INTENT_INIT(&intent, INT_OPEN, &m, NULL); pno = NULL; - err = _sysio_namei(dir, v[0].value, 0, &intent, &pno); + err = _sysio_namei(dir, v[0].ovi_value, 0, &intent, &pno); if (err) return err; fil = NULL; @@ -635,14 +642,16 @@ do_command(char *buf) char *args, *cmd; len = strlen(buf); - args = (char *)get_token(buf, 1, ",", IGNORE_WHITE, cmd = buf); + args = (char *)_sysio_get_token(buf, 1, ",", IGNORE_WHITE, cmd = buf); if (args) { if (strcmp("creat", cmd) == 0) return do_creat(args); if (strcmp("mnt", cmd) == 0) return do_mnt(args); +#if 0 if (strcmp("cd", cmd) == 0) return do_cd(args); +#endif if (strcmp("chmd", cmd) == 0) return do_chmd(args); if (strcmp("open", cmd) == 0) @@ -656,15 +665,23 @@ do_command(char *buf) * commands */ int -_sysio_boot(const char *buf) +_sysio_boot(const char *buf +#if DEFER_INIT_CWD + , const char *path +#endif + ) { char c, *tok; + ssize_t len; int err; + if (!buf) + buf = ""; /* * Allocate token buffer. */ - tok = malloc(strlen(buf)); + len = strlen(buf); + tok = malloc(len ? len : 1); if (!tok) return -ENOMEM; err = 0; @@ -684,7 +701,12 @@ _sysio_boot(const char *buf) /* * Get the command. */ - buf = (char *)get_token(buf + 1, 0, "}", IGNORE_WHITE, tok); + buf = + (char *)_sysio_get_token(buf + 1, + 0, + "}", + IGNORE_WHITE, + tok); if (!buf) { err = -EINVAL; break; @@ -697,5 +719,10 @@ _sysio_boot(const char *buf) break; } free(tok); +#if DEFER_INIT_CWD + if (err) + return err; + _sysio_init_cwd = path; +#endif return err; } Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- inode.c 21 Sep 2004 16:18:31 -0000 1.21 +++ inode.c 14 Oct 2004 14:59:29 -0000 1.22 @@ -323,6 +323,8 @@ void _sysio_i_undead(struct inode *ino) { + if (ino->i_zombie) + return; LIST_REMOVE(ino, i_link); ino->i_zombie = 1; } Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- lseek.c 9 Aug 2004 15:30:06 -0000 1.24 +++ lseek.c 14 Oct 2004 14:59:29 -0000 1.25 @@ -78,6 +78,11 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset { int err; + /* + * Don't blindly trust the attributes + * in the inode record for this. Give the + * driver a chance to refresh them. + */ err = (*fil->f_ino->i_ops.inop_getattr)(NULL, fil->f_ino, @@ -163,7 +168,6 @@ sysio_sym_weak_alias(SYSIO_INTERFACE_NAM PREPEND(__, SYSIO_INTERFACE_NAME(lseek))) #endif -#if 0 #ifdef __linux__ #undef llseek int @@ -173,17 +177,34 @@ SYSIO_INTERFACE_NAME(llseek)(unsigned in loff_t *result __IS_UNUSED, unsigned int whence __IS_UNUSED) { + loff_t off; SYSIO_INTERFACE_DISPLAY_BLOCK; /* - * Something is very wrong if this was called. + * This is just plain goofy. */ SYSIO_INTERFACE_ENTER; - SYSIO_INTERFACE_RETURN(-1, -ENOTSUP); +#if !_LARGEFILE64_SOURCE + if (offset_high) { + /* + * We are using 32-bit internals. This just isn't + * going to work. + */ + SYSIO_INTERFACE_RETURN(-1, -EOVERFLOW); + } +#else + off = offset_high; + off <<= 32; + off |= offset_low; +#endif + off = _sysio_lseek(fd, off, whence); + if (off < 0) + SYSIO_INTERFACE_RETURN((off_t )-1, (int )off); + *result = off; + SYSIO_INTERFACE_RETURN(0, 0); } #undef __llseek sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(llseek), PREPEND(__, SYSIO_INTERFACE_NAME(llseek))) #endif -#endif Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- mount.c 21 Sep 2004 16:18:31 -0000 1.17 +++ mount.c 14 Oct 2004 14:59:29 -0000 1.18 @@ -258,6 +258,7 @@ _sysio_mount_root(const char *source, return err; _sysio_root = mnt->mnt_root; +#if !DEFER_INIT_CWD /* * It is very annoying to have to set the current working directory. * So... If it isn't set, make it the root now. @@ -266,6 +267,7 @@ _sysio_mount_root(const char *source, _sysio_cwd = _sysio_root; P_REF(_sysio_cwd); } +#endif return 0; } @@ -575,7 +577,6 @@ _sysio_automount(struct pnode *mntpno) { int err; struct inode *ino; - struct intnl_stat stbuf; struct iovec iovec; struct ioctx iocontext; struct intnl_xtvec xtvec; @@ -596,24 +597,21 @@ _sysio_automount(struct pnode *mntpno) * Read file content. */ ino = mntpno->p_base->pb_ino; - err = (*ino->i_ops.inop_getattr)(mntpno, ino, &stbuf); - if (err) - return err; - if (stbuf.st_size > 64 * 1024) { + if (ino->i_stbuf.st_size > 64 * 1024) { /* * Let's be reasonable. */ return -EINVAL; } - iovec.iov_base = malloc(stbuf.st_size + 1); + iovec.iov_base = malloc(ino->i_stbuf.st_size + 1); if (!iovec.iov_base) return -ENOMEM; - iovec.iov_len = stbuf.st_size; + iovec.iov_len = ino->i_stbuf.st_size; err = _sysio_open(mntpno, O_RDONLY, 0); if (err) goto out; xtvec.xtv_off = 0; - xtvec.xtv_len = stbuf.st_size; + xtvec.xtv_len = ino->i_stbuf.st_size; IOCTX_INIT(&iocontext, 1, 0, Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- namei.c 21 Sep 2004 16:18:31 -0000 1.15 +++ namei.c 14 Oct 2004 14:59:29 -0000 1.16 @@ -182,6 +182,27 @@ _sysio_path_walk(struct pnode *parent, s parent = nd->nd_root; } +#if DEFER_INIT_CWD + if (!parent) { + const char *icwd; + + if (!_sysio_init_cwd) + abort(); + + /* + * Finally have to set the curretn working directory. We can + * not tolerate errors here or else risk leaving the process + * in a very unexpected location. We abort then unless all goes + * well. + */ + icwd = _sysio_init_cwd; + _sysio_init_cwd = NULL; + if (_sysio_namei(NULL, icwd, 0, NULL, &parent) != 0 || + _sysio_p_chdir(parent) != 0) + abort(); + } +#endif + /* * (Re)Validate the parent. */ Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- readlink.c 10 Sep 2004 16:43:37 -0000 1.5 +++ readlink.c 14 Oct 2004 14:59:29 -0000 1.6 @@ -62,7 +62,6 @@ SYSIO_INTERFACE_NAME(readlink)(const cha int err; struct pnode *pno; struct inode *ino; - struct intnl_stat stbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -71,17 +70,11 @@ SYSIO_INTERFACE_NAME(readlink)(const cha if (err) goto out; ino = pno->p_base->pb_ino; - err = (*ino->i_ops.inop_getattr)(pno, ino, &stbuf); - if (err) - goto error; - if (!S_ISLNK(stbuf.st_mode)) { + if (!S_ISLNK(ino->i_stbuf.st_mode)) { err = -EINVAL; goto error; } err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz); - if (err) - goto error; - error: P_RELE(pno); out: Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- rename.c 26 Aug 2004 09:03:03 -0000 1.9 +++ rename.c 14 Oct 2004 14:59:29 -0000 1.10 @@ -61,7 +61,6 @@ SYSIO_INTERFACE_NAME(rename)(const char int err; struct pnode *old, *new; struct pnode_base *nxtpb, *pb; - struct intnl_stat ostbuf, nstbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -92,16 +91,19 @@ SYSIO_INTERFACE_NAME(rename)(const char if (err) goto error2; + /* + * Don't allow mount points to move. + */ if (old->p_mount->mnt_root == old || old->p_cover || new->p_mount->mnt_root == new) { err = -EBUSY; goto error1; } - if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { /* - * Oops. They're trying to move it across file systems. + * No xdev renames either. */ + if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { err = -EXDEV; goto error1; } @@ -127,40 +129,24 @@ SYSIO_INTERFACE_NAME(rename)(const char if (old->p_base->pb_ino == new->p_base->pb_ino) goto out; - while (new->p_base->pb_ino) { + if (new->p_base->pb_ino) { /* * Existing entry. We're replacing the new. Make sure that's * ok. */ - err = - old->p_base->pb_ino->i_ops.inop_getattr(old, NULL, &ostbuf); - if (err) - goto error1; - err = - new->p_base->pb_ino->i_ops.inop_getattr(new, NULL, &nstbuf); - if (err) { - if (err != ENOENT) - goto error1; - /* - * Rats! It disappeared beneath us. - */ - (void )_sysio_p_validate(new, NULL, NULL); - continue; - } - if (S_ISDIR(nstbuf.st_mode)) { - if (!S_ISDIR(ostbuf.st_mode)) { + if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { + if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { err = -EISDIR; goto error1; } - if (nstbuf.st_nlink > 2) { + if (new->p_base->pb_ino->i_stbuf.st_nlink > 2) { err = -ENOTEMPTY; goto error1; } - } else if (S_ISDIR(ostbuf.st_mode)) { + } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { err = -ENOTDIR; goto error1; } - break; } /* Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- stat.c 27 Jul 2004 15:00:48 -0000 1.16 +++ stat.c 14 Oct 2004 14:59:29 -0000 1.17 @@ -119,6 +119,10 @@ PREPEND(__, SYSIO_INTERFACE_NAME(fxstat) #else buf = __stat_buf; #endif + /* + * Never use the attributes cached in the inode record. Give the + * driver a chance to refresh them. + */ err = fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf); #if _LARGEFILE64_SOURCE @@ -164,10 +168,6 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat)) int err; struct pnode *pno; struct inode *ino; - struct intnl_stat *buf; -#if _LARGEFILE64_SOURCE - struct stat64 st64; -#endif SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -180,22 +180,18 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat)) err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno); if (err) goto out; + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ ino = pno->p_base->pb_ino; #if _LARGEFILE64_SOURCE - buf = &st64; + convstat(&ino->i_stbuf, __stat_buf); #else - buf = __stat_buf; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); #endif - err = - ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - buf); - P_RELE(pno); -#if _LARGEFILE64_SOURCE - if (!err) - convstat(buf, __stat_buf); -#endif out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } @@ -236,10 +232,6 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat) int err; struct pnode *pno; struct inode *ino; - struct intnl_stat *buf; -#if _LARGEFILE64_SOURCE - struct stat64 st64; -#endif SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -252,22 +244,18 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat) err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno); if (err) goto out; + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; #if _LARGEFILE64_SOURCE - buf = &st64; + convstat(&ino->i_stbuf, __stat_buf); #else - buf = __stat_buf; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); #endif - ino = pno->p_base->pb_ino; - err = - ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - buf); - P_RELE(pno); -#if _LARGEFILE64_SOURCE - if (!err) - convstat(buf, __stat_buf); -#endif out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } Index: stat64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- stat64.c 27 Jul 2004 15:00:48 -0000 1.12 +++ stat64.c 14 Oct 2004 14:59:29 -0000 1.13 @@ -43,6 +43,7 @@ #ifdef _LARGEFILE64_SOURCE +#include <string.h> #include <errno.h> #include <assert.h> #include <sys/types.h> @@ -85,6 +86,10 @@ PREPEND(__, SYSIO_INTERFACE_NAME(fxstat6 err = -EBADF; goto out; } + /* + * Never use the attributes cached in the inode record. Give + * the driver a chance to refresh them. + */ err = fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, __stat_buf); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); @@ -107,6 +112,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat64 struct intent intent; int err; struct pnode *pno; + struct inode *ino; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -119,10 +125,13 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat64 err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno); if (err) goto out; - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - __stat_buf); + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); @@ -147,6 +156,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat6 struct intent intent; int err; struct pnode *pno; + struct inode *ino; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -159,10 +169,13 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat6 err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno); if (err) goto out; - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - __stat_buf); + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); Index: utime.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/utime.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- utime.c 27 Jul 2004 15:00:48 -0000 1.6 +++ utime.c 14 Oct 2004 14:59:29 -0000 1.7 @@ -41,6 +41,7 @@ * le...@sa... */ +#include <stdlib.h> #include <string.h> #include <errno.h> #include <time.h> @@ -50,11 +51,22 @@ #include <sys/stat.h> #include <unistd.h> #include <sys/queue.h> +#include <sys/time.h> #include "sysio.h" #include "inode.h" #include "file.h" +time_t +_sysio_local_time() +{ + struct timeval tv; + + if (gettimeofday(&tv, NULL) != 0) + abort(); + return tv.tv_sec; +} + int SYSIO_INTERFACE_NAME(utime)(const char *path, const struct utimbuf *buf) { @@ -69,7 +81,7 @@ SYSIO_INTERFACE_NAME(utime)(const char * if (err) goto out; if (!buf) { - _utbuffer.actime = _utbuffer.modtime = time(NULL); + _utbuffer.actime = _utbuffer.modtime = _SYSIO_LOCAL_TIME(); buf = &_utbuffer; } (void )memset(&stbuf, 0, sizeof(struct intnl_stat)); |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:47
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/tests Modified Files: Makefile.am startup.c test_all.pl Added Files: sysio-run-start.c Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- Makefile.am 30 Aug 2004 15:58:01 -0000 1.20 +++ Makefile.am 14 Oct 2004 14:59:29 -0000 1.21 @@ -115,5 +115,9 @@ drv_data.c: $(CONFIG_DEPENDENCIES) $(top test -z "drv_data.c" && rm -f drv_data.c; \ $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c +lib_LIBRARIES=libruntime.a + +libruntime_a_SOURCES=sysio-run-start.c startup.c drv_init_all.c drv_data.c + AM_CFLAGS = -L$(LIBBUILD_DIR) include $(top_srcdir)/Rules.make Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- startup.c 9 Aug 2004 15:33:03 -0000 1.6 +++ startup.c 14 Oct 2004 14:59:29 -0000 1.7 @@ -13,6 +13,7 @@ int _test_sysio_startup() { int err; + const char *cwd; const char *s; err = _sysio_init(); @@ -22,23 +23,28 @@ _test_sysio_startup() if (err) return err; s = getenv("SYSIO_NAMESPACE"); - if (s) - err = _sysio_boot(s); - else if (!(s = getenv("SYSIO_MANUAL"))) { + if (!(s || (s = getenv("SYSIO_MANUAL")))) { /* * Assume a native mount at root. */ - err = _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + s = "{mnt,dev=\"native:/\",dir=/,fl=0}"; } + cwd = getenv("SYSIO_CWD"); +#if DEFER_INIT_CWD + err = _sysio_boot(s, cwd ? cwd : "/"); +#else + err = _sysio_boot(s); +#endif if (err) return err; - s = getenv("SYSIO_CWD"); - if (s) { +#if !DEFER_INIT_CWD + if (!cwd) + s = "/"; err = chdir(s); if (err) return err; - } +#endif return 0; } Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- test_all.pl 30 Aug 2004 20:28:53 -0000 1.14 +++ test_all.pl 14 Oct 2004 14:59:29 -0000 1.15 @@ -73,6 +73,15 @@ $ENV{$namespace_env} = "\ my $res; if ($use_system == 1) { + # Test for tmp_dir. If it exists, fail + # The tmp_dir should be removed after a successful + # test run, but is kept if anything fails + if (-e "$cwd/tmp_dir") { + print STDERR "ERROR! tmp_dir already exists.\n"; + print STDERR "Need to remove tmp_dir for test to run properly\n"; + exit 1; + } + # Will use this directory... system("mkdir -p $cwd/tmp_dir"); |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:46
|
Update of /cvsroot/libsysio/libsysio/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/misc Modified Files: init-env.sh Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: init-env.sh =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/init-env.sh,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- init-env.sh 24 Jun 2004 19:58:28 -0000 1.5 +++ init-env.sh 14 Oct 2004 14:59:29 -0000 1.6 @@ -34,7 +34,6 @@ export SYSIO_NAMESPACE="\ {open, nm=\"/dev/fd/1\",fd=1,m=1} \ {creat, ft=chr,nm=\"/dev/fd/2\",pm=0200,mm=0+2} \ {open, nm=\"/dev/fd/2\",fd=2,m=1} \ - {cd, dir=\"$HOME\"} \ ${_extras} \ " unset _root_flags |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:45
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/drivers/sockets Modified Files: sockets.c Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: sockets.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/sockets.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- sockets.c 21 Sep 2004 16:18:14 -0000 1.11 +++ sockets.c 14 Oct 2004 14:59:28 -0000 1.12 @@ -59,12 +59,15 @@ #include <sys/fcntl.h> #include <sys/syscall.h> #include <sys/socket.h> +#ifdef __linux__ #include <linux/net.h> +#endif #include <sys/uio.h> #include <sys/queue.h> #include "xtio.h" #include "sysio.h" +#include "native.h" #include "fs.h" #include "inode.h" #include "file.h" @@ -116,7 +119,7 @@ struct filesys_ops sockets_filesys_ops = (void (*)(struct filesys *))sockets_illop }; -static struct filesys *sockets_fs; +static struct filesys *sockets_fs = NULL; static struct inode_ops sockets_i_ops; @@ -127,6 +130,8 @@ int _sysio_sockets_init() { + assert(!sockets_fs); + sockets_i_ops = _sysio_nodev_ops; sockets_i_ops.inop_close = sockets_inop_close; sockets_i_ops.inop_read = sockets_inop_read; @@ -155,7 +160,7 @@ sockets_inop_close(struct inode *ino) if (ski->ski_fd < 0) return -EBADF; - err = syscall(SYS_close, ski->ski_fd); + err = syscall(SYSIO_SYS_close, ski->ski_fd); if (err) return -errno; ski->ski_fd = -1; @@ -206,7 +211,7 @@ static ssize_t _readv(int fd, const struct iovec *vector, int count) { - return syscall(SYS_readv, fd, vector, count); + return syscall(SYSIO_SYS_readv, fd, vector, count); } static int @@ -224,7 +229,7 @@ static ssize_t _writev(int fd, const struct iovec *vector, int count) { - return syscall(SYS_writev, fd, vector, count); + return syscall(SYSIO_SYS_writev, fd, vector, count); } static int @@ -265,7 +270,7 @@ sockets_inop_fcntl(struct inode *ino __I case F_GETFD: case F_GETFL: case F_GETOWN: - *rtn = syscall(SYS_fcntl, I2SKI(ino)->ski_fd, cmd); + *rtn = syscall(SYSIO_SYS_fcntl, I2SKI(ino)->ski_fd, cmd); break; case F_DUPFD: case F_SETFD: @@ -275,7 +280,7 @@ sockets_inop_fcntl(struct inode *ino __I case F_SETLKW: case F_SETOWN: arg = va_arg(ap, long); - *rtn = syscall(SYS_fcntl, I2SKI(ino)->ski_fd, cmd, arg); + *rtn = syscall(SYSIO_SYS_fcntl, I2SKI(ino)->ski_fd, cmd, arg); break; default: *rtn = -1; @@ -290,7 +295,7 @@ sockets_inop_sync(struct inode *ino) assert(I2SKI(ino)->ski_fd >= 0); - return syscall(SYS_fsync, I2SKI(ino)->ski_fd); + return syscall(SYSIO_SYS_fsync, I2SKI(ino)->ski_fd); } static int @@ -299,7 +304,7 @@ sockets_inop_datasync(struct inode *ino) assert(I2SKI(ino)->ski_fd >= 0); - return syscall(SYS_fdatasync, I2SKI(ino)->ski_fd); + return syscall(SYSIO_SYS_fdatasync, I2SKI(ino)->ski_fd); } #ifdef HAVE_LUSTRE_HACK @@ -321,7 +326,7 @@ sockets_inop_ioctl(struct inode *ino, arg3 = va_arg(ap, long); arg4 = va_arg(ap, long); - return syscall(SYS_ioctl, I2SKI(ino)->ski_fd, request, + return syscall(SYSIO_SYS_ioctl, I2SKI(ino)->ski_fd, request, arg1, arg2, arg3, arg4); } #else @@ -399,12 +404,13 @@ socket(int domain, int type, int protoco } ski = I2SKI(ino); -#ifndef SYS_socketcall - ski->ski_fd = syscall(SYS_socket, domain, type, protocol); +#ifndef SYSIO_SYS_socketcall + ski->ski_fd = syscall(SYSIO_SYS_socket, domain, type, protocol); #else { unsigned long avec[3] = {domain, type, protocol}; - ski->ski_fd = syscall(SYS_socketcall, SYS_SOCKET, avec); + ski->ski_fd = + syscall(SYSIO_SYS_socketcall, SYS_SOCKET, avec); } #endif if (ski->ski_fd < 0) { @@ -469,16 +475,20 @@ accept(int s, struct sockaddr *addr, soc } ski = I2SKI(ino); -#ifndef SYS_socketcall - ski->ski_fd = syscall(SYS_accept, I2SKI(ofil->f_ino)->ski_fd, - addr, addrlen); +#ifndef SYSIO_SYS_socketcall + ski->ski_fd = + syscall(SYSIO_SYS_accept, + I2SKI(ofil->f_ino)->ski_fd, + addr, + addrlen); #else { unsigned long avec[3] = { (unsigned long) I2SKI(ofil->f_ino)->ski_fd, (unsigned long) addr, (unsigned long) addrlen}; - ski->ski_fd = syscall(SYS_socketcall, SYS_ACCEPT, avec); + ski->ski_fd = + syscall(SYSIO_SYS_socketcall, SYS_ACCEPT, avec); } #endif if (ski->ski_fd < 0) { @@ -521,13 +531,16 @@ bind(int sockfd, const struct sockaddr * goto out; } -#ifndef SYS_socketcall - if (syscall(SYS_bind, I2SKI(fil->f_ino)->ski_fd, my_addr, addrlen)) { +#ifndef SYSIO_SYS_socketcall + if (syscall(SYSIO_SYS_bind, + I2SKI(fil->f_ino)->ski_fd, + my_addr, + addrlen)) { #else avec[0] = I2SKI(fil->f_ino)->ski_fd; avec[1] = (unsigned long )my_addr; avec[2] = addrlen; - if (syscall(SYS_socketcall, SYS_BIND, avec) != 0) { + if (syscall(SYSIO_SYS_socketcall, SYS_BIND, avec) != 0) { #endif err = -errno; goto out; @@ -554,12 +567,14 @@ listen(int s, int backlog) goto out; } -#ifndef SYS_socketcall - if (syscall(SYS_listen, I2SKI(fil->f_ino)->ski_fd, backlog) != 0) { +#ifndef SYSIO_SYS_socketcall + if (syscall(SYSIO_SYS_listen, + I2SKI(fil->f_ino)->ski_fd, + backlog) != 0) { #else avec[0] = I2SKI(fil->f_ino)->ski_fd; avec[1] = backlog; - if (syscall(SYS_socketcall, SYS_LISTEN, avec) != 0) { + if (syscall(SYSIO_SYS_socketcall, SYS_LISTEN, avec) != 0) { #endif err = -errno; goto out; @@ -586,14 +601,16 @@ connect(int sockfd, const struct sockadd goto out; } -#ifndef SYS_socketcall - if (syscall(SYS_connect, I2SKI(fil->f_ino)->ski_fd, - serv_addr, addrlen) != 0) { +#ifndef SYSIO_SYS_socketcall + if (syscall(SYSIO_SYS_connect, + I2SKI(fil->f_ino)->ski_fd, + serv_addr, + addrlen) != 0) { #else avec[0] = I2SKI(fil->f_ino)->ski_fd; avec[1] = (unsigned long )serv_addr; avec[2] = addrlen; - if (syscall(SYS_socketcall, SYS_CONNECT, avec) != 0) { + if (syscall(SYSIO_SYS_socketcall, SYS_CONNECT, avec) != 0) { #endif err = -errno; goto out; |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:45
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/dev/stdfd Modified Files: stdfd.c Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- stdfd.c 21 Sep 2004 17:36:57 -0000 1.12 +++ stdfd.c 14 Oct 2004 14:59:28 -0000 1.13 @@ -56,6 +56,7 @@ #include "xtio.h" #include "sysio.h" +#include "native.h" #include "inode.h" #include "dev.h" @@ -67,8 +68,8 @@ #define dowrite(f, b, n) write_yod(f, b, n) #define doread(f, b, n) read_yod(f, b, n) #else -#define dowrite(f, b, n) syscall(SYS_write, f, b, n) -#define doread(f, b, n) syscall(SYS_read, f, b, n) +#define dowrite(f, b, n) syscall(SYSIO_SYS_write, f, b, n) +#define doread(f, b, n) syscall(SYSIO_SYS_read, f, b, n) #endif /* |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:44
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/include Modified Files: sysio.h Added Files: native.h Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -b -B -p -r1.26 -r1.27 --- sysio.h 3 Jul 2004 05:47:13 -0000 1.26 +++ sysio.h 14 Oct 2004 14:59:28 -0000 1.27 @@ -145,13 +145,40 @@ struct intnl_stat; struct pnode; +#if DEFER_INIT_CWD +extern const char *_sysio_init_cwd; +#endif + extern struct pnode *_sysio_cwd; extern mode_t _sysio_umask; extern int _sysio_init(void); extern void _sysio_shutdown(void); +#if DEFER_INIT_CWD +extern int _sysio_boot(const char *buf, const char *path); +#else extern int _sysio_boot(const char *buf); +#endif + +/* + * Option-value pair information. + */ +struct option_value_info { + const char *ovi_name; /* name */ + char *ovi_value; /* value */ +}; + +extern const char * _sysio_get_token(const char *buf, + int accepts, + const char *delim, + const char *ignore, + char *tbuf); +extern char * _sysio_get_args(char *buf, struct option_value_info *vec); + +#define _SYSIO_LOCAL_TIME() _sysio_local_time() + +extern time_t _sysio_local_time(void); /* * SYSIO name label macros @@ -302,7 +329,7 @@ extern int SYSIO_INTERFACE_NAME(umount)( return (rtn); \ } while(0) -/* syscall enter/leave hook functions */ +/* Interface enter/leave hook functions */ #if 0 extern void _sysio_sysenter(); extern void _sysio_sysleave(); |
From: Lee W. <lw...@us...> - 2004-10-14 14:59:43
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/drivers/native Modified Files: fs_native.c Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -w -b -B -p -r1.51 -r1.52 --- fs_native.c 30 Sep 2004 15:31:55 -0000 1.51 +++ fs_native.c 14 Oct 2004 14:59:28 -0000 1.52 @@ -74,6 +74,7 @@ #include "xtio.h" #include "sysio.h" +#include "native.h" #include "fs.h" #include "mount.h" #include "inode.h" @@ -84,13 +85,13 @@ #include <sys/uio.h> #endif [...1061 lines suppressed...] + assert(nino->ni_fd >= 0); arg1 = va_arg(ap, long); arg2 = va_arg(ap, long); arg3 = va_arg(ap, long); arg4 = va_arg(ap, long); - return syscall(SYS_ioctl, I2NI(ino)->ni_fd, request, + return syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, arg1, arg2, arg3, arg4); } #else @@ -1781,7 +1777,7 @@ native_inop_gone(struct inode *ino) struct native_inode *nino = I2NI(ino); if (nino->ni_fd >= 0) - (void )syscall(SYS_close, nino->ni_fd); + (void )syscall(SYSIO_SYS_close, nino->ni_fd); free(ino->i_private); } |