libsysio-commit Mailing List for libsysio (Page 37)
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: Mei <me...@us...> - 2003-12-15 08:22:19
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv3191/include
Modified Files:
Tag: b_lustre
sysio.h
Log Message:
remove the enter/leave syscalls intercept, now liblustre don't need them.
Index: sysio.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v
retrieving revision 1.7.4.5
retrieving revision 1.7.4.6
diff -u -w -b -B -p -r1.7.4.5 -r1.7.4.6
--- sysio.h 1 Nov 2003 03:08:22 -0000 1.7.4.5
+++ sysio.h 15 Dec 2003 08:22:16 -0000 1.7.4.6
@@ -267,32 +267,3 @@ extern int mount(const char *source, con
unsigned long mountflags,
const void *data);
extern int umount(const char *target);
-
-/* This allow lustre's function hook into libsysio */
-extern int __sysio_in_syscall;
-typedef void __sysio_hook_func(void);
-extern __sysio_hook_func *__sysio_hook_sys_enter;
-extern __sysio_hook_func *__sysio_hook_sys_leave;
-
-#if 1
-/* XXX temprarily disabled for the re-entrance problem */
-#define SYSIO_ENTER
-#define SYSIO_LEAVE
-
-#else
-#define SYSIO_ENTER \
- do { \
- if (__sysio_hook_sys_enter) \
- __sysio_hook_sys_enter(); \
- if (__sysio_in_syscall++) \
- abort(); \
- } while(0)
-
-#define SYSIO_LEAVE \
- do { \
- if (__sysio_hook_sys_leave) \
- __sysio_hook_sys_leave(); \
- if (--__sysio_in_syscall != 0) \
- abort(); \
- } while(0)
-#endif
|
|
From: Mei <me...@us...> - 2003-12-15 08:22:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv3191/drivers/native
Modified Files:
Tag: b_lustre
fs_native.c
Log Message:
remove the enter/leave syscalls intercept, now liblustre don't need them.
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.11.2.4
retrieving revision 1.11.2.5
diff -u -w -b -B -p -r1.11.2.4 -r1.11.2.5
--- fs_native.c 1 Nov 2003 03:08:21 -0000 1.11.2.4
+++ fs_native.c 15 Dec 2003 08:22:16 -0000 1.11.2.5
@@ -1356,8 +1356,6 @@ native_inop_fcntl(struct inode *ino,
case F_GETFD:
case F_GETFL:
case F_GETOWN:
-// case F_GETSIG:
-// case F_GETLEASE:
return syscall(SYS_fcntl, nino->ni_fd, cmd);
case F_DUPFD:
case F_SETFD:
@@ -1366,9 +1364,6 @@ native_inop_fcntl(struct inode *ino,
case F_SETLK:
case F_SETLKW:
case F_SETOWN:
-// case F_SETSIG:
-// case F_SETLEASE:
-// case F_NOTIFY:
arg = va_arg(ap, long);
return syscall(SYS_fcntl, nino->ni_fd, cmd, arg);
default:
|
|
From: Mei <me...@us...> - 2003-12-12 06:05:28
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv20631/include
Modified Files:
Tag: b_lustre
cygwin-defs.h
Removed Files:
Tag: b_lustre
bypass.h
Log Message:
remove bypass.c/bypass.h, integrate some of remains bypass code into
each .c files.
Index: cygwin-defs.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/Attic/cygwin-defs.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -b -B -p -r1.1.2.1 -r1.1.2.2
--- cygwin-defs.h 18 Aug 2003 13:56:04 -0000 1.1.2.1
+++ cygwin-defs.h 12 Dec 2003 06:05:25 -0000 1.1.2.2
@@ -29,37 +29,4 @@ typedef long long off64_t
*/
#undef _LARGEFILE64_SOURCE
-/*
- * bypass should NEVER happen under cygwin. nullify them.
- */
-struct iovec;
-
-static inline
-ioid_t __bypass_ireadv(int fd, const struct iovec *iov, int count)
-{
- return 0;
-};
-static inline
-ioid_t __bypass_preadv(int fd, const struct iovec *iov,
- int count, off_t offset)
-{
- return 0;
-};
-static inline
-ioid_t __bypass_iwritev(int fd, const struct iovec *iov, int count)
-{
- return 0;
-};
-static inline
-ioid_t __bypass_pwritev(int fd, const struct iovec *iov,
- int count, off_t offset)
-{
- return 0;
-};
-static inline
-int __bypass_fcntl(int fd, int cmd, va_list ap)
-{
- return -1;
-};
-
#endif /* CYGWIN_DEFS_H */
--- bypass.h DELETED ---
|
|
From: Mei <me...@us...> - 2003-12-12 06:05:28
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv20631/src
Modified Files:
Tag: b_lustre
Makefile.am fcntl.c iowait.c
Removed Files:
Tag: b_lustre
bypass.c
Log Message:
remove bypass.c/bypass.h, integrate some of remains bypass code into
each .c files.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v
retrieving revision 1.5.4.5
retrieving revision 1.5.4.6
diff -u -w -b -B -p -r1.5.4.5 -r1.5.4.6
--- Makefile.am 4 Dec 2003 04:33:46 -0000 1.5.4.5
+++ Makefile.am 12 Dec 2003 06:05:25 -0000 1.5.4.6
@@ -1,20 +1,11 @@
lib_LIBRARIES = libsysio.a
-if CYGWIN
libsysio_a_SOURCES = chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c fs.c \
fsync.c init.c inode.c ioctl.c ioctx.c iowait.c \
link.c lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rename.c \
rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c \
unlink.c \
utime.c write.c access.c
-else
-libsysio_a_SOURCES = chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c fs.c \
- fsync.c getdirentries.c init.c inode.c ioctl.c ioctx.c iowait.c \
- link.c lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rename.c \
- rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c \
- unlink.c \
- utime.c write.c access.c bypass.c
-endif
libsysio_a_CFLAGS = -fPIC
Index: fcntl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v
retrieving revision 1.3.2.9
retrieving revision 1.3.2.10
diff -u -w -b -B -p -r1.3.2.9 -r1.3.2.10
--- fcntl.c 4 Dec 2003 04:39:17 -0000 1.3.2.9
+++ fcntl.c 12 Dec 2003 06:05:25 -0000 1.3.2.10
@@ -54,7 +54,6 @@
#include "sysio.h"
#include "inode.h"
#include "file.h"
-#include "bypass.h"
#include "sysio-symbols.h"
@@ -100,7 +99,7 @@ fcntl(int fd, int cmd, ...)
fil = _sysio_fd_find(fd);
if (!fil) {
va_start(ap, cmd);
- err = __bypass_fcntl(fd, cmd, ap);
+ err = _sysio_fcntl_common(fd, cmd, ap);
va_end(ap);
SYSIO_LEAVE;
return err;
Index: iowait.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v
retrieving revision 1.3.8.2
retrieving revision 1.3.8.3
diff -u -w -b -B -p -r1.3.8.2 -r1.3.8.3
--- iowait.c 1 Nov 2003 03:08:22 -0000 1.3.8.2
+++ iowait.c 12 Dec 2003 06:05:25 -0000 1.3.8.3
@@ -91,14 +91,6 @@ iowait(ioid_t ioid)
struct ioctx *ioctx;
ssize_t cc;
- /* check if it's a bypassed ioctx */
- ioctx = (struct ioctx *)ioid;
- if (ioctx->ioctx_id == 0) {
- cc = ioctx->ioctx_cc;
- free(ioctx);
- return cc;
- }
-
ioctx = lookup_ioid(ioid);
if (!ioctx) {
return -1;
--- bypass.c DELETED ---
|
|
From: Mei <me...@us...> - 2003-12-04 04:39:20
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv18050/src
Modified Files:
Tag: b_lustre
chdir.c dup.c fcntl.c ioctl.c lseek.c open.c read.c stat.c
stat64.c write.c
Log Message:
don't intercept non-standard calls such as __xxxx. Probably Catamount
need it but currently can't works with liblustre on linux. We can't
add them back later if testing show we really need it.
Index: chdir.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v
retrieving revision 1.3.8.4
retrieving revision 1.3.8.5
diff -u -w -b -B -p -r1.3.8.4 -r1.3.8.5
--- chdir.c 1 Nov 2003 03:08:22 -0000 1.3.8.4
+++ chdir.c 4 Dec 2003 04:39:17 -0000 1.3.8.5
@@ -236,10 +236,6 @@ getcwd(char *buf, size_t size)
return buf;
}
-#ifdef __GLIBC__
-sysio_sym_weak_alias(getcwd, __getcwd)
-#endif
-
#ifdef PATH_MAX
char *
getwd(char *buf)
Index: dup.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/dup.c,v
retrieving revision 1.1.1.1.12.2
retrieving revision 1.1.1.1.12.3
diff -u -w -b -B -p -r1.1.1.1.12.2 -r1.1.1.1.12.3
--- dup.c 1 Nov 2003 03:08:22 -0000 1.1.1.1.12.2
+++ dup.c 4 Dec 2003 04:39:17 -0000 1.1.1.1.12.3
@@ -86,8 +86,3 @@ dup(int oldfd)
return rc;
}
-#ifdef __GLIBC__
-#undef __dup
-sysio_sym_weak_alias(dup, __dup)
-#endif
-
Index: fcntl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v
retrieving revision 1.3.2.8
retrieving revision 1.3.2.9
diff -u -w -b -B -p -r1.3.2.8 -r1.3.2.9
--- fcntl.c 1 Nov 2003 03:38:28 -0000 1.3.2.8
+++ fcntl.c 4 Dec 2003 04:39:17 -0000 1.3.2.9
@@ -142,11 +142,6 @@ out:
return err;
}
-#ifdef __GLIBC__
-#undef __fcntl
-sysio_sym_weak_alias(fcntl, __fcntl)
-#endif
-
#if defined(BSD) || defined(REDSTORM)
#undef _fcntl
sysio_sym_weak_alias(fcntl, _fcntl)
Index: ioctl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v
retrieving revision 1.1.1.1.12.4
retrieving revision 1.1.1.1.12.5
diff -u -w -b -B -p -r1.1.1.1.12.4 -r1.1.1.1.12.5
--- ioctl.c 1 Nov 2003 03:08:22 -0000 1.1.1.1.12.4
+++ ioctl.c 4 Dec 2003 04:39:17 -0000 1.1.1.1.12.5
@@ -86,11 +86,6 @@ out:
}
-#ifdef __GLIBC__
-#undef __ioctl
-sysio_sym_weak_alias(ioctl, __ioctl)
-#endif
-
#if defined(BSD) || defined(REDSTORM)
#undef _ioctl
sysio_sym_weak_alias(ioctl, _ioctl)
Index: lseek.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -u -w -b -B -p -r1.4.2.4 -r1.4.2.5
--- lseek.c 1 Nov 2003 03:08:22 -0000 1.4.2.4
+++ lseek.c 4 Dec 2003 04:39:17 -0000 1.4.2.5
@@ -106,10 +106,6 @@ out:
#if _LARGEFILE64_SOURCE
#undef lseek64
sysio_sym_weak_alias(_sysio_lseek, lseek64)
-#ifdef __GLIBC__
-#undef __lseek64
-sysio_sym_weak_alias(_sysio_lseek, __lseek64)
-#endif
#endif
#undef lseek
@@ -135,11 +131,6 @@ lseek(int fd, off_t offset, int whence)
SYSIO_LEAVE;
return rtn;
}
-
-#ifdef __GLIBC__
-#undef __lseek
-sysio_sym_weak_alias(lseek, __lseek)
-#endif
#if 0
#ifdef __linux__
Index: open.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/open.c,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -u -w -b -B -p -r1.7.2.5 -r1.7.2.6
--- open.c 1 Nov 2003 03:08:22 -0000 1.7.2.5
+++ open.c 4 Dec 2003 04:39:17 -0000 1.7.2.6
@@ -212,12 +212,8 @@ error:
}
#ifdef __GLIBC__
-#undef __open
-sysio_sym_weak_alias(open, __open)
#undef open64
sysio_sym_weak_alias(open, open64)
-#undef __open64
-sysio_sym_weak_alias(open, __open64)
#endif
#if defined(BSD) || defined(REDSTORM)
@@ -238,11 +234,6 @@ close(int fd)
return err ? -1 : 0;
}
-#ifdef __GLIBC__
-#undef __close
-sysio_sym_weak_alias(close, __close)
-#endif
-
#if defined(BSD) || defined(REDSTORM)
#undef _close
sysio_sym_weak_alias(close, _close)
@@ -256,12 +247,8 @@ creat(const char *path, mode_t mode)
}
#ifdef __GLIBC__
-#undef __creat
-sysio_sym_weak_alias(creat, __creat)
#undef creat64
sysio_sym_weak_alias(creat, creat64)
-#undef __creat64
-sysio_sym_weak_alias(creat, __creat64)
#endif
#if defined(BSD) || defined(REDSTORM)
Index: read.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/read.c,v
retrieving revision 1.2.8.8
retrieving revision 1.2.8.9
diff -u -w -b -B -p -r1.2.8.8 -r1.2.8.9
--- read.c 1 Nov 2003 03:08:22 -0000 1.2.8.8
+++ read.c 4 Dec 2003 04:39:17 -0000 1.2.8.9
@@ -257,11 +257,6 @@ read(int fd, void *buf, size_t count)
return iowait(ioid);
}
-#ifdef __GLIBC__
-#undef __read
-sysio_sym_weak_alias(read, __read)
-#endif
-
#if defined(BSD) || defined(REDSTORM)
#undef _read
sysio_sym_weak_alias(read, _read)
Index: stat.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- stat.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
+++ stat.c 4 Dec 2003 04:39:17 -0000 1.3.4.3
@@ -87,8 +87,8 @@ convstat(struct stat64 *st64_buf, struct
}
#endif
-int
-__fxstat(int __ver, int __fildes, struct stat *__stat_buf)
+static int
+__fxstat_internal(int __ver, int __fildes, struct stat *__stat_buf)
{
struct file *fil;
int err;
@@ -132,7 +132,7 @@ __fstat(int fd, struct stat *buf)
int rc;
SYSIO_ENTER;
- rc = __fxstat(_STAT_VER, fd, buf);
+ rc = __fxstat_internal(_STAT_VER, fd, buf);
SYSIO_LEAVE;
return rc;
Index: stat64.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- stat64.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
+++ stat64.c 4 Dec 2003 04:39:17 -0000 1.3.4.3
@@ -62,8 +62,8 @@
#undef __xstat64
#undef __lxstat64
-int
-__fxstat64(int __ver, int __fildes, struct stat64 *__stat_buf)
+static int
+__fxstat64_internal(int __ver, int __fildes, struct stat64 *__stat_buf)
{
struct file *fil;
int err;
@@ -94,7 +94,7 @@ fstat64(int fd, struct stat64 *buf)
int rc;
SYSIO_ENTER;
- rc = __fxstat64(_STAT_VER, fd, buf);
+ rc = __fxstat64_internal(_STAT_VER, fd, buf);
SYSIO_LEAVE;
return rc;
Index: write.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/write.c,v
retrieving revision 1.2.10.8
retrieving revision 1.2.10.9
diff -u -w -b -B -p -r1.2.10.8 -r1.2.10.9
--- write.c 1 Nov 2003 03:08:23 -0000 1.2.10.8
+++ write.c 4 Dec 2003 04:39:17 -0000 1.2.10.9
@@ -255,11 +255,6 @@ write(int fd, const void *buf, size_t co
return iowait(ioid);
}
-#ifdef __GLIBC__
-#undef __write
-sysio_sym_weak_alias(write, __write)
-#endif
-
#if defined(BSD) || defined(REDSTORM)
#undef _write
sysio_sym_weak_alias(write, _write)
|
|
From: Mei <me...@us...> - 2003-12-04 04:39:19
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv18050/include
Modified Files:
Tag: b_lustre
sysio-symbols.h
Log Message:
don't intercept non-standard calls such as __xxxx. Probably Catamount
need it but currently can't works with liblustre on linux. We can't
add them back later if testing show we really need it.
Index: sysio-symbols.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/sysio-symbols.h,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -b -B -p -r1.2 -r1.2.10.1
--- sysio-symbols.h 7 Mar 2003 03:31:36 -0000 1.2
+++ sysio-symbols.h 4 Dec 2003 04:39:16 -0000 1.2.10.1
@@ -2,6 +2,8 @@
#define HAVE_WEAK_SYMBOLS
#endif
+#undef HAVE_WEAK_SYMBOLS /* workaround SuSE glibc 2.2.5 */
+
/*
* Define alias, asym, as a strong alias for symbol, sym.
*/
|
|
From: Mei <me...@us...> - 2003-12-04 04:36:28
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets
In directory sc8-pr-cvs1:/tmp/cvs-serv17784/drivers/sockets
Modified Files:
Tag: b_lustre
sockets.c
Log Message:
Zach's fix for build on x86_64: there's no socketcall on x86_64.
Index: sockets.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/Attic/sockets.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -w -b -B -p -r1.1.2.3 -r1.1.2.4
--- sockets.c 1 Nov 2003 03:38:27 -0000 1.1.2.3
+++ sockets.c 4 Dec 2003 04:36:24 -0000 1.1.2.4
@@ -323,7 +323,6 @@ socket(int domain, int type, int protoco
int err;
struct inode *ino;
struct socket_info *ski;
- unsigned long avec[3];
struct file *fil;
err = 0;
@@ -335,11 +334,15 @@ socket(int domain, int type, int protoco
goto error;
}
- avec[0] = domain;
- avec[1] = type;
- avec[2] = protocol;
ski = I2SKI(ino);
+#ifndef SYS_socketcall
+ ski->ski_fd = syscall(SYS_socket, domain, type, protocol);
+#else
+ {
+ unsigned long avec[3] = {domain, type, protocol};
ski->ski_fd = syscall(SYS_socketcall, SYS_SOCKET, avec);
+ }
+#endif
if (ski->ski_fd < 0) {
err = -errno;
goto error;
@@ -374,7 +377,6 @@ accept(int s, struct sockaddr *addr, soc
struct inode *ino;
struct socket_info *ski;
struct file *ofil, *nfil;
- unsigned long avec[3];
err = 0;
nfil = NULL;
@@ -398,11 +400,17 @@ accept(int s, struct sockaddr *addr, soc
goto error;
}
- avec[0] = I2SKI(ofil->f_ino)->ski_fd;
- avec[1] = (unsigned long )addr;
- avec[2] = (unsigned long )addrlen;
ski = I2SKI(ino);
+#ifndef SYS_socketcall
+ ski->ski_fd = syscall(SYS_accept, I2SKI(ofil->f_ino)->ski_fd,
+ addr, addrlen);
+#else
+ {
+ unsigned long avec[3] = {I2SKI(ofil->f_ino)->ski_fd, addr,
+ addrlen};
ski->ski_fd = syscall(SYS_socketcall, SYS_ACCEPT, avec);
+ }
+#endif
if (ski->ski_fd < 0) {
err = -errno;
goto error;
@@ -444,7 +452,11 @@ bind(int sockfd, const struct sockaddr *
avec[0] = I2SKI(fil->f_ino)->ski_fd;
avec[1] = (unsigned long )my_addr;
avec[2] = addrlen;
+#ifndef SYS_socketcall
+ if (syscall(SYS_bind, I2SKI(fil->f_ino)->ski_fd, my_addr, addrlen)) {
+#else
if (syscall(SYS_socketcall, SYS_BIND, avec) != 0) {
+#endif
err = -errno;
goto out;
}
@@ -472,7 +484,11 @@ listen(int s, int backlog)
avec[0] = I2SKI(fil->f_ino)->ski_fd;
avec[1] = backlog;
+#ifndef SYS_socketcall
+ if (syscall(SYS_listen, I2SKI(fil->f_ino)->ski_fd, backlog) != 0) {
+#else
if (syscall(SYS_socketcall, SYS_LISTEN, avec) != 0) {
+#endif
err = -errno;
goto out;
}
@@ -501,7 +517,11 @@ connect(int sockfd, const struct sockadd
avec[0] = I2SKI(fil->f_ino)->ski_fd;
avec[1] = (unsigned long )serv_addr;
avec[2] = addrlen;
+#ifndef SYS_socketcall
+ if (syscall(SYS_connect, I2SKI(fil->f_ino)->ski_fd, serv_addr, addrlen) != 0) {
+#else
if (syscall(SYS_socketcall, SYS_CONNECT, avec) != 0) {
+#endif
err = -errno;
goto out;
}
|
|
From: Mei <me...@us...> - 2003-12-04 04:33:49
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets
In directory sc8-pr-cvs1:/tmp/cvs-serv17385/drivers/sockets
Modified Files:
Tag: b_lustre
Makefile.am
Log Message:
Zach's fix for x86_64 build: need -fPIC flag.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/Attic/Makefile.am,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -b -B -p -r1.1.2.1 -r1.1.2.2
--- Makefile.am 8 Sep 2003 03:52:28 -0000 1.1.2.1
+++ Makefile.am 4 Dec 2003 04:33:45 -0000 1.1.2.2
@@ -1,5 +1,6 @@
lib_LIBRARIES = libsysio_sockets.a
libsysio_sockets_a_SOURCES = sockets.c
+libsysio_sockets_a_CFLAGS = -fPIC
include $(top_srcdir)/Rules.make
|
|
From: Mei <me...@us...> - 2003-12-04 04:33:49
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17385/src
Modified Files:
Tag: b_lustre
Makefile.am
Log Message:
Zach's fix for x86_64 build: need -fPIC flag.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v
retrieving revision 1.5.4.4
retrieving revision 1.5.4.5
diff -u -w -b -B -p -r1.5.4.4 -r1.5.4.5
--- Makefile.am 1 Nov 2003 03:08:22 -0000 1.5.4.4
+++ Makefile.am 4 Dec 2003 04:33:46 -0000 1.5.4.5
@@ -16,6 +16,8 @@ libsysio_a_SOURCES = chdir.c chmod.c cho
utime.c write.c access.c bypass.c
endif
+libsysio_a_CFLAGS = -fPIC
+
include $(top_srcdir)/Rules.make
if WITH_CPLANT_YOD
|
|
From: Mei <me...@us...> - 2003-12-04 04:33:49
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv17385/drivers/native
Modified Files:
Tag: b_lustre
Makefile.am
Log Message:
Zach's fix for x86_64 build: need -fPIC flag.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -b -B -p -r1.2 -r1.2.10.1
--- Makefile.am 7 Mar 2003 03:31:36 -0000 1.2
+++ Makefile.am 4 Dec 2003 04:33:45 -0000 1.2.10.1
@@ -3,5 +3,6 @@ lib_LIBRARIES = libsysio_native.a
EXTRA_DIST = fs_native.h
libsysio_native_a_SOURCES = fs_native.c
+libsysio_native_a_CFLAGS = -fPIC
include $(top_srcdir)/Rules.make
|
|
From: Mei <me...@us...> - 2003-12-04 04:33:49
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd
In directory sc8-pr-cvs1:/tmp/cvs-serv17385/dev/stdfd
Modified Files:
Tag: b_lustre
Makefile.am
Log Message:
Zach's fix for x86_64 build: need -fPIC flag.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/Makefile.am,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -u -w -b -B -p -r1.2.4.1 -r1.2.4.2
--- Makefile.am 15 Aug 2003 07:43:14 -0000 1.2.4.1
+++ Makefile.am 4 Dec 2003 04:33:45 -0000 1.2.4.2
@@ -3,6 +3,7 @@ lib_LIBRARIES = libsysio_stdfd.a
EXTRA_DIST = stdfd.h
libsysio_stdfd_a_SOURCES = stdfd.c
+libsysio_stdfd_a_CFLAGS = -fPIC
include $(top_srcdir)/Rules.make
|
|
From: Mei <me...@us...> - 2003-11-22 08:01:59
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv10144
Modified Files:
Tag: b_lustre
file.c
Log Message:
fix another guilty of resolv lib: open a socket fd but close it with
syscall(), which cause chaos in libsysio.
Index: file.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/file.c,v
retrieving revision 1.4.8.3
retrieving revision 1.4.8.4
diff -u -w -b -B -p -r1.4.8.3 -r1.4.8.4
--- file.c 1 Nov 2003 03:08:22 -0000 1.4.8.3
+++ file.c 22 Nov 2003 08:01:55 -0000 1.4.8.4
@@ -208,6 +208,16 @@ find_free_fildes(oftab_t *oftab, int tar
assert(!*filp);
}
+ /* XXX
+ * application use open/socket to create a fd, but use
+ * syscall() to directly close it? at least resolv lib
+ * is doing this. We simply destroy the file struct.
+ */
+ if (oftab->table[n]) {
+ free(oftab->table[n]);
+ oftab->table[n] = NULL;
+ }
+
return oftab->offset + n;
}
|
|
From: Ruth K. <rk...@us...> - 2003-11-12 21:51:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv16720 Modified Files: fs_yod.c Log Message: close yod fd once after all refs are gone, duplicate of fix to native driver Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- fs_yod.c 20 Oct 2003 16:44:36 -0000 1.7 +++ fs_yod.c 12 Nov 2003 21:51:40 -0000 1.8 @@ -904,12 +904,14 @@ yod_inop_close(struct inode *ino) if (nino->ni_fd < 0) abort(); - err = close_yod(nino->ni_fd); - if (err) - return -errno; assert(nino->ni_nopens); if (--nino->ni_nopens) return 0; + + err = close_yod(nino->ni_fd); + if (err) + return -errno; + nino->ni_fd = -1; nino->ni_fpos = 0; return 0; |
|
From: Mei <me...@us...> - 2003-11-01 03:38:31
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv31910/src
Modified Files:
Tag: b_lustre
bypass.c fcntl.c
Log Message:
use the common code of fcntl(), need some cleanup later.
Index: bypass.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Attic/bypass.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -w -b -B -p -r1.1.2.3 -r1.1.2.4
--- bypass.c 8 Sep 2003 03:58:17 -0000 1.1.2.3
+++ bypass.c 1 Nov 2003 03:38:27 -0000 1.1.2.4
@@ -96,31 +96,5 @@ ioid_t __bypass_pwritev(int fd, const st
int __bypass_fcntl(int fd, int cmd, va_list ap)
{
- int err;
- long arg;
-
- DEBUG("fcntl on unknown fd %d, cmd %d\n", fd, cmd);
- switch (cmd) {
- case F_GETFD:
- case F_GETFL:
- case F_GETOWN:
-// case F_GETSIG:
-// case F_GETLEASE:
- return syscall(SYS_fcntl, fd, cmd);
- case F_DUPFD:
- case F_SETFD:
- case F_SETFL:
- case F_GETLK:
- case F_SETLK:
- case F_SETLKW:
- case F_SETOWN:
-// case F_SETSIG:
-// case F_SETLEASE:
-// case F_NOTIFY:
- arg = va_arg(ap, long);
- return syscall(SYS_fcntl, fd, cmd, arg);
- default:
- ERROR("uncatched cmd %d\n", cmd);
- }
- return -1;
+ return _sysio_fcntl_common(fd, cmd, ap);
}
Index: fcntl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v
retrieving revision 1.3.2.7
retrieving revision 1.3.2.8
diff -u -w -b -B -p -r1.3.2.7 -r1.3.2.8
--- fcntl.c 1 Nov 2003 03:08:22 -0000 1.3.2.7
+++ fcntl.c 1 Nov 2003 03:38:28 -0000 1.3.2.8
@@ -58,6 +58,36 @@
#include "sysio-symbols.h"
+int _sysio_fcntl_common(int fd, int cmd, va_list ap)
+{
+ int err;
+ long arg;
+
+ switch (cmd) {
+ case F_GETFD:
+ case F_GETFL:
+ case F_GETOWN:
+// case F_GETSIG:
+// case F_GETLEASE:
+ return syscall(SYS_fcntl, fd, cmd);
+ case F_DUPFD:
+ case F_SETFD:
+ case F_SETFL:
+ case F_GETLK:
+ case F_SETLK:
+ case F_SETLKW:
+ case F_SETOWN:
+// case F_SETSIG:
+// case F_SETLEASE:
+// case F_NOTIFY:
+ arg = va_arg(ap, long);
+ return syscall(SYS_fcntl, fd, cmd, arg);
+ }
+
+ printf("sysio: unrecongnized fcntl cmd %d on fd %d\n", cmd, fd);
+ return -ENOSYS;
+}
+
int
fcntl(int fd, int cmd, ...)
{
|
|
From: Mei <me...@us...> - 2003-11-01 03:38:30
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv31910/include
Modified Files:
Tag: b_lustre
file.h
Log Message:
use the common code of fcntl(), need some cleanup later.
Index: file.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/file.h,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -u -w -b -B -p -r1.5.4.1 -r1.5.4.2
--- file.h 1 Nov 2003 03:08:22 -0000 1.5.4.1
+++ file.h 1 Nov 2003 03:38:27 -0000 1.5.4.2
@@ -98,3 +98,4 @@ extern struct file *_sysio_fd_find(int f
extern int _sysio_fd_set(struct file *fil, int fd);
extern int _sysio_fd_dup2(int oldfd, int newfd);
extern int _sysio_fd_close_all(void);
+extern int _sysio_fcntl_common(int fd, int cmd, va_list ap);
|
|
From: Mei <me...@us...> - 2003-11-01 03:38:30
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets
In directory sc8-pr-cvs1:/tmp/cvs-serv31910/drivers/sockets
Modified Files:
Tag: b_lustre
sockets.c
Log Message:
use the common code of fcntl(), need some cleanup later.
Index: sockets.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/Attic/sockets.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -b -B -p -r1.1.2.2 -r1.1.2.3
--- sockets.c 1 Nov 2003 03:08:21 -0000 1.1.2.2
+++ sockets.c 1 Nov 2003 03:38:27 -0000 1.1.2.3
@@ -239,10 +239,9 @@ sockets_inop_fcntl(struct inode *ino __I
int cmd __IS_UNUSED,
va_list ap __IS_UNUSED)
{
- /*
- * I'm lazy. Maybe implemented later.
- */
- return -ENOTTY;
+ assert(I2SKI(ino)->ski_fd >= 0);
+
+ return _sysio_fcntl_common(I2SKI(ino)->ski_fd, cmd, ap);
}
static int
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:28
|
Update of /cvsroot/libsysio/libsysio/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/tests
Modified Files:
Tag: b_lustre
Makefile.am README drv_init_all.c helper.pm sysio_stubs.c
sysio_tests.c test_all.pl test_copy.c test_copy.pl
test_driver.c test_driver.h test_getcwd.c test_getcwd.pl
test_list.c test_list.pl test_mounts.c test_path.c
test_path.pl test_stats.c test_stats.pl test_stdfd.c
test_stdfd.pl
Added Files:
Tag: b_lustre
cleanup.pl setup.pl test_link.c test_rename.c test_symlink.pl
test_unlink.c
Log Message:
merge HEAD into b_lustre, some fixes
--- NEW FILE ---
#!/usr/bin/perl -w
use IPC::Open2;
use strict;
use FindBin;
use lib "$FindBin::Bin";
use helper;
sub usage
{
print "Usage: ./cleanup.pl <cwd> : Remove system directories used for test\n";
exit(-1);
}
sub do_remove
{
my ($cmdfh, $outfh, $type, $cwd, $lastdir) = @_;
my $cmd;
if ($type eq "dir") {
$cmd = "rmdir";
} else {
$cmd = "unlink";
}
my $cmdstr = "CALL $cmd $cwd/$lastdir\n";
# Now remove the file/dir
helper::send_cmd($cmdfh, $outfh, $cmd, $cmdstr);
# Verify the directory was made correctly
helper::verify_cmd($cmdfh, $outfh, $cmd);
}
my $currarg = 0;
my $is_alpha = 0;
my $alpha_arg = "";
if (@ARGV == 0) {
usage();
}
if ((@ARGV > 1) && ($ARGV[$currarg++] eq "-alpha")){
$is_alpha = 1;
$alpha_arg = $ARGV[$currarg-1];
}
my $cwd = $ARGV[$currarg];
# Get tests directory
my $testdir = $0;
$testdir =~ s/\/\w+.pl$//;
eval {
if ($is_alpha == 0) {
open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
"yod -batch -quiet -sz 1 $testdir/test_driver --np");
}
};
if ($@) {
if ($@ =~ /^open2/) {
warn "open2 failed: $!\n$@\n";
return;
}
die;
}
my $outfh = \*OUTFILE;
my $cmdfh = \*CMDFILE;
if ($is_alpha == 0) {
helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n");
}
# Remove the helper.pms
do_remove($cmdfh, $outfh, "file", $cwd, "tmp_dir/helper.pm");
do_remove($cmdfh, $outfh, "file", $cwd, "tmp_dir/test1/helper.pm");
# Remove directories
do_remove($cmdfh, $outfh, "dir", $cwd, "tmp_dir/test1");
do_remove($cmdfh, $outfh, "dir", $cwd, "tmp_dir/test2");
do_remove($cmdfh, $outfh, "dir", $cwd, "tmp_dir");
print $cmdfh "exit\n";
close $outfh;
# Give test_driver time to finish
sleep 0.000001;
print STDOUT "cleanup successful\n";
exit 0;
--- NEW FILE ---
#!/usr/bin/perl -w
use IPC::Open2;
use strict;
use FindBin;
use lib "$FindBin::Bin";
use helper;
sub usage
{
print "Usage: ./setup.pl <cwd> : Setup initial system directories for test\n";
exit(-1);
}
sub do_makedir
{
my ($cmdfh, $outfh, $cwd, $lastdir) = @_;
my $cmd = "CALL mkdir $cwd/$lastdir 0777\n";
# Now create newdir
helper::send_cmd($cmdfh, $outfh, "mkdir", $cmd);
# Verify the directory was made correctly
helper::verify_cmd($cmdfh, $outfh, "mkdir");
}
my $currarg = 0;
my $is_alpha = 0;
my $alpha_arg = "";
if (@ARGV == 0) {
usage();
}
if ((@ARGV > 1) && ($ARGV[$currarg++] eq "-alpha")){
$is_alpha = 1;
$alpha_arg = $ARGV[$currarg-1];
}
my $cwd = $ARGV[$currarg];
# Get tests directory
my $testdir = $0;
$testdir =~ s/\/\w+.pl$//;
eval {
if ($is_alpha == 0) {
open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
"yod -batch -quiet -sz 1 $testdir/test_driver --np");
}
};
if ($@) {
if ($@ =~ /^open2/) {
warn "open2 failed: $!\n$@\n";
return;
}
die;
}
my $outfh = \*OUTFILE;
my $cmdfh = \*CMDFILE;
if ($is_alpha == 0) {
helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n");
}
# Create tmp_dir
do_makedir($cmdfh, $outfh, $cwd, "tmp_dir");
do_makedir($cmdfh, $outfh, $cwd, "tmp_dir/test1");
do_makedir($cmdfh, $outfh, $cwd, "tmp_dir/test2");
# Copy helper.pm
print STDERR "Copying $testdir/helper.pm to $cwd/tmp_dir/test1/helper.pm\n";
my $res = `perl $testdir/test_copy.pl $alpha_arg $testdir/helper.pm $cwd/tmp_dir/test1/helper.pm`;
chop($res);
if ($res ne "copy test successful") {
print STDERR "setup (copy test) failed with message: $res\n";
print $cmdfh "exit\n";
close $outfh;
# Give test_driver time to finish
sleep 0.000001;
print STDOUT "Copying of helper.pm failed\n";
exit 1;
}
print $cmdfh "exit\n";
close $outfh;
# Give test_driver time to finish
sleep 0.000001;
print STDOUT "setup successful\n";
exit 0;
--- 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-2003 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef REDSTORM
#include <getopt.h>
#else
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/queue.h>
#if 0
#include <dirent.h>
#endif
#include "sysio.h"
#include "mount.h"
#include "test.h"
/*
* Test hard link
*
* Usage: link [-a] [-m <fsname>] [-r <mntpath>] oldpath newpath
*
*/
static int linkit(const char *old, const char *new);
static void usage(void);
static const char *root_driver = DEFAULT_DRIVER;
static const char *mntpath = "/";
static unsigned mntflgs = 0;
#ifdef AUTOMOUNT_FILE_NAME
#define EXTRA_AUTOMOUNT_OPT "a"
#else
#define EXTRA_AUTOMOUNT_OPT
#endif
const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:";
int
main(int argc, char *const argv[])
{
int i;
int err;
int n;
/*
* Parse command line arguments.
*/
while ((i = getopt(argc, argv, opts)) != -1)
switch (i) {
#ifdef AUTOMOUNT_FILE_NAME
case 'a':
mntflgs |= MOUNT_F_AUTO;
break;
#endif
case 'm':
root_driver = optarg;
break;
case 'r':
mntpath = optarg;
break;
default:
usage();
}
/*
* Init sysio lib.
*/
_sysio_init();
/*
* Init native file system driver and request mount of specified
* source directory.
*/
err = drv_init_all();
if (err) {
errno = -err;
perror("drv_init_all");
exit(1);
}
err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL);
if (err) {
errno = -err;
perror("_sysio_mount_root");
exit(1);
}
n = argc - optind;
if (n < 2) usage();
/*
* Try paths listed on command-line.
*/
while (optind < argc) {
const char *old, *new;
old = argv[optind++];
new = argv[optind++];
(void )linkit(old, new);
}
/*
* Clean up.
*/
_sysio_shutdown();
return 0;
}
static int
linkit(const char *old, const char *new)
{
unlink(new);
if (link(old, new) < 0) {
perror(old);
return -1;
}
return 0;
}
static void
usage()
{
(void )fprintf(stderr,
"Usage: unlink [-a] [-m <driver>] [-r <mntpath>]"
" oldpath newpath\n");
exit(1);
}
--- 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-2003 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...
*/
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef REDSTORM
#include <getopt.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/queue.h>
#include "sysio.h"
#include "mount.h"
#include "fs_native.h"
#include "test.h"
/*
* Rename a file system object.
*
* Usage: test_rename [-a] [-r <source>] [-m <root-driver>] <src> <dest>
*/
char *root_driver = DEFAULT_DRIVER;
char *mntpath = "/";
unsigned mntflgs = 0;
void usage(void);
int rename_file(const char *spath, const char *dpath);
int
main(int argc, char * const argv[])
{
int i;
int err;
const char *spath, *dpath;
/*
* Parse command-line args.
*/
while ((i = getopt(argc,
argv,
#ifdef AUTOMOUNT_FILE_NAME
"a"
#endif
"r:m:")) != -1)
switch (i) {
#ifdef AUTOMOUNT_FILE_NAME
case 'a':
mntflgs |= MOUNT_F_AUTO;
break;
#endif
case 'r': /* set working dir */
mntpath = optarg;
break;
case 'm':
root_driver = optarg;
break;
default:
usage();
}
if (!(argc - optind))
usage();
#ifndef CPLANT_YOD
if (_sysio_init() != 0) {
perror("init sysio");
exit(1);
}
err = drv_init_all();
if (err) {
perror("init drivers");
exit(1);
}
err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL);
if (err) {
errno = -err;
perror(root_driver);
exit(1);
}
#endif
(void )umask(022);
/*
* Source
*/
spath = argv[optind++];
if (!(argc - optind))
usage();
/*
* Destination
*/
dpath = argv[optind++];
if (argc - optind)
usage();
err = rename(spath, dpath);
if (err)
perror("rename");
#ifndef CPLANT_YOD
_sysio_shutdown();
#endif
return err;
}
void
usage()
{
(void )fprintf(stderr,
"Usage: test_rename "
#ifdef AUTOMOUNT_FILE_NAME
"[-a] "
#endif
"[-r <source>] [-m <fsname>]"
" source destination\n");
exit(1);
}
--- NEW FILE ---
#!/usr/bin/perl -w
#
# symlink test: Verify that symbolic links work
#
use IPC::Open2;
use strict;
use FindBin;
use lib "$FindBin::Bin";
use helper;
sub usage
{
print "Usage: ./test_symlink.pl [-alpha] <src> <dest>: Create a symlink from src to dest\n";
exit(-1);
}
sub clean_exit
{
my ($cmdfh, $outfh, $exit_num, $exit_str) = @_;
print STDOUT "$exit_str";
# Free buffers
my $cmdstr = 'FREE $srcbuf'."\n";
print $cmdfh $cmdstr;
my $res = <$outfh>;
chop($res);
if ($res ne "0000 ") {
print STDOUT "ERROR! Failed to free srcbuf (code $res)\n";
}
$cmdstr = 'FREE $destbuf'."\n";
print $cmdfh $cmdstr;
$res = <$outfh>;
chop($res);
if ($res ne "0000 ") {
print STDOUT "ERROR! Failed to free destbuf (code $res)\n";
}
print $cmdfh "exit\n";
close $outfh;
# Give test_driver time to finish
sleep 0.000001;
exit $exit_num;
}
sub process_cmd
{
my ($src, $dest, $is_alpha) = @_;
# Get tests directory
my $testdir = $0;
$testdir =~ s/\/\w+.pl$//;
eval {
if ($is_alpha == 0) {
open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 $testdir/test_driver --np");
}
};
if ($@) {
if ($@ =~ /^open2/) {
warn "open2 failed: $!\n$@\n";
return;
}
die;
}
my $outfh = \*OUTFILE;
my $cmdfh = \*CMDFILE;
if ($is_alpha == 0) {
helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n");
}
# Get the filesize of src
my $size = -s $src;
my $bufsize;
if ( $size > 1024) { # Arbitrary limit
$bufsize = 1024;
} else {
$bufsize = $size;
}
# Create the symbolic link from src to dest
my $cmdstr = "CALL symlink $src $dest\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmdstr);
helper::verify_cmd($cmdfh, $outfh, "symlink");
# Open src
$cmdstr = '$src = CALL open '."$src O_RDONLY\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmdstr);
# Open dest
$cmdstr = '$dest = CALL open '."$dest O_RDONLY\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmdstr);
my $res = helper::verify_cmd($cmdfh, $outfh, "open $dest");
# Allocate buffer for src
$cmdstr = '$srcbuf = ALLOC '."$bufsize\n";
helper::send_cmd($cmdfh, $outfh, "ALLOC", $cmdstr);
# Allocate buffer for dest
$cmdstr = '$destbuf = ALLOC '."$bufsize\n";
helper::send_cmd($cmdfh, $outfh, "ALLOC", $cmdstr);
# Read size bytes from src and dest, then compare them and verify they
# are the same
$cmdstr = 'CALL read $src $srcbuf '."$bufsize\n";
helper::send_cmd($cmdfh, $outfh, "read $src", $cmdstr);
$res = helper::verify_cmd($cmdfh, $outfh, "read $src");
my $readb = oct($res);
# Now read $readb from dest
$cmdstr = 'CALL read $dest $destbuf '."$readb\n";
helper::send_cmd($cmdfh, $outfh, "read $dest", $cmdstr);
$res = helper::verify_cmd($cmdfh, $outfh, "read $dest");
my $errstr;
if ($readb != oct($res)) {
$errstr = "ERROR! Read $readb bytes from src but only $res bytes from dest\n";
clean_exit($cmdfh, $outfh, 1, $errstr);
}
# Compare the two buffers
$cmdstr = 'CALL cmpstr $srcbuf $destbuf'."\n";
helper::send_cmd($cmdfh, $outfh, "cmpstr", $cmdstr);
# Verify that it returned an error
$cmdstr = 'PRINT $$';
$cmdstr .= "\n";
helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr);
$res = <$outfh>;
chop($res);
$res = helper::verify_cmd($cmdfh, $outfh, "cmpstr");
$res = oct($res);
if ($res != 0) {
$errstr = "ERROR! Buffers from $src and $dest do not match\n";
clean_exit($cmdfh, $outfh, 1, $errstr);
}
# Clean up
$cmdstr = 'CALL close $src'."\n";
helper::send_cmd($cmdfh, $outfh, "close", $cmdstr);
$cmdstr = 'CALL close $dest'."\n";
helper::send_cmd($cmdfh, $outfh, "close", $cmdstr);
# Clear out destbuf
$cmdstr = 'CALL clear $destbuf'."\n";
helper::send_cmd($cmdfh, $outfh, "CLEAR", $cmdstr);
# Now remove the symbolic link and make sure everything stays the same
# Remove the link (this assumes the link is not in incore)
$cmdstr = "CALL unlink $dest\n";
helper::send_cmd($cmdfh, $outfh, "unlink", $cmdstr);
helper::verify_cmd($cmdfh, $outfh, "unlink");
# Attempt to open the symbolic link. This should return an error
$cmdstr = 'CALL open '."$dest O_RDONLY\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmdstr);
# Verify that it returned an error
$cmdstr = 'PRINT $$';
$cmdstr .= "\n";
helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr);
$res = <$outfh>;
chop($res);
if ($res ne "0xffffffff") {
$errstr = "ERROR! Open on $dest succeeded (should have failed)\n";
clean_exit($cmdfh, $outfh, 1, $errstr);
}
# Now read from the src again and make sure it matches the original
# Open src
$cmdstr = '$src2 = CALL open '."$src O_RDONLY\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmdstr);
helper::verify_cmd($cmdfh, $outfh, "open $src(2)");
$cmdstr = 'CALL read $src2 $destbuf '."$readb\n";
helper::send_cmd($cmdfh, $outfh, "read $src(2)", $cmdstr);
$res = helper::verify_cmd($cmdfh, $outfh, "read $src(2)");
if ($readb != oct($res)) {
$errstr = "ERROR! Read $readb bytes from src originally but now only $res bytes\n";
clean_exit($cmdfh, $outfh, 1, $errstr);
}
# Compare the two buffers
$cmdstr = 'CALL cmpstr $srcbuf $destbuf'."\n";
helper::send_cmd($cmdfh, $outfh, "cmpstr", $cmdstr);
$res = helper::verify_cmd($cmdfh, $outfh, "cmpstr");
$res = oct($res);
if ($res != 0) {
$errstr = "ERROR! Original buffers from $src and new buf do not match\n";
clean_exit($cmdfh, $outfh, 1, $errstr);
}
# Clean up
$cmdstr = 'CALL close $src2'."\n";
helper::send_cmd($cmdfh, $outfh, "close", $cmdstr);
clean_exit($cmdfh, $outfh, 0, "Symlink test successful\n");
exit 0;
}
my $currarg = 0;
my $is_alpha = 0;
if (@ARGV < 2) {
usage;
} elsif (@ARGV > 2 ) {
if ($ARGV[$currarg++] eq "-alpha") {
$is_alpha = 1;
}
}
my $src = $ARGV[$currarg++];
my $dest = $ARGV[$currarg];
process_cmd($src, $dest, $is_alpha);
exit 0;
--- 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-2003 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef REDSTORM
#include <getopt.h>
#else
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/queue.h>
#if 0
#include <dirent.h>
#endif
#include "sysio.h"
#include "mount.h"
#include "test.h"
/*
* Unlink files.
*
* Usage: unlink [-a] [-m <fsname>] [-r <mntpath>] [path...]
*
* Without any path arguments, the program unlinks files named
* by the ocmmand line args.
*/
static int unlinkit(const char *path);
static void usage(void);
static const char *root_driver = DEFAULT_DRIVER;
static const char *mntpath = "/";
static unsigned mntflgs = 0;
#ifdef AUTOMOUNT_FILE_NAME
#define EXTRA_AUTOMOUNT_OPT "a"
#else
#define EXTRA_AUTOMOUNT_OPT
#endif
const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:";
int
main(int argc, char *const argv[])
{
int i;
int err;
int n;
/*
* Parse command line arguments.
*/
while ((i = getopt(argc, argv, opts)) != -1)
switch (i) {
#ifdef AUTOMOUNT_FILE_NAME
case 'a':
mntflgs |= MOUNT_F_AUTO;
break;
#endif
case 'm':
root_driver = optarg;
break;
case 'r':
mntpath = optarg;
break;
default:
usage();
}
/*
* Init sysio lib.
*/
_sysio_init();
/*
* Init native file system driver and request mount of specified
* source directory.
*/
err = drv_init_all();
if (err) {
errno = -err;
perror("drv_init_all");
exit(1);
}
err = _sysio_mount_root(mntpath, root_driver, mntflgs, NULL);
if (err) {
errno = -err;
perror("_sysio_mount_root");
exit(1);
}
n = argc - optind;
/*
* Try path(s) listed on command-line.
*/
while (optind < argc) {
const char *path;
path = argv[optind++];
(void )unlinkit(path);
}
/*
* If no command-line arguments, read from stdin until EOF.
*/
if (!n) {
int doflush;
static char buf[4096];
size_t len;
char *cp;
char c;
doflush = 0;
while (fgets(buf, sizeof(buf), stdin) != NULL) {
len = strlen(buf);
cp = buf + len - 1;
c = *cp;
*cp = '\0';
if (!doflush)
unlinkit(buf);
doflush = c == '\n' ? 0 : 1;
}
}
/*
* Clean up.
*/
_sysio_shutdown();
return 0;
}
static int
unlinkit(const char *path)
{
if (unlink(path) != 0) {
perror(path);
return -1;
}
return 0;
}
static void
usage()
{
(void )fprintf(stderr,
"Usage: unlink [-a] [-m <driver>] [-r <mntpath>]"
" [<path> ...\n]");
exit(1);
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v
retrieving revision 1.8.4.2
retrieving revision 1.8.4.3
diff -u -w -b -B -p -r1.8.4.2 -r1.8.4.3
--- Makefile.am 8 Sep 2003 03:52:28 -0000 1.8.4.2
+++ Makefile.am 1 Nov 2003 03:08:23 -0000 1.8.4.3
@@ -1,5 +1,5 @@
noinst_PROGRAMS = test_copy test_stats test_path test_mounts test_list \
- test_getcwd test_stdfd test_driver
+ test_getcwd test_stdfd test_link test_unlink test_rename test_driver
CLEANFILES=drv_data.c
@@ -36,6 +36,7 @@ endif
if WITH_CPLANT_YOD
YOD_DRIVER_NAME=yod
YOD_DRIVER_CFLAGS= -DCPLANT_YOD
+YOD_DRIVER_LIB=$(top_builddir)/drivers/yod/libsysio_yod.a
else
YOD_DRIVER_NAME=
YOD_DRIVER_CFLAGS=
@@ -55,7 +56,13 @@ CMNSRC=drv_init_all.c drv_data.c
BUILT_SOURCES=drv_data.c
check_PROGRAMS=test_driver
+if TEST_ALPHA_ARG
+TESTS_ENVIRONMENT=IS_ALPHA=yes
+else
+TESTS_ENVIRONMENT=IS_ALPHA=no
+endif
TESTS=test_all.pl
+
CFL=$(AM_CFLAGS) $(AM_CPPFLAGS) \
$(NATIVE_DRIVER_CFLAGS) $(INCORE_DRIVER_CFLAGS) \
$(STDFD_DEV_CFLAGS) $(YOD_DRIVER_CFLAGS)
@@ -100,12 +107,27 @@ test_stdfd_CFLAGS=$(CFL)
test_stdfd_LDADD=$(LIBS)
test_stdfd_DEPENDENCIES=$(LIBS)
+test_link_SOURCES=test_link.c $(CMNSRC)
+test_link_CFLAGS=$(CFL)
+test_link_LDADD=$(LIBS)
+test_link_DEPENDENCIES=$(LIBS)
+
+test_unlink_SOURCES=test_unlink.c $(CMNSRC)
+test_unlink_CFLAGS=$(CFL)
+test_unlink_LDADD=$(LIBS)
+test_unlink_DEPENDENCIES=$(LIBS)
+
+test_rename_SOURCES=test_rename.c $(CMNSRC)
+test_rename_CFLAGS=$(CFL)
+test_rename_LDADD=$(LIBS)
+test_rename_DEPENDENCIES=$(LIBS)
+
test_driver_SOURCES=test_driver.c sysio_tests.c sysio_stubs.c help.c $(CMNSRC)
test_driver_CFLAGS=$(CFL)
test_driver_LDADD=$(LIBS)
test_driver_DEPENDENCIES=$(LIBS)
-EXTRA_DIST=gendrvdata.sh test.h test_driver.h
+EXTRA_DIST=$(shell ls *.pl *.pm) gendrvdata.sh test.h test_driver.h
drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh
test -z "drv_data.c" && rm -f drv_data.c; \
Index: README
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/README,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- README 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ README 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -1,8 +1,12 @@
-To run the tests, just do ./test_all.pl (at some point I will
-integrate that into the build environment). This will run the 6
-basic functionality tests (explained below) and report the total
-number of passes and failures. This is not currently working on
-alpha/cplant architectures, however.
+To run the tests, just do a "make check" in the tests subdirectory.
+On the CPlant alpha systems, 3 of the 7 tests in test_all.pl are excluded
+due to known problems (problems as of the date of writing this; they
+may have since been fixed). You can also manually run the individual
+tests or ./test_all.pl. If you are running on CPlant, you need to
+run test_all.pl with a -alpha argument. Either "make check" or
+test_all.pl will run the 7 basic functionality tests (explained
+below) and report the total number of passes and failures.
+number of passes and failures.
-----------------------SCRIPTS---------------------------------
Index: drv_init_all.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/drv_init_all.c,v
retrieving revision 1.1
retrieving revision 1.1.12.1
diff -u -w -b -B -p -r1.1 -r1.1.12.1
--- drv_init_all.c 22 Feb 2003 18:25:11 -0000 1.1
+++ drv_init_all.c 1 Nov 2003 03:08:23 -0000 1.1.12.1
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
extern int (*drvinits[])(void);
/*
Index: helper.pm
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/helper.pm,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- helper.pm 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ helper.pm 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -7,7 +7,7 @@
package helper;
use strict;
-use Fcntl ':mode';
+use POSIX;
BEGIN{}
Index: sysio_stubs.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- sysio_stubs.c 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ sysio_stubs.c 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -7,7 +7,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/uio.h>
-#include <linux/fs.h>
+#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
@@ -22,7 +22,7 @@
* ################################################
*/
-int do_setdebug(int argc, char **argv)
+int test_do_setdebug(int argc, char **argv)
{
int level;
@@ -43,7 +43,7 @@ int do_setdebug(int argc, char **argv)
return SUCCESS;
}
-int do_printline(int argc, char **argv)
+int test_do_printline(int argc, char **argv)
{
int on;
@@ -64,7 +64,7 @@ int do_printline(int argc, char **argv)
}
/*
-int do_setoutput(int argc, char **argv)
+int test_do_setoutput(int argc, char **argv)
{
FILE *newfp;
@@ -88,7 +88,7 @@ int do_setoutput(int argc, char **argv)
*/
-int do_fillbuff(int argc, char **argv)
+int test_do_fillbuff(int argc, char **argv)
{
char *typestr, *buf;
void *valptr;
@@ -209,7 +209,7 @@ void print_partial(char *buf, int offset
}
}
-int do_printbuf(int argc, char **argv)
+int test_do_printbuf(int argc, char **argv)
{
int index, i, type, offset, len;
struct buf_t *buf_st;
@@ -288,10 +288,10 @@ int do_printbuf(int argc, char **argv)
return SUCCESS;
}
-int do_mount(int argc, char **argv)
+int test_do_mount(int argc, char **argv)
{
if (argc != 2) {
- DBG(2, fprintf(outfp, "Invalid number of args (%d) for do_mount\n",
+ DBG(2, fprintf(outfp, "Invalid number of args (%d) for test_do_mount\n",
argc));
return INVALID_ARGS;
}
@@ -304,7 +304,7 @@ int do_mount(int argc, char **argv)
return SUCCESS;
}
-int do_clear(int argc, char **argv)
+int test_do_clear(int argc, char **argv)
{
int index;
struct buf_t *buf;
@@ -326,7 +326,7 @@ int do_clear(int argc, char **argv)
return SUCCESS;
}
-int do_list(int argc, char **argv)
+int test_do_list(int argc, char **argv)
{
char *buf;
@@ -336,7 +336,7 @@ int do_list(int argc, char **argv)
return INVALID_ARGS;
}
- DBG(5,fprintf(outfp, "In do_list with args %p\n", argv));
+ DBG(5,fprintf(outfp, "In test_do_list with args %p\n", argv));
if (!argv) {
buf = getcwd(NULL, 0);
DBG(4, fprintf(outfp, "Calling list with dir of %s\n", buf));
@@ -354,7 +354,7 @@ int do_list(int argc, char **argv)
* Initlizes sysio library. Will use default initlization
* unless arguments are given
*/
-int do_init(int argc, char **argv)
+int test_do_init(int argc, char **argv)
{
if (argc > 0) {
char *rdriver;
@@ -391,7 +391,7 @@ int do_init(int argc, char **argv)
}
}
- DBG(5, fprintf(outfp, "In do_init\n"));
+ DBG(5, fprintf(outfp, "In test_do_init\n"));
last_type = SINT;
DBG(3, fprintf(outfp, "Using driver %s, path %s, flags %x\n",
root_driver, mntpath, mntflgs));
@@ -408,7 +408,7 @@ int get_endian(int argc, char **argv)
int x = 1;
if ((argc) || (argv)) {
- DBG(2, fprintf(outfp, "Expected no args for do_endian\n"));
+ DBG(2, fprintf(outfp, "Expected no args for test_do_endian\n"));
return INVALID_ARGS;
}
@@ -460,7 +460,7 @@ int get_sizeof(int argc, char **argv)
return SUCCESS;
}
-int do_exit(int argc, char **argv)
+int test_do_exit(int argc, char **argv)
{
int val = 0;
@@ -557,14 +557,14 @@ int cmp_bufs(int argc, char **argv)
if (argc != 2) {
fprintf(outfp, "Need two buffers to compare\n");
- return -1;
+ return INVALID_ARGS;
}
index1 = get_obj(argv[0]);
if (index1 < 0) {
fprintf(outfp, "Unable to locate buffer %s\n",
argv[0]);
- return -1;
+ return INVALID_VAR;
}
buf1 = buflist[index1]->buf;
@@ -572,17 +572,17 @@ int cmp_bufs(int argc, char **argv)
if (index2 < 0) {
fprintf(outfp, "Unable to locate buffer %s\n",
argv[1]);
- return -1;
+ return INVALID_VAR;
}
buf2 = buflist[index2]->buf;
- res = strcmp(buf1, buf2);
+ last_ret_val = strcmp(buf1, buf2);
DBG(3, fprintf(outfp, "strcmp returned %d\n", res));
- return res;
+ return SUCCESS;
}
-int do_chdir(int argc, char **argv)
+int test_do_chdir(int argc, char **argv)
{
if (argc != 1) {
DBG(2, fprintf(outfp, "Number of args (%d) invalid for chdir\n",
@@ -594,7 +594,7 @@ int do_chdir(int argc, char **argv)
}
-int do_chmod(int argc, char **argv)
+int test_do_chmod(int argc, char **argv)
{
if (argc != 2) {
DBG(2, fprintf(outfp, "Number of args (%d) invalid for chmod\n",
@@ -605,7 +605,7 @@ int do_chmod(int argc, char **argv)
return sysio_chmod(argv[0], argv[1]);
}
-int do_chown(int argc, char **argv)
+int test_do_chown(int argc, char **argv)
{
if (argc != 2) {
DBG(2, fprintf(outfp, "Number of args (%d) invalid for chown\n",
@@ -616,7 +616,7 @@ int do_chown(int argc, char **argv)
return sysio_chown(argv[0], argv[1]);
}
-int do_open(int argc, char **argv)
+int test_do_open(int argc, char **argv)
{
char *name = argv[0];
int flags = O_RDWR;
@@ -649,7 +649,7 @@ int do_open(int argc, char **argv)
return SUCCESS;
}
-int do_close(int argc, char **argv)
+int test_do_close(int argc, char **argv)
{
int fd;
char *name = argv[0];
@@ -675,7 +675,7 @@ int do_close(int argc, char **argv)
return SUCCESS;
}
-int do_dup(int argc, char **argv)
+int test_do_dup(int argc, char **argv)
{
int fd;
char *var_name = argv[0];
@@ -700,7 +700,7 @@ int do_dup(int argc, char **argv)
return SUCCESS;
}
-int do_dup2(int argc, char **argv)
+int test_do_dup2(int argc, char **argv)
{
int fd1, fd2;
char *var_name1 = argv[0];
@@ -770,7 +770,7 @@ struct cmd_map* get_cmd(char *cmd_name,
return NULL;
}
-int do_fcntl(int argc, char **argv)
+int test_do_fcntl(int argc, char **argv)
{
struct cmd_map *cmd;
@@ -806,7 +806,7 @@ int do_fcntl(int argc, char **argv)
return SUCCESS;
}
-int do_fstat(int argc, char **argv)
+int test_do_fstat(int argc, char **argv)
{
int fd, index;
void *buf;
@@ -841,7 +841,7 @@ int do_fstat(int argc, char **argv)
return SUCCESS;
}
-int do_lstat(int argc, char **argv)
+int test_do_lstat(int argc, char **argv)
{
char *name = argv[0];
int index;
@@ -866,7 +866,7 @@ int do_lstat(int argc, char **argv)
return sysio_lstat(name, buf);
}
-int do_fsync(int argc, char **argv)
+int test_do_fsync(int argc, char **argv)
{
int fd;
@@ -892,7 +892,7 @@ int do_fsync(int argc, char **argv)
}
-int do_fdatasync(int argc, char **argv)
+int test_do_fdatasync(int argc, char **argv)
{
int fd;
@@ -918,7 +918,7 @@ int do_fdatasync(int argc, char **argv)
}
-int do_ftruncate(int argc, char **argv)
+int test_do_ftruncate(int argc, char **argv)
{
int fd;
off_t length;
@@ -948,7 +948,7 @@ int do_ftruncate(int argc, char **argv)
return SUCCESS;
}
-int do_getcwd(int argc, char **argv)
+int test_do_getcwd(int argc, char **argv)
{
char *buf;
int size, index;
@@ -985,7 +985,7 @@ int do_getcwd(int argc, char **argv)
return SUCCESS;
}
-int do_lseek(int argc, char **argv)
+int test_do_lseek(int argc, char **argv)
{
int fd, whence;
off_t offset;
@@ -1021,7 +1021,7 @@ int do_lseek(int argc, char **argv)
return SUCCESS;
}
-int do_getdirentries(int argc, char **argv)
+int test_do_getdirentries(int argc, char **argv)
{
int fd, nbytes;
int bufindex;
@@ -1084,7 +1084,7 @@ int do_getdirentries(int argc, char **ar
return SUCCESS;
}
-int do_mkdir(int argc, char **argv)
+int test_do_mkdir(int argc, char **argv)
{
if (argc !=2) {
DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to mkdir\n", argc));
@@ -1095,7 +1095,7 @@ int do_mkdir(int argc, char **argv)
return sysio_mkdir(argv[0], argv[1]);
}
-int do_creat(int argc, char **argv)
+int test_do_creat(int argc, char **argv)
{
if (argc !=2) {
DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to creat\n", argc));
@@ -1106,7 +1106,7 @@ int do_creat(int argc, char **argv)
return sysio_creat(argv[0], argv[1]);
}
-int do_stat(int argc, char **argv)
+int test_do_stat(int argc, char **argv)
{
int index;
void *buf;
@@ -1132,7 +1132,7 @@ int do_stat(int argc, char **argv)
return sysio_stat(str, buf);
}
-int do_statvfs(int argc, char **argv)
+int test_do_statvfs(int argc, char **argv)
{
int index;
void *buf;
@@ -1156,7 +1156,7 @@ int do_statvfs(int argc, char **argv)
return sysio_statvfs(argv[0], buf);
}
-int do_fstatvfs(int argc, char **argv)
+int test_do_fstatvfs(int argc, char **argv)
{
int index, fd;
void *buf;
@@ -1188,7 +1188,7 @@ int do_fstatvfs(int argc, char **argv)
return sysio_fstatvfs(fd, buf);
}
-int do_truncate(int argc, char **argv)
+int test_do_truncate(int argc, char **argv)
{
off_t length;
@@ -1208,7 +1208,7 @@ int do_truncate(int argc, char **argv)
return SUCCESS;
}
-int do_rmdir(int argc, char **argv)
+int test_do_rmdir(int argc, char **argv)
{
if (argc != 1) {
@@ -1225,7 +1225,7 @@ int do_rmdir(int argc, char **argv)
return SUCCESS;
}
-int do_symlink(int argc, char **argv)
+int test_do_symlink(int argc, char **argv)
{
if (argc != 2) {
DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to symlink\n", argc));
@@ -1235,8 +1235,11 @@ int do_symlink(int argc, char **argv)
DBG(3, fprintf(outfp, "Linking %s to %s\n", argv[0], argv[1]));
last_ret_val = symlink(argv[0], argv[1]);
- if (last_ret_val)
+ if (last_ret_val) {
+ if (errno < 0)
+ errno = errno*-1;
my_perror("symlink");
+ }
my_errno = errno;
last_type = SINT;
@@ -1245,6 +1248,7 @@ int do_symlink(int argc, char **argv)
struct cmd_map ioctl_cmds[] = {
+#if 0
{ "BLKROSET", BLKROSET, 3 },
{ "BLKROGET", BLKROGET, 3 },
{ "BLKRRPART", BLKRRPART, 3 },
@@ -1260,6 +1264,7 @@ struct cmd_map ioctl_cmds[] = {
{ "BLKBSZSET", BLKBSZSET, 3 },
{ "FIBMAP", FIBMAP, 3 },
{ "FIGETBSZ", FIGETBSZ, 3},
+#endif
{ NULL, -1, 0 }
};
@@ -1277,7 +1282,7 @@ int get_ioctl_cmd(char *cmd)
return -1;
}
-int do_ioctl(int argc, char **argv)
+int test_do_ioctl(int argc, char **argv)
{
int fd, cmd;
@@ -1310,7 +1315,7 @@ int do_ioctl(int argc, char **argv)
return SUCCESS;
}
-int do_unlink(int argc, char **argv)
+int test_do_unlink(int argc, char **argv)
{
if (argc != 1) {
DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to unlink\n", argc));
@@ -1328,7 +1333,7 @@ int do_unlink(int argc, char **argv)
return SUCCESS;
}
-int do_umask(int argc, char **argv)
+int test_do_umask(int argc, char **argv)
{
mode_t old_mask;
@@ -1345,7 +1350,7 @@ int do_umask(int argc, char **argv)
return SUCCESS;
}
-int do_iowait(int argc, char **argv)
+int test_do_iowait(int argc, char **argv)
{
int err;
ioid_t ioid;
@@ -1373,7 +1378,7 @@ int do_iowait(int argc, char **argv)
return SUCCESS;
}
-int do_iodone(int argc, char **argv)
+int test_do_iodone(int argc, char **argv)
{
int err;
ioid_t ioid;
@@ -1401,7 +1406,7 @@ int do_iodone(int argc, char **argv)
}
-int do_ipread(int argc, char **argv)
+int test_do_ipread(int argc, char **argv)
{
int fd, index, count, offset;
char *buf;
@@ -1447,7 +1452,7 @@ int do_ipread(int argc, char **argv)
return SUCCESS;
}
-int do_iread(int argc, char **argv)
+int test_do_iread(int argc, char **argv)
{
int fd, index, count;
char *buf;
@@ -1488,7 +1493,7 @@ int do_iread(int argc, char **argv)
}
-int do_ipreadv(int argc, char **argv)
+int test_do_ipreadv(int argc, char **argv)
{
int fd, count, index;
off_t offset;
@@ -1543,7 +1548,7 @@ int do_ipreadv(int argc, char **argv)
}
-int do_preadv(int argc, char **argv)
+int test_do_preadv(int argc, char **argv)
{
int fd, count, index;
off_t offset;
@@ -1598,7 +1603,7 @@ int do_preadv(int argc, char **argv)
}
-int do_pread(int argc, char **argv)
+int test_do_pread(int argc, char **argv)
{
int fd, count, index, numbytes, offset;
char *buf;
@@ -1651,7 +1656,7 @@ int do_pread(int argc, char **argv)
}
-int do_ireadv(int argc, char **argv)
+int test_do_ireadv(int argc, char **argv)
{
int fd, count, index;
char *buf;
@@ -1698,7 +1703,7 @@ int do_ireadv(int argc, char **argv)
return SUCCESS;
}
-int do_readv(int argc, char **argv)
+int test_do_readv(int argc, char **argv)
{
int fd, count, index;
char *buf;
@@ -1745,7 +1750,7 @@ int do_readv(int argc, char **argv)
return SUCCESS;
}
-int do_read(int argc, char **argv)
+int test_do_read(int argc, char **argv)
{
int fd, count, index, numbytes=0;
char *buf;
@@ -1798,7 +1803,7 @@ int do_read(int argc, char **argv)
return SUCCESS;
}
-int do_ipwritev(int argc, char **argv)
+int test_do_ipwritev(int argc, char **argv)
{
int fd, count, index, offset;
char *buf;
@@ -1852,7 +1857,7 @@ int do_ipwritev(int argc, char **argv)
return SUCCESS;
}
-int do_ipwrite(int argc, char **argv)
+int test_do_ipwrite(int argc, char **argv)
{
int fd, count, index, offset;
char *buf;
@@ -1899,7 +1904,7 @@ int do_ipwrite(int argc, char **argv)
return SUCCESS;
}
-int do_pwritev(int argc, char **argv)
+int test_do_pwritev(int argc, char **argv)
{
int fd, count, index, offset;
char *buf;
@@ -1954,7 +1959,7 @@ int do_pwritev(int argc, char **argv)
return SUCCESS;
}
-int do_pwrite(int argc, char **argv)
+int test_do_pwrite(int argc, char **argv)
{
int fd, count, index, offset;
char *buf;
@@ -2002,7 +2007,7 @@ int do_pwrite(int argc, char **argv)
}
-int do_iwritev(int argc, char **argv)
+int test_do_iwritev(int argc, char **argv)
{
int fd, count, index;
char *buf;
@@ -2049,7 +2054,7 @@ int do_iwritev(int argc, char **argv)
return SUCCESS;
}
-int do_iwrite(int argc, char **argv)
+int test_do_iwrite(int argc, char **argv)
{
int fd, count, index;
char *buf;
@@ -2091,7 +2096,7 @@ int do_iwrite(int argc, char **argv)
}
-int do_write(int argc, char **argv)
+int test_do_write(int argc, char **argv)
{
int fd, count, index, err;
char *buf;
@@ -2137,7 +2142,7 @@ int do_write(int argc, char **argv)
}
-int do_writev(int argc, char **argv)
+int test_do_writev(int argc, char **argv)
{
int fd, count, index;
char *buf;
@@ -2184,7 +2189,7 @@ int do_writev(int argc, char **argv)
return SUCCESS;
}
-int do_mknod(int argc, char **argv)
+int test_do_mknod(int argc, char **argv)
{
int dev;
@@ -2204,7 +2209,7 @@ int do_mknod(int argc, char **argv)
return sysio_mknod(argv[0], argv[1], (dev_t) dev);
}
-int do_umount(int argc, char **argv)
+int test_do_umount(int argc, char **argv)
{
int err;
Index: sysio_tests.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- sysio_tests.c 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ sysio_tests.c 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -44,6 +44,7 @@ int initilize_sysio(char *root_driver, c
* source directory.
*/
err = drv_init_all();
+ DBG(5, sprintf(output, "%sdrv_init_all: err %d\n", output, err));
if (err) {
my_errno = err;
my_perror("drv_init_all");
@@ -51,6 +52,7 @@ int initilize_sysio(char *root_driver, c
return SUCCESS;
}
err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL);
+ DBG(5, sprintf(output, "%ssysio_mount_root: err %d\n", output, err));
if (err) {
my_errno = errno;
my_perror("_sysio_mount_root");
@@ -70,6 +72,7 @@ int initilize_sysio(char *root_driver, c
strcpy(wd, "/");
}
if (chdir(wd) != 0) {
+ DBG(5, sprintf(output, "%schdir: errno %d\n", output, errno));
my_perror(wd);
my_errno = errno;
last_ret_val = errno;
@@ -551,10 +555,10 @@ int sysio_chown(char *new_id, char *file
int sysio_open(char *path, int flags)
{
- DBG(4, sprintf(output, "Opening file %s with flags %x\n",
- path, flags));
last_ret_val = open(path, flags);
my_errno = errno;
+ DBG(3, sprintf(output, "Returning with errno set to %s (ret val is %d)\n",
+ strerror(my_errno), last_ret_val));
return SUCCESS;
}
@@ -574,6 +578,7 @@ int sysio_open3(char *path, int flags, c
last_ret_val = open(path, flags, mode);
my_errno = errno;
+
return SUCCESS;
}
@@ -824,7 +829,11 @@ void print_statvfs(struct statvfs *st)
DBG(3, sprintf(output, "%s f_ffree: %x\n", output, (unsigned int) st->f_ffree));
DBG(3, sprintf(output, "%s f_favail: %x\n", output, (unsigned int) st->f_favail));
DBG(3, sprintf(output, "%s f_files: %x\n", output, (unsigned int) st->f_files));
+#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
+ DBG(3, sprintf(output, "%s f_fsid: %x\n", output, (unsigned int) st->f_fsid.__val[1]));
+#else
DBG(3, sprintf(output, "%s f_fsid: %x\n", output, (unsigned int) st->f_fsid));
+#endif
DBG(3, sprintf(output, "%s f_flag: %x\n", output, (unsigned int) st->f_flag));
DBG(3, sprintf(output, "%s f_fnamemax: %x\n", output, (unsigned int) st->f_namemax));
}
Index: test_all.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- test_all.pl 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ test_all.pl 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -6,30 +6,58 @@
#
use strict;
+use Cwd 'abs_path';
my $alpha_arg = "";
+my $use_system = 1;
my $is_broke = 1; # Don't test certain areas known to not work on Cplant
-if ((@ARGV > 0) && ($ARGV[0] eq "-alpha")) {
+my $arg_count = @ARGV;
+foreach my $arg (@ARGV) {
+ if ($arg eq "-alpha") {
+ $alpha_arg = "-alpha";
+ } elsif ($arg eq "-nosystem") {
+ $use_system = 0;
+ }
+}
+my $alpha_env = $ENV{"IS_ALPHA"};
+# Check the environment vars
+if (defined($alpha_env) && ($alpha_env eq "yes")) {
$alpha_arg = "-alpha";
}
-
-
-# Will use this directory...
-system("mkdir ./tmp_dir");
my $failures = 0;
my $success = 0;
# Get cwd..
my $cwd = $ENV{PWD};
-# Get the sysio dir
-my $sysdir = $cwd;
-$sysdir =~ s/\/\w+$//;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
my $res;
+if ($use_system == 1) {
+ # Will use this directory...
+ system("mkdir -p $cwd/tmp_dir");
+
+ # Create a couple of files and subdirectories for use in the tests
+ system("mkdir -p $cwd/tmp_dir/test1");
+ system("mkdir -p $cwd/tmp_dir/test2");
+
+ system("cp $testdir/helper.pm $cwd/tmp_dir/test1");
+} else {
+ $res = `perl $testdir/setup.pl $alpha_arg $cwd`;
+ chop($res);
+ if ($res ne "setup successful") {
+ print "Test setup failed with $res, bailing out\n";
+ exit 1;
+ }
+}
+
+
if (($alpha_arg eq "") || ($is_broke == 0)) {
# Test getdirentries
- $res = `./test_list.pl $alpha_arg $sysdir`;
+ $res = `perl $testdir/test_list.pl $alpha_arg $cwd/tmp_dir`;
chop($res);
if ($res ne "list test successful") {
print "Basic getdirentries test failed with message: $res\n";
@@ -41,8 +69,9 @@ if (($alpha_arg eq "") || ($is_broke ==
}
# Test path
-my @resarr = `./test_path.pl $alpha_arg $sysdir $cwd $cwd/tmp_dir`;
-$res = $sysdir.": d\n";
+my $path1 = abs_path($testdir);
+my @resarr = `perl $testdir/test_path.pl $alpha_arg $path1 $cwd $cwd/tmp_dir`;
+$res = $path1.": d\n";
if ($resarr[0] ne $res) {
print "path test returned $resarr[0] instead of $res\n";
$failures++;
@@ -65,7 +94,7 @@ if ($resarr[0] ne $res) {
if (($alpha_arg eq "") || ($is_broke == 0)) {
# Test mount
- $res = `./test_list.pl $alpha_arg -m native:$sysdir $cwd/tmp_dir`;
+ $res = `perl $testdir/test_list.pl $alpha_arg -m native:$testdir $cwd/tmp_dir/test2`;
chop($res);
if ($res ne "list test successful") {
print "Mount test failed with message: $res\n";
@@ -75,8 +104,9 @@ if (($alpha_arg eq "") || ($is_broke ==
print "test_mount finished successfully\n";
}
+}
# Test getcwd
- $res = `./test_getcwd.pl $alpha_arg $sysdir`;
+$res = `perl $testdir/test_getcwd.pl $alpha_arg $cwd/tmp_dir/test1`;
chop($res);
if ($res ne "getcwd test successful") {
print "getcwd test failed with message: $res\n";
@@ -85,10 +115,9 @@ if (($alpha_arg eq "") || ($is_broke ==
$success++;
print "test_getcwd finished successfully\n";
}
-}
# Test copy
-$res = `./test_copy.pl $alpha_arg $sysdir/README $cwd/tmp_dir/README`;
+$res = `perl $testdir/test_copy.pl $alpha_arg $cwd/tmp_dir/test1/helper.pm $cwd/tmp_dir/helper.pm`;
chop($res);
if ($res ne "copy test successful") {
print "copy test failed with message: $res\n";
@@ -99,7 +128,7 @@ if ($res ne "copy test successful") {
}
# Test stats
-$res = `./test_stats.pl $alpha_arg $cwd/tmp_dir/README`;
+$res = `perl $testdir/test_stats.pl $alpha_arg $use_system $cwd/tmp_dir/helper.pm`;
chop($res);
if ($res ne "stat test successful") {
print "stat test failed with message: $res\n";
@@ -110,7 +139,7 @@ if ($res ne "stat test successful") {
}
# Test stdfd
-$res = `./test_stdfd.pl $alpha_arg foo_dir`;
+$res = `perl $testdir/test_stdfd.pl $alpha_arg foo_dir`;
chop($res);
if ($res ne "test_stdfd successful") {
print "stdfd test failed with message: $res\n";
@@ -120,7 +149,29 @@ if ($res ne "test_stdfd successful") {
print "test_stdfd finished successfully\n";
}
+# Test symlink
+$res = `perl $testdir/test_symlink.pl $alpha_arg $cwd/tmp_dir/helper.pm $cwd/tmp_dir/helper.foo`;
+chop($res);
+if ($res ne "Symlink test successful") {
+ print "symlink test failed with message: $res\n";
+ $failures++;
+} else {
+ $success++;
+ print "test_symlink finished successfully\n";
+}
+
print "$failures tests failed and $success tests succeeded\n";
# cleanup
-system(`rm -rf tmp_dir`);
+if ($use_system == 1) {
+ system(`rm -rf $cwd/tmp_dir`);
+} else {
+ $res = `perl $testdir/cleanup.pl $alpha_arg $cwd`;
+ chop($res);
+ if ($res ne "cleanup successful") {
+ print "Test cleanup failed with $res, bailing out\n";
+ exit 1;
+ }
+}
+
+exit $failures;
Index: test_copy.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -u -w -b -B -p -r1.5.4.1 -r1.5.4.2
--- test_copy.c 15 Aug 2003 07:43:15 -0000 1.5.4.1
+++ test_copy.c 1 Nov 2003 03:08:23 -0000 1.5.4.2
@@ -46,7 +46,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#ifndef REDSTORM
#include <getopt.h>
+#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -90,7 +92,7 @@ main(int argc, char * const argv[])
#ifdef AUTOMOUNT_FILE_NAME
"a"
#endif
- "i:m:")) != -1)
+ "r:m:")) != -1)
switch (i) {
#ifdef AUTOMOUNT_FILE_NAME
Index: test_copy.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- test_copy.pl 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ test_copy.pl 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -8,6 +8,8 @@
use IPC::Open2;
use strict;
+use FindBin;
+use lib "$FindBin::Bin";
use helper;
sub usage
@@ -20,12 +22,15 @@ sub process_cmd
{
my ($src, $dest, $is_alpha) = @_;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
eval {
if ($is_alpha == 0) {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
- open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 ./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 $testdir/test_driver --np");
}
};
Index: test_driver.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- test_driver.c 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ test_driver.c 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -39,68 +39,68 @@ struct queue_t {
struct cmd_t cmd_list[] = {
{"alloc", get_buffer, usage_get_buffer},
- {"chdir", do_chdir, usage_chdir},
- {"chmod", do_chmod, usage_chmod},
- {"chown", do_chown, usage_chown},
- {"clear", do_clear, usage_clear},
- {"close", do_close, usage_close},
+ {"chdir", test_do_chdir, usage_chdir},
+ {"chmod", test_do_chmod, usage_chmod},
+ {"chown", test_do_chown, usage_chown},
+ {"clear", test_do_clear, usage_clear},
+ {"close", test_do_close, usage_close},
{"cmpstr", cmp_bufs, usage_cmpbufs},
- {"creat", do_creat, usage_creat},
- {"debug", do_setdebug, usage_setdebug},
- {"dup", do_dup, usage_dup},
- {"dup2", do_dup2, usage_dup2},
+ {"creat", test_do_creat, usage_creat},
+ {"debug", test_do_setdebug, usage_setdebug},
+ {"dup", test_do_dup, usage_dup},
+ {"dup2", test_do_dup2, usage_dup2},
{"endian", get_endian, usage_endian},
- {"exit", do_exit, usage_exit},
- {"fcntl", do_fcntl, usage_fcntl},
- {"fdatasync", do_fdatasync, usage_fdatasync},
- {"fill", do_fillbuff, usage_do_fillbuff},
+ {"exit", test_do_exit, usage_exit},
+ {"fcntl", test_do_fcntl, usage_fcntl},
+ {"fdatasync", test_do_fdatasync, usage_fdatasync},
+ {"fill", test_do_fillbuff, usage_do_fillbuff},
{"free", free_buffer, usage_free_buffer},
- {"fstat", do_fstat, usage_fstat},
- {"fstatvfs", do_fstatvfs, usage_fstatvfs},
- {"fsync", do_fsync, usage_fsync},
- {"ftruncate", do_ftruncate, usage_ftruncate},
- {"getcwd", do_getcwd, usage_getcwd},
- {"getdirentries", do_getdirentries, usage_getdirentries},
- {"init", do_init, usage_init},
- {"ioctl", do_ioctl, usage_ioctl},
- {"iodone", do_iodone, usage_iodone},
- {"iowait", do_iowait, usage_iowait},
- {"ipread", do_ipread, usage_ipread},
- {"ipreadv", do_ipreadv, usage_ipreadv},
- {"ipwrite", do_ipwrite, usage_ipwrite},
- {"ipwritev", do_ipwritev, usage_ipwritev},
- {"iread", do_iread, usage_iread},
- {"ireadv", do_ireadv, usage_ireadv},
- {"iwrite", do_iwrite, usage_iwrite},
- {"iwritev", do_iwritev, usage_iwritev},
- {"list", do_list, usage_list},
- {"lseek", do_lseek, usage_lseek},
- {"lstat", do_lstat, usage_lstat},
- {"mkdir", do_mkdir, usage_mkdir},
- {"mknod", do_mknod, usage_mknod},
- {"mount", do_mount, usage_mount},
- {"open", do_open, usage_open},
- {"printbuf", do_printbuf, usage_do_printbuf},
- {"printline", do_printline, usage_printline},
- {"pread", do_pread, usage_pread},
- {"preadv", do_preadv, usage_preadv},
- {"pwritev", do_pwritev, usage_pwritev},
- {"pwrite", do_pwrite, usage_pwrite},
- {"quit", do_exit, usage_exit},
- {"read", do_read, usage_read},
- {"readv", do_readv, usage_readv},
- {"rmdir", do_rmdir, usage_rmdir},
+ {"fstat", test_do_fstat, usage_fstat},
+ {"fstatvfs", test_do_fstatvfs, usage_fstatvfs},
+ {"fsync", test_do_fsync, usage_fsync},
+ {"ftruncate", test_do_ftruncate, usage_ftruncate},
+ {"getcwd", test_do_getcwd, usage_getcwd},
+ {"getdirentries", test_do_getdirentries, usage_getdirentries},
+ {"init", test_do_init, usage_init},
+ {"ioctl", test_do_ioctl, usage_ioctl},
+ {"iodone", test_do_iodone, usage_iodone},
+ {"iowait", test_do_iowait, usage_iowait},
+ {"ipread", test_do_ipread, usage_ipread},
+ {"ipreadv", test_do_ipreadv, usage_ipreadv},
+ {"ipwrite", test_do_ipwrite, usage_ipwrite},
+ {"ipwritev", test_do_ipwritev, usage_ipwritev},
+ {"iread", test_do_iread, usage_iread},
+ {"ireadv", test_do_ireadv, usage_ireadv},
+ {"iwrite", test_do_iwrite, usage_iwrite},
+ {"iwritev", test_do_iwritev, usage_iwritev},
+ {"list", test_do_list, usage_list},
+ {"lseek", test_do_lseek, usage_lseek},
+ {"lstat", test_do_lstat, usage_lstat},
+ {"mkdir", test_do_mkdir, usage_mkdir},
+ {"mknod", test_do_mknod, usage_mknod},
+ {"mount", test_do_mount, usage_mount},
+ {"open", test_do_open, usage_open},
+ {"printbuf", test_do_printbuf, usage_do_printbuf},
+ {"printline", test_do_printline, usage_printline},
+ {"pread", test_do_pread, usage_pread},
+ {"preadv", test_do_preadv, usage_preadv},
+ {"pwritev", test_do_pwritev, usage_pwritev},
+ {"pwrite", test_do_pwrite, usage_pwrite},
+ {"quit", test_do_exit, usage_exit},
+ {"read", test_do_read, usage_read},
+ {"readv", test_do_readv, usage_readv},
+ {"rmdir", test_do_rmdir, usage_rmdir},
{"sizeof", get_sizeof, usage_sizeof},
- /* {"setoutput", do_setoutput, usage_setoutput}, */
- {"stat", do_stat, usage_stat},
- {"statvfs", do_statvfs, usage_statvfs},
- {"symlink", do_symlink, usage_symlink},
- {"truncate", do_truncate, usage_truncate},
- {"umask", do_umask, usage_umask},
- {"umount", do_umount, usage_umount},
- {"unlink", do_unlink, usage_unlink},
- {"write", do_write, usage_write},
- {"writev", do_writev, usage_writev},
+ /* {"setoutput", test_do_setoutput, usage_setoutput}, */
+ {"stat", test_do_stat, usage_stat},
+ {"statvfs", test_do_statvfs, usage_statvfs},
+ {"symlink", test_do_symlink, usage_symlink},
+ {"truncate", test_do_truncate, usage_truncate},
+ {"umask", test_do_umask, usage_umask},
+ {"umount", test_do_umount, usage_umount},
+ {"unlink", test_do_unlink, usage_unlink},
+ {"write", test_do_write, usage_write},
+ {"writev", test_do_writev, usage_writev},
{NULL, NULL, NULL}
};
@@ -120,8 +120,8 @@ void * alloc_buff32(unsigned int size, i
long buf_ptr;
int err;
/*
- if ((err = posix_memalign(&buf, align, size)) != 0) {
- perror("posix_memalign");
+ if ((err = memalign(&buf, align, size)) != 0) {
+ perror("memalign");
return 0;
}
*/
@@ -145,7 +145,7 @@ long alloc_buff64(unsigned int size, int
char * buf;
long ret_value;
- if (posix_memalign((void **)&buf, align, size))
+ if (memalign((void **)&buf, align, size))
return 0;
ret_value = (long)buf;
@@ -621,6 +621,9 @@ int add_args(char **cmd, int length, int
new->val = NULL;
new->cmd = build_tree(&cmd[1], &new_len, total);
+ if (new->cmd == NULL) { /* Invalid command */
+ return length; /* Pretend we used everything up */
+ }
total = (length - new_len);
DBG(4, fprintf(outfp, "Used %d bytes\n", total));
}
@@ -659,9 +662,10 @@ cmd_tree* build_tree(char **cmd, int *le
{
int index = 0, used_args = 0;
cmd_tree *tree;
- if ((*length < 0) || (!cmd))
+ if ((*length < 0) || (!cmd) || (*cmd == NULL))
return NULL;
+
DBG(4, fprintf(outfp, "length is %d\n", *length));
tree = (cmd_tree *)malloc(sizeof(cmd_tree));
tree->res_name = NULL;
@@ -721,7 +725,11 @@ char *getline(char *prompt)
if ((do_prompt) && (infp == stdin))
printf(prompt);
+ /*
+ fprintf(stderr, "getline: errno %x\n", errno);
fseek(infp, 0, SEEK_CUR);
+ fprintf(stderr, "getline: errno %x\n", errno);
+ */
do {
/* If we get an end of file, just wait */
if (feof(infp)) {
@@ -817,6 +825,7 @@ int main(int argc, char *argv[])
do_prompt = 1;
+ errno = 0;
/* Get the input/output streams */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--input")) {
@@ -889,10 +899,14 @@ int main(int argc, char *argv[])
}
i++;
tree = build_tree(&cmd[i], &count, 0);
+ if (tree != NULL) {
err = run_cmd(tree);
store_result((char *)(&cmd[0][1]), last_ret_val);
+ }
} else {
+
tree = build_tree(cmd, &count, 0);
+ if (tree != NULL)
err = run_cmd(tree);
}
/* Print out return code and any string from command */
Index: test_driver.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.h,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- test_driver.h 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ test_driver.h 1 Nov 2003 03:08:23 -0000 1.2.2.2
@@ -135,67 +135,67 @@ extern void my_perror(char *msg);
extern char *get_str(char *var_name);
/* Stub functions defined in sysio_stubs.c */
-extern int do_setdebug(int argc, char **argv);
-extern int do_printline(int argc, char **argv);
+extern int test_do_setdebug(int argc, char **argv);
+extern int test_do_printline(int argc, char **argv);
extern int cmp_bufs(int argc, char **argv);
-extern int do_printbuf(int argc, char **argv);
-extern int do_fillbuff(int argc, char **argv);
-extern int do_mount(int argc, char **args);
-extern int do_list(int argc, char **args);
-extern int do_init(int argc, char **args);
+extern int test_do_printbuf(int argc, char **argv);
+extern int test_do_fillbuff(int argc, char **argv);
+extern int test_do_mount(int argc, char **args);
+extern int test_do_list(int argc, char **args);
+extern int test_do_init(int argc, char **args);
extern int get_endian(int argc, char **args);
extern int get_sizeof(int argc, char **args);
-extern int do_exit(int argc, char **args);
+extern int test_do_exit(int argc, char **args);
extern int get_buffer(int argc, char **args);
extern int free_buffer(int argc, char **args);
-extern int do_chdir(int argc, char **args);
-extern int do_chmod(int argc, char **args);
-extern int do_chown(int argc, char **args);
-extern int do_open(int argc, char **args);
-extern int do_close(int argc, char **args);
-extern int do_clear(int argc, char **argv);
-extern int do_dup(int argc, char **args);
-extern int do_dup2(int argc, char **args);
-extern int do_fcntl(int argc, char **args);
-extern int do_fstat(int argc, char **argv);
-extern int do_fsync(int argc, char **argv);
-extern int do_ftruncate(int argc, char **argv);
-extern int do_getcwd(int argc, char **argv);
-extern int do_lseek(int argc, char **argv);
-extern int do_lstat(int argc, char **argv);
-extern int do_getdirentries(int argc, char **argv);
-extern int do_mkdir(int argc, char **argv);
-extern int do_creat(int argc, char **argv);
-extern int do_stat(int argc, char **argv);
-extern int do_statvfs(int argc, char **argv);
-extern int do_fstatvfs(int argc, char **argv);
-extern int do_truncate(int argc, char **argv);
-extern int do_rmdir(int argc, char **argv);
-extern int do_symlink(int argc, char **argv);
-extern int do_unlink(int argc, char **argv);
-extern int do_fdatasync(int argc, char **argv);
-extern int do_ioctl(int argc, char **argv);
-extern int do_umask(int argc, char **argv);
-extern int do_iodone(int argc, char **argv);
-extern int do_iowait(int argc, char **argv);
-extern int do_ipreadv(int argc, char **argv);
-extern int do_ipread(int argc, char **argv);
-extern int do_preadv(int a...
[truncated message content] |
|
From: Mei <me...@us...> - 2003-11-01 03:08:27
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/src
Modified Files:
Tag: b_lustre
Makefile.am chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c
getdirentries.c inode.c ioctl.c ioctx.c iowait.c lseek.c
mknod.c mount.c namei.c open.c read.c rmdir.c stat.c stat64.c
statvfs.c statvfs64.c truncate.c unlink.c write.c
Added Files:
Tag: b_lustre
link.c rename.c utime.c
Log Message:
merge HEAD into b_lustre, some fixes
--- 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-2003 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 <string.h>
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/queue.h>
#include "sysio.h"
#include "mount.h"
#include "inode.h"
int
link(const char *oldpath, const char *newpath)
{
struct intent intent;
int err;
struct pnode *old, *new;
INTENT_INIT(&intent, 0, NULL, NULL);
err = _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old);
if (err)
goto out;
if (S_ISDIR(old->p_base->pb_ino->i_mode)) {
err = -EPERM;
goto error2;
}
INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL);
err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new);
if (err && !new)
goto error2;
if (err && err != -ENOENT) {
err = -EEXIST;
goto error1;
}
if (old->p_mount->mnt_root != new->p_mount->mnt_root) {
err = -EXDEV;
goto error1;
}
err = old->p_base->pb_ino->i_ops.inop_link(old, new);
if (err)
goto error1;
/*
* The new path-base node must point to the inode referenced by
* the old. As well, we need to record the new reference of the inode.
*/
new->p_base->pb_ino = old->p_base->pb_ino;
I_REF(new->p_base->pb_ino);
error1:
P_RELE(new);
error2:
P_RELE(old);
if (err) {
errno = -err;
err = -1;
}
out:
return err;
}
--- 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-2003 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/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/queue.h>
#include "sysio.h"
#include "mount.h"
#include "inode.h"
int
rename(const char *oldpath, const char *newpath)
{
struct intent intent;
int err;
struct pnode *old, *new;
struct pnode_base *nxtpb, *pb;
struct intnl_stat ostbuf, nstbuf;
/*
* Resolve oldpath to a path node.
*/
INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL);
err = _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old);
if (err)
goto out;
/*
* Resolve newpath to a path node.
*/
INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL);
err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new);
if (err && !new)
goto error2;
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.
*/
err = -EXDEV;
goto error1;
}
/*
* Make sure the old pnode can't be found in the ancestor chain
* for the new. If it can, they are trying to move into a subdirectory
* of the old.
*/
nxtpb = new->p_base;
do {
pb = nxtpb;
nxtpb = pb->pb_parent;
if (pb == old->p_base) {
err = -EINVAL;
goto error1;
}
} while (nxtpb);
while (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(ostbuf.st_mode)) {
if (!S_ISDIR(nstbuf.st_mode)) {
err = -ENOTDIR;
goto error1;
}
if (nstbuf.st_nlink > 2) {
err = -ENOTEMPTY;
goto error1;
}
} else if (S_ISDIR(nstbuf.st_mode)) {
err = -EEXIST;
goto error1;
}
break;
}
/*
* It's not impossible to clean up the altered name space after
* a rename. However, it is onerous and I don't want to do it right
* now. If it becomes an issue, we can do it later. For now, I've
* elected to use the semantic that says, basically, the entire
* sub-tree must be unreferenced.
*/
if (_sysio_p_prune(new) != 1) {
err = -EBUSY;
goto error1;
}
err = old->p_base->pb_ino->i_ops.inop_rename(old, new);
if (err)
goto error1;
error1:
P_RELE(new);
error2:
P_RELE(old);
if (err) {
errno = -err;
err = -1;
goto out;
}
_sysio_p_gone(old); /* kill it! */
out:
return err;
}
--- 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-2003 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 <string.h>
#include <errno.h>
#include <time.h>
#include <assert.h>
#include <sys/types.h>
#include <utime.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/queue.h>
#include "sysio.h"
#include "inode.h"
#include "file.h"
int
utime(const char *path, const struct utimbuf *buf)
{
struct intent intent;
int err;
struct pnode *pno;
struct utimbuf _utbuffer;
struct intnl_stat stbuf;
INTENT_INIT(&intent, INT_SETATTR, NULL, NULL);
err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno);
if (err)
goto out;
if (!buf) {
_utbuffer.actime = _utbuffer.modtime = time(NULL);
buf = &_utbuffer;
}
(void )memset(&stbuf, 0, sizeof(struct intnl_stat));
stbuf.st_atime = buf->actime;
stbuf.st_mtime = buf->modtime;
err =
_sysio_setattr(pno,
pno->p_base->pb_ino,
SETATTR_ATIME | SETATTR_MTIME,
&stbuf);
P_RELE(pno);
out:
if (err) {
errno = -err;
err = -1;
}
return err;
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v
retrieving revision 1.5.4.3
retrieving revision 1.5.4.4
diff -u -w -b -B -p -r1.5.4.3 -r1.5.4.4
--- Makefile.am 18 Aug 2003 13:56:04 -0000 1.5.4.3
+++ Makefile.am 1 Nov 2003 03:08:22 -0000 1.5.4.4
@@ -3,14 +3,17 @@ lib_LIBRARIES = libsysio.a
if CYGWIN
libsysio_a_SOURCES = chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c fs.c \
fsync.c init.c inode.c ioctl.c ioctx.c iowait.c \
- lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \
- statvfs.c symlink.c truncate.c unlink.c write.c access.c
+ link.c lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rename.c \
+ rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c \
+ unlink.c \
+ utime.c write.c access.c
else
libsysio_a_SOURCES = chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c fs.c \
fsync.c getdirentries.c init.c inode.c ioctl.c ioctx.c iowait.c \
- lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \
- stat64.c statvfs.c symlink.c truncate.c unlink.c write.c access.c \
- bypass.c
+ link.c lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rename.c \
+ rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c \
+ unlink.c \
+ utime.c write.c access.c bypass.c
endif
include $(top_srcdir)/Rules.make
Index: chdir.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v
retrieving revision 1.3.8.3
retrieving revision 1.3.8.4
diff -u -w -b -B -p -r1.3.8.3 -r1.3.8.4
--- chdir.c 15 Aug 2003 07:43:15 -0000 1.3.8.3
+++ chdir.c 1 Nov 2003 03:08:22 -0000 1.3.8.4
@@ -64,12 +64,13 @@
*/
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
-#include <sys/types.h>
#include <sys/queue.h>
#include "sysio.h"
@@ -77,86 +78,60 @@
#include "mount.h"
#include "file.h"
+#include "sysio-symbols.h"
+
struct pnode *_sysio_cwd = NULL;
+/*
+ * Change to directory specified by the given pnode.
+ */
int
-chdir(const char *path)
+_sysio_p_chdir(struct pnode *pno)
{
int err;
- struct pnode *pno;
- SYSIO_ENTER;
- err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno);
- if (err) {
- errno = -err;
- SYSIO_LEAVE;
- return -1;
- }
+ /*
+ * Revalidate the pnode, and ensure it's a directory
+ */
+ err = _sysio_p_validate(pno, NULL, NULL);
+ if (err)
+ return err;
+ if (!(pno->p_base->pb_ino &&
+ S_ISDIR(pno->p_base->pb_ino->i_mode)))
+ return -ENOTDIR;
+ /*
+ * Release old if set.
+ */
if (_sysio_cwd)
P_RELE(_sysio_cwd);
+ /*
+ * Finally, change to the new.
+ */
_sysio_cwd = pno;
- SYSIO_LEAVE;
+
return 0;
}
-char *
-getwd(char *buf)
+int
+chdir(const char *path)
{
- size_t len, n;
- struct pnode *tmp;
- char *cp;
+ int err;
+ struct pnode *pno;
SYSIO_ENTER;
- /*
- * First pass: Traverse to the root of the sub-tree, remembering
- * lengths.
- */
- len = 0;
- tmp = _sysio_cwd;
- do {
- n = tmp->p_base->pb_name.len;
- len += tmp->p_base->pb_name.len;
- if (n)
- len++;
- tmp = tmp->p_parent;
- /*
- * Traverse mount points.
- */
- while (tmp->p_mount->mnt_root == tmp &&
- tmp != tmp->p_mount->mnt_covers)
- tmp = tmp->p_mount->mnt_root;
- } while (tmp != tmp->p_parent);
- if (!len)
- len++;
- /*
- * Fill in the path buffer -- Backwards, since we're starting
- * from the end.
- */
- cp = buf;
- *cp = PATH_SEPARATOR;
- cp += len;
- *cp = '\0'; /* NUL term */
- tmp = _sysio_cwd;
- do {
- cp -= tmp->p_base->pb_name.len;
- n = tmp->p_base->pb_name.len;
- if (n) {
- (void )strncpy(cp, tmp->p_base->pb_name.name, n);
- *--cp = PATH_SEPARATOR;
+ err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno);
+ if (err) {
+ errno = -err;
+ SYSIO_LEAVE;
+ return -1;
}
- tmp = tmp->p_parent;
- /*
- * Traverse mount points.
- */
- while (tmp->p_mount->mnt_root == tmp &&
- tmp != tmp->p_mount->mnt_covers)
- tmp = tmp->p_mount->mnt_root;
- } while (tmp != tmp->p_parent);
+
+ err = _sysio_p_chdir(pno);
SYSIO_LEAVE;
- return buf;
+ return err;
}
/*
@@ -183,11 +158,13 @@ _sysio_p_path(struct pnode *pno, char **
n = 0;
do {
/*
- * Traverse back through mounts.
+ * If this is a covering path-node then the name should be
+ * the *covered* nodes name, not this one unless we are at
+ * the root of the name-space.
*/
- while (pno->p_mount->mnt_root == pno &&
- pno != pno->p_mount->mnt_covers)
- pno = pno->p_mount->mnt_root;
+ while (pno == pno->p_mount->mnt_root && pno != pno->p_parent )
+ pno = pno->p_mount->mnt_covers;
+
/*
* Add length of this component to running sum and
* account for this vertex.
@@ -222,11 +199,13 @@ _sysio_p_path(struct pnode *pno, char **
*cp = '\0'; /* NUL terminate */
do {
/*
- * Traverse back through mounts.
+ * If this is a covering path-node then the name should be
+ * the *covered* nodes name, not this one unless we are at
+ * the root of the name-space.
*/
- while (pno->p_mount->mnt_root == pno &&
- pno != pno->p_mount->mnt_covers)
- pno = pno->p_mount->mnt_root;
+ while (pno == pno->p_mount->mnt_root && pno != pno->p_parent )
+ pno = pno->p_mount->mnt_covers;
+
/*
* Add component and separator.
*/
@@ -257,11 +236,20 @@ getcwd(char *buf, size_t size)
return buf;
}
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
+#ifdef __GLIBC__
+sysio_sym_weak_alias(getcwd, __getcwd)
+#endif
+
+#ifdef PATH_MAX
char *
-__getcwd(char *buf, size_t size)
+getwd(char *buf)
{
- return getcwd(buf, size);
+
+ if (!buf) {
+ errno = EFAULT;
+ return NULL;
}
-#endif
+ return getcwd(buf, PATH_MAX);
+}
+#endif
Index: chmod.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/chmod.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- chmod.c 29 Jun 2003 10:15:32 -0000 1.3.4.2
+++ chmod.c 1 Nov 2003 03:08:22 -0000 1.3.4.3
@@ -51,23 +51,33 @@
#include "sysio.h"
#include "inode.h"
+#include "file.h"
+
+static int
+do_chmod(struct pnode *pno, struct inode *ino, mode_t mode)
+{
+ int err;
+ struct intnl_stat stbuf;
+ unsigned mask;
+
+ (void )memset(&stbuf, 0, sizeof(struct intnl_stat));
+ stbuf.st_mode = mode & 0777;
+ mask = SETATTR_MODE;
+ err = _sysio_setattr(pno, ino, mask, &stbuf);
+ return err;
+}
int
chmod(const char *path, mode_t mode)
{
int err;
struct pnode *pno;
- struct intnl_stat stbuf;
- unsigned mask;
SYSIO_ENTER;
err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno);
if (err)
goto out;
- (void )memset(&stbuf, 0, sizeof(struct intnl_stat));
- stbuf.st_mode = mode & 0777;
- mask = SETATTR_MODE;
- err = _sysio_setattr(pno, pno->p_base->pb_ino, mask, &stbuf);
+ err = do_chmod(pno, pno->p_base->pb_ino, mode);
P_RELE(pno);
out:
if (err) {
@@ -75,5 +85,27 @@ out:
err = -1;
}
SYSIO_LEAVE;
+ return err;
+}
+
+int
+fchmod(int fd, mode_t mode)
+{
+ int err;
+ struct file *fil;
+
+ err = 0;
+ fil = _sysio_fd_find(fd);
+ if (!fil) {
+ err = -EBADF;
+ goto out;
+ }
+
+ err = do_chmod(NULL, fil->f_ino, mode);
+out:
+ if (err) {
+ errno = -err;
+ err = -1;
+ }
return err;
}
Index: chown.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/chown.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- chown.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ chown.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -51,19 +51,16 @@
#include "sysio.h"
#include "inode.h"
+#include "file.h"
-int
-chown(const char *path, uid_t owner, gid_t group)
+static int
+_do_chown(struct pnode *pno, struct inode *ino, uid_t owner, gid_t group)
{
int err;
- struct pnode *pno;
struct intnl_stat stbuf;
unsigned mask;
SYSIO_ENTER;
- err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno);
- if (err)
- goto out;
(void )memset(&stbuf, 0, sizeof(struct intnl_stat));
mask = 0;
if (owner != (uid_t )-1) {
@@ -74,10 +71,21 @@ chown(const char *path, uid_t owner, gid
stbuf.st_gid = group;
mask |= SETATTR_GID;
}
- if (!mask)
- goto done;
- err = _sysio_setattr(pno, pno->p_base->pb_ino, mask, &stbuf);
-done:
+ err = _sysio_setattr(pno, ino, mask, &stbuf);
+ return err;
+}
+
+int
+chown(const char *path, uid_t owner, gid_t group)
+{
+ int err;
+ struct pnode *pno;
+
+ err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno);
+ if (err)
+ goto out;
+
+ err = _do_chown(pno, pno->p_base->pb_ino, owner, group);
P_RELE(pno);
out:
if (err) {
@@ -85,5 +93,27 @@ out:
err = -1;
}
SYSIO_LEAVE;
+ return err;
+}
+
+int
+fchown(int fd, uid_t owner, gid_t group)
+{
+ int err;
+ struct file *fil;
+
+ err = 0;
+ fil = _sysio_fd_find(fd);
+ if (!fil) {
+ err = -EBADF;
+ goto out;
+ }
+
+ err = _do_chown(NULL, fil->f_ino, owner, group);
+out:
+ if (err) {
+ errno = -err;
+ err = -1;
+ }
return err;
}
Index: dev.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/dev.c,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -w -b -B -p -r1.2 -r1.2.4.1
--- dev.c 24 Mar 2003 22:09:06 -0000 1.2
+++ dev.c 1 Nov 2003 03:08:22 -0000 1.2.4.1
@@ -63,7 +63,9 @@ const struct inode_ops _sysio_nodev_ops
_sysio_nodev_inop_readlink,
_sysio_nodev_inop_open,
_sysio_nodev_inop_close,
+ _sysio_nodev_inop_link,
_sysio_nodev_inop_unlink,
+ _sysio_nodev_inop_rename,
_sysio_nodev_inop_ipreadv,
_sysio_nodev_inop_ipwritev,
_sysio_nodev_inop_iodone,
@@ -72,7 +74,9 @@ const struct inode_ops _sysio_nodev_ops
_sysio_nodev_inop_datasync,
_sysio_nodev_inop_ioctl,
_sysio_nodev_inop_mknod,
+#ifdef _HAVE_STATVFS
_sysio_nodev_inop_statvfs,
+#endif
_sysio_nodev_inop_gone
};
@@ -167,45 +171,10 @@ _sysio_dev_lookup(mode_t mode, dev_t dev
}
int
-_sysio_dev_e_notdir()
-{
-
- return -ENOTDIR;
-}
-
-int
-_sysio_dev_e_badf()
-{
-
- return -EBADF;
-}
-
-int
-_sysio_dev_e_inval()
-{
-
- return -EINVAL;
-}
-
-int
-_sysio_dev_e_nxio()
-{
-
- return -ENXIO;
-}
-
-int
-_sysio_dev_e_illop()
+_sysio_dev_illop()
{
abort();
-}
-
-int
-_sysio_dev_e_notty()
-{
-
- return -ENOTTY;
}
void
Index: dup.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/dup.c,v
retrieving revision 1.1.1.1.12.1
retrieving revision 1.1.1.1.12.2
diff -u -w -b -B -p -r1.1.1.1.12.1 -r1.1.1.1.12.2
--- dup.c 29 Jun 2003 10:15:32 -0000 1.1.1.1.12.1
+++ dup.c 1 Nov 2003 03:08:22 -0000 1.1.1.1.12.2
@@ -49,6 +49,8 @@
#include "sysio.h"
#include "file.h"
+#include "sysio-symbols.h"
+
int
dup2(int oldfd, int newfd)
{
@@ -83,3 +85,9 @@ dup(int oldfd)
SYSIO_LEAVE;
return rc;
}
+
+#ifdef __GLIBC__
+#undef __dup
+sysio_sym_weak_alias(dup, __dup)
+#endif
+
Index: fcntl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v
retrieving revision 1.3.2.6
retrieving revision 1.3.2.7
diff -u -w -b -B -p -r1.3.2.6 -r1.3.2.7
--- fcntl.c 18 Aug 2003 13:56:04 -0000 1.3.2.6
+++ fcntl.c 1 Nov 2003 03:08:22 -0000 1.3.2.7
@@ -56,6 +56,8 @@
#include "file.h"
#include "bypass.h"
+#include "sysio-symbols.h"
+
int
fcntl(int fd, int cmd, ...)
{
@@ -110,17 +112,12 @@ out:
return err;
}
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
-int
-__fcntl(int fd, int cmd, ...)
-{
- int rc;
- va_list ap;
-
- va_start(ap, cmd);
- rc = fcntl(fd, cmd, ap);
- va_end(ap);
-
- return rc;
-}
+#ifdef __GLIBC__
+#undef __fcntl
+sysio_sym_weak_alias(fcntl, __fcntl)
+#endif
+
+#if defined(BSD) || defined(REDSTORM)
+#undef _fcntl
+sysio_sym_weak_alias(fcntl, _fcntl)
#endif
Index: file.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/file.c,v
retrieving revision 1.4.8.2
retrieving revision 1.4.8.3
diff -u -w -b -B -p -r1.4.8.2 -r1.4.8.3
--- file.c 8 Sep 2003 03:58:17 -0000 1.4.8.2
+++ file.c 1 Nov 2003 03:08:22 -0000 1.4.8.3
@@ -128,14 +128,12 @@ _sysio_fgone(struct file *fil)
* IO operation completion handler.
*/
void
-_sysio_fcompletio(struct ioctx *ioctx)
+_sysio_fcompletio(struct ioctx *ioctx, struct file *fil)
{
- struct file *fil;
if (ioctx->ioctx_errno)
return;
- fil = (struct file *)ioctx->ioctx_data;
assert(ioctx->ioctx_ino == fil->f_ino);
fil->f_pos = ioctx->ioctx_offset + ioctx->ioctx_cc;
}
Index: getdirentries.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v
retrieving revision 1.1.8.2
retrieving revision 1.1.8.3
diff -u -w -b -B -p -r1.1.8.2 -r1.1.8.3
--- getdirentries.c 15 Aug 2003 07:43:15 -0000 1.1.8.2
+++ getdirentries.c 1 Nov 2003 03:08:22 -0000 1.1.8.3
@@ -1,7 +1,6 @@
-#ifdef __GNUC__
-#include <alloca.h>
-#else
#include <stdlib.h>
+#ifdef __GLIBC__
+#include <alloca.h>
#endif
#include <string.h>
#include <errno.h>
@@ -19,8 +18,11 @@
#define __restrict
#endif
-ssize_t
-getdirentries64(int fd, char *buf, size_t nbytes, off64_t * __restrict basep)
+static ssize_t
+_getdirentries64(int fd,
+ char *buf,
+ size_t nbytes,
+ _SYSIO_OFF_T * __restrict basep)
{
struct file *fil;
ssize_t cc;
@@ -43,6 +45,13 @@ getdirentries64(int fd, char *buf, size_
return cc;
}
+#if _LARGEFILE64_SOURCE
+#undef getdirentries64
+sysio_sym_strong_alias(_getdirentries64, getdirentries64)
+#endif
+
+#undef getdirentries
+
#ifndef DIRENT64_IS_NATURAL
#ifndef EOVERFLOW
@@ -55,34 +64,60 @@ getdirentries64(int fd, char *buf, size_
#define _namlen(dp) (strlen((dp)->d_name))
#endif
+#ifndef _rndup
+#define _rndup(n, boundary) \
+ ((((n) + (boundary) - 1 ) / (boundary)) * (boundary))
+#endif
+
+#if !(defined(BSD) || defined(REDSTORM))
ssize_t
-getdirentries(int fd, char *buf, size_t nbytes, off_t * __restrict basep)
+getdirentries(int fd,
+ char *buf,
+ size_t nbytes,
+ off_t * __restrict basep)
+#else
+int
+getdirentries(int fd,
+ char *buf,
+ int nbytes,
+ long * __restrict basep)
+#endif
{
size_t inbytes;
void *ibuf;
- off64_t ibase;
+ _SYSIO_OFF_T ibase;
ssize_t cc;
struct dirent *dp, *nxtdp;
- struct dirent64 *od64p = NULL, *d64p = NULL;
+#if defined(BSD) || defined(REDSTORM)
+ int off;
+#endif
+ struct intnl_dirent *od64p, *d64p;
size_t n;
size_t reclen;
char *cp;
SYSIO_ENTER;
#define _dbaselen ((size_t )&((struct dirent *)0)->d_name[0])
-#ifdef __GNUC__
+#ifdef __GLIBC__
#define _dreclen(namlen) \
((_dbaselen + (namlen) + __alignof__ (struct dirent)) & \
~(__alignof__ (struct dirent) - 1))
#define _fast_alloc(n) alloca(n)
#define _fast_free(p)
-#else /* !defined(__GNUC__) */
-#define _dreclen(namelen) \
- (_rndup(_dbaselen + (namlen) + 1, sizeof(unsigned long long))
+#else /* !defined(__GLIBC__) */
+#define _dreclen(namlen) \
+ _rndup(_dbaselen + (namlen) + 1, sizeof(int))
#define _fast_alloc(n) malloc(n)
#define _fast_free(p) free(p)
#endif
+#if defined(BSD) || defined(REDSTORM)
+ if (nbytes < 0) {
+ errno = -EINVAL;
+ return -1;
+ }
+#endif
+
inbytes = nbytes;
if (inbytes > 8 * 1024) {
/*
@@ -100,7 +135,7 @@ getdirentries(int fd, char *buf, size_t
dp = (struct dirent *)buf;
ibase = *basep;
- cc = getdirentries64(fd, ibuf, inbytes, &ibase);
+ cc = _getdirentries64(fd, ibuf, inbytes, &ibase);
if (cc < 0) {
cc = -errno;
goto out;
@@ -111,6 +146,9 @@ getdirentries(int fd, char *buf, size_t
goto out;
}
+#if defined(BSD) || defined(REDSTORM)
+ off = *basep;
+#endif
od64p = NULL;
d64p = ibuf;
for (;;) {
@@ -122,14 +160,22 @@ getdirentries(int fd, char *buf, size_t
n = strlen(d64p->d_name);
#endif
reclen = _dreclen(n);
- if (reclen >= nbytes)
+ if (reclen >= (unsigned )nbytes)
break;
dp->d_ino = (ino_t )d64p->d_ino;
+#if !(defined(BSD) || defined(REDSTORM))
dp->d_off = (off_t )d64p->d_off;
+#endif
if ((sizeof(dp->d_ino) != sizeof(d64p->d_ino) &&
- dp->d_ino != d64p->d_ino) &&
+ dp->d_ino != d64p->d_ino)
+ ||
+#if !(defined(BSD) || defined(REDSTORM))
(sizeof(dp->d_off) != sizeof(d64p->d_off) &&
- dp->d_off != d64p->d_off)) {
+ dp->d_off != d64p->d_off)
+#else
+ (off + (int )reclen < off)
+#endif
+ ) {
cc = -EOVERFLOW;
break;
}
@@ -143,6 +189,9 @@ getdirentries(int fd, char *buf, size_t
od64p = d64p;
d64p = (void *)d64p + d64p->d_reclen;
nbytes -= reclen;
+#if defined(BSD) || defined(REDSTORM)
+ off += reclen;
+#endif
dp = nxtdp;
}
@@ -156,11 +205,16 @@ out:
}
cc = (char *)dp - buf;
if (cc)
- *basep = od64p->d_off;
+ *basep =
+#if !(defined(BSD) || defined(REDSTORM))
+ od64p->d_off;
+#else
+ off;
+#endif
SYSIO_LEAVE;
return cc;
-#ifdef __GNUC__
+#ifdef __GLIBC__
#undef _fast_alloc
#undef _fast_free
#endif
@@ -168,6 +222,10 @@ out:
#undef _dbaselen
}
#else /* !defined(DIRENT64_IS_NATURAL) */
-sysio_sym_strong_alias(getdirentries64, getdirentries)
+sysio_sym_strong_alias(_getdirentries64, getdirentries)
#endif
+#if defined(BSD) || defined(REDSTORM)
+#undef _getdirentries
+sysio_sym_weak_alias(getdirentries, _getdirentries)
+#endif
Index: inode.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -u -w -b -B -p -r1.7.2.3 -r1.7.2.4
--- inode.c 16 Sep 2003 10:09:40 -0000 1.7.2.3
+++ inode.c 1 Nov 2003 03:08:22 -0000 1.7.2.4
@@ -171,6 +171,23 @@ i_reclaim()
max_inodes += t;
}
+static unsigned
+hash(struct file_identifier *fid)
+{
+ size_t n;
+ void *p;
+ unsigned hkey;
+
+ n = fid->fid_len;
+ p = fid->fid_data;
+ hkey = 0;
+ do {
+ hkey <<= 1;
+ hkey += *(unsigned char *)p++;
+ } while (--n);
+ return hkey;
+}
+
/*
* Allocate and initialize a new i-node. Returned i-node is referenced.
*
@@ -179,7 +196,6 @@ i_reclaim()
*/
struct inode *
_sysio_i_new(struct filesys *fs,
- ino_t inum,
struct file_identifier *fid,
mode_t type,
dev_t rdev,
@@ -217,10 +233,10 @@ _sysio_i_new(struct filesys *fs,
ino->i_ops.inop_datasync = o->inop_datasync;
ino->i_ops.inop_ioctl = o->inop_ioctl;
}
- I_INIT(ino, fs, inum, type, rdev, &ino->i_ops, fid, immunity, private);
+ I_INIT(ino, fs, type, rdev, &ino->i_ops, fid, immunity, private);
ino->i_ref = 1;
TAILQ_INSERT_TAIL(&_sysio_inodes, ino, i_nodes);
- head = &fs->fs_itbl[inum % FS_ITBLSIZ];
+ head = &fs->fs_itbl[hash(fid) % FS_ITBLSIZ];
LIST_INSERT_HEAD(head, ino, i_link);
n_inodes++;
@@ -234,18 +250,17 @@ _sysio_i_new(struct filesys *fs,
* and identifier.
*/
struct inode *
-_sysio_i_find(struct filesys *fs, ino_t inum, struct file_identifier *fid)
+_sysio_i_find(struct filesys *fs, struct file_identifier *fid)
{
struct inode *ino;
struct itable_entry *head;
- head = &fs->fs_itbl[inum % FS_ITBLSIZ];
+ head = &fs->fs_itbl[hash(fid) % FS_ITBLSIZ];
/*
* Look for existing.
*/
for (ino = head->lh_first; ino; ino = ino->i_link.le_next)
- if (ino->i_num == inum &&
- ino->i_fid->fid_len == fid->fid_len &&
+ if (ino->i_fid->fid_len == fid->fid_len &&
memcmp(ino->i_fid->fid_data,
fid->fid_data,
fid->fid_len) == 0) {
@@ -268,8 +283,8 @@ _sysio_i_gone(struct inode *ino)
abort();
#else
if (ino->i_ref)
- printf("_sysio_i_gone: inode(%lu, 0%o) still have ref %d\n",
- ino->i_num, ino->i_mode, ino->i_ref);
+ printf("_sysio_i_gone: inode(mode 0%o) still have ref %d\n",
+ ino->i_mode, ino->i_ref);
#endif
if (!ino->i_zombie)
LIST_REMOVE(ino, i_link);
@@ -503,43 +518,19 @@ _sysio_p_gone(struct pnode *pno)
int
_sysio_p_validate(struct pnode *pno, struct intent *intnt, const char *path)
{
- struct pnode *parent;
- int err;
struct inode *ino;
+ struct pnode_base *rootpb;
+ int err;
- err = 0;
-
+ ino = pno->p_base->pb_ino;
/*
- * Make sure we can use the parent. We don't validate that
- * unless we have to. Beware of this! It's assuming the caller
- * recently revalidated. Namei will do this for instance.
- */
- parent = pno->p_parent;
- if (!parent->p_base->pb_ino) {
- err = _sysio_p_validate(parent, NULL, NULL);
- if (err) {
- /*
- * I really, really want to smash the association
- * of the passed path node with it's i-node. Can't
- * do it, though, since at least one FS driver can
- * still accomplish IO accesses to the currently
- * held i-node. For now, the driver needs to
- * record that the i-node has become (semi) invalid
- * and return appropriate errors itself.
- *
- * We *might* be able to do this, now, with the
- * recent changes to the open file table. Must check
- * on it. It is so annoying to have these half
- * dead i-nodes hanging around.
+ * An invalid pnode will not have an associated inode. We'll use
+ * the FS root inode, then -- It *must* be valid.
*/
- return err;
- }
- }
-
- ino = pno->p_base->pb_ino;
- if (!err)
+ rootpb = pno->p_mount->mnt_root->p_base;
+ assert(rootpb->pb_ino);
err =
- parent->p_base->pb_ino->i_ops.inop_lookup(pno,
+ rootpb->pb_ino->i_ops.inop_lookup(pno,
&ino,
intnt,
path);
Index: ioctl.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v
retrieving revision 1.1.1.1.12.3
retrieving revision 1.1.1.1.12.4
diff -u -w -b -B -p -r1.1.1.1.12.3 -r1.1.1.1.12.4
--- ioctl.c 18 Aug 2003 13:56:04 -0000 1.1.1.1.12.3
+++ ioctl.c 1 Nov 2003 03:08:22 -0000 1.1.1.1.12.4
@@ -50,6 +50,8 @@
#include "inode.h"
#include "file.h"
+#include "sysio-symbols.h"
+
#ifdef __CYGWIN__
int
ioctl(int fd, int request, ...)
@@ -84,17 +86,12 @@ out:
}
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
-int
-__ioctl(int fd, unsigned long request, ...)
-{
- va_list ap;
- int rc;
-
- va_start(ap, request);
- rc = ioctl(fd, request, ap);
- va_end(ap);
+#ifdef __GLIBC__
+#undef __ioctl
+sysio_sym_weak_alias(ioctl, __ioctl)
+#endif
- return rc;
-}
+#if defined(BSD) || defined(REDSTORM)
+#undef _ioctl
+sysio_sym_weak_alias(ioctl, _ioctl)
#endif
Index: ioctx.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -b -B -p -r1.2 -r1.2.10.1
--- ioctx.c 7 Mar 2003 03:31:36 -0000 1.2
+++ ioctx.c 1 Nov 2003 03:08:22 -0000 1.2.10.1
@@ -78,40 +78,67 @@ _sysio_ioctx_init()
* Allocate and initialisze a new IO context.
*/
struct ioctx *
-_sysio_ioctx_new(struct inode *ino, struct io_arguments *ioargs)
+_sysio_ioctx_new(struct inode *ino,
+ const struct iovec *iov,
+ size_t iovlen,
+ _SYSIO_OFF_T offset)
{
struct ioctx *ioctx;
ioctx =
- malloc(sizeof(struct ioctx) +
- ioargs->ioarg_iovlen * sizeof(struct iovec));
+ malloc(sizeof(struct ioctx) + iovlen * sizeof(struct iovec));
if (!ioctx)
return NULL;
I_REF(ino);
+ ioctx->ioctx_iovec = (void *)ioctx + sizeof(struct ioctx);
+ (void )memcpy((void *)ioctx->ioctx_iovec,
+ iov,
+ iovlen * sizeof(struct iovec));
+ IOCTX_INIT(ioctx,
+ 0,
+ (ioid_t )ioctx,
+ ino,
+ ioctx->ioctx_iovec,
+ iovlen,
+ offset);
+
/*
* Link request onto the outstanding requests queue.
*/
LIST_INSERT_HEAD(&aioq, ioctx, ioctx_link);
- ioctx->ioctx_id = (ioid_t )ioctx;
- ioctx->ioctx_ino = ino;
- ioctx->ioctx_iovec = (void *)ioctx + sizeof(struct ioctx);
- (void )memcpy((void *)ioctx->ioctx_iovec,
- ioargs->ioarg_iovec,
- ioargs->ioarg_iovlen * sizeof(struct iovec));
- ioctx->ioctx_iovlen = ioargs->ioarg_iovlen;
- ioctx->ioctx_offset = ioargs->ioarg_offset;
- ioctx->ioctx_cc = 0;
- ioctx->ioctx_errno = 0;
- ioctx->ioctx_cb = ioargs->ioarg_completion;
- ioctx->ioctx_data = ioargs->ioarg_completion_arg;
-
return ioctx;
}
/*
+ * Add an IO completion call-back to the end of the context call-back queue.
+ * These are called in iowait() as the last thing, right before the context
+ * is destroyed.
+ *
+ * They are called in order. Beware.
+ */
+int
+_sysio_ioctx_cb(struct ioctx *ioctx,
+ void (*f)(struct ioctx *, void *),
+ void *data)
+{
+ struct ioctx_callback *entry;
+
+ entry = malloc(sizeof(struct ioctx_callback));
+ if (!entry)
+ return -ENOMEM;
+
+ entry->iocb_f = f;
+ entry->iocb_data = data;
+
+ TAILQ_INSERT_TAIL(&ioctx->ioctx_cbq, entry, iocb_next);
+
+ return 0;
+}
+
+/*
* Find an IO context given it's identifier.
*
* NB: This is dog-slow. If there are alot of these, we will need to change
@@ -145,7 +172,8 @@ _sysio_ioctx_wait(struct ioctx *ioctx)
/*
* Wait for async operation to complete.
*/
- while (!(*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx))
+ while (!(ioctx->ioctx_done ||
+ (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx)))
;
/*
@@ -170,26 +198,25 @@ _sysio_ioctx_wait(struct ioctx *ioctx)
void
_sysio_ioctx_complete(struct ioctx *ioctx)
{
- struct inode *ino;
+ struct ioctx_callback *entry;
/*
- * Unlink from the file record's outstanding request queue.
+ * Run the call-back queue.
*/
- LIST_REMOVE(ioctx, ioctx_link);
+ while ((entry = ioctx->ioctx_cbq.tqh_first)) {
+ TAILQ_REMOVE(&ioctx->ioctx_cbq, entry, iocb_next);
+ (*entry->iocb_f)(ioctx, entry->iocb_data);
+ free(entry);
+ }
+
+ if (ioctx->ioctx_fast)
+ return;
/*
- * Wait for IO to complete and remember completion values.
- */
- ino = ioctx->ioctx_ino;
- while (ino && !(*ino->i_ops.inop_iodone)(ioctx))
- ;
- /*
- * Notify interested parties.
+ * Unlink from the file record's outstanding request queue.
*/
- if (ioctx->ioctx_cb)
- (*ioctx->ioctx_cb)(ioctx);
-
- I_RELE(ino);
+ LIST_REMOVE(ioctx, ioctx_link);
+ I_RELE(ioctx->ioctx_ino);
free(ioctx);
}
Index: iowait.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v
retrieving revision 1.3.8.1
retrieving revision 1.3.8.2
diff -u -w -b -B -p -r1.3.8.1 -r1.3.8.2
--- iowait.c 19 Jun 2003 12:18:29 -0000 1.3.8.1
+++ iowait.c 1 Nov 2003 03:08:22 -0000 1.3.8.2
@@ -75,7 +75,8 @@ iodone(ioid_t ioid)
if (!ioctx)
return -1;
- return (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx);
+ return (ioctx->ioctx_done ||
+ (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx));
}
/*
Index: lseek.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -u -w -b -B -p -r1.4.2.3 -r1.4.2.4
--- lseek.c 15 Aug 2003 10:03:29 -0000 1.4.2.3
+++ lseek.c 1 Nov 2003 03:08:22 -0000 1.4.2.4
@@ -53,12 +53,12 @@
#include "sysio-symbols.h"
-static off64_t
-_sysio_lseek(int fd, off64_t offset, int whence)
+static _SYSIO_OFF_T
+_sysio_lseek(int fd, _SYSIO_OFF_T offset, int whence)
{
int err;
struct file *fil;
- off64_t off = 0;
+ _SYSIO_OFF_T off = 0;
struct intnl_stat stbuf;
err = 0;
@@ -103,46 +103,63 @@ out:
return fil->f_pos = off;
}
+#if _LARGEFILE64_SOURCE
+#undef lseek64
sysio_sym_weak_alias(_sysio_lseek, lseek64)
+#ifdef __GLIBC__
+#undef __lseek64
+sysio_sym_weak_alias(_sysio_lseek, __lseek64)
+#endif
+#endif
#undef lseek
extern off_t
lseek(int fd, off_t offset, int whence)
{
- off_t rc;
+ _SYSIO_OFF_T off;
+ off_t rtn;
SYSIO_ENTER;
- rc = (off_t )_sysio_lseek(fd, offset, whence);
-
+ off = _sysio_lseek(fd, offset, whence);
+ if (off < 0) {
SYSIO_LEAVE;
- return rc;
-}
-
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
-
-off_t
-__lseek(int fd, off_t offset, int whence)
-{
- return lseek(fd, offset, whence);
+ return -1;
}
-
-loff_t
-__lseek64( int fd, loff_t offset, int whence)
-{
- return lseek( fd, offset, whence );
+ rtn = (off_t )off;
+ if ((_SYSIO_OFF_T )rtn != off) {
+ errno = EINVAL;
+ SYSIO_LEAVE;
+ return -1;
}
-
-loff_t
-__llseek( int fd, loff_t offset, int whence)
-{
- return __lseek64(fd, offset, whence);
+ SYSIO_LEAVE;
+ return rtn;
}
-loff_t
-__llseek64( int fd, loff_t offset, int whence)
-{
- return __lseek64(fd, offset, whence);
+#ifdef __GLIBC__
+#undef __lseek
+sysio_sym_weak_alias(lseek, __lseek)
+#endif
+
+#if 0
+#ifdef __linux__
+#undef llseek
+int
+llseek(unsigned int fd __IS_UNUSED,
+ unsigned long offset_high __IS_UNUSED,
+ unsigned long offset_low __IS_UNUSED,
+ loff_t *result __IS_UNUSED,
+ unsigned int whence __IS_UNUSED)
+{
+
+ /*
+ * Something is very wrong if this was called.
+ */
+ errno = ENOTSUP;
+ return -1;
}
+#undef __llseek
+sysio_sym_weak_alias(llseek, __llseek)
+#endif
#endif
Index: mknod.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- mknod.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ mknod.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -62,6 +62,10 @@
#undef mknod
#undef __xmknod
+#if defined(BSD) || defined(REDSTORM)
+#define _MKNOD_VER 0
+#endif
+
int
__xmknod(int __ver, const char *path, mode_t mode, dev_t *dev)
{
Index: mount.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -w -b -B -p -r1.5 -r1.5.2.1
--- mount.c 18 Apr 2003 20:24:05 -0000 1.5
+++ mount.c 1 Nov 2003 03:08:22 -0000 1.5.2.1
@@ -102,12 +102,10 @@ _sysio_do_mount(struct filesys *fs,
{
struct mount *mnt;
int err;
- struct intnl_stat stbuf;
- struct inode *ino;
/*
- * It's really poor form to allow the new root to be
- * descendant of the pnode being covered.the one being covered.
+ * It's really poor form to allow the new root to be a
+ * descendant of the pnode being covered.
*/
if (tocover) {
struct pnode_base *pb;
@@ -142,19 +140,21 @@ _sysio_do_mount(struct filesys *fs,
/*
* Get alias for the new root.
*/
- mnt->mnt_root = _sysio_p_new_alias(NULL, rootpb, mnt);
+ mnt->mnt_root =
+ _sysio_p_new_alias(tocover ? tocover->p_parent : NULL, rootpb, mnt);
if (!mnt->mnt_root) {
err = -ENOMEM;
goto error;
}
- ino = mnt->mnt_root->p_base->pb_ino;
- err = ino->i_ops.inop_getattr(mnt->mnt_root, ino, &stbuf);
- if (err)
- goto error;
/*
- * Begtter be a directory object!
+ * It may have been a while since the root inode was validated;
+ * better validate again. And it better be a directory!
*/
- if (!S_ISDIR(stbuf.st_mode)) {
+ err = _sysio_p_validate(mnt->mnt_root, NULL, NULL);
+ if (err)
+ goto error;
+
+ if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_mode)) {
err = -ENOTDIR;
goto error;
}
@@ -541,11 +541,12 @@ parse_opts(char *opts, unsigned *flagsp)
*dst++ = *src++;
while (src != cp);
}
- *dst = '\0';
if (!*src)
break;
+ *dst = '\0';
src++; /* skip comma */
}
+ *dst = '\0';
*flagsp = flags;
return opts;
@@ -561,8 +562,7 @@ _sysio_automount(struct pnode *mntpno)
struct inode *ino;
struct intnl_stat stbuf;
struct iovec iovec;
- struct io_arguments ioarguments;
- struct ioctx *ioctx;
+ struct ioctx iocontext;
ssize_t cc;
char *fstype, *source, *opts;
unsigned flags;
@@ -596,13 +596,14 @@ _sysio_automount(struct pnode *mntpno)
err = _sysio_open(mntpno, O_RDONLY, 0);
if (err)
goto out;
- IOARG_INIT(&ioarguments, &iovec, 1, 0, NULL, NULL);
- err = (*ino->i_ops.inop_ipreadv)(ino, &ioarguments, &ioctx);
+ IOCTX_INIT(&iocontext, 1, (ioid_t )&iocontext, ino, &iovec, 1, 0);
+ err = (*ino->i_ops.inop_ipreadv)(ino, &iocontext);
if (err) {
+ _sysio_ioctx_complete(&iocontext);
(void )(*ino->i_ops.inop_close)(ino);
goto out;
}
- cc = _sysio_ioctx_wait(ioctx);
+ cc = _sysio_ioctx_wait(&iocontext);
err = (*ino->i_ops.inop_close)(ino);
if (err)
goto out;
Index: namei.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v
retrieving revision 1.5.4.3
retrieving revision 1.5.4.4
diff -u -w -b -B -p -r1.5.4.3 -r1.5.4.4
--- namei.c 15 Aug 2003 07:43:15 -0000 1.5.4.3
+++ namei.c 1 Nov 2003 03:08:22 -0000 1.5.4.4
@@ -222,7 +222,7 @@ _sysio_path_walk(struct pnode *parent, s
ino->i_ops.inop_readlink(nd->nd_pno,
lpath,
MAXPATHLEN);
- if (err) {
+ if (err < 0) {
free(lpath);
break;
}
Index: open.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/open.c,v
retrieving revision 1.7.2.4
retrieving revision 1.7.2.5
diff -u -w -b -B -p -r1.7.2.4 -r1.7.2.5
--- open.c 15 Aug 2003 07:43:15 -0000 1.7.2.4
+++ open.c 1 Nov 2003 03:08:22 -0000 1.7.2.5
@@ -49,7 +49,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/queue.h>
-#include <features.h>
#include "sysio.h"
#include "inode.h"
@@ -58,12 +57,7 @@
#include "mount.h"
#include "sysio-symbols.h"
-#ifdef __GLIBC__
-#undef open
-#undef __open
-#undef open64
-#undef __open64
-#endif
+#include "sysio-symbols.h"
/*
* Open file support.
@@ -125,6 +119,8 @@ _sysio_open(struct pnode *pno, int flags
return err;
}
+#undef open
+
int
open(const char *path, int flags, ...)
{
@@ -154,7 +150,12 @@ open(const char *path, int flags, ...)
* Will need mode too.
*/
va_start(ap, flags);
- mode = va_arg(ap, mode_t);
+ mode =
+#ifndef REDSTORM
+ va_arg(ap, mode_t);
+#else
+ va_arg(ap, int);
+#endif
va_end(ap);
mode &= ~_sysio_umask; /* apply umask */
@@ -210,7 +211,19 @@ error:
return -1;
}
+#ifdef __GLIBC__
+#undef __open
+sysio_sym_weak_alias(open, __open)
+#undef open64
sysio_sym_weak_alias(open, open64)
+#undef __open64
+sysio_sym_weak_alias(open, __open64)
+#endif
+
+#if defined(BSD) || defined(REDSTORM)
+#undef _open
+sysio_sym_weak_alias(open, _open)
+#endif
int
close(int fd)
@@ -225,6 +238,16 @@ close(int fd)
return err ? -1 : 0;
}
+#ifdef __GLIBC__
+#undef __close
+sysio_sym_weak_alias(close, __close)
+#endif
+
+#if defined(BSD) || defined(REDSTORM)
+#undef _close
+sysio_sym_weak_alias(close, _close)
+#endif
+
int
creat(const char *path, mode_t mode)
{
@@ -232,7 +255,19 @@ creat(const char *path, mode_t mode)
return open(path, O_CREAT|O_WRONLY|O_TRUNC, mode);
}
+#ifdef __GLIBC__
+#undef __creat
+sysio_sym_weak_alias(creat, __creat)
+#undef creat64
sysio_sym_weak_alias(creat, creat64)
+#undef __creat64
+sysio_sym_weak_alias(creat, __creat64)
+#endif
+
+#if defined(BSD) || defined(REDSTORM)
+#undef _creat
+sysio_sym_weak_alias(creat, _creat)
+#endif
mode_t
umask(mode_t mask)
@@ -243,49 +278,3 @@ umask(mode_t mask)
_sysio_umask = mask & 0777;
return omask;
}
-
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
-int
-open64(const char *fname, int flags, ...)
-{
- va_list ap;
- mode_t mode;
-
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
-
- return open(fname, flags, mode);
-}
-
-int
-__open64(const char *fname, int flags, ...)
-{
- va_list ap;
- mode_t mode;
-
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
-
- return open(fname, flags, mode);
-}
-int
-__open(const char *fname, int flags, ...)
-{
- va_list ap;
- mode_t mode;
-
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
-
- return open(fname, flags, mode);
-}
-
-int
-__close(int fd) {
-
- return close(fd);
-}
-#endif
Index: read.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/read.c,v
retrieving revision 1.2.8.7
retrieving revision 1.2.8.8
diff -u -w -b -B -p -r1.2.8.7 -r1.2.8.8
--- read.c 8 Sep 2003 03:58:17 -0000 1.2.8.7
+++ read.c 1 Nov 2003 03:08:22 -0000 1.2.8.8
@@ -57,17 +57,19 @@
#include "file.h"
#include "inode.h"
+#include "sysio-symbols.h"
+
/*
* Schedule asynchronous read of iovec at some file extent.
*/
static struct ioctx *
-do_ipreadv(struct file *fil,
+do_ixreadv(struct file *fil,
const struct iovec *iov, size_t count,
- off64_t offset)
+ _SYSIO_OFF_T offset,
+ void (*fcompletio)(struct ioctx *, struct file *))
{
struct inode *ino;
int err;
- struct io_arguments ioarguments;
struct ioctx *ioctx;
if (fil->f_flags & O_WRONLY) {
@@ -83,12 +85,23 @@ do_ipreadv(struct file *fil,
errno = EBADF;
return NULL;
}
- IOARG_INIT(&ioarguments,
- iov, count,
- offset,
- (void (*)(void *))_sysio_fcompletio, fil);
- err = ino->i_ops.inop_ipreadv(fil->f_ino, &ioarguments, &ioctx);
+ ioctx = _sysio_ioctx_new(fil->f_ino, iov, count, offset);
+ if (!ioctx ||
+ (fcompletio &&
+ _sysio_ioctx_cb(ioctx,
+ (void (*)(struct ioctx *, void *))fcompletio,
+ fil) != 0)) {
+ err = -ENOMEM;
+ goto out;
+ }
+ err = ino->i_ops.inop_ipreadv(fil->f_ino, ioctx);
+out:
if (err) {
+ if (ioctx) {
+ ioctx->ioctx_cc = -1;
+ ioctx->ioctx_errno = -err;
+ _sysio_ioctx_complete(ioctx);
+ }
errno = -err;
return NULL;
}
@@ -99,7 +112,7 @@ do_ipreadv(struct file *fil,
* API interface to accomplish asynch read into iovec from given file offset.
*/
ioid_t
-ipreadv(int fd, const struct iovec *iov, size_t count, off_t offset)
+ipreadv(int fd, const struct iovec *iov, size_t count, _SYSIO_OFF_T offset)
{
struct file *fil;
struct ioctx *ioctxp;
@@ -113,8 +126,7 @@ ipreadv(int fd, const struct iovec *iov,
return IOID_FAIL;
}
- ioctxp = do_ipreadv(fil, iov, count, offset);
-
+ ioctxp = do_ixreadv(fil, iov, count, offset, NULL);
SYSIO_LEAVE;
return ioctxp ? ioctxp->ioctx_id : IOID_FAIL;
}
@@ -123,7 +135,7 @@ ipreadv(int fd, const struct iovec *iov,
* API interface to accomplish asynch read into buf from given file offset.
*/
ioid_t
-ipread(int fd, void *buf, size_t count, off_t offset)
+ipread(int fd, void *buf, size_t count, _SYSIO_OFF_T offset)
{
struct iovec iov[1];
@@ -138,7 +150,7 @@ ipread(int fd, void *buf, size_t count,
* API interface to accomplish read into iovec from given file offset.
*/
ssize_t
-preadv(int fd, const struct iovec *iov, size_t count, off_t offset)
+preadv(int fd, const struct iovec *iov, size_t count, _SYSIO_OFF_T offset)
{
ioid_t ioid;
@@ -151,8 +163,8 @@ preadv(int fd, const struct iovec *iov,
/*
* API interface to accomplish read into buf from given file offset.
*/
-ssize_t
-pread(int fd, void *buf, size_t count, off_t offset)
+static ssize_t
+_pread(int fd, void *buf, size_t count, _SYSIO_OFF_T offset)
{
ioid_t ioid;
@@ -162,6 +174,21 @@ pread(int fd, void *buf, size_t count, o
return iowait(ioid);
}
+#if _LARGEFILE64_SOURCE
+#undef pread64
+sysio_sym_weak_alias(_pread, pread64)
+
+ssize_t
+pread(int fd, void *buf, size_t count, off_t offset)
+{
+
+ return _pread(fd, buf, count, offset);
+}
+#else
+#undef pread
+sysio_sym_weak_alias(_pread, pread)
+#endif
+
/*
* API interface to accomplish asynch read into iovec from current file offset.
*/
@@ -180,10 +207,13 @@ ireadv(int fd, const struct iovec *iov,
return IOID_FAIL;
}
- ioctxp = do_ipreadv(fil, iov, count, fil->f_pos);
-
+ ioctxp = do_ixreadv(fil, iov, count, fil->f_pos, _sysio_fcompletio);
+ if (!ioctxp) {
SYSIO_LEAVE;
- return ioctxp ? ioctxp->ioctx_id : IOID_FAIL;
+ return IOID_FAIL;
+ }
+ SYSIO_LEAVE;
+ return ioctxp->ioctx_id;
}
/*
@@ -211,6 +241,11 @@ readv(int fd, const struct iovec *iov, i
return iowait(ioid);
}
+#if defined(BSD) || defined(REDSTORM)
+#undef _readv
+sysio_sym_weak_alias(readv, _readv)
+#endif
+
ssize_t
read(int fd, void *buf, size_t count)
{
@@ -222,6 +257,21 @@ read(int fd, void *buf, size_t count)
return iowait(ioid);
}
+#ifdef __GLIBC__
+#undef __read
+sysio_sym_weak_alias(read, __read)
+#endif
+
+#if defined(BSD) || defined(REDSTORM)
+#undef _read
+sysio_sym_weak_alias(read, _read)
+#endif
+
+#if _LARGEFILE64_SOURCE
+#undef read64
+sysio_sym_weak_alias(read, read64)
+#endif
+
#ifdef notdef
int
read_list(int fd,
@@ -234,13 +284,5 @@ read_list(int fd,
{
errno = ENOSYS;
return -1;
-}
-#endif
-
-#if defined(__GLIBC__) && defined(ALPHA_LINUX)
-ssize_t
-__read(int fd, void *buf, size_t count)
-{
- return read(fd, buf, count);
}
#endif
Index: rmdir.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- rmdir.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ rmdir.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -69,6 +69,13 @@ rmdir(const char *path)
goto error;
}
err = pno->p_base->pb_ino->i_ops.inop_rmdir(pno);
+ if (err)
+ goto error;
+ /*
+ * Invalide the path-base node. The inode reference was dropped
+ * by the driver.
+ */
+ pno->p_base->pb_ino = NULL;
error:
P_RELE(pno);
out:
Index: stat.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- stat.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ stat.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -62,8 +62,29 @@
#undef __xstat
#undef __lxstat
-#if !(defined(__GNUC__) && __GNUC__ >= 2)
-#warning Check assumptions here about stat/stat64 sizes and offsets
+#if !defined(_STAT_VER)
+#define _STAT_VER 0
+#endif
+
+#if _LARGEFILE64_SOURCE
+static void
+convstat(struct stat64 *st64_buf, struct stat *st_buf)
+{
+
+ st_buf->st_dev = st64_buf->st_dev;
+ st_buf->st_ino = st64_buf->st_ino;
+ st_buf->st_mode = st64_buf->st_mode;
+ st_buf->st_nlink = st64_buf->st_nlink;
+ st_buf->st_uid = st64_buf->st_uid;
+ st_buf->st_gid = st64_buf->st_gid;
+ st_buf->st_rdev = st64_buf->st_rdev;
+ st_buf->st_size = st64_buf->st_size;
+ st_buf->st_blksize = st64_buf->st_blksize;
+ st_buf->st_blocks = st64_buf->st_blocks;
+ st_buf->st_atime = st64_buf->st_atime;
+ st_buf->st_mtime = st64_buf->st_mtime;
+ st_buf->st_ctime = st64_buf->st_ctime;
+}
#endif
int
@@ -71,6 +92,10 @@ __fxstat(int __ver, int __fildes, struct
{
struct file *fil;
int err;
+ struct intnl_stat *buf;
+#if _LARGEFILE64_SOURCE
+ struct stat64 st64;
+#endif
if (__ver != _STAT_VER) {
err = -ENOSYS;
@@ -83,15 +108,21 @@ __fxstat(int __ver, int __fildes, struct
err = -EBADF;
goto out;
}
+#if _LARGEFILE64_SOURCE
+ buf = &st64;
+#else
+ buf = __stat_buf;
+#endif
err =
- fil->f_ino->i_ops.inop_getattr(NULL,
- fil->f_ino,
- (struct intnl_stat *)__stat_buf);
+ fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf);
out:
if (err) {
errno = -err;
err = -1;
}
+#if _LARGEFILE64_SOURCE
+ convstat(buf, __stat_buf);
+#endif
return err;
}
@@ -109,6 +140,11 @@ __fstat(int fd, struct stat *buf)
sysio_sym_weak_alias(__fstat, fstat)
+#if defined(BSD) || defined(REDSTORM)
+#undef _fstat
+sysio_sym_weak_alias(__fstat, _fstat)
+#endif
+
int
__xstat(int __ver, const char *__filename, struct stat *__stat_buf)
{
@@ -116,6 +152,10 @@ __xstat(int __ver, const char *__filenam
int err;
struct pnode *pno;
struct inode *ino;
+ struct intnl_stat *buf;
+#if _LARGEFILE64_SOURCE
+ struct stat64 st64;
+#endif
if (__ver != _STAT_VER) {
err = -ENOSYS;
@@ -127,11 +167,19 @@ __xstat(int __ver, const char *__filenam
if (err)
goto out;
ino = pno->p_base->pb_ino;
+#if _LARGEFILE64_SOURCE
+ buf = &st64;
+#else
+ buf = __stat_buf;
+#endif
err =
ino->i_ops.inop_getattr(pno,
pno->p_base->pb_ino,
- (struct intnl_stat *)__stat_buf);
+ buf);
P_RELE(pno);
+#if _LARGEFILE64_SOURCE
+ convstat(buf, __stat_buf);
+#endif
out:
if (err) {
errno = -err;
@@ -140,7 +188,7 @@ out:
return err;
}
-int
+static int
__stat(const char *filename, struct stat *buf)
{
int rc;
@@ -154,6 +202,11 @@ __stat(const char *filename, struct stat
sysio_sym_weak_alias(__stat, stat)
+#if defined(BSD) || defined(REDSTORM)
+#undef _stat
+sysio_sym_weak_alias(__stat, _stat)
+#endif
+
int
__lxstat(int __ver, const char *__filename, struct stat *__stat_buf)
{
@@ -161,6 +214,10 @@ __lxstat(int __ver, const char *__filena
int err;
struct pnode *pno;
struct inode *ino;
+ struct intnl_stat *buf;
+#if _LARGEFILE64_SOURCE
+ struct stat64 st64;
+#endif
if (__ver != _STAT_VER) {
err = -ENOSYS;
@@ -171,12 +228,20 @@ __lxstat(int __ver, const char *__filena
err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno);
if (err)
goto out;
+#if _LARGEFILE64_SOURCE
+ buf = &st64;
+#else
+ buf = __stat_buf;
+#endif
ino = pno->p_base->pb_ino;
err =
ino->i_ops.inop_getattr(pno,
pno->p_base->pb_ino,
- (struct intnl_stat *)__stat_buf);
+ buf);
P_RELE(pno);
+#if _LARGEFILE64_SOURCE
+ convstat(buf, __stat_buf);
+#endif
out:
if (err) {
errno = -err;
@@ -199,3 +264,7 @@ __lstat(const char *filename, struct sta
sysio_sym_weak_alias(__lstat, lstat)
+#if defined(BSD) || defined(REDSTORM)
+#undef _lstat
+sysio_sym_weak_alias(__lstat, _lstat)
+#endif
Index: stat64.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- stat64.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ stat64.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -41,6 +41,8 @@
* le...@sa...
*/
+#ifdef _LARGEFILE64_SOURCE
+
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
@@ -179,3 +181,4 @@ lstat64(const char *filename, struct sta
SYSIO_LEAVE;
return rc;
}
+#endif /* !_LARGEFILE64_SOURCE */
Index: statvfs.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/statvfs.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- statvfs.c 18 Aug 2003 13:56:04 -0000 1.3.4.2
+++ statvfs.c 1 Nov 2003 03:08:22 -0000 1.3.4.3
@@ -41,6 +41,10 @@
* le...@sa...
*/
+#ifdef _HAVE_STATVFS
+
+#if !(defined(BSD) || defined(REDSTORM))
+
#include <unistd.h>
#include <errno.h>
#include <assert.h>
@@ -144,3 +148,5 @@ out:
SYSIO_LEAVE;
return err;
}
+#endif /* if !(defined(BSD) || defined(REDSTORM)) */
+#endif /* defined(_HAVE_STATVFS) */
Index: statvfs64.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/statvfs64.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -w -b -B -p -r1.3.4.1 -r1.3.4.2
--- statvfs64.c 29 Jun 2003 10:15:32 -0000 1.3.4.1
+++ statvfs64.c 1 Nov 2003 03:08:22 -0000 1.3.4.2
@@ -41,6 +41,9 @@
* le...@sa...
*/
+#ifdef _HAVE_STATVFS
+
+#if !(defined(BSD) || defined(REDSTORM))
#include <unistd.h>
#include <errno.h>
#include <assert.h>
@@ -76,7 +79,7 @@ out:
}
int
-fstatvfs(int fd, struct statvfs64 *buf)
+fstatvfs64(int fd, struct statvfs64 *buf)
{
int err;
struct file *filp;
@@ -99,3 +102,5 @@ out:
SYSIO_LEAVE;
return err;
}
+#endif /* if !(defined(BSD) || defined(REDSTORM)) */
+#endif /* define(_HAVE_STATVFS) */
Index: truncate.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- truncate.c 15 Aug 2003 07:14:01 -0000 1.3.4.2
+++ truncate.c 1 Nov 2003 03:08:23 -0000 1.3.4.3
@@ -53,11 +53,13 @@
#include "inode.h"
#include "file.h"
+#include "sysio-symbols.h"
+
/*
* Truncate file, given path (alias) or index node.
*/
static int
-do_truncate(struct pnode *pno, struct inode *ino, off64_t length)
+do_truncate(struct pnode *pno, struct inode *ino, _SYSIO_OFF_T length)
{
struct intnl_stat stbuf;
unsigned mask;
@@ -66,8 +68,10 @@ do_truncate(struct pnode *pno, struct in
ino = pno->p_base->pb_ino;
if (!ino)
return -EBADF;
+ if (S_ISDIR(ino->i_mode)) /* for others too? */
+ return -EISDIR;
if (!S_ISREG(ino->i_mode))
- return -EISDIR; /* for others too? */
+ return -EINVAL;
(void )memset(&stbuf, 0, sizeof(stbuf));
stbuf.st_size = length;
@@ -75,8 +79,8 @@ do_truncate(struct pnode *pno, struct in
return _sysio_setattr(pno, ino, mask, &stbuf);
}
-int
-truncate64(const char *path, off64_t length)
+static int
+_truncate(const char *path, _SYSIO_OFF_T length)
{
int err;
struct pnode *pno;
@@ -97,13 +101,24 @@ out:
return err;
}
-int truncate(const char *path, off_t length)
+#if _LARGEFILE64_SOURCE
+#undef truncate64
+sysio_sym_weak_alias(_truncate, truncate64)
+
+#undef truncate
+int
+truncate(const char *path, off_t length)
{
- return truncate64(path, length);
+
+ return _truncate(path, length);
}
+#else
+#undef truncate
+sysio_sym_weak_alias(_truncate, truncate)
+#endif
-int
-ftruncate64(int fd, off64_t length)
+static int
+_ftruncate(int fd, _SYSIO_OFF_T length)
{
int err;
struct file *fil;
@@ -125,8 +140,18 @@ out:
return err;
}
+#if _LARGEFILE64_SOURCE
+#undef ftruncate64
+sysio_sym_weak_alias(_ftruncate, ftruncate64)
+
+#undef ftruncate
int
ftruncate(int fd, off_t length)
{
- return ftruncate64(fd, length);
+
+ return _ftruncate(fd, length);
}
+#else
+#undef ftruncate
+sysio_sym_weak_alias(_ftruncate, ftruncate)
+#endif
Index: unlink.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -w -b -B -p -r1.3.4.2 -r1.3.4.3
--- unlink.c 29 Jun 2003 10:15:32 -0000 1.3.4.2
+++ unlink.c 1 Nov 2003 03:08:23 -0000 1.3.4.3
@@ -69,6 +69,13 @@ unlink(const char *path)
goto error;
}
err = (*pno->p_base->pb_ino->i_o...
[truncated message content] |
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/drivers/native
Modified Files:
Tag: b_lustre
fs_native.c
Log Message:
merge HEAD into b_lustre, some fixes
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.11.2.3
retrieving revision 1.11.2.4
diff -u -w -b -B -p -r1.11.2.3 -r1.11.2.4
--- fs_native.c 15 Aug 2003 07:43:15 -0000 1.11.2.3
+++ fs_native.c 1 Nov 2003 03:08:21 -0000 1.11.2.4
@@ -57,8 +57,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
+#if 0
#include <sys/vfs.h>
+#endif
+#ifdef _HAVE_STATVFS
#include <sys/statvfs.h>
+#include <sys/statfs.h>
+#endif
#include <utime.h>
#include <sys/queue.h>
@@ -69,6 +74,22 @@
#include "fs_native.h"
+#ifdef REDSTORM
+#include <sys/uio.h>
+#include <catamount/syscall.h> /* ! in sys include? */
+#endif
+
+#ifdef REDSTORM
+/*
+ * The cnos IO routines on Red Storm can't do scatter/gather IO. We
+ * must use a different interface, then. The doio() routine will loop
+ * over the vector entries.
+ */
+typedef ssize_t (*iof)(int, void *, size_t, _SYSIO_OFF_T);
+#else
+typedef ssize_t (*iof)(int, const struct iovec *, int);
+#endif
+
/*
* Local host file system driver.
*/
@@ -126,18 +147,15 @@ do {
#define __native_stat intnl_stat
#define COPY_STAT(src, dest) *(dest) = *(src)
-#define CALL_LSEEK(fd, off, rc, wh) \
- (syscall(SYS_lseek, fd, off, &rc, wh))
-
#endif
#if defined(USE_NATIVE_STAT)
-#define __SYS_STAT SYS_stat
+#define __SYS_STAT SYS_lstat
#define __SYS_FSTAT SYS_fstat
#define __SYS_TRUNCATE SYS_truncate
#define __SYS_FTRUNCATE SYS_ftruncate
#else
-#define __SYS_STAT SYS_stat64
+#define __SYS_STAT SYS_lstat64
#define __SYS_FSTAT SYS_fstat64
#define __SYS_TRUNCATE SYS_truncate64
#define __SYS_FTRUNCATE SYS_ftruncate64
@@ -175,9 +193,7 @@ struct native_inode {
struct file_identifier ni_fileid; /* ditto */
int ni_fd; /* host fildes */
int ni_oflags; /* flags, from open */
-#if 0
unsigned ni_nopens; /* soft ref count */
-#endif
off_t ni_fpos; /* current pos */
};
@@ -195,20 +211,20 @@ static int native_inop_setattr(struct pn
static ssize_t native_getdirentries(struct inode *ino,
char *buf,
size_t nbytes,
- off64_t *basep);
+ _SYSIO_OFF_T *basep);
static int native_inop_mkdir(struct pnode *pno, mode_t mode);
static int native_inop_rmdir(struct pnode *pno);
static int native_inop_symlink(struct pnode *pno, const char *data);
static int native_inop_readlink(struct pnode *pno, char *buf, size_t bufsiz);
static int native_inop_open(struct pnode *pno, int flags, mode_t mode);
static int native_inop_close(struct inode *ino);
+static int native_inop_link(struct pnode *old, struct pnode *new);
static int native_inop_unlink(struct pnode *pno);
+static int native_inop_rename(struct pnode *old, struct pnode *new);
static int native_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int native_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int native_inop_iodone(struct ioctx *ioctx);
static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap);
static int native_inop_sync(struct inode *ino);
@@ -217,9 +233,11 @@ static int native_inop_ioctl(struct inod
unsigned long int request,
va_list ap);
static int native_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev);
+#ifdef _HAVE_STATVFS
static int native_inop_statvfs(struct pnode *pno,
struct inode *ino,
struct intnl_statvfs *buf);
+#endif
static void native_inop_gone(struct inode *ino);
static struct inode_ops native_i_ops = {
@@ -233,7 +251,9 @@ static struct inode_ops native_i_ops = {
native_inop_readlink,
native_inop_open,
native_inop_close,
+ native_inop_link,
native_inop_unlink,
+ native_inop_rename,
native_inop_ipreadv,
native_inop_ipwritev,
native_inop_iodone,
@@ -242,7 +262,9 @@ static struct inode_ops native_i_ops = {
native_inop_datasync,
native_inop_ioctl,
native_inop_mknod,
+#ifdef _HAVE_STATVFS
native_inop_statvfs,
+#endif
native_inop_gone
};
@@ -335,13 +357,10 @@ native_i_new(struct filesys *fs, struct
nino->ni_fileid.fid_len = sizeof(nino->ni_ident);
nino->ni_fd = -1;
nino->ni_oflags = 0;
-#if 0
nino->ni_nopens = 0;
-#endif
nino->ni_fpos = 0;
ino =
_sysio_i_new(fs,
- buf->st_ino,
&nino->ni_fileid,
#ifndef AUTOMOUNT_FILE_NAME
buf->st_mode & S_IFMT,
@@ -584,7 +603,7 @@ native_iget(struct filesys *fs,
#endif
fileid.fid_data = &ident;
fileid.fid_len = sizeof(ident);
- ino = _sysio_i_find(fs, stbuf.st_ino, &fileid);
+ ino = _sysio_i_find(fs, &fileid);
if (ino && forced) {
/*
* Insertion was forced but it's already present!
@@ -827,30 +846,92 @@ out:
return err;
}
+static int
+native_pos(int fd,
+#if _LARGEFILE64_SOURCE
+ loff_t *offset
+#else
+ _SYSIO_OFF_T *offset
+#endif
+ )
+{
+
+ assert(fd >= 0);
+ assert(*offset >= 0);
+
+#if _LARGEFILE64_SOURCE && defined(SYS__llseek)
+ {
+ int err;
+ err =
+ syscall(SYS__llseek,
+ (unsigned int)fd,
+ (unsigned int)(*offset >> 32),
+ (unsigned int)*offset,
+ offset,
+ SEEK_SET);
+ if (err == -1)
+ return -errno;
+ }
+#else
+ *offset =
+ syscall(SYS_lseek,
+ fd,
+ *offset,
+ SEEK_SET);
+ if (*offset == -1)
+ return -errno;
+#endif
+
+ return 0;
+}
+
+
static ssize_t
native_getdirentries(struct inode *ino,
char *buf,
size_t nbytes,
- off64_t *basep)
+ _SYSIO_OFF_T *basep)
{
struct native_inode *nino = I2NI(ino);
+ int err;
+#ifndef SYS_getdirentries
+#if _LARGEFILE64_SOURCE
loff_t result;
+#else
+ _SYSIO_OFF_T result;
+#endif
+#endif
ssize_t cc;
assert(nino->ni_fd >= 0);
+#ifndef SYS_getdirentries
result = *basep;
- if (*basep != nino->ni_fpos &&
- CALL_LSEEK(nino->ni_fd,
- *basep,
- result,
- SEEK_SET) == -1)
- return -errno;
+ if (*basep != nino->ni_fpos) {
+ err = native_pos(nino->ni_fd, &result);
+ if (err)
+ return err;
+ }
nino->ni_fpos = result;
+#ifdef SYS_getdents64
cc = syscall(SYS_getdents64, nino->ni_fd, buf, nbytes);
+#else
+ cc = syscall(SYS_getdents, nino->ni_fd, buf, nbytes);
+#endif
+#else /* defined(SYS_getdirentries) */
+ cc =
+ syscall(SYS_getdirentries,
+ nino->ni_fd,
+ buf,
+ nbytes,
+ basep,
+ &nino->ni_fpos);
+#endif /* !defined(SYS_getdirentries) */
if (cc < 0)
return -errno;
+#ifndef SYS_getdirentries
nino->ni_fpos += cc;
+#endif
return cc;
}
@@ -965,10 +1046,8 @@ native_inop_open(struct pnode *pno, int
* Remember this new open.
*/
nino = I2NI(pno->p_base->pb_ino);
-#if 0
nino->ni_nopens++;
assert(nino->ni_nopens);
-#endif
if (nino->ni_fd >= 0) {
if ((nino->ni_oflags & O_RDWR) ||
@@ -999,11 +1078,16 @@ native_inop_close(struct inode *ino)
if (nino->ni_fd < 0)
abort();
-#if 0
assert(nino->ni_nopens);
- if (--nino->ni_nopens)
+ if (--nino->ni_nopens) {
+ /*
+ * Hmmm. We really don't need anything else. However, some
+ * filesystems try to implement a sync-on-close semantic.
+ * As this appears now, that is lost. Might want to change
+ * it somehow in the future?
+ */
return 0;
-#endif
+ }
err = syscall(SYS_close, nino->ni_fd);
if (err)
@@ -1014,6 +1099,32 @@ native_inop_close(struct inode *ino)
}
static int
+native_inop_link(struct pnode *old, struct pnode *new)
+{
+ int err;
+ char *opath, *npath;
+
+ err = 0;
+
+ opath = _sysio_pb_path(old->p_base, '/');
+ npath = _sysio_pb_path(new->p_base, '/');
+ if (!(opath && npath)) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = syscall(SYS_link, opath, npath);
+
+out:
+ if (opath)
+ free(opath);
+ if (npath)
+ free(npath);
+
+ return err;
+}
+
+static int
native_inop_unlink(struct pnode *pno)
{
char *path;
@@ -1048,30 +1159,32 @@ native_inop_unlink(struct pnode *pno)
* now.
*/
static int
-doio(ssize_t (*f)(int, const struct iovec *, int),
+doio(iof f,
struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
struct native_inode *nino = I2NI(ino);
- struct ioctx *ioctx;
+#ifndef REDSTORM
+#if _LARGEFILE64_SOURCE
loff_t result;
+#else
+ _SYSIO_OFF_T result;
+#endif
+#endif
assert(nino->ni_fd >= 0);
- if (ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0)
+ if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) ||
+ !(S_ISREG(ino->i_mode) ||
+ S_ISCHR(ino->i_mode) ||
+ S_ISSOCK(ino->i_mode) ||
+ S_ISFIFO(ino->i_mode)))
return -EINVAL;
- /*
- * Get a new IO context.
- */
- ioctx = _sysio_ioctx_new(ino, ioargs);
- if (!ioctx)
- return -ENOMEM;
-
+#ifndef REDSTORM
/*
* This implementation first positions the real system descriptor, then
- * performs the operation. This is silly because it's not atomic.
+ * performs the operation. This is not atomic.
*
* An alternative, more complex, less efficient but atomic,
* implementation might consider each entry of the iovec separately.
@@ -1081,71 +1194,141 @@ doio(ssize_t (*f)(int, const struct iove
* Avoid the reposition call if we're already at the right place.
* Allows us to access pipes and fifos.
*/
- result = nino->ni_fpos;
- if (ioctx->ioctx_offset != nino->ni_fpos &&
- !(S_ISCHR(ino->i_mode) ||
- S_ISSOCK(ino->i_mode) ||
- S_ISFIFO(ino->i_mode)) &&
- CALL_LSEEK(nino->ni_fd,
- ioctx->ioctx_offset,
- result,
- SEEK_SET) == -1) {
+ result = ioctx->ioctx_offset;
+ if (ioctx->ioctx_offset != nino->ni_fpos) {
+ int err;
+
+ err = native_pos(nino->ni_fd, &result);
+ if (err) {
ioctx->ioctx_cc = -1;
- ioctx->ioctx_errno = errno;
- } else {
+ ioctx->ioctx_errno = -err;
+ goto out;
+ }
+ nino->ni_fpos = result;
+ }
+#endif
+
/*
* Call the appropriate (read/write) IO function to
* transfer the data now.
*/
- nino->ni_fpos = result;
+#ifdef REDSTORM
+ {
+ size_t count = ioctx->ioctx_iovlen;
+ struct iovec *iov = ioctx->ioctx_iovec;
+ ssize_t cc;
+
+ nino->ni_fpos = ioctx->ioctx_offset;
+ while (count) {
+ cc =
+ (*f)(nino->ni_fd,
+ iov->iov_base,
+ iov->iov_len,
+ nino->ni_fpos);
+ if (cc < 0) {
+ if (ioctx->ioctx_cc) {
+ /*
+ * No data written at all. Return
+ * error.
+ */
+ ioctx->ioctx_cc = -1;
+ }
+ break;
+ }
+ ioctx->ioctx_cc += cc;
+ count--, iov++;
+ }
+ }
+#else /* !defined(REDSTORM) */
ioctx->ioctx_cc =
(*f)(nino->ni_fd, ioctx->ioctx_iovec, ioctx->ioctx_iovlen);
+#endif /* defined(REDSTORM) */
if (ioctx->ioctx_cc < 0)
ioctx->ioctx_errno = errno;
if (ioctx->ioctx_cc > 0)
nino->ni_fpos += ioctx->ioctx_cc;
- }
- *ioctxp = ioctx;
+out:
+ ioctx->ioctx_done = 1;
return 0;
}
/*
* Helper function passed to doio(), above, to accomplish a real readv.
*/
+#ifdef REDSTORM
static ssize_t
-_readv(int fd, const struct iovec *vector, int count)
+native_read(int fd, void *buf, size_t count, _SYSIO_OFF_T offset)
+{
+
+ return syscall(SYS_pread, fd, buf, count, offset);
+}
+#else
+static ssize_t
+native_read(int fd, const struct iovec *vector, int count)
{
return syscall(SYS_readv, fd, vector, count);
}
+#endif
+
+static int
+native_inop_rename(struct pnode *old, struct pnode *new)
+{
+ int err;
+ char *opath, *npath;
+
+ opath = _sysio_pb_path(old->p_base, '/');
+ npath = _sysio_pb_path(new->p_base, '/');
+ if (!(opath && npath)) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = syscall(SYS_rename, opath, npath);
+
+out:
+ if (opath)
+ free(opath);
+ if (npath)
+ free(npath);
+
+ return err;
+}
static int
native_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_readv, ino, ioargs, ioctxp);
+ return doio(native_read, ino, ioctx);
}
/*
* Helper function passed to doio(), above, to accomplish a real writev.
*/
+#ifdef REDSTORM
static ssize_t
-_writev(int fd, const struct iovec *vector, int count)
+native_write(int fd, void *buf, size_t count, _SYSIO_OFF_T offset)
+{
+
+ return syscall(SYS_pwrite, fd, buf, count, offset);
+}
+#else
+static ssize_t
+native_write(int fd, const struct iovec *vector, int count)
{
return syscall(SYS_writev, fd, vector, count);
}
+#endif
static int
native_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_writev, ino, ioargs, ioctxp);
+ return doio(native_write, ino, ioctx);
}
static int
@@ -1204,6 +1387,7 @@ native_inop_mknod(struct pnode *pno __IS
return -ENOSYS;
}
+#ifdef _HAVE_STATVFS
static int
native_inop_statvfs(struct pnode *pno,
struct inode *ino,
@@ -1249,6 +1433,7 @@ native_inop_statvfs(struct pnode *pno,
buf->f_namemax = fs.f_namelen;
return 0;
}
+#endif
static int
native_inop_sync(struct inode *ino)
@@ -1265,7 +1450,14 @@ native_inop_datasync(struct inode *ino)
assert(I2NI(ino)->ni_fd >= 0);
- return syscall(__SYS_FDATASYNC, I2NI(ino)->ni_fd);
+#ifdef NATIVE_FDATASYNC
+ return syscall(NATIVE_FDATASYNC, I2NI(ino)->ni_fd);
+#else
+#if 0
+#warning No fdatasync system call -- Using fsync instead!
+#endif
+ return syscall(SYS_fsync, I2NI(ino)->ni_fd);
+#endif
}
static int
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/drivers/yod
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/drivers/yod
Modified Files:
Tag: b_lustre
Makefile.am fs_yod.c
Log Message:
merge HEAD into b_lustre, some fixes
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/yod/Makefile.am,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- Makefile.am 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ Makefile.am 1 Nov 2003 03:08:22 -0000 1.2.2.2
@@ -1,6 +1,6 @@
lib_LIBRARIES = libsysio_yod.a
-EXTRA_DIST = fs_yod.h
+EXTRA_DIST = ../../include/cplant-yod.h fs_yod.h
libsysio_yod_a_SOURCES = fs_yod.c
Index: fs_yod.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- fs_yod.c 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ fs_yod.c 1 Nov 2003 03:08:22 -0000 1.2.2.2
@@ -57,8 +57,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
+#if 0
#include <sys/vfs.h>
+#endif
+#ifdef _HAVE_STATVFS
#include <sys/statvfs.h>
+#endif
#include <utime.h>
#include <sys/queue.h>
#include <sys/uio.h>
@@ -140,9 +144,7 @@ struct yod_inode {
struct file_identifier ni_fileid; /* ditto */
int ni_fd; /* host fildes */
int ni_oflags; /* flags, from open */
-#if 0
unsigned ni_nopens; /* soft ref count */
-#endif
off_t ni_fpos; /* current pos */
};
@@ -167,13 +169,13 @@ static int yod_inop_symlink(struct pnode
static int yod_inop_readlink(struct pnode *pno, char *buf, size_t bufsiz);
static int yod_inop_open(struct pnode *pno, int flags, mode_t mode);
static int yod_inop_close(struct inode *ino);
+static int yod_inop_link(struct pnode *old, struct pnode *new);
static int yod_inop_unlink(struct pnode *pno);
+static int yod_inop_rename(struct pnode *old, struct pnode *new);
static int yod_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int yod_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int yod_inop_iodone(struct ioctx *ioctx);
static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap);
static int yod_inop_sync(struct inode *ino);
@@ -182,9 +184,11 @@ static int yod_inop_ioctl(struct inode *
unsigned long int request,
va_list ap);
static int yod_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev);
+#ifdef _HAVE_STATVFS
static int yod_inop_statvfs(struct pnode *pno,
struct inode *ino,
struct intnl_statvfs *buf);
+#endif
static void yod_inop_gone(struct inode *ino);
static struct inode_ops yod_i_ops = {
@@ -198,7 +202,9 @@ static struct inode_ops yod_i_ops = {
yod_inop_readlink,
yod_inop_open,
yod_inop_close,
+ yod_inop_link,
yod_inop_unlink,
+ yod_inop_rename,
yod_inop_ipreadv,
yod_inop_ipwritev,
yod_inop_iodone,
@@ -207,7 +213,9 @@ static struct inode_ops yod_i_ops = {
yod_inop_datasync,
yod_inop_ioctl,
yod_inop_mknod,
+#ifdef _HAVE_STATVFS
yod_inop_statvfs,
+#endif
yod_inop_gone
};
@@ -284,6 +291,7 @@ yod_i_new(struct filesys *fs, struct int
nino = malloc(sizeof(struct yod_inode));
if (!nino)
return NULL;
+ bzero(&nino->ni_ident, sizeof(nino->ni_ident));
nino->ni_ident.dev = buf->st_dev;
nino->ni_ident.ino = buf->st_ino;
#ifdef HAVE_GENERATION
@@ -293,13 +301,10 @@ yod_i_new(struct filesys *fs, struct int
nino->ni_fileid.fid_len = sizeof(nino->ni_ident);
nino->ni_fd = -1;
nino->ni_oflags = 0;
-#if 0
nino->ni_nopens = 0;
-#endif
nino->ni_fpos = 0;
ino =
_sysio_i_new(fs,
- buf->st_ino,
&nino->ni_fileid,
#ifndef AUTOMOUNT_FILE_NAME
buf->st_mode & S_IFMT,
@@ -534,6 +539,7 @@ yod_iget(struct filesys *fs,
/*
* I-node is not already known. Find or create it.
*/
+ bzero(&ident, sizeof(ident));
ident.dev = stbuf.st_dev;
ident.ino = stbuf.st_ino;
#ifdef HAVE_GENERATION
@@ -541,7 +547,7 @@ yod_iget(struct filesys *fs,
#endif
fileid.fid_data = &ident;
fileid.fid_len = sizeof(ident);
- ino = _sysio_i_find(fs, stbuf.st_ino, &fileid);
+ ino = _sysio_i_find(fs, &fileid);
if (ino && forced) {
/*
* Insertion was forced but it's already present!
@@ -704,7 +710,7 @@ yod_inop_setattr(struct pnode *pno,
}
if (err)
mask &= ~(SETATTR_UID|SETATTR_GID);
- if (mask & SETATTR_LEN) {
+ else if (mask & SETATTR_LEN) {
/*
* Do the truncate last. It can't be undone.
*/
@@ -727,15 +733,6 @@ yod_inop_setattr(struct pnode *pno,
? st.st_gid
: (gid_t )-1);
}
-#if 0
- if (mask & (SETATTR_MTIME|SETATTR_ATIME)) {
- struct utimbuf ut;
-
- ut.actime = st.st_atime;
- ut.modtime = st.st_mtime;
- (void )utime_yod(path, &ut);
- }
-#endif
if (mask & SETATTR_MODE) {
chmod_yod(path, st.st_mode & 0777);
}
@@ -875,10 +872,8 @@ yod_inop_open(struct pnode *pno, int fla
* Remember this new open.
*/
nino = I2NI(pno->p_base->pb_ino);
-#if 0
nino->ni_nopens++;
assert(nino->ni_nopens);
-#endif
if (nino->ni_fd >= 0) {
if ((nino->ni_oflags & O_RDWR) ||
@@ -909,24 +904,48 @@ yod_inop_close(struct inode *ino)
if (nino->ni_fd < 0)
abort();
-#if 0
- assert(nino->ni_nopens);
- if (--nino->ni_nopens)
- return 0;
-#endif
err = close_yod(nino->ni_fd);
if (err)
return -errno;
+ assert(nino->ni_nopens);
+ if (--nino->ni_nopens)
+ return 0;
nino->ni_fd = -1;
nino->ni_fpos = 0;
return 0;
}
static int
+yod_inop_link(struct pnode *old, struct pnode *new)
+{
+ int err;
+ char *opath, *npath;
+
+ err = 0;
+
+ opath = _sysio_pb_path(old->p_base, '/');
+ npath = _sysio_pb_path(new->p_base, '/');
+ if (!(opath && npath)) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = link_yod(opath, npath);
+
+out:
+ if (opath)
+ free(opath);
+ if (npath)
+ free(npath);
+
+ return err;
+}
+
+static int
yod_inop_unlink(struct pnode *pno)
{
char *path;
- int err;
+ int err = 0;
path = _sysio_pb_path(pno->p_base, '/');
if (!path)
@@ -944,7 +963,8 @@ yod_inop_unlink(struct pnode *pno)
* (usually .NFSXXXXXX, where the X's are replaced by the PID and some
* unique characters) in order to simulate the proper semantic.
*/
- err = unlink_yod(path);
+ if (unlink_yod(path) != 0)
+ err = -errno;
free(path);
return err;
}
@@ -958,26 +978,17 @@ yod_inop_unlink(struct pnode *pno)
static int
doio(ssize_t (*f)(int, const struct iovec *, int),
struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
struct yod_inode *nino = I2NI(ino);
- struct ioctx *ioctx;
loff_t result;
assert(nino->ni_fd >= 0);
- if (ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0)
+ if (ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0)
return -EINVAL;
/*
- * Get a new IO context.
- */
- ioctx = _sysio_ioctx_new(ino, ioargs);
- if (!ioctx)
- return -ENOMEM;
-
- /*
* This implementation first positions the real system descriptor, then
* performs the operation. This is silly because it's not atomic.
*
@@ -1013,7 +1024,7 @@ doio(ssize_t (*f)(int, const struct iove
nino->ni_fpos += ioctx->ioctx_cc;
}
- *ioctxp = ioctx;
+ ioctx->ioctx_done = 1;
return 0;
}
@@ -1021,20 +1032,48 @@ doio(ssize_t (*f)(int, const struct iove
* Helper function passed to doio(), above, to accomplish a real readv.
*/
static ssize_t
-_readv(int fd, const struct iovec *vector, int count __IS_UNUSED)
+_readv(int fd, const struct iovec *vector, int count)
+{
+ int i;
+ ssize_t total = 0;
+
+ for (i = 0; i < count; i++)
+ total += read_yod(fd,
+ vector[i].iov_base,
+ vector[i].iov_len);
+ return total;
+}
+
+static int
+yod_inop_rename(struct pnode *old, struct pnode *new)
{
- return read_yod(fd,
- vector[0].iov_base,
- vector[0].iov_len);
+ int err;
+ char *opath, *npath;
+
+ opath = _sysio_pb_path(old->p_base, '/');
+ npath = _sysio_pb_path(new->p_base, '/');
+ if (!(opath && npath)) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = rename_yod(opath, npath);
+
+out:
+ if (opath)
+ free(opath);
+ if (npath)
+ free(npath);
+
+ return err;
}
static int
yod_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_readv, ino, ioargs, ioctxp);
+ return doio(_readv, ino, ioctx);
}
/*
@@ -1055,11 +1094,10 @@ _writev(int fd, const struct iovec *vect
static int
yod_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_writev, ino, ioargs, ioctxp);
+ return doio(_writev, ino, ioctx);
}
static int
@@ -1096,6 +1134,7 @@ yod_inop_mknod(struct pnode *pno __IS_UN
return -ENOSYS;
}
+#ifdef _HAVE_STATVFS
static int
yod_inop_statvfs(struct pnode *pno,
struct inode *ino,
@@ -1141,6 +1180,7 @@ yod_inop_statvfs(struct pnode *pno,
buf->f_namemax = fs.f_namelen;
return 0;
}
+#endif
static int
yod_inop_sync(struct inode *ino)
@@ -1184,13 +1224,11 @@ yod_inop_gone(struct inode *ino)
}
static void
-yod_fsop_gone(struct filesys *fs)
+yod_fsop_gone(struct filesys *fs __IS_UNUSED)
{
/*
- * Release fs private data
+ * Do nothing. There is no private part maintained for the
+ * yod file interface.
*/
-
- if (fs->fs_private) free(fs->fs_private);
-
}
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/drivers/sockets
Modified Files:
Tag: b_lustre
sockets.c
Log Message:
merge HEAD into b_lustre, some fixes
Index: sockets.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/Attic/sockets.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -b -B -p -r1.1.2.1 -r1.1.2.2
--- sockets.c 8 Sep 2003 03:52:28 -0000 1.1.2.1
+++ sockets.c 1 Nov 2003 03:08:21 -0000 1.1.2.2
@@ -90,11 +90,9 @@ struct socket_info {
static int sockets_inop_close(struct inode *ino);
static int sockets_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int sockets_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctxp);
static int sockets_inop_iodone(struct ioctx *ioctx);
static int sockets_inop_sync(struct inode *ino);
static int sockets_inop_datasync(struct inode *ino);
@@ -168,25 +166,16 @@ sockets_inop_close(struct inode *ino)
static int
doio(ssize_t (*f)(int, const struct iovec *, int),
struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
struct socket_info *ski = I2SKI(ino);
- struct ioctx *ioctx;
assert(ski->ski_fd >= 0);
- if (ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0)
+ if (ioctx->ioctx_iovlen && (int) ioctx->ioctx_iovlen < 0)
return -EINVAL;
/*
- * Get a new IO context.
- */
- ioctx = _sysio_ioctx_new(ino, ioargs);
- if (!ioctx)
- return -ENOMEM;
-
- /*
* Call the appropriate (read/write) IO function to
* transfer the data now.
*/
@@ -195,7 +184,7 @@ doio(ssize_t (*f)(int, const struct iove
if (ioctx->ioctx_cc < 0)
ioctx->ioctx_errno = errno;
- *ioctxp = ioctx;
+ ioctx->ioctx_done = 1;
return 0;
}
@@ -211,11 +200,10 @@ _readv(int fd, const struct iovec *vecto
static int
sockets_inop_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_readv, ino, ioargs, ioctxp);
+ return doio(_readv, ino, ioctx);
}
/*
@@ -230,11 +218,10 @@ _writev(int fd, const struct iovec *vect
static int
sockets_inop_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(_writev, ino, ioargs, ioctxp);
+ return doio(_writev, ino, ioctx);
}
static int
@@ -319,7 +306,6 @@ _sysio_sockets_inew()
ino =
_sysio_i_new(sockets_fs,
- ski->ski_ident.inum,
&ski->ski_fileid,
0,
0,
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/misc
Modified Files:
Tag: b_lustre
gdb-libsysio
Log Message:
merge HEAD into b_lustre, some fixes
Index: gdb-libsysio
===================================================================
RCS file: /cvsroot/libsysio/libsysio/misc/gdb-libsysio,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -b -B -p -r1.2 -r1.2.10.1
--- gdb-libsysio 7 Mar 2003 03:31:36 -0000 1.2
+++ gdb-libsysio 1 Nov 2003 03:08:22 -0000 1.2.10.1
@@ -66,21 +66,45 @@ Dump path-base node and it's aliases
Usage: x_dump_pbnode <pbnode>
end
-define x_dump_mounts
- set $x_m = mounts.lh_first
- while $x_m
- printf "MOUNT %p:", $x_m
- if $x_m->mnt_root
- printf "\n root "
- x_dump_pbnode $x_m->mnt_root->p_base
- else
- printf "\n"
- end
- if $x_m->mnt_covers
- printf " covers "
- x_dump_pbnode $x_m->mnt_covers->p_base
+define __x_dump_pnode
+ printf "%spnode %p, mount %p, base: ", $arg0, $arg1, $arg1->p_mount
+ x_dump_pbnode $arg1->p_base
+end
+
+define x_dump_pnode
+ __x_dump_pnode "" $arg0
+end
+document x_dump_pnode
+Dump path node information
+
+Usage: x_dump_pnode <pnode>
+end
+
+define x_dump_mount
+ printf "MOUNT %p: root pnode %p, covers %p\n", \
+ $arg0, $arg0->mnt_root, $arg0->mnt_covers
+ set $_x_dump_mount_var_pno = _sysio_pnodes->tqh_first
+ while $_x_dump_mount_var_pno != 0
+printf "%p, %p\n", $_x_dump_mount_var_pno, $arg0
+ if $_x_dump_mount_var_pno->p_mount == $arg0
+ __x_dump_pnode " " $_x_dump_mount_var_pno
+ end
+ set $_x_dump_mount_var_pno = \
+ $_x_dump_mount_var_pno->p_nodes.tqe_next
end
- set $x_m = $x_m->mnt_link.le_next
+end
+document x_dump_mount
+Dump single mount record information
+
+Usage: x_dump_mount <mnt>
+end
+
+define x_dump_mounts
+ set $__x_dump_mounts_var_mnt = mounts.lh_first
+ while $__x_dump_mounts_var_mnt
+ x_dump_mount $__x_dump_mounts_var_mnt
+ set $__x_dump_mounts_var_mnt = \
+ $__x_dump_mounts_var_mnt->mnt_link.le_next
end
end
document x_dump_mounts
@@ -89,3 +113,15 @@ Dump the contents of the libsysio mount
Usage: x_dump_mounts
end
+define x_dump_pnodes
+ set $_x_dump_pnodes_var_pno = _sysio_pnodes.tqh_first
+ while $_x_dump_pnodes_var_pno
+ x_dump_pnode $_x_dump_pnodes_var_pno
+ set $_x_dump_pnodes_var_pno = \
+ $_x_dump_pnodes_var_pno->p_nodes.tqe_next
+ end
+end
+
+br _sysio_unmount_all
+run -r /tmp/lee foo bar
+x_dump_pnodes
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/include
Modified Files:
Tag: b_lustre
cplant-yod.h dev.h file.h inode.h sysio.h
Log Message:
merge HEAD into b_lustre, some fixes
Index: cplant-yod.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/cplant-yod.h,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- cplant-yod.h 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ cplant-yod.h 1 Nov 2003 03:08:22 -0000 1.2.2.2
@@ -48,14 +48,17 @@ extern int chmod_yod(const char* path, m
extern int chown_yod(const char* path, uid_t, gid_t);
extern int stat_yod(const char *path, struct stat *sbuf);
extern int fstat_yod(int fd, struct stat *buf);
+#ifdef _HAVE_STATVFS
extern int statfs_yod(const char *path, struct statfs *sbuf);
extern int fstatfs_yod(int fd, struct statfs *buf);
+#endif
extern int mkdir_yod(const char *path, mode_t mode);
extern int rmdir_yod(const char *path);
extern int getdirentries_yod(int fd, char *buf, size_t nbytes, loff_t *basep);
extern int link_yod(const char *path1, const char *path2);
extern int unlink_yod(const char *path);
extern int symlink_yod(const char *path1, const char *path2 );
+extern int rename_yod( const char *path1, const char *path2 );
extern int open_yod(const char *fname, int flags, mode_t mode);
extern int close_yod(int);
extern ssize_t write_yod(int fd, const void *buff, size_t nbytes);
Index: dev.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -w -b -B -p -r1.2 -r1.2.4.1
--- dev.h 24 Mar 2003 22:09:04 -0000 1.2
+++ dev.h 1 Nov 2003 03:08:22 -0000 1.2.4.1
@@ -70,71 +70,75 @@ extern const struct inode_ops _sysio_nod
(int (*)(struct pnode *, \
struct inode **, \
struct intent *, \
- const char *))_sysio_dev_e_notdir
+ const char *))_sysio_dev_illop
#define _sysio_nodev_inop_getattr \
(int (*)(struct pnode *, \
struct inode *, \
- struct intnl_stat *))_sysio_dev_e_badf
+ struct intnl_stat *))_sysio_dev_illop
#define _sysio_nodev_inop_setattr \
(int (*)(struct pnode *, \
struct inode *, \
unsigned , \
- struct intnl_stat *))_sysio_dev_e_badf
+ struct intnl_stat *))_sysio_dev_illop
#define _sysio_nodev_getdirentries \
(ssize_t (*)(struct inode *, \
char *, \
size_t , \
- off64_t *))_sysio_dev_e_notdir
+ _SYSIO_OFF_T *))_sysio_dev_illop
#define _sysio_nodev_inop_mkdir \
(int (*)(struct pnode *, \
- mode_t))_sysio_dev_e_notdir
+ mode_t))_sysio_dev_illop
#define _sysio_nodev_inop_rmdir \
- (int (*)(struct pnode *))_sysio_dev_e_notdir
+ (int (*)(struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_symlink \
(int (*)(struct pnode *, \
- const char *))_sysio_dev_e_notdir
+ const char *))_sysio_dev_illop
#define _sysio_nodev_inop_readlink \
(int (*)(struct pnode *, \
char *, \
- size_t))_sysio_dev_e_inval
+ size_t))_sysio_dev_illop
#define _sysio_nodev_inop_open \
(int (*)(struct pnode *, \
int, \
- mode_t))_sysio_dev_e_nxio
+ mode_t))_sysio_dev_illop
#define _sysio_nodev_inop_close \
- (int (*)(struct inode *))_sysio_dev_e_badf
+ (int (*)(struct inode *))_sysio_dev_illop
+#define _sysio_nodev_inop_link \
+ (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_unlink \
- (int (*)(struct pnode *))_sysio_dev_e_notdir
+ (int (*)(struct pnode *))_sysio_dev_illop
+#define _sysio_nodev_inop_rename \
+ (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_ipreadv \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_e_inval
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_ipwritev \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_e_inval
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_iodone \
- (int (*)(struct ioctx *))_sysio_dev_e_illop
+ (int (*)(struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_fcntl \
(int (*)(struct inode *, \
int, \
- va_list))_sysio_dev_e_inval
+ va_list))_sysio_dev_illop
#define _sysio_nodev_inop_sync \
- (int (*)(struct inode *))_sysio_dev_e_inval
+ (int (*)(struct inode *))_sysio_dev_illop
#define _sysio_nodev_inop_datasync \
- (int (*)(struct inode *))_sysio_dev_e_inval
+ (int (*)(struct inode *))_sysio_dev_illop
#define _sysio_nodev_inop_ioctl \
(int (*)(struct inode *, \
unsigned long int, \
- va_list))_sysio_dev_e_notty
+ va_list))_sysio_dev_illop
#define _sysio_nodev_inop_mknod \
(int (*)(struct pnode *, \
mode_t, \
- dev_t))_sysio_dev_e_notdir
+ dev_t))_sysio_dev_illop
+#ifdef _HAVE_STATVFS
#define _sysio_nodev_inop_statvfs \
(int (*)(struct pnode *, \
struct inode *, \
- struct intnl_statvfs *))_sysio_dev_e_inval
+ struct intnl_statvfs *))_sysio_dev_illop
+#endif
#define _sysio_nodev_inop_gone \
(void (*)(struct inode *ino))_sysio_dev_noop
@@ -144,10 +148,5 @@ extern struct inode_ops *_sysio_dev_look
extern int _sysio_char_dev_register(int major,
const char *name,
struct inode_ops *ops);
-extern int _sysio_dev_e_notdir(void);
-extern int _sysio_dev_e_badf(void);
-extern int _sysio_dev_e_inval(void);
-extern int _sysio_dev_e_nxio(void);
-extern int _sysio_dev_e_illop(void);
-extern int _sysio_dev_e_notty(void);
+extern int _sysio_dev_illop(void);
extern void _sysio_dev_noop(void);
Index: file.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/file.h,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -w -b -B -p -r1.5 -r1.5.4.1
--- file.h 24 Mar 2003 22:09:05 -0000 1.5
+++ file.h 1 Nov 2003 03:08:22 -0000 1.5.4.1
@@ -52,7 +52,7 @@
*/
struct file {
struct inode *f_ino; /* path node */
- off64_t f_pos; /* current stream pos */
+ _SYSIO_OFF_T f_pos; /* current stream pos */
unsigned f_ref; /* ref count */
int f_flags; /* open/fcntl flags */
};
@@ -92,7 +92,7 @@ struct ioctx;
extern struct file *_sysio_fnew(struct inode *ino, int flags);
extern void _sysio_fgone(struct file *fil);
-extern void _sysio_fcompletio(struct ioctx *ioctx);
+extern void _sysio_fcompletio(struct ioctx *ioctx, struct file *fil);
extern int _sysio_fd_close(int fd);
extern struct file *_sysio_fd_find(int fd);
extern int _sysio_fd_set(struct file *fil, int fd);
Index: inode.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -w -b -B -p -r1.6.2.1 -r1.6.2.2
--- inode.h 15 Aug 2003 07:43:15 -0000 1.6.2.1
+++ inode.h 1 Nov 2003 03:08:22 -0000 1.6.2.2
@@ -63,7 +63,9 @@ struct inode;
struct intent;
struct intnl_dirent;
struct intnl_stat;
+#ifdef _HAVE_STATVFS
struct intnl_statvfs;
+#endif
struct io_arguments;
struct ioctx;
@@ -87,29 +89,29 @@ struct inode_ops {
ssize_t (*inop_getdirentries)(struct inode *ino,
char *buf,
size_t nbytes,
- off64_t *basep);
+ _SYSIO_OFF_T *basep);
int (*inop_mkdir)(struct pnode *pno, mode_t mode);
int (*inop_rmdir)(struct pnode *pno);
int (*inop_symlink)(struct pnode *pno, const char *data);
int (*inop_readlink)(struct pnode *pno, char *buf, size_t bufsiz);
int (*inop_open)(struct pnode *pno, int flags, mode_t mode);
int (*inop_close)(struct inode *ino);
+ int (*inop_link)(struct pnode *old, struct pnode *new);
int (*inop_unlink)(struct pnode *pno);
- int (*inop_ipreadv)(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
- int (*inop_ipwritev)(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ int (*inop_rename)(struct pnode *old, struct pnode *new);
+ int (*inop_ipreadv)(struct inode *ino, struct ioctx *ioctx);
+ int (*inop_ipwritev)(struct inode *ino, struct ioctx *ioctx);
int (*inop_iodone)(struct ioctx *iocp);
int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap);
int (*inop_sync)(struct inode *ino);
int (*inop_datasync)(struct inode *ino);
int (*inop_ioctl)(struct inode *ino, unsigned long int request, va_list ap);
int (*inop_mknod)(struct pnode *pno, mode_t mode, dev_t dev);
+#ifdef _HAVE_STATVFS
int (*inop_statvfs)(struct pnode *pno,
struct inode *ino,
struct intnl_statvfs *buf);
+#endif
void (*inop_gone)(struct inode *ino);
};
@@ -128,10 +130,10 @@ struct inode_ops {
*/
struct inode {
LIST_ENTRY(inode) i_link; /* FS i-nodes link */
- unsigned i_immune : 1; /* immune from GC */
- unsigned i_zombie : 1; /* stale inode */
+ unsigned
+ i_immune : 1, /* immune from GC */
+ i_zombie : 1; /* stale inode */
unsigned i_ref; /* soft ref counter */
- ino_t i_num; /* i-num (deprecate!) */
mode_t i_mode; /* mode (see stat.h) */
dev_t i_rdev; /* dev (if device) */
struct inode_ops i_ops; /* operations */
@@ -144,12 +146,11 @@ struct inode {
/*
* Init an i-node record.
*/
-#define I_INIT(ino, fs, inum, mode, rdev, ops, fid, immunity, private) \
+#define I_INIT(ino, fs, mode, rdev, ops, fid, immunity, private) \
do { \
(ino)->i_immune = (immunity) ? 1 : 0; \
(ino)->i_zombie = 0; \
(ino)->i_ref = 0; \
- (ino)->i_num = (inum); \
(ino)->i_mode = (mode); \
(ino)->i_rdev = (rdev); \
(ino)->i_ops = *(ops); \
@@ -340,46 +341,53 @@ struct nameidata {
} while (0)
/*
- * Bundled up arguments to file system driver IO calls.
+ * IO completion callback record.
*/
-struct io_arguments {
- const struct iovec *ioarg_iovec; /* io vector */
- size_t ioarg_iovlen; /* iovec length */
- off64_t ioarg_offset; /* beginning offset */
- void (*ioarg_completion)(void *); /* callback */
- void *ioarg_completion_arg; /* callback data */
+struct ioctx_callback {
+ TAILQ_ENTRY(ioctx_callback) iocb_next; /* list link */
+ void (*iocb_f)(struct ioctx *, void *); /* cb func */
+ void *iocb_data; /* cb data */
};
/*
- * Init IO arguments bundle.
- */
-#define IOARG_INIT(ioarg, iov, len, off, cb, data) \
- do { \
- (ioarg)->ioarg_iovec = (iov); \
- (ioarg)->ioarg_iovlen = (len); \
- (ioarg)->ioarg_offset = (off); \
- (ioarg)->ioarg_completion = (cb); \
- (ioarg)->ioarg_completion_arg = (data); \
- } while (0)
-
-/*
* All IO internally is done with an asynchronous mechanism. This record
* holds the completion information. It's too big :-(
*/
struct ioctx {
LIST_ENTRY(ioctx) ioctx_link; /* AIO list link */
+ unsigned
+ ioctx_fast : 1, /* from stack space */
+ ioctx_done : 1; /* transfer complete */
ioid_t ioctx_id; /* unique ident */
struct inode *ioctx_ino; /* i-node */
const struct iovec *ioctx_iovec; /* scatter/gather vec */
size_t ioctx_iovlen; /* iovec length */
- off64_t ioctx_offset; /* file offset */
+ _SYSIO_OFF_T ioctx_offset; /* file offset */
ssize_t ioctx_cc; /* rtn char count */
int ioctx_errno; /* error number */
- void (*ioctx_cb)(void *); /* callback */
- void *ioctx_data; /* callback data */
+ TAILQ_HEAD(, ioctx_callback) ioctx_cbq; /* callback queue */
+ void *ioctx_private; /* driver data */
};
/*
+ * Init IO context record.
+ */
+#define IOCTX_INIT(ioctx, fast, id, ino, iov, iovlen, off) \
+ do { \
+ (ioctx)->ioctx_fast = (fast); \
+ (ioctx)->ioctx_done = 0; \
+ (ioctx)->ioctx_id = (id); \
+ (ioctx)->ioctx_ino = (ino); \
+ (ioctx)->ioctx_iovec = (iov); \
+ (ioctx)->ioctx_iovlen = (iovlen); \
+ (ioctx)->ioctx_offset = (off); \
+ (ioctx)->ioctx_cc = 0; \
+ (ioctx)->ioctx_errno = 0; \
+ TAILQ_INIT(&(ioctx)->ioctx_cbq); \
+ (ioctx)->ioctx_private = NULL; \
+ } while (0)
+
+/*
* Return whether a pnode/inode is on a read-only mount or file system.
*/
#define IS_RDONLY(pno, ino) \
@@ -398,7 +406,6 @@ extern TAILQ_HEAD(pnodes_head, pnode) _s
extern int _sysio_i_init(void);
extern struct inode *_sysio_i_new(struct filesys *fs,
- ino_t ino,
struct file_identifier *fid,
mode_t type,
dev_t rdev,
@@ -406,7 +413,6 @@ extern struct inode *_sysio_i_new(struct
struct inode_ops *ops,
void *private);
extern struct inode *_sysio_i_find(struct filesys *fs,
- ino_t ino,
struct file_identifier *fid);
extern void _sysio_i_gone(struct inode *ino);
extern void _sysio_i_undead(struct inode *ino);
@@ -440,9 +446,15 @@ extern int _sysio_namei(struct pnode *pn
unsigned flags,
struct intent *intnt,
struct pnode **pnop);
+extern int _sysio_p_chdir(struct pnode *pno);
extern int _sysio_ioctx_init(void);
extern struct ioctx *_sysio_ioctx_new(struct inode *ino,
- struct io_arguments *ioargs);
+ const struct iovec *iov,
+ size_t iovlen,
+ _SYSIO_OFF_T offset);
+extern int _sysio_ioctx_cb(struct ioctx *ioctx,
+ void (*f)(struct ioctx *, void *),
+ void *data);
extern struct ioctx *_sysio_ioctx_find(ioid_t id);
extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx);
extern void _sysio_ioctx_complete(struct ioctx *ioctx);
Index: sysio.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v
retrieving revision 1.7.4.4
retrieving revision 1.7.4.5
diff -u -w -b -B -p -r1.7.4.4 -r1.7.4.5
--- sysio.h 8 Sep 2003 03:58:17 -0000 1.7.4.4
+++ sysio.h 1 Nov 2003 03:08:22 -0000 1.7.4.5
@@ -84,11 +84,27 @@ typedef void *ioid_t;
#include "cygwin-defs.h"
#endif
+#ifndef _LARGEFILE64_SOURCE
+/*
+ * Not glibc. Define this ourselves.
+ */
+#define _LARGEFILE64_SOURCE 0
+#endif
+
+/*
+ * Define internal file-offset type.
+ */
+#if _LARGEFILE64_SOURCE
+#define _SYSIO_OFF_T off64_t
+#else
+#define _SYSIO_OFF_T off_t
+#endif
+
/*
* Internally, all directory entries are carried in the 64-bit capable
* structure.
*/
-#ifdef _LARGEFILE64_SOURCE
+#if _LARGEFILE64_SOURCE
#define intnl_dirent dirent64
#else
#define intnl_dirent dirent
@@ -99,22 +115,29 @@ struct dirent;
* Internally, all file status is carried in the 64-bit capable
* structure.
*/
-#ifdef _LARGEFILE64_SOURCE
+#if _LARGEFILE64_SOURCE
#define intnl_stat stat64
#else
#define intnl_stat stat
#endif
struct stat;
-#ifdef _LARGEFILE64_SOURCE
+#ifdef _HAVE_STATVFS
+#if _LARGEFILE64_SOURCE
#define intnl_statvfs statvfs64
#else
#define intnl_statvfs statvfs
#define INTNL_STATVFS_IS_NATURAL 1
#endif
struct statvfs;
+struct intnl_statvfs;
+#endif
struct iovec;
+struct utimbuf;
+
+struct intnl_stat;
+
struct pnode;
extern struct pnode *_sysio_cwd;
@@ -132,28 +155,68 @@ extern void _sysio_shutdown(void);
extern int access(const char *path, int amode);
extern int chdir(const char *path);
extern int chmod(const char *path, mode_t mode);
+extern int fchmod(int fd, mode_t mode);
extern int chown(const char *path, uid_t owner, gid_t group);
+extern int fchown(int fd, uid_t owner, gid_t group);
extern int close(int d);
extern int dup(int oldfd);
extern int dup2(int oldfd, int newfd);
extern int fcntl(int fd, int cmd, ...);
extern int fstat(int fd, struct stat *buf);
extern int fsync(int fd);
-extern int ftruncate(int fd, off_t length);
extern char *getcwd(char *buf, size_t size);
extern off_t lseek(int fd, off_t offset, int whence);
+#if _LARGEFILE64_SOURCE
+extern off64_t lseek64(int fd, off64_t offset, int whence);
+#endif
extern int lstat(const char *path, struct stat *buf);
+#if defined(BSD) || defined(REDSTORM)
+extern int getdirentries(int fd, char *buf, int nbytes , long *basep);
+#else
extern ssize_t getdirentries(int fd, char *buf, size_t nbytes , off_t *basep);
+#if _LARGEFILE64_SOURCE
+extern ssize_t getdirentries64(int fd,
+ char *buf,
+ size_t nbytes,
+ off64_t *basep);
+#endif
+#endif
extern int mkdir(const char *path, mode_t mode);
extern int open(const char *path, int flag, ...);
+#if _LARGEFILE64_SOURCE
+extern int open64(const char *path, int flag, ...);
+#endif
extern int creat(const char *path, mode_t mode);
+#if _LARGEFILE64_SOURCE
+extern int creat64(const char *path, mode_t mode);
+#endif
extern int stat(const char *path, struct stat *buf);
+#if _LARGEFILE64_SOURCE
+extern int stat64(const char *path, struct stat64 *buf);
+#endif
+#ifdef _HAVE_STATVFS
extern int statvfs(const char *path, struct statvfs *buf);
-extern int truncate(const char *path, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int statvfs64(const char *path, struct statvfs64 *buf);
+#endif
extern int fstatvfs(int fd, struct statvfs *buf);
+#if _LARGEFILE64_SOURCE
+extern int fstatvfs64(int fd, struct statvfs64 *buf);
+#endif
+#endif
+extern int truncate(const char *path, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int truncate64(const char *path, off64_t length);
+#endif
+extern int ftruncate(int fd, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int ftruncate64(int fd, off64_t length);
+#endif
extern int rmdir(const char *path);
extern int symlink(const char *path1, const char *path2);
+extern int link(const char *oldpath, const char *newpath);
extern int unlink(const char *path);
+extern int rename(const char *oldpath, const char *newpath);
extern int fdatasync(int fd);
#ifndef __CYGWIN__
extern int ioctl(int fd, unsigned long request, ...);
@@ -165,26 +228,40 @@ extern int iodone(ioid_t ioid);
extern ssize_t iowait(ioid_t ioid);
extern int iodone(ioid_t ioid);
extern ioid_t ipreadv(int fd, const struct iovec *iov, size_t count,
- off_t offset);
-extern ioid_t ipread(int fd, void *buf, size_t count, off_t offset);
+ _SYSIO_OFF_T offset);
+extern ioid_t ipread(int fd, void *buf, size_t count, _SYSIO_OFF_T offset);
extern ssize_t preadv(int fd, const struct iovec *iov, size_t count,
- off_t offset);
+ _SYSIO_OFF_T offset);
extern ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+#if _LARGEFILE64_SOURCE
+extern ssize_t pread64(int fd, void *buf, size_t count, off64_t offset);
+#endif
extern ioid_t ireadv(int fd, const struct iovec *iov, int count);
extern ioid_t iread(int fd, void *buf, size_t count);
extern ssize_t readv(int fd, const struct iovec *iov, int count);
extern ssize_t read(int fd, void *buf, size_t count);
+#if _LARGEFILE64_SOURCE
+extern ssize_t read64(int fd, void *buf, size_t count);
+#endif
extern ioid_t ipwritev(int fd, const struct iovec *iov, size_t count,
- off_t offset);
-extern ioid_t ipwrite(int fd, const void *buf, size_t count, off_t offset);
+ _SYSIO_OFF_T offset);
+extern ioid_t ipwrite(int fd, const void *buf, size_t count,
+ _SYSIO_OFF_T offset);
extern ssize_t pwritev(int fd, const struct iovec *iov, size_t count,
- off_t offset);
+ _SYSIO_OFF_T offset);
extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+#if _LARGEFILE64_SOURCE
+extern ssize_t pwrite64(int fd, const void *buf, size_t count, off64_t offset);
+#endif
extern ioid_t iwritev(int fd, const struct iovec *iov, int count);
extern ioid_t iwrite(int fd, const void *buf, size_t count);
extern ssize_t writev(int fd, const struct iovec *iov, int count);
extern ssize_t write(int fd, const void *buf, size_t count);
+#if _LARGEFILE64_SOURCE
+extern ssize_t write64(int fd, const void *buf, size_t count);
+#endif
extern int mknod(const char *path, mode_t mode, dev_t dev);
+extern int utime(const char *path, const struct utimbuf *buf);
extern int mount(const char *source, const char *target,
const char *filesystemtype,
unsigned long mountflags,
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:24
|
Update of /cvsroot/libsysio/libsysio
In directory sc8-pr-cvs1:/tmp/cvs-serv28091
Modified Files:
Tag: b_lustre
README configure.in
Log Message:
merge HEAD into b_lustre, some fixes
Index: README
===================================================================
RCS file: /cvsroot/libsysio/libsysio/README,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -b -B -p -r1.2 -r1.2.10.1
--- README 7 Mar 2003 03:31:35 -0000 1.2
+++ README 1 Nov 2003 03:08:21 -0000 1.2.10.1
@@ -17,8 +17,8 @@ Option --with-tests=yes will cause the t
to be enabled. This is set by default; Use "no" to disable.
Option --with-automount=<automount-file-name> will cause automount support
-to be included. Normally, this should be set to ".mount", matching the
-documentation.
+to be included. If <automount-file-name> is not supplied, a default value
+of ".mount" will be used, matching the Lustre documentation.
To build:
@@ -53,3 +53,14 @@ is required. They are not on a timer, un
one for them. They just disappear as resource is needed elsewhere. As they
were automatically mounted to begin with, they should re-establish as needed,
transparently.
+
+REDSTORM
+--------
+
+The following works for me:
+
+#!/bin/sh
+
+export CFLAGS="-DREDSTORM -nostdinc -isystem /home/lee/REDSTORM/catamount/computeincs/i386 -isystem /home/lee/REDSTORM/catamount/include -g -W -Wall -ansi"
+
+sh configure --with-autmount=".mount" --with-native=yes --with-incore-yes --with-stdfd=yes --with-tests=yes
Index: configure.in
===================================================================
RCS file: /cvsroot/libsysio/libsysio/configure.in,v
retrieving revision 1.5.4.3
retrieving revision 1.5.4.4
diff -u -w -b -B -p -r1.5.4.3 -r1.5.4.4
--- configure.in 8 Sep 2003 03:52:28 -0000 1.5.4.3
+++ configure.in 1 Nov 2003 03:08:21 -0000 1.5.4.4
@@ -3,7 +3,7 @@ AC_INIT(libsysio, 0.1)
AC_CANONICAL_HOST
case "$host_os" in
- linux-gnu)
+ linux*)
;;
cygwin)
;;
@@ -22,7 +22,7 @@ AC_HEADER_STAT
AC_HEADER_TIME
AC_ARG_WITH(native_driver,
- [ --with-native-driver build native test driver],
+ AC_HELP_STRING([--with-native-driver],[build native test driver]),
[ case "${withval}" in
yes) ;;
no) ;;
@@ -32,7 +32,7 @@ AC_ARG_WITH(native_driver,
AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
AC_ARG_WITH(incore-driver,
- [ --with-incore-driver build incore test driver],
+ AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
[ case "${withval}" in
yes) ;;
no) ;;
@@ -42,7 +42,7 @@ AC_ARG_WITH(incore-driver,
AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
AC_ARG_WITH(tests,
- [ --with-tests build tests],
+ AC_HELP_STRING([--with-tests],[build tests]),
[ case "${withval}" in
yes) ;;
no) ;;
@@ -52,14 +52,18 @@ AC_ARG_WITH(tests,
AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
AC_ARG_WITH(automount,
- [ --with-automount=[automount-file-name] with automounts],
- [ if test x${withval} != x; then
+ AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
+ [with automounts @<:@<automount-file-name>=.mount@:>@]),
+ [ if test x${withval} = xyes; then
+ AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
+ elif test x${withval} != x; then
AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
fi])
AC_SUBST(AUTOMOUNT)
AC_ARG_WITH(stdfd-dev,
- [ --with-stdfd-dev build standard file descriptors pseudo-driver],
+ AC_HELP_STRING([--with-stdfd-dev],
+ [build standard file descriptors pseudo-driver]),
[ case "${withval}" in
yes) ;;
no) ;;
@@ -69,7 +73,7 @@ AC_ARG_WITH(stdfd-dev,
AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
AC_ARG_WITH(cplant_yod,
- [ --with-cplant-yod build cplant yod I/O driver],
+ AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
[ case "${withval}" in
yes) if test x${with_stdfd_dev} != xyes; then
with_stdfd_dev=yes
@@ -82,12 +86,12 @@ AC_ARG_WITH(cplant_yod,
AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
AC_ARG_WITH(cplant_tests,
- [ --with-cplant-tests=[cplant build path] build libsysio tests for cplant platform],
+ AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
+ [build libsysio tests for cplant platform]),
[ case "${withval}" in
yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
no) with_cplant_tests=no;;
- *) CPLANT_PATH=${withval}
- CC=${CPLANT_PATH}/cplant-cc
+ *) CC=${withval}
CCDEPMODE=${CC}
CPP="${CC} -E"
AC_CHECK_FILE(${CC},
@@ -160,7 +164,7 @@ AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>], [
-struct stat64 st64; printf("%u\n", sizeof(struct stat64));],
+struct stat64 st64;],
sysio_largefile64_source_required=no,
sysio_largefile64_source_required=maybe)
if test x$sysio_largefile64_source_required = xmaybe; then
@@ -169,7 +173,7 @@ if test x$sysio_largefile64_source_requi
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>], [
-int i; i = 0;],
+struct stat64 st64;],
sysio_largefile64_source_required=yes,
sysio_largefile64_source_required=no)
fi
@@ -182,12 +186,13 @@ fi
#
AC_MSG_CHECKING(for alpha linux)
alpha_linux_env=no
-if test ${machine:0:5} = alpha && \
- test ${os:0:5} = linux; then
+if test `expr ${machine} : "alpha"` = 5 && \
+ test `expr ${os} : "linux"` = 5; then
alpha_linux_env=yes
AC_DEFINE(ALPHA_LINUX)
fi
AC_MSG_RESULT($alpha_linux_env)
+AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
# check for 64 bit stat, fstat, truncate, ftruncate syscalls
#
@@ -214,6 +219,11 @@ fi
# Check for fdatasync syscall
#
AC_MSG_CHECKING(for fdatasync system call)
+if test x$alpha_linux_env == xyes; then
+ _syscallnum=SYS_osf_fdatasync
+else
+ _syscallnum=SYS_fdatasync
+fi
AC_TRY_COMPILE([
#include <syscall.h>
extern int syscall();],
@@ -222,8 +232,8 @@ syscall(SYS_fdatasync, fd);],
syscall_fdatasync_exists=yes,
syscall_fdatasync_exists=no)
AC_MSG_RESULT($syscall_fdatasync_exists)
-if test x$syscall_fdatasync_exists = xno; then
- AC_DEFINE(USE_NATIVE_FDATASYNC)
+if test x$syscall_fdatasync_exists = xyes; then
+ AC_DEFINE_UNQUOTED(NATIVE_FDATASYNC, $_syscallnum)
fi
# Check for SYS_utime
|
|
From: Mei <me...@us...> - 2003-11-01 03:08:24
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/dev/stdfd
Modified Files:
Tag: b_lustre
stdfd.c
Log Message:
merge HEAD into b_lustre, some fixes
Index: stdfd.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -u -w -b -B -p -r1.2.4.1 -r1.2.4.2
--- stdfd.c 15 Aug 2003 07:43:15 -0000 1.2.4.1
+++ stdfd.c 1 Nov 2003 03:08:21 -0000 1.2.4.2
@@ -58,6 +58,10 @@
#include "stdfd.h"
+#ifdef REDSTORM
+#include <catamount/syscall.h> /* ! in sys include? */
+#endif
+
#ifdef CPLANT_YOD
#include <sys/statfs.h>
#include "cplant-yod.h"
@@ -75,11 +79,9 @@
static int stdfd_open(struct pnode *pno, int flags, mode_t mode);
static int stdfd_close(struct inode *ino);
static int stdfd_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int stdfd_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ struct ioctx *ioctx);
static int stdfd_iodone(struct ioctx *ioctx);
static int stdfd_datasync(struct inode *ino);
static int stdfd_ioctl(struct inode *ino,
@@ -124,18 +126,12 @@ stdfd_close(struct inode *ino __IS_UNUSE
static int
doio(ssize_t (*f)(int, char *, size_t),
struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- struct ioctx *ioctx;
const struct iovec *iov;
size_t n;
ssize_t cc = 0;
- ioctx = _sysio_ioctx_new(ino, ioargs);
- if (!ioctx)
- return -ENOMEM;
-
iov = ioctx->ioctx_iovec;
for (n = ioctx->ioctx_iovlen, iov = ioctx->ioctx_iovec;
n--;
@@ -155,7 +151,6 @@ doio(ssize_t (*f)(int, char *, size_t),
ioctx->ioctx_errno = -cc;
}
- *ioctxp = ioctx;
return 0;
}
@@ -168,11 +163,10 @@ stdfd_read(int fd, char *buf, size_t nby
static int
stdfd_ipreadv(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
- return doio(stdfd_read, ino, ioargs, ioctxp);
+ return doio(stdfd_read, ino, ioctx);
}
static ssize_t
@@ -186,14 +180,12 @@ stdfd_write(int fd,
static int
stdfd_ipwritev(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp)
+ struct ioctx *ioctx)
{
return doio((ssize_t (*)(int, char *, size_t))stdfd_write,
ino,
- ioargs,
- ioctxp);
+ ioctx);
}
static int
|