libsysio-commit Mailing List for libsysio (Page 38)
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-11-01 03:08:24
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1:/tmp/cvs-serv28091/drivers/incore Modified Files: Tag: b_lustre fs_incore.c Log Message: merge HEAD into b_lustre, some fixes Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -w -b -B -p -r1.4.2.1 -r1.4.2.2 --- fs_incore.c 15 Aug 2003 07:43:15 -0000 1.4.2.1 +++ fs_incore.c 1 Nov 2003 03:08:21 -0000 1.4.2.2 @@ -56,7 +56,9 @@ #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> +#ifdef _HAVE_STATVFS #include <sys/statvfs.h> +#endif #include <sys/queue.h> #include "sysio.h" @@ -132,18 +134,18 @@ static int _sysio_incore_inop_setattr(st static ssize_t _sysio_incore_dirop_getdirentries(struct inode *ino, char *buf, size_t nbytes, - off64_t *basep); + _SYSIO_OFF_T *basep); static int _sysio_incore_dirop_mkdir(struct pnode *pno, mode_t mode); static int _sysio_incore_dirop_rmdir(struct pnode *pno); static int _sysio_incore_inop_open(struct pnode *pno, int flags, mode_t mode); static int _sysio_incore_inop_close(struct inode *ino); +static int _sysio_incore_dirop_link(struct pnode *old, struct pnode *new); static int _sysio_incore_dirop_unlink(struct pnode *pno); +static int _sysio_incore_dirop_rename(struct pnode *old, struct pnode *new); static int _sysio_incore_filop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int _sysio_incore_filop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int _sysio_incore_filop_iodone(struct ioctx *ioctx); static int _sysio_incore_filop_fcntl(struct inode *ino, int cmd, va_list ap); static int _sysio_incore_inop_sync(struct inode *ino); @@ -151,12 +153,13 @@ static int _sysio_incore_filop_ioctl(str unsigned long int request, va_list ap); static int _sysio_incore_dirop_mknod(struct pnode *pno, mode_t mode, dev_t dev); +#ifdef _HAVE_STATVFS static int _sysio_incore_inop_statvfs(struct pnode *pno, struct inode *ino, struct intnl_statvfs *buf); +#endif static void _sysio_incore_inop_gone(struct inode *ino); static int _sysio_incore_e_isdir(void); -static int _sysio_incore_e_notdir(void); static int _sysio_incore_e_inval(void); static int _sysio_incore_e_nosys(void); static void _sysio_incore_illop(void); @@ -167,12 +170,10 @@ static void _sysio_incore_illop(void); (int (*)(struct pnode *, char *, size_t))_sysio_incore_e_inval #define _sysio_incore_dirop_ipreadv \ (int (*)(struct inode *, \ - struct io_arguments *, \ - struct ioctx **))_sysio_incore_e_isdir + struct ioctx *))_sysio_incore_e_isdir #define _sysio_incore_dirop_ipwritev \ (int (*)(struct inode *, \ - struct io_arguments *, \ - struct ioctx **))_sysio_incore_e_isdir + struct ioctx *))_sysio_incore_e_isdir #define _sysio_incore_dirop_iodone \ (int (*)(struct ioctx *))_sysio_incore_illop #define _sysio_incore_dirop_fcntl \ @@ -193,7 +194,9 @@ static struct inode_ops _sysio_incore_di _sysio_incore_dirop_readlink, _sysio_incore_inop_open, _sysio_incore_inop_close, + _sysio_incore_dirop_link, _sysio_incore_dirop_unlink, + _sysio_incore_dirop_rename, _sysio_incore_dirop_ipreadv, _sysio_incore_dirop_ipwritev, _sysio_incore_dirop_iodone, @@ -202,7 +205,9 @@ static struct inode_ops _sysio_incore_di _sysio_incore_inop_sync, _sysio_incore_dirop_ioctl, _sysio_incore_dirop_mknod, +#ifdef _HAVE_STATVFS _sysio_incore_inop_statvfs, +#endif _sysio_incore_inop_gone }; @@ -210,24 +215,28 @@ static struct inode_ops _sysio_incore_di (int (*)(struct pnode *, \ struct inode **, \ struct intent *, \ - const char *))_sysio_incore_e_notdir + const char *))_sysio_incore_illop #define _sysio_incore_filop_getdirentries \ (ssize_t (*)(struct inode *, \ char *, \ size_t, \ - off64_t *))_sysio_incore_e_notdir + _SYSIO_OFF_T *))_sysio_incore_illop #define _sysio_incore_filop_mkdir \ - (int (*)(struct pnode *, mode_t))_sysio_incore_e_notdir + (int (*)(struct pnode *, mode_t))_sysio_incore_illop #define _sysio_incore_filop_rmdir \ - (int (*)(struct pnode *))_sysio_incore_e_notdir + (int (*)(struct pnode *))_sysio_incore_illop #define _sysio_incore_filop_symlink \ (int (*)(struct pnode *, const char *))_sysio_incore_illop #define _sysio_incore_symlinkop_readlink \ (int (*)(struct pnode *, char *, size_t))_sysio_incore_illop +#define _sysio_incore_filop_link \ + (int (*)(struct pnode *old, struct pnode *new))_sysio_incore_illop #define _sysio_incore_filop_unlink \ - (int (*)(struct pnode *pno))_sysio_incore_e_notdir + (int (*)(struct pnode *pno))_sysio_incore_illop +#define _sysio_incore_filop_rename \ + (int (*)(struct pnode *old, struct pnode *new))_sysio_incore_illop #define _sysio_incore_filop_mknod \ - (int (*)(struct pnode *pno, mode_t, dev_t))_sysio_incore_e_notdir + (int (*)(struct pnode *pno, mode_t, dev_t))_sysio_incore_illop static struct inode_ops _sysio_incore_file_ops = { _sysio_incore_filop_lookup, @@ -240,7 +249,9 @@ static struct inode_ops _sysio_incore_fi _sysio_incore_symlinkop_readlink, _sysio_incore_inop_open, _sysio_incore_inop_close, + _sysio_incore_filop_link, _sysio_incore_filop_unlink, + _sysio_incore_filop_rename, _sysio_incore_filop_ipreadv, _sysio_incore_filop_ipwritev, _sysio_incore_filop_iodone, @@ -249,7 +260,9 @@ static struct inode_ops _sysio_incore_fi _sysio_incore_inop_sync, _sysio_incore_filop_ioctl, _sysio_incore_filop_mknod, +#ifdef _HAVE_STATVFS _sysio_incore_inop_statvfs, +#endif _sysio_incore_inop_gone }; @@ -264,7 +277,9 @@ static struct inode_ops _sysio_incore_de _sysio_incore_symlinkop_readlink, _sysio_nodev_inop_open, _sysio_nodev_inop_close, + _sysio_incore_filop_link, _sysio_incore_filop_unlink, + _sysio_incore_filop_rename, _sysio_nodev_inop_ipreadv, _sysio_nodev_inop_ipwritev, _sysio_nodev_inop_iodone, @@ -273,7 +288,9 @@ static struct inode_ops _sysio_incore_de _sysio_nodev_inop_sync, _sysio_nodev_inop_ioctl, _sysio_incore_filop_mknod, +#ifdef _HAVE_STATVFS _sysio_incore_inop_statvfs, +#endif _sysio_incore_inop_gone }; @@ -309,7 +326,7 @@ struct lookup_data { */ #define INCORE_D_RECLEN(namlen) \ (((size_t )&((struct intnl_dirent *)0)->d_name + \ - (namlen) + sizeof(void *)) & \ + (namlen) + 1 + sizeof(void *)) & \ ~(sizeof(void *) - 1)) /* @@ -350,14 +367,30 @@ _sysio_incore_init() * Fill in the directory template. */ de = (struct intnl_dirent *)incore_dir_template; - de->d_off = off = de->d_reclen = INCORE_D_RECLEN(1); +#ifdef _DIRENT_HAVE_D_OFF + de->d_off = +#endif + off = de->d_reclen = INCORE_D_RECLEN(1); de->d_type = INCORE_D_TYPEOF(S_IFDIR); de->d_name[0] = '.'; - de = (void *)de + de->d_off; +#ifdef _DIRENT_HAVE_D_NAMLEN + de->d_namlen = 1; +#endif + /* + * Move to entry for `..' + */ + de = (void *)de + off; de->d_reclen = INCORE_D_RECLEN(2); - de->d_off = off += de->d_reclen; +#ifdef _DIRENT_HAVE_D_NAMLEN + de->d_namlen = 2; +#endif +#ifdef _DIRENT_HAVE_D_OFF + de->d_off = +#endif + off += de->d_reclen; de->d_type = INCORE_D_TYPEOF(S_IFDIR); de->d_name[0] = de->d_name[1] = '.'; + de->d_name[2] = ' '; return _sysio_fssw_register("incore", &incore_fssw_ops); } @@ -394,9 +427,9 @@ incore_i_alloc(struct incore_filesys *ic } static int -incore_trunc(struct incore_inode *icino, off64_t size, int clear) +incore_trunc(struct incore_inode *icino, _SYSIO_OFF_T size, int clear) { - off64_t n; + _SYSIO_OFF_T n; void *p; if (size < 0) @@ -464,7 +497,12 @@ incore_directory_new(struct incore_files sizeof(incore_dir_template)); de = icino->ici_data; de->d_ino = st->st_ino; - (void *)de += de->d_off; + (void *)de += +#ifdef _DIRENT_HAVE_D_OFF + de->d_off; +#else + de->d_reclen; +#endif de->d_ino = parent->ici_st.st_ino; /* @@ -587,7 +625,6 @@ _sysio_incore_fsswop_mount(const char *s */ rooti = _sysio_i_new(fs, - icino->ici_st.st_ino, &icino->ici_fileid, icino->ici_st.st_mode, 0, @@ -682,7 +719,11 @@ _sysio_incore_fsop_gone(struct filesys * static void * incore_directory_probe(void *data, size_t siz, - off64_t origin, + _SYSIO_OFF_T origin +#ifndef _DIRENT_HAVE_D_OFF + __IS_UNUSED +#endif + , probe_ty entry, probe_ty hole, void *arg) @@ -693,15 +734,21 @@ incore_directory_probe(void *data, de = data; for (;;) { +#ifdef _DIRENT_HAVE_D_OFF assert(de->d_off); +#else + assert(de->d_reclen); +#endif if (entry && (p = (*entry)(de, de->d_reclen, arg))) return p; - n = de->d_off - origin; - if (hole && n > de->d_reclen) { - p = - (*hole)((void *)de + de->d_reclen, - n - de->d_reclen, - arg); + n = +#ifdef _DIRENT_HAVE_D_OFF + de->d_off - origin; +#else + ((void *)de - data) + de->d_reclen; +#endif + if (hole) { + p = (*hole)((void *)de, de->d_reclen, arg); if (p) return p; } @@ -719,7 +766,15 @@ incore_directory_match(struct intnl_dire struct lookup_data *ld) { - if (strncmp(de->d_name, ld->name->name, ld->name->len) == 0) +#if defined(BSD) || defined(REDSTORM) + if (IFTODT(de->d_type) == DT_WHT) + return NULL; +#endif + if ( +#ifdef _DIRENT_HAVE_D_NAMLEN + ld->name->len == de->d_namlen && +#endif + strncmp(de->d_name, ld->name->name, ld->name->len) == 0) return de; ld->de = de; return NULL; @@ -771,7 +826,7 @@ _sysio_incore_dirop_lookup(struct pnode fileid.fid_data = &de->d_ino; fileid.fid_len = sizeof(de->d_ino); ino = - _sysio_i_find(ino->i_fs, de->d_ino, &fileid); + _sysio_i_find(ino->i_fs, &fileid); #ifdef notdef if (ino) goto out; @@ -792,7 +847,6 @@ _sysio_incore_dirop_lookup(struct pnode abort(); ino = _sysio_i_new(ino->i_fs, - icino->ici_st.st_ino, &icino->ici_fileid, icino->ici_st.st_mode, 0, @@ -879,6 +933,13 @@ struct copy_info { size_t nbytes; }; +/* + * Eumeration callback. + * + * Note: + * On those systems supporting white-out entries, they are returned. On + * systems without, they are not. + */ static void * incore_directory_enumerate(struct intnl_dirent *de, size_t reclen, @@ -896,7 +957,7 @@ static ssize_t _sysio_incore_dirop_getdirentries(struct inode *ino, char *buf, size_t nbytes, - off64_t *basep) + _SYSIO_OFF_T *basep) { struct incore_inode *icino = I2IC(ino); off_t off; @@ -960,7 +1021,9 @@ incore_directory_insert(struct incore_in size_t reclen; struct lookup_data lookup_data; struct intnl_dirent *de; + size_t xt; size_t n; + size_t r; reclen = INCORE_D_RECLEN(name->len); INCORE_LD_INIT(&lookup_data, reclen, name); @@ -974,38 +1037,74 @@ incore_directory_insert(struct incore_in if (de) return -EEXIST; de = lookup_data.de; - n = de->d_off; - if (n >= (size_t )parent->ici_st.st_size) { + xt = (void *)lookup_data.de - parent->ici_data; + n = +#ifdef _DIRENT_HAVE_D_OFF + de->d_off; +#else + xt + de->d_reclen; +#endif + r = +#ifdef _DIRENT_HAVE_D_OFF + de->d_reclen; +#else + INCORE_D_RECLEN(de->d_namlen); +#endif + if (!parent->ici_st.st_size || + xt + r + reclen > (size_t )parent->ici_st.st_size) { int err; - size_t xt; - xt = (void *)lookup_data.de - parent->ici_data; - err = - incore_trunc(parent, - ((size_t )((void *)de - parent->ici_data) + - de->d_reclen + - reclen), - 1); + err = incore_trunc(parent, xt + r + reclen, 1); if (err) return err; de = parent->ici_data + xt; n = parent->ici_st.st_size; } +#ifdef _DIRENT_HAVE_D_OFF + de->d_off = xt + r; /* trim */ +#else + de->d_reclen = r; +#endif + (void *)de += r; /* reposition */ + xt += r; + +#ifndef _DIRENT_HAVE_D_OFF /* - * Fix previous entry. + * Will we split this hole or use all of it? */ - de->d_off = (void *)de - parent->ici_data + de->d_reclen; + if (lookup_data.hole.len - reclen && + lookup_data.hole.len - reclen <= INCORE_D_RECLEN(1)) + reclen = lookup_data.hole.len; +#endif /* * Insert new. */ - (void *)de += de->d_reclen; de->d_ino = inum; +#ifdef _DIRENT_HAVE_D_OFF de->d_off = n; +#endif de->d_reclen = reclen; de->d_type = type; (void )memcpy(de->d_name, name->name, name->len); +#ifdef _DIRENT_HAVE_D_NAMLEN + de->d_namlen = name->len; +#endif + +#ifndef _DIRENT_HAVE_D_OFF + xt += reclen; + if (n - xt) { + /* + * White-out remaining part of the hole. + */ + (void *)de += reclen; + de->d_ino = 0; + de->d_reclen = n - xt; + de->d_type = DT_WHT; + de->d_namlen = 0; + } +#endif /* * Update attributes to reflect the new entry. @@ -1057,7 +1156,6 @@ _sysio_incore_dirop_mkdir(struct pnode * */ ino = _sysio_i_new(pno->p_parent->p_base->pb_ino->i_fs, - stat.st_ino, &icino->ici_fileid, stat.st_mode, 0, @@ -1095,6 +1193,10 @@ incore_unlink_entry(struct incore_inode { struct lookup_data lookup_data; struct intnl_dirent *de; + size_t reclen; +#ifdef _DIRENT_HAVE_D_OFF + size_t off; +#endif if (!S_ISDIR(icino->ici_st.st_mode)) return -ENOTDIR; @@ -1111,8 +1213,25 @@ incore_unlink_entry(struct incore_inode return -ENOENT; assert((size_t )((void *)de - icino->ici_data) >= sizeof(incore_dir_template)); - lookup_data.de->d_off = de->d_off; /* unlink */ - (void )memset(de, 0, de->d_reclen); /* clear */ +#ifndef _DIRENT_HAVE_D_OFF + reclen = de->d_reclen; +#else + off = de->d_off; + reclen = off - ((void *)de - icino->ici_data); +#endif + (void )memset(de, 0, reclen); +#ifndef _DIRENT_HAVE_D_OFF + de->d_type = (__uint8_t )DTTOIF(DT_WHT); + de->d_reclen = reclen; +#else + lookup_data.de->d_off = off; +#endif + + /* + * Adjust link count. + */ + assert(icino->ici_st.st_nlink > 2); + icino->ici_st.st_nlink--; return 0; } @@ -1145,6 +1264,12 @@ _sysio_incore_dirop_rmdir(struct pnode * return err; I_RELE(ino); + /* + * Adjust link count. + */ + assert(icino->ici_st.st_nlink > 2); + icino->ici_st.st_nlink--; + return 0; } @@ -1167,7 +1292,6 @@ incore_create(struct pnode *pno, struct */ ino = _sysio_i_new(dino->i_fs, - st->st_ino, &icino->ici_fileid, st->st_mode, st->st_rdev, @@ -1242,6 +1366,94 @@ _sysio_incore_inop_close(struct inode *i } static int +_sysio_incore_dirop_link(struct pnode *old, struct pnode *new) +{ + struct incore_inode *icino = I2IC(old->p_base->pb_ino); + int err; + + assert(!new->p_base->pb_ino); + assert(!S_ISDIR(old->p_base->pb_ino->i_mode)); + + /* + * Can bump the link count? + */ + if (!(icino->ici_st.st_nlink + 1)) + return -EMLINK; + /* + * Insert into parent. + */ + err = + incore_directory_insert(I2IC(new->p_parent->p_base->pb_ino), + &new->p_base->pb_name, + icino->ici_st.st_ino, + INCORE_D_TYPEOF(icino->ici_st.st_mode)); + if (err) + return err; + /* + * Bump the link count. + */ + icino->ici_st.st_nlink++; + + return 0; +} + +static int +_sysio_incore_dirop_rename(struct pnode *old, struct pnode *new) +{ + int err; + struct incore_inode *icino = I2IC(old->p_base->pb_ino); + + if (new->p_base->pb_ino) { + /* + * Have to kill off the target first. + */ + if (S_ISDIR(I2IC(new->p_base->pb_ino)->ici_st.st_mode) && + I2IC(new->p_base->pb_ino)->ici_st.st_nlink > 2) + return -ENOTEMPTY; + err = + incore_unlink_entry(I2IC(new->p_parent->p_base->pb_ino), + &new->p_base->pb_name); + if (err) + return err; + I_RELE(new->p_base->pb_ino); + _sysio_i_gone(new->p_base->pb_ino); + new->p_base->pb_ino = NULL; + } + + /* + * Insert into new parent. + */ + err = + incore_directory_insert(I2IC(new->p_parent->p_base->pb_ino), + &new->p_base->pb_name, + icino->ici_st.st_ino, + INCORE_D_TYPEOF(icino->ici_st.st_mode)); + if (err) + abort(); + /* + * Remove from the old parent. + */ + err = + incore_unlink_entry(I2IC(old->p_parent->p_base->pb_ino), + &old->p_base->pb_name); + if (err) + abort(); + + if (S_ISDIR(icino->ici_st.st_mode)) { + struct intnl_dirent *de; + + /* + * We moved a directory. The entry for `..' must be corrected. + */ + de = icino->ici_data; + de++; + assert(strcmp(de->d_name, "..") == 0); + de->d_ino = I2IC(new->p_parent->p_base->pb_ino)->ici_st.st_ino; + } + return 0; +} + +static int _sysio_incore_dirop_unlink(struct pnode *pno) { struct inode *ino = pno->p_base->pb_ino; @@ -1251,7 +1463,6 @@ _sysio_incore_dirop_unlink(struct pnode if (S_ISDIR(icino->ici_st.st_mode)) return -EISDIR; - pno->p_base->pb_ino = NULL; err = incore_unlink_entry(I2IC(pno->p_parent->p_base->pb_ino), &pno->p_base->pb_name); @@ -1265,18 +1476,12 @@ _sysio_incore_dirop_unlink(struct pnode static int incore_doio(ssize_t (*f)(struct incore_inode *, off_t, 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--; @@ -1297,18 +1502,19 @@ incore_doio(ssize_t (*f)(struct incore_i ioctx->ioctx_errno = -cc; } - *ioctxp = ioctx; + ioctx->ioctx_done = 1; + return 0; } static ssize_t incore_read(struct incore_inode *icino, off_t off, char *buf, size_t nbytes) { - off64_t n; + _SYSIO_OFF_T n; if (!nbytes || off > icino->ici_st.st_size) return 0; - n = (off64_t )nbytes; + n = (_SYSIO_OFF_T )nbytes; if (!(n > 0 && (size_t )n == nbytes)) return -EINVAL; if (n > icino->ici_st.st_size - off) @@ -1320,11 +1526,10 @@ incore_read(struct incore_inode *icino, static int _sysio_incore_filop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return incore_doio(incore_read, ino, ioargs, ioctxp); + return incore_doio(incore_read, ino, ioctx); } static ssize_t @@ -1334,11 +1539,11 @@ incore_write(struct incore_inode *icino, size_t nbytes) { int err; - off64_t n; + _SYSIO_OFF_T n; if (!nbytes) return 0; - n = (off64_t )nbytes; + n = (_SYSIO_OFF_T )nbytes; if (!(n > 0 && (size_t )n == nbytes)) return -EINVAL; if (off + n > icino->ici_st.st_size) { @@ -1353,8 +1558,7 @@ incore_write(struct incore_inode *icino, static int _sysio_incore_filop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { return incore_doio((ssize_t (*)(struct incore_inode *, @@ -1362,8 +1566,7 @@ _sysio_incore_filop_ipwritev(struct inod char *, size_t))incore_write, ino, - ioargs, - ioctxp); + ioctx); } static int @@ -1430,7 +1633,7 @@ _sysio_incore_dirop_mknod(struct pnode * return -EINVAL; /* - * Must create a new, regular, file. + * Initialize attributes. */ (void )memset(&stat, 0, sizeof(stat)); stat.st_dev = pno->p_parent->p_base->pb_ino->i_fs->fs_dev; @@ -1452,6 +1655,7 @@ _sysio_incore_dirop_mknod(struct pnode * return incore_create(pno, &stat); } +#ifdef _HAVE_STATVFS static int _sysio_incore_inop_statvfs(struct pnode *pno, struct inode *ino, @@ -1472,7 +1676,8 @@ _sysio_incore_inop_statvfs(struct pnode */ buf->f_bsize = fs->fs_bsize; buf->f_frsize = buf->f_bsize; - buf->f_blocks = (0xffffffffffffffff - 1) / buf->f_bsize; + buf->f_blocks = ~0; + buf->f_blocks /= buf->f_bsize; buf->f_bfree = buf->f_blocks - 1; buf->f_bavail = buf->f_bfree; buf->f_files = buf->f_blocks; @@ -1484,6 +1689,7 @@ _sysio_incore_inop_statvfs(struct pnode return 0; } +#endif void _sysio_incore_inop_gone(struct inode *ino) @@ -1498,13 +1704,6 @@ _sysio_incore_e_isdir(void) { return -EISDIR; -} - -static int -_sysio_incore_e_notdir(void) -{ - - return -ENOTDIR; } static int |
From: Sonja T. <so...@us...> - 2003-10-30 15:22:22
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv8526 Modified Files: test_all.pl test_getcwd.pl test_stats.pl test_symlink.pl Added Files: cleanup.pl setup.pl Log Message: Removed some system dependencies from test_all.pl. test_all.pl can now be ran with a -nosystem option and it will not use the underlying system to do any setup. --- 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; Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_all.pl 28 Oct 2003 20:59:39 -0000 1.5 +++ test_all.pl 30 Oct 2003 15:22:19 -0000 1.6 @@ -9,16 +9,21 @@ 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"; -} else { + } elsif ($arg eq "-nosystem") { + $use_system = 0; + } +} my $alpha_env = $ENV{"IS_ALPHA"}; - # If there is no command line arg, check the environment vars +# Check the environment vars if (defined($alpha_env) && ($alpha_env eq "yes")) { $alpha_arg = "-alpha"; } -} my $failures = 0; my $success = 0; @@ -31,7 +36,7 @@ $testdir =~ s/\/\w+.pl$//; my $res; - +if ($use_system == 1) { # Will use this directory... system("mkdir -p $cwd/tmp_dir"); @@ -40,6 +45,15 @@ 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 @@ -114,7 +128,7 @@ if ($res ne "copy test successful") { } # Test stats -$res = `perl $testdir/test_stats.pl $alpha_arg $cwd/tmp_dir/helper.pm`; +$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"; @@ -149,6 +163,15 @@ if ($res ne "Symlink test successful") { print "$failures tests failed and $success tests succeeded\n"; # cleanup +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_getcwd.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 Index: test_stats.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- test_stats.pl 27 Oct 2003 16:50:54 -0000 1.4 +++ test_stats.pl 30 Oct 2003 15:22:19 -0000 1.5 @@ -92,7 +92,7 @@ sub verify_stat sub process_cmd { - my ($file, $is_alpha) = @_; + my ($file, $use_system, $is_alpha) = @_; # Get tests directory my $testdir = $0; @@ -122,9 +122,12 @@ $testdir =~ s/\/\w+.pl$//; if ($is_alpha == 0) { helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n"); } - # Get stats for file - my @stats = stat($file); + my @stats; + if ($use_system == 1) { + # Get stats for file + @stats = stat($file); + } # Allocate the buffer my $cmdstr = '$buf = ALLOC ( $size = CALL sizeof stat )'."\n"; @@ -136,9 +139,11 @@ $testdir =~ s/\/\w+.pl$//; helper::send_cmd($cmdfh, $outfh, "stat", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "stat"); + if ($use_system == 1) { # Now print the buffer out and verify that it matches # what Perl has verify_stat($cmdfh, $outfh, "stat", $is_alpha, @stats); + } # Open the file $cmdstr = '$fd = CALL open '."$file O_RDONLY\n"; @@ -151,17 +156,22 @@ $testdir =~ s/\/\w+.pl$//; helper::send_cmd($cmdfh, $outfh, "fstat", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "fstat"); + if ($use_system == 1) { verify_stat($cmdfh, $outfh, "fstat", $is_alpha, @stats); + } # Test lstat + if ($use_system == 1) { @stats = lstat($file); + } $cmdstr = 'CALL lstat '."$file ".'$buf'."\n"; helper::send_cmd($cmdfh, $outfh, "lstat", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "lstat"); + if ($use_system == 1) { verify_stat($cmdfh, $outfh, "lstat", $is_alpha, @stats); - + } # Now do statvfs functions $cmdstr = '$buf2 = ALLOC ( $size2 = CALL sizeof statvfs )'."\n"; @@ -207,10 +217,6 @@ $testdir =~ s/\/\w+.pl$//; my $i=0; - # Stupid hack. statvfs on Cplant is unhappy :-( - # Rather than do the honest thing and just continue to report its unhappiness, - # don't test for its happiness - if ( $is_alpha == 0) { foreach my $stat1 (@vfsstats1) { if ($stat1 ne $vfsstats2[$i++]) { my $str = sprintf("vfsstats field %d are not equal (%s != %s)\n", @@ -218,7 +224,6 @@ $testdir =~ s/\/\w+.pl$//; helper::print_and_exit($cmdfh, $outfh, 1, $str); } } - } helper::print_and_exit($cmdfh, $outfh, 0, "stat test successful\n"); } @@ -228,16 +233,16 @@ $testdir =~ s/\/\w+.pl$//; my $currarg = 0; my $is_alpha = 0; -if (@ARGV < 1) { +if (@ARGV < 2) { usage; -} elsif (@ARGV > 1) { +} elsif (@ARGV > 2) { if ($ARGV[$currarg++] eq "-alpha") { $is_alpha = 1; } } - +my $use_system= $ARGV[$currarg++]; my $file = $ARGV[$currarg]; -process_cmd($file, $is_alpha); +process_cmd($file, $use_system, $is_alpha); Index: test_symlink.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_symlink.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- test_symlink.pl 28 Oct 2003 22:01:22 -0000 1.2 +++ test_symlink.pl 30 Oct 2003 15:22:19 -0000 1.3 @@ -172,7 +172,9 @@ sub process_cmd # Now remove the symbolic link and make sure everything stays the same # Remove the link (this assumes the link is not in incore) - system("rm -f $dest"); + $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"; @@ -196,6 +198,7 @@ sub process_cmd # 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); |
From: Sonja T. <so...@us...> - 2003-10-30 15:20:52
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv8390 Modified Files: unlink.c Log Message: Added ND_NOFOLLOW flag to namei call to fix unlink with symlinks Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- unlink.c 27 Sep 2003 19:42:03 -0000 1.4 +++ unlink.c 30 Oct 2003 15:20:49 -0000 1.5 @@ -60,7 +60,7 @@ unlink(const char *path) struct pnode *pno; INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); - err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); + err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); if (err) goto out; if (IS_RDONLY(pno, pno->p_base->pb_ino)) { |
From: Lee W. <lw...@us...> - 2003-10-29 00:26:58
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv15603/include Modified Files: sysio.h Log Message: Oops. It's lseek, not lsee4. Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- sysio.h 29 Oct 2003 00:10:42 -0000 1.13 +++ sysio.h 29 Oct 2003 00:25:53 -0000 1.14 @@ -160,7 +160,7 @@ extern int fcntl(int fd, int cmd, ...); extern int fstat(int fd, struct stat *buf); extern int fsync(int fd); extern char *getcwd(char *buf, size_t size); -extern off_t lsee4(int fd, off_t offset, int whence); +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 |
From: Lee W. <lw...@us...> - 2003-10-29 00:10:48
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv12663/src Modified Files: lseek.c Log Message: Add prototype for lseek and fix bug in _sysio_lseek (from Wally Wang) that makes the temporary offset a _SYSIO_OFF_T instead of off_t. Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- lseek.c 10 Oct 2003 18:50:31 -0000 1.8 +++ lseek.c 29 Oct 2003 00:10:42 -0000 1.9 @@ -58,7 +58,7 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset { int err; struct file *fil; - off_t off = 0; + _SYSIO_OFF_T off = 0; struct intnl_stat stbuf; err = 0; |
From: Lee W. <lw...@us...> - 2003-10-29 00:10:47
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv12663/include Modified Files: sysio.h Log Message: Add prototype for lseek and fix bug in _sysio_lseek (from Wally Wang) that makes the temporary offset a _SYSIO_OFF_T instead of off_t. Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- sysio.h 21 Oct 2003 13:38:47 -0000 1.12 +++ sysio.h 29 Oct 2003 00:10:42 -0000 1.13 @@ -160,6 +160,7 @@ extern int fcntl(int fd, int cmd, ...); extern int fstat(int fd, struct stat *buf); extern int fsync(int fd); extern char *getcwd(char *buf, size_t size); +extern off_t lsee4(int fd, off_t offset, int whence); #if _LARGEFILE64_SOURCE extern off64_t lseek64(int fd, off64_t offset, int whence); #endif |
From: Sonja T. <so...@us...> - 2003-10-28 22:02:40
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv21250/tests Modified Files: test_symlink.pl Log Message: test_symlink didn't clean up after itself very well..fixed. Index: test_symlink.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_symlink.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_symlink.pl 28 Oct 2003 21:00:39 -0000 1.1 +++ test_symlink.pl 28 Oct 2003 22:01:22 -0000 1.2 @@ -17,6 +17,42 @@ sub usage 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) = @_; @@ -98,9 +134,10 @@ sub process_cmd $res = helper::verify_cmd($cmdfh, $outfh, "read $dest"); + my $errstr; if ($readb != oct($res)) { - print STDOUT "ERROR! Read $readb bytes from src but only $res bytes from dest\n"; - exit 1; + $errstr = "ERROR! Read $readb bytes from src but only $res bytes from dest\n"; + clean_exit($cmdfh, $outfh, 1, $errstr); } # Compare the two buffers @@ -118,8 +155,8 @@ sub process_cmd $res = helper::verify_cmd($cmdfh, $outfh, "cmpstr"); $res = oct($res); if ($res != 0) { - print STDOUT "ERROR! Buffers from $src and $dest do not match\n"; - exit 1; + $errstr = "ERROR! Buffers from $src and $dest do not match\n"; + clean_exit($cmdfh, $outfh, 1, $errstr); } # Clean up @@ -150,9 +187,8 @@ sub process_cmd chop($res); if ($res ne "0xffffffff") { - - print STDOUT "ERROR! Open on $dest succeeded (should have failed)\n"; - exit 1; + $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 @@ -167,8 +203,8 @@ sub process_cmd $res = helper::verify_cmd($cmdfh, $outfh, "read $src(2)"); if ($readb != oct($res)) { - print STDOUT "ERROR! Read $readb bytes from src originally but now only $res bytes\n"; - exit 1; + $errstr = "ERROR! Read $readb bytes from src originally but now only $res bytes\n"; + clean_exit($cmdfh, $outfh, 1, $errstr); } # Compare the two buffers @@ -177,16 +213,15 @@ sub process_cmd $res = helper::verify_cmd($cmdfh, $outfh, "cmpstr"); $res = oct($res); if ($res != 0) { - print STDOUT "ERROR! Original buffers from $src and new buf do not match\n"; - exit 1; + $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); - - print STDOUT "Symlink test successful\n"; + clean_exit($cmdfh, $outfh, 0, "Symlink test successful\n"); exit 0; } |
From: Sonja T. <so...@us...> - 2003-10-28 21:03:59
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv4178/tests Added Files: test_symlink.pl Log Message: Now I am actually going to add test_symlink.pl... --- 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 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"); if ($readb != oct($res)) { print STDOUT "ERROR! Read $readb bytes from src but only $res bytes from dest\n"; exit 1; } # 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) { print STDOUT "ERROR! Buffers from $src and $dest do not match\n"; exit 1; } # 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) system("rm -f $dest"); # 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") { print STDOUT "ERROR! Open on $dest succeeded (should have failed)\n"; exit 1; } # 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); $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)) { print STDOUT "ERROR! Read $readb bytes from src originally but now only $res bytes\n"; exit 1; } # 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) { print STDOUT "ERROR! Original buffers from $src and new buf do not match\n"; exit 1; } # Clean up $cmdstr = 'CALL close $src2'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); print STDOUT "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; |
From: Sonja T. <so...@us...> - 2003-10-28 21:02:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv3617/src Modified Files: namei.c Log Message: Fixed bug in namei that assumed a non-zero return from readlink was an error Fixed bugs in test_driver.c Added test_symlink.pl into test_all.pl Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- namei.c 14 Aug 2003 18:39:33 -0000 1.7 +++ namei.c 28 Oct 2003 20:59:39 -0000 1.8 @@ -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; } |
From: Sonja T. <so...@us...> - 2003-10-28 21:02:27
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv3617/tests Modified Files: sysio_stubs.c test_all.pl test_driver.c Log Message: Fixed bug in namei that assumed a non-zero return from readlink was an error Fixed bugs in test_driver.c Added test_symlink.pl into test_all.pl Index: sysio_stubs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- sysio_stubs.c 10 Oct 2003 18:50:31 -0000 1.5 +++ sysio_stubs.c 28 Oct 2003 20:59:39 -0000 1.6 @@ -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,14 +572,14 @@ 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 test_do_chdir(int argc, char **argv) @@ -1235,8 +1235,11 @@ int test_do_symlink(int argc, char **arg 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; Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- test_all.pl 10 Oct 2003 18:50:31 -0000 1.4 +++ test_all.pl 28 Oct 2003 20:59:39 -0000 1.5 @@ -135,6 +135,17 @@ 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 Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- test_driver.c 10 Oct 2003 18:50:31 -0000 1.3 +++ test_driver.c 28 Oct 2003 20:59:39 -0000 1.4 @@ -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; @@ -895,11 +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 */ |
From: jaschut <ja...@us...> - 2003-10-28 18:54:24
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv5577 Modified Files: test_rename.c Log Message: We actually want to return an appropriate status regardless of whether the rename goes well. Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- test_rename.c 28 Oct 2003 18:14:11 -0000 1.2 +++ test_rename.c 28 Oct 2003 18:54:19 -0000 1.3 @@ -79,7 +79,7 @@ int main(int argc, char * const argv[]) { int i; - int err = 0; + int err; const char *spath, *dpath; /* @@ -142,7 +142,8 @@ main(int argc, char * const argv[]) if (argc - optind) usage(); - if (rename(spath, dpath) != 0) + err = rename(spath, dpath); + if (err) perror("rename"); #ifndef CPLANT_YOD |
From: jaschut <ja...@us...> - 2003-10-28 18:14:22
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv32370 Modified Files: test_rename.c Log Message: We need to initialize the return status in the event things go well. Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_rename.c 13 Oct 2003 21:23:44 -0000 1.1 +++ test_rename.c 28 Oct 2003 18:14:11 -0000 1.2 @@ -79,7 +79,7 @@ int main(int argc, char * const argv[]) { int i; - int err; + int err = 0; const char *spath, *dpath; /* |
From: jaschut <ja...@us...> - 2003-10-27 23:49:49
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv20287 Modified Files: mount.c Log Message: In _sysio_do_mount(), change the inop_getattr() call to _sysio_p_validate(), since the latter should be checking the inode mode bits, and is potentially cheaper. Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- mount.c 13 Oct 2003 01:04:35 -0000 1.8 +++ mount.c 27 Oct 2003 23:49:10 -0000 1.9 @@ -102,8 +102,6 @@ _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 a @@ -148,14 +146,15 @@ _sysio_do_mount(struct filesys *fs, 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; } |
From: jaschut <ja...@us...> - 2003-10-27 23:43:12
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv19199 Modified Files: chdir.c Log Message: Remove the inop_getattr() call, which is redundant since _sysio_p_validate() should be checking the inode mode bits, and we can use them to test if the node is a directory. Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- chdir.c 24 Oct 2003 17:59:18 -0000 1.9 +++ chdir.c 27 Oct 2003 23:42:29 -0000 1.10 @@ -89,28 +89,17 @@ int _sysio_p_chdir(struct pnode *pno) { int err; - struct intnl_stat stbuf; /* - * Revalidate + * 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) - return -ENOTDIR; - /* - * Stat the node and ensure it's a directory. - */ - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - NULL, - &stbuf); - if (err) - return err; - if (!S_ISDIR(stbuf.st_mode)) - return -ENOTDIR; + if (!(pno->p_base->pb_ino && + S_ISDIR(pno->p_base->pb_ino->i_mode))) + return -ENOTDIR; /* * Release old if set. */ |
From: Sonja T. <so...@us...> - 2003-10-27 17:00:31
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv608/tests Modified Files: test_stats.pl Log Message: Fixed printing error in test_stats.pl Index: test_stats.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- test_stats.pl 10 Oct 2003 18:50:31 -0000 1.3 +++ test_stats.pl 27 Oct 2003 16:50:54 -0000 1.4 @@ -71,7 +71,7 @@ sub verify_stat my $cmdstr; # Print out the stat buffer if ($is_alpha == 0) { - $cmdstr = 'PRINT $buf 0 8 LONG 12 24 INT 44 8 LONG 52 8 INT 64 24 LONG'."\n"; + $cmdstr = 'PRINT $buf 0 8 LONG 12 24 INT 44 8 LONG 48 8 INT 56 24 LONG'."\n"; } else { $cmdstr = 'PRINT $buf 0 16 LONG 16 16 INT 32 8 LONG 40 4 INT 48 40 LONG'."\n"; } |
From: Lee W. <lw...@us...> - 2003-10-24 18:49:32
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv4984/src Modified Files: stat.c Log Message: A struct stat and a struct sts64 don't quite match up with the field offsets. I had thought otherwise. Now, we convert between the two. Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- stat.c 20 Oct 2003 17:15:38 -0000 1.6 +++ stat.c 24 Oct 2003 18:49:24 -0000 1.7 @@ -66,8 +66,25 @@ #define _STAT_VER 0 #endif -#if 0 && !(defined(__GLIBC__) && __GLIBC__ >= 2) -#warning Check assumptions here about stat/stat64 sizes and offsets +#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 @@ -75,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; @@ -87,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; } @@ -120,6 +147,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; @@ -131,11 +162,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; @@ -165,6 +204,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; @@ -175,12 +218,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; |
From: Lee W. <lw...@us...> - 2003-10-24 18:00:46
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv27145 Modified Files: chdir.c Log Message: It's a bad idea to return -EFAULT from a function that returns pointers. Now set errno to EFAULT and return NULL in getwd(). Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- chdir.c 15 Oct 2003 19:21:37 -0000 1.8 +++ chdir.c 24 Oct 2003 17:59:18 -0000 1.9 @@ -248,8 +248,10 @@ char * getwd(char *buf) { - if (!buf) - return -EFAULT; + if (!buf) { + errno = EFAULT; + return NULL; + } return getcwd(buf, PATH_MAX); } |
From: Ruth K. <rk...@us...> - 2003-10-23 20:23:31
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv13939 Modified Files: truncate.c Log Message: set EINVAL for non-dir, non-regular file Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- truncate.c 10 Oct 2003 18:50:31 -0000 1.4 +++ truncate.c 23 Oct 2003 15:20:31 -0000 1.5 @@ -68,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; |
From: Ruth K. <rk...@us...> - 2003-10-23 18:29:32
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1:/tmp/cvs-serv23724 Modified Files: configure.in Log Message: older bash on alpha RH6, no substring. and slight mod to cplant_tests Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- configure.in 10 Oct 2003 18:50:30 -0000 1.10 +++ configure.in 23 Oct 2003 16:06:13 -0000 1.11 @@ -89,8 +89,7 @@ AC_ARG_WITH(cplant_tests, [ 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}, @@ -172,8 +171,8 @@ 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 |
From: Ruth K. <rk...@us...> - 2003-10-23 16:04:20
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv12728 Modified Files: dup.c Log Message: wrap __dup for glibc Index: dup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dup.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1.1.1 -r1.2 --- dup.c 22 Feb 2003 16:33:05 -0000 1.1.1.1 +++ dup.c 23 Oct 2003 15:16:05 -0000 1.2 @@ -49,6 +49,8 @@ #include "sysio.h" #include "file.h" +#include "sysio-symbols.h" + int dup2(int oldfd, int newfd) { @@ -70,3 +72,9 @@ dup(int oldfd) return _sysio_fd_dup2(oldfd, -1); } + +#ifdef __GLIBC__ +#undef __dup +sysio_sym_weak_alias(dup, __dup) +#endif + |
From: Ruth K. <rk...@us...> - 2003-10-22 16:54:36
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv5402 Modified Files: fs_native.c Log Message: close native fd once after all refs are gone Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- fs_native.c 21 Oct 2003 13:38:47 -0000 1.24 +++ fs_native.c 22 Oct 2003 15:57:23 -0000 1.25 @@ -1078,10 +1078,6 @@ native_inop_close(struct inode *ino) if (nino->ni_fd < 0) abort(); - err = syscall(SYS_close, nino->ni_fd); - if (err) - return -errno; - assert(nino->ni_nopens); if (--nino->ni_nopens) { /* @@ -1092,6 +1088,10 @@ native_inop_close(struct inode *ino) */ return 0; } + + err = syscall(SYS_close, nino->ni_fd); + if (err) + return -errno; nino->ni_fd = -1; nino->ni_fpos = 0; |
From: <ja...@sa...> - 2003-10-21 16:53:40
|
Hi, I'd like to suggest the possibility of splitting the libsysio code base into two modules, one for the library/drivers, and one for the test code. The issue for me is that Sandia's Cplant build environment is somewhat intrusive, as it requires linking startup code that is not part of libsysio into the test executables. Having the test code as its own module, with its own configuration process, would facilitate this. Discussion? -- Jim (I'm sending this to the libsysio-commit mailing list since it seems to be the only libsysio mailing list defined.) -- Jim Schutt <ja...@sa...> Sandia National Laboratories, Albuquerque, New Mexico USA |
From: Lee W. <lw...@us...> - 2003-10-21 16:51:25
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv24724/src Modified Files: Makefile.am statvfs64.c Log Message: Hmmm. Make statvfs/statvfs64 work again. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- Makefile.am 27 Sep 2003 19:42:02 -0000 1.8 +++ Makefile.am 21 Oct 2003 13:38:47 -0000 1.9 @@ -3,7 +3,8 @@ lib_LIBRARIES = libsysio.a 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 symlink.c truncate.c unlink.c \ + rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c \ + unlink.c \ utime.c write.c access.c include $(top_srcdir)/Rules.make Index: statvfs64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/statvfs64.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- statvfs64.c 10 Oct 2003 18:50:31 -0000 1.4 +++ statvfs64.c 21 Oct 2003 13:38:47 -0000 1.5 @@ -76,7 +76,7 @@ out: } int -fstatvfs(int fd, struct statvfs64 *buf) +fstatvfs64(int fd, struct statvfs64 *buf) { int err; struct file *filp; |
From: Lee W. <lw...@us...> - 2003-10-21 16:51:25
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv24724/drivers/native Modified Files: fs_native.c Log Message: Hmmm. Make statvfs/statvfs64 work again. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- fs_native.c 20 Oct 2003 17:01:31 -0000 1.23 +++ fs_native.c 21 Oct 2003 13:38:47 -0000 1.24 @@ -62,6 +62,7 @@ #endif #ifdef _HAVE_STATVFS #include <sys/statvfs.h> +#include <sys/statfs.h> #endif #include <utime.h> #include <sys/queue.h> |
From: Lee W. <lw...@us...> - 2003-10-21 15:02:19
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv21252 Modified Files: sysio.h Log Message: How did I miss this file? It's _LARGEFILE64_SOURCE, not __USE_LARGEFILE64. Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- sysio.h 10 Oct 2003 18:50:31 -0000 1.10 +++ sysio.h 21 Oct 2003 13:27:43 -0000 1.11 @@ -79,17 +79,17 @@ typedef void *ioid_t; #define MAX_SYMLINK 250 #endif -#ifndef __USE_LARGEFILE64 +#ifndef _LARGEFILE64_SOURCE /* * Not glibc. Define this ourselves. */ -#define __USE_LARGEFILE64 0 +#define _LARGEFILE64_SOURCE 0 #endif /* * Define internal file-offset type. */ -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE #define _SYSIO_OFF_T off64_t #else #define _SYSIO_OFF_T off_t @@ -99,7 +99,7 @@ typedef void *ioid_t; * Internally, all directory entries are carried in the 64-bit capable * structure. */ -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE #define intnl_dirent dirent64 #else #define intnl_dirent dirent @@ -110,7 +110,7 @@ struct dirent; * Internally, all file status is carried in the 64-bit capable * structure. */ -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE #define intnl_stat stat64 #else #define intnl_stat stat @@ -118,7 +118,7 @@ struct dirent; struct stat; #ifdef _HAVE_STATVFS -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE #define intnl_statvfs statvfs64 #else #define intnl_statvfs statvfs @@ -159,7 +159,7 @@ extern int fcntl(int fd, int cmd, ...); extern int fstat(int fd, struct stat *buf); extern int fsync(int fd); extern char *getcwd(char *buf, size_t size); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern off64_t lseek64(int fd, off64_t offset, int whence); #endif extern int lstat(const char *path, struct stat *buf); @@ -167,7 +167,7 @@ extern int lstat(const char *path, struc 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 __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern ssize_t getdirentries64(int fd, char *buf, size_t nbytes, @@ -176,33 +176,33 @@ extern ssize_t getdirentries64(int fd, #endif extern int mkdir(const char *path, mode_t mode); extern int open(const char *path, int flag, ...); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int open64(const char *path, int flag, ...); #endif extern int creat(const char *path, mode_t mode); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int creat64(const char *path, mode_t mode); #endif extern int stat(const char *path, struct stat *buf); -#if __USE_LARGEFILE64 +#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); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int statvfs64(const char *path, struct statvfs64 *buf); #endif extern int fstatvfs(int fd, struct statvfs *buf); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int fstatvfs64(int fd, struct statvfs64 *buf); #endif #endif extern int truncate(const char *path, off_t length); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int truncate64(const char *path, off64_t length); #endif extern int ftruncate(int fd, off_t length); -#if __USE_LARGEFILE64 +#if _LARGEFILE64_SOURCE extern int ftruncate64(int fd, off64_t length); #endif extern int rmdir(const char *path); @@ -222,14 +222,14 @@ extern ioid_t ipread(int fd, void *buf, extern ssize_t preadv(int fd, const struct iovec *iov, size_t count, _SYSIO_OFF_T offset); extern ssize_t pread(int fd, void *buf, size_t count, off_t offset); -#if __USE_LARGEFILE64 +#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 __USE_LARGEFILE64 +#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, @@ -239,14 +239,14 @@ extern ioid_t ipwrite(int fd, const void extern ssize_t pwritev(int fd, const struct iovec *iov, size_t count, _SYSIO_OFF_T offset); extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); -#if __USE_LARGEFILE64 +#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 __USE_LARGEFILE64 +#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); |