libsysio-commit Mailing List for libsysio (Page 7)
Brought to you by:
lward
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(25) |
May
(28) |
Jun
(25) |
Jul
(30) |
Aug
(60) |
Sep
(52) |
Oct
(100) |
Nov
(15) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(89) |
Feb
(48) |
Mar
(22) |
Apr
(59) |
May
(16) |
Jun
(15) |
Jul
(50) |
Aug
(26) |
Sep
(40) |
Oct
(27) |
Nov
(12) |
Dec
|
2005 |
Jan
(24) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(6) |
Jul
|
Aug
(14) |
Sep
(21) |
Oct
(10) |
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
(5) |
Mar
(2) |
Apr
(6) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2007 |
Jan
(3) |
Feb
(5) |
Mar
(20) |
Apr
(41) |
May
(21) |
Jun
(3) |
Jul
(5) |
Aug
(12) |
Sep
(21) |
Oct
(5) |
Nov
(16) |
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(23) |
May
|
Jun
(22) |
Jul
(13) |
Aug
|
Sep
|
Oct
(9) |
Nov
(3) |
Dec
(13) |
2009 |
Jan
(14) |
Feb
(10) |
Mar
(2) |
Apr
(11) |
May
(7) |
Jun
(1) |
Jul
(1) |
Aug
(36) |
Sep
(12) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Lee W. <lw...@us...> - 2008-06-17 15:17:37
|
Update of /cvsroot/libsysio/libsysio/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32385/dev Added Files: module.mk stddev.c stddev.h Log Message: Integrate and initialize new, built-in, stddev pseudo-driver that gives us /dev/null, /dev/zero, and /dev/full functionality. |
From: Lee W. <lw...@us...> - 2008-06-17 15:17:33
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32385 Modified Files: Makefile.am Rules.make configure.in Log Message: Integrate and initialize new, built-in, stddev pseudo-driver that gives us /dev/null, /dev/zero, and /dev/full functionality. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/Makefile.am,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- Makefile.am 16 Jul 2004 13:34:43 -0000 1.15 +++ Makefile.am 17 Jun 2008 15:17:30 -0000 1.16 @@ -9,6 +9,7 @@ endif include $(top_srcdir)/src/module.mk include $(top_srcdir)/include/module.mk include $(top_srcdir)/tests/module.mk +include $(top_srcdir)/dev/module.mk include $(top_srcdir)/dev/stdfd/module.mk include $(top_srcdir)/drivers/incore/module.mk include $(top_srcdir)/drivers/native/module.mk @@ -23,6 +24,12 @@ else OPTIONAL_STDFD_SRCS = endif +if WITH_STDDEV_DEV +OPTIONAL_STDDEV_SRCS = $(STDDEV_SRCS) +else +OPTIONAL_STDDEV_SRCS = +endif + if WITH_INCORE_DRIVER OPTIONAL_INCORE_SRCS = $(INCORE_SRCS) else @@ -56,6 +63,7 @@ AM_CFLAGS = $(OPTIONAL_LUSTRE_CFLAGS) __LIBBUILD_DIR__libsysio_a_SOURCES = \ $(SRCDIR_SRCS) \ + $(OPTIONAL_STDDEV_SRCS) \ $(OPTIONAL_STDFD_SRCS) \ $(OPTIONAL_INCORE_SRCS) \ $(OPTIONAL_SOCKETS_SRCS) \ @@ -65,7 +73,7 @@ __LIBBUILD_DIR__libsysio_a_SOURCES = \ include $(top_srcdir)/Rules.make EXTRA_DIST = Rules.make misc/init-env.sh $(TESTS_EXTRA) $(SRCDIR_EXTRA) \ - $(INCLUDE_EXTRA) $(STDFD_EXTRA) $(INCORE_EXTRA) \ + $(INCLUDE_EXTRA) $(STDDEV_EXTRA) $(STDFD_EXTRA) $(INCORE_EXTRA) \ $(SOCKETS_EXTRA) $(NATIVE_EXTRA) $(YOD_EXTRA) AM_CPPFLAGS += ${YOD_DRIVER_FLAGS} Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- Rules.make 20 Aug 2007 19:28:12 -0000 1.13 +++ Rules.make 17 Jun 2008 15:17:30 -0000 1.14 @@ -3,6 +3,11 @@ STDFD_DEV_CPPFLAGS =-DSTDFD_DEV=1 -I$(to else STFD_DEV_CPPFLAGS = endif +if WITH_STDDEV_DEV +STDDEV_DEV_CPPFLAGS =-DSTDDEV_DEV=1 -I$(top_srcdir)/dev +else +STDEV_DEV_CPPFLAGS = +endif if WITH_SOCKETS_DRIVER SOCKETS_CPPFLAGS=-DWITH_SOCKETS=1 @@ -10,7 +15,7 @@ else SOCKETS_CPPFLAGS= endif -DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) +DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) $(STDDEV_DEV_CPPFLAGS) AM_CPPFLAGS = \ $(TRACING) \ Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.39 retrieving revision 1.40 diff -u -w -b -B -p -r1.39 -r1.40 --- configure.in 16 Apr 2008 12:49:39 -0000 1.39 +++ configure.in 17 Jun 2008 15:17:30 -0000 1.40 @@ -92,6 +92,17 @@ AC_ARG_WITH(stdfd-dev, [with_stdfd_dev=yes]) AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes) +AC_ARG_WITH(stddev-dev, + AC_HELP_STRING([--with-stddev-dev], + [build standard file descriptors pseudo-driver]), + [ case "${withval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-stddev-dev) ;; + esac], + [with_stddev_dev=yes]) +AM_CONDITIONAL(WITH_STDDEV_DEV, test x$with_stddev_dev = xyes) + AC_ARG_WITH(zero-sum-memory, AC_HELP_STRING([--with-zero-sum-memory], [free all dynamically allocated memory at the end -- useful for debugging]), |
From: Lee W. <lw...@us...> - 2008-06-17 15:17:33
|
Update of /cvsroot/libsysio/libsysio/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32385/misc Modified Files: init-env.sh Log Message: Integrate and initialize new, built-in, stddev pseudo-driver that gives us /dev/null, /dev/zero, and /dev/full functionality. Index: init-env.sh =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/init-env.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- init-env.sh 9 Mar 2007 19:36:21 -0000 1.7 +++ init-env.sh 17 Jun 2008 15:17:30 -0000 1.8 @@ -24,6 +24,9 @@ fi export SYSIO_NAMESPACE="\ {mnt, dev=\"native:/\",dir=/,fl=${_root_flags:-0}} \ {mnt, dev=\"incore:0755\",dir=\"/dev\"} \ + {creat, ft=chr,nm=\"/dev/null\",pm=0666,mm=1+3} \ + {creat, ft=chr,nm=\"/dev/zero\",pm=0666,mm=1+5} \ + {creat, ft=chr,nm=\"/dev/full\",pm=0666,mm=1+7} \ {creat, ft=chr,nm=\"/dev/stdin\",pm=0400,mm=0+0} \ {creat, ft=chr,nm=\"/dev/stdout\",pm=0200,mm=0+1} \ {creat, ft=chr,nm=\"/dev/stderr\",pm=0200,mm=0+2} \ |
From: Lee W. <lw...@us...> - 2008-06-17 15:16:29
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32348/tests Modified Files: test_regions.c Log Message: Add -e switch to allow working with existing files. Index: test_regions.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_regions.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- test_regions.c 1 May 2007 16:33:53 -0000 1.9 +++ test_regions.c 17 Jun 2008 15:16:26 -0000 1.10 @@ -62,7 +62,7 @@ /* * Copy one file to another. * - * Usage: test_regions [-x] \ + * Usage: test_regions [-x] [-e] \ * {r,w} <off> <count> <path> * * Destination will not be overwritten if it already exist. @@ -85,6 +85,7 @@ int main(int argc, char * const argv[]) { int i; + int keep; int err; long l; off_t off; @@ -104,6 +105,7 @@ main(int argc, char * const argv[]) /* * Parse command-line args. */ + keep = 0; while ((i = getopt(argc, argv, #ifdef __GLIBC__ @@ -112,7 +114,7 @@ main(int argc, char * const argv[]) #ifdef GO64 "x" #endif - "")) != -1) + "e")) != -1) switch (i) { #ifdef GO64 @@ -120,6 +122,9 @@ main(int argc, char * const argv[]) use64 = 1; break; #endif + case 'e': + keep = 1; + break; default: usage(); } @@ -181,7 +186,10 @@ main(int argc, char * const argv[]) (void )memset(buf, 0, nbytes); err = 0; - flags = which == 'r' ? O_RDONLY : (O_WRONLY|O_CREAT|O_EXCL); + flags = 0; + if (!keep) + flags |= O_CREAT|O_EXCL; + flags |= which == 'r' ? O_RDONLY : O_WRONLY; #ifdef GO64 if (use64) flags |= O_LARGEFILE; |
From: Lee W. <lw...@us...> - 2008-06-17 15:11:44
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30094 Modified Files: init.c Log Message: Fixed a bug in parse_mm. It was building the dev_t by hand, incorrectly. It should have been using SYSIO_MKDEV. It does now. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -w -b -B -p -r1.39 -r1.40 --- init.c 26 Sep 2007 19:46:25 -0000 1.39 +++ init.c 17 Jun 2008 15:11:40 -0000 1.40 @@ -62,6 +62,9 @@ #ifdef STDFD_DEV #include "stdfd.h" #endif +#ifdef STDDEV_DEV +#include "stddev.h" +#endif /* * White space characters. @@ -222,6 +225,11 @@ _sysio_init() if (err) goto error; #endif +#ifdef STDDEV_DEV + err = _sysio_stddev_init(); + if (err) + goto error; +#endif #ifdef WITH_SOCKETS err = _sysio_sockets_init(); if (err) @@ -368,18 +376,22 @@ parse_mm(const char *s, dev_t *devp) { unsigned long ul; char *cp; - dev_t dev; + dev_t major, minor; ul = strtoul(s, &cp, 0); if (*cp != '+' || ul > USHRT_MAX) return -EINVAL; - dev = ul << 16; + major = ul; + if (major != ul) + return -ERANGE; s = (const char *)++cp; ul = strtoul(s, &cp, 0); if (*cp != '\0' || ul > USHRT_MAX) return -EINVAL; - dev |= ul & 0xffff; - *devp = dev; + minor = ul; + if (minor != ul) + return -ERANGE; + *devp = SYSIO_MKDEV(major, minor); return 0; } |
From: Lee W. <lw...@us...> - 2008-06-17 15:10:42
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29665 Modified Files: stdfd.c Log Message: Fixed bug in _sysio_stdfd_init. It was returning the major number. That happened to be zero but could be anything in [0,127]. Any other number is interpreted by the caller as an error. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- stdfd.c 25 Jan 2005 00:36:46 -0000 1.14 +++ stdfd.c 17 Jun 2008 15:10:39 -0000 1.15 @@ -91,6 +91,7 @@ int _sysio_stdfd_init() { struct inode_ops stdfd_operations; + int mjr; stdfd_operations = _sysio_nodev_ops; stdfd_operations.inop_open = stdfd_open; @@ -102,9 +103,13 @@ _sysio_stdfd_init() stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; - return _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, + mjr = + _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, "stdfd", &stdfd_operations); + if (mjr >= 0) + mjr = 0; + return mjr; } static int |
From: Lee W. <lw...@us...> - 2008-06-17 14:46:16
|
Update of /cvsroot/libsysio/libsysio/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20541 Modified Files: Tag: RELEASE_1_3 init-env.sh Log Message: Added lines to create /dev/{null,zero,full}. Index: init-env.sh =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/init-env.sh,v retrieving revision 1.7 retrieving revision 1.7.6.1 diff -u -w -b -B -p -r1.7 -r1.7.6.1 --- init-env.sh 9 Mar 2007 19:36:21 -0000 1.7 +++ init-env.sh 17 Jun 2008 14:46:05 -0000 1.7.6.1 @@ -24,6 +24,9 @@ fi export SYSIO_NAMESPACE="\ {mnt, dev=\"native:/\",dir=/,fl=${_root_flags:-0}} \ {mnt, dev=\"incore:0755\",dir=\"/dev\"} \ + {creat, ft=chr,nm=\"/dev/null\",pm=0666,mm=1+3} \ + {creat, ft=chr,nm=\"/dev/zero\",pm=0666,mm=1+5} \ + {creat, ft=chr,nm=\"/dev/full\",pm=0666,mm=1+7} \ {creat, ft=chr,nm=\"/dev/stdin\",pm=0400,mm=0+0} \ {creat, ft=chr,nm=\"/dev/stdout\",pm=0200,mm=0+1} \ {creat, ft=chr,nm=\"/dev/stderr\",pm=0200,mm=0+2} \ |
From: Lee W. <lw...@us...> - 2008-06-17 14:45:37
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20143 Modified Files: Tag: RELEASE_1_3 init.c Log Message: In parse_mm function, removed spurious semi-colon that reliably caused the function to error out. Also, removed unused variable in the same function. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.38.2.2 retrieving revision 1.38.2.3 diff -u -w -b -B -p -r1.38.2.2 -r1.38.2.3 --- init.c 16 Jun 2008 19:01:16 -0000 1.38.2.2 +++ init.c 17 Jun 2008 14:45:29 -0000 1.38.2.3 @@ -62,6 +62,9 @@ #ifdef STDFD_DEV #include "stdfd.h" #endif +#ifdef STDDEV_DEV +#include "stddev.h" +#endif /* * White space characters. @@ -373,7 +376,6 @@ parse_mm(const char *s, dev_t *devp) { unsigned long ul; char *cp; - dev_t dev; dev_t major, minor; ul = strtoul(s, &cp, 0); @@ -387,7 +389,7 @@ parse_mm(const char *s, dev_t *devp) if (*cp != '\0' || ul > USHRT_MAX) return -EINVAL; minor = ul; - if (minor != ul); + if (minor != ul) return -ERANGE; *devp = SYSIO_MKDEV(major, minor); return 0; |
From: Lee W. <lw...@us...> - 2008-06-17 14:43:57
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19407 Modified Files: Tag: RELEASE_1_3 Rules.make Log Message: More integration of the stddev pseudo-driver. Needed to define STDDEV_DEV as one and give location of the include file. Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -w -b -B -p -r1.13 -r1.13.2.1 --- Rules.make 20 Aug 2007 19:28:12 -0000 1.13 +++ Rules.make 17 Jun 2008 14:43:48 -0000 1.13.2.1 @@ -3,6 +3,11 @@ STDFD_DEV_CPPFLAGS =-DSTDFD_DEV=1 -I$(to else STFD_DEV_CPPFLAGS = endif +if WITH_STDDEV_DEV +STDDEV_DEV_CPPFLAGS =-DSTDDEV_DEV=1 -I$(top_srcdir)/dev +else +STDEV_DEV_CPPFLAGS = +endif if WITH_SOCKETS_DRIVER SOCKETS_CPPFLAGS=-DWITH_SOCKETS=1 @@ -10,7 +15,7 @@ else SOCKETS_CPPFLAGS= endif -DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) +DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) $(STDDEV_DEV_CPPFLAGS) AM_CPPFLAGS = \ $(TRACING) \ |
From: Lee W. <lw...@us...> - 2008-06-17 14:42:39
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19371/tests Modified Files: Tag: RELEASE_1_3 test_regions.c Log Message: Add -e switch in order to work with existing files. Index: test_regions.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_regions.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- test_regions.c 1 May 2007 16:33:53 -0000 1.9 +++ test_regions.c 17 Jun 2008 14:42:34 -0000 1.9.2.1 @@ -62,7 +62,7 @@ /* * Copy one file to another. * - * Usage: test_regions [-x] \ + * Usage: test_regions [-x] [-e] \ * {r,w} <off> <count> <path> * * Destination will not be overwritten if it already exist. @@ -85,6 +85,7 @@ int main(int argc, char * const argv[]) { int i; + int keep; int err; long l; off_t off; @@ -104,6 +105,7 @@ main(int argc, char * const argv[]) /* * Parse command-line args. */ + keep = 0; while ((i = getopt(argc, argv, #ifdef __GLIBC__ @@ -112,7 +114,7 @@ main(int argc, char * const argv[]) #ifdef GO64 "x" #endif - "")) != -1) + "e")) != -1) switch (i) { #ifdef GO64 @@ -120,6 +122,9 @@ main(int argc, char * const argv[]) use64 = 1; break; #endif + case 'e': + keep = 1; + break; default: usage(); } @@ -181,7 +186,10 @@ main(int argc, char * const argv[]) (void )memset(buf, 0, nbytes); err = 0; - flags = which == 'r' ? O_RDONLY : (O_WRONLY|O_CREAT|O_EXCL); + flags = 0; + if (!keep) + flags |= O_CREAT|O_EXCL; + flags |= which == 'r' ? O_RDONLY : O_WRONLY; #ifdef GO64 if (use64) flags |= O_LARGEFILE; |
From: Lee W. <lw...@us...> - 2008-06-16 20:19:03
|
Update of /cvsroot/libsysio/libsysio/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23687 Modified Files: Tag: RELEASE_1_3 stddev.c Log Message: In the doio function, we should not have been returning a non-zero value. That makes the caller believe some error has occurred while posting the request. Fixed. Index: stddev.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/Attic/stddev.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 --- stddev.c 16 Jun 2008 20:12:07 -0000 1.1.2.2 +++ stddev.c 16 Jun 2008 20:18:48 -0000 1.1.2.3 @@ -196,7 +196,7 @@ doio(struct ioctx *ioctx, ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; } - return ioctx->ioctx_cc; + return 0; } static int |
From: Lee W. <lw...@us...> - 2008-06-16 20:12:11
|
Update of /cvsroot/libsysio/libsysio/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21421 Modified Files: Tag: RELEASE_1_3 stddev.c stddev.h Log Message: Removed spurious <ctrl>-M characters at the end of each line. Index: stddev.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/Attic/stddev.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 Index: stddev.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/Attic/stddev.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 |
From: Ruth K. <rk...@us...> - 2008-06-16 19:01:21
|
Update of /cvsroot/libsysio/libsysio/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27581/dev Added Files: Tag: RELEASE_1_3 module.mk stddev.c stddev.h Log Message: additional files for /dev/{null,zero,full} --- NEW FILE --- STDDEV_SRCS = dev/stddev.c STDDEV_EXTRA = dev/stddev.h dev/module.mk --- 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-2008 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-1319 * * le...@sa... */ #include <errno.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <stdarg.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" #include "xtio.h" #include "inode.h" #include "dev.h" #include "stddev.h" /* * Standard devices; null, zero, and full. */ static int stddev_open(struct pnode *pno, int flags, mode_t mode); static int stddev_close(struct inode *ino); static int stddev_read(struct inode *ino, struct ioctx *ioctx); static int stddev_write(struct inode *ino, struct ioctx *ioctx); static int stddev_iodone(struct ioctx *ioctx); static int stddev_datasync(struct inode *ino); static int stddev_ioctl(struct inode *ino, unsigned long int request, va_list ap); int _sysio_stddev_init() { struct inode_ops stddev_operations; int mjr; stddev_operations = _sysio_nodev_ops; stddev_operations.inop_open = stddev_open; stddev_operations.inop_close = stddev_close; stddev_operations.inop_read = stddev_read; stddev_operations.inop_write = stddev_write; stddev_operations.inop_iodone = stddev_iodone; stddev_operations.inop_datasync = stddev_datasync; stddev_operations.inop_ioctl = stddev_ioctl; mjr = _sysio_char_dev_register(SYSIO_C_STDDEV_MAJOR, "stddev", &stddev_operations); if (mjr >= 0) mjr = 0; return mjr; } static int stddev_open(struct pnode *pno, int flags __IS_UNUSED, mode_t mode __IS_UNUSED) { int err; err = 0; switch (SYSIO_MINOR_DEV(pno->p_base->pb_ino->i_stbuf.st_rdev)) { case SYSIO_STDDEV_NULL_MINOR: /* * Fall into... */ case SYSIO_STDDEV_ZERO_MINOR: /* * Fall into... */ case SYSIO_STDDEV_FULL_MINOR: break; default: err = -ENODEV; break; } return err; } static int stddev_close(struct inode *ino __IS_UNUSED) { return 0; } static ssize_t doread(void *cp, size_t n, _SYSIO_OFF_T off __IS_UNUSED, struct ioctx *ioctx) { ssize_t cc; switch (SYSIO_MINOR_DEV(ioctx->ioctx_ino->i_stbuf.st_rdev)) { case SYSIO_STDDEV_NULL_MINOR: cc = 0; break; case SYSIO_STDDEV_ZERO_MINOR: /* * Fall into... */ case SYSIO_STDDEV_FULL_MINOR: (void )memset((char *)cp, '\0', n); cc = (ssize_t )n; break; default: abort(); } return cc; } static ssize_t dowrite(void *cp __IS_UNUSED, size_t n, _SYSIO_OFF_T off __IS_UNUSED, struct ioctx *ioctx) { ssize_t cc; switch (SYSIO_MINOR_DEV(ioctx->ioctx_ino->i_stbuf.st_rdev)) { case SYSIO_STDDEV_NULL_MINOR: /* * Fall into... */ case SYSIO_STDDEV_ZERO_MINOR: cc = (ssize_t )n; break; case SYSIO_STDDEV_FULL_MINOR: cc = -ENOSPC; break; default: abort(); } return cc; } static ssize_t doio(struct ioctx *ioctx, ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct ioctx *)) { int cc; cc = _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, ioctx->ioctx_iov, ioctx->ioctx_iovlen, (ssize_t (*)(void *, size_t, _SYSIO_OFF_T, void *))f, ioctx); ioctx->ioctx_cc = cc; if (ioctx->ioctx_cc < 0) { ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; } return ioctx->ioctx_cc; } static int stddev_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { return doio(ioctx, doread); } static int stddev_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { return doio(ioctx, dowrite); } static int stddev_iodone(struct ioctx *ioctx __IS_UNUSED) { /* * It's always done in this driver. It completed when posted. */ return 1; } static int stddev_datasync(struct inode *ino __IS_UNUSED) { /* * We don't buffer, so nothing to do. */ return 0; } static int stddev_ioctl(struct inode *ino __IS_UNUSED, unsigned long int request __IS_UNUSED, va_list ap __IS_UNUSED) { return -ENOTTY; } --- 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-2008 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-1319 * * le...@sa... */ /* * Standard devices pseudo-dvice driver. */ #define SYSIO_C_STDDEV_MAJOR 1 #define SYSIO_STDDEV_NULL_MINOR 3 #define SYSIO_STDDEV_ZERO_MINOR 5 #define SYSIO_STDDEV_FULL_MINOR 7 extern int _sysio_stddev_init(void); |
From: Ruth K. <rk...@us...> - 2008-06-16 19:01:20
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27581/src Modified Files: Tag: RELEASE_1_3 init.c Log Message: additional files for /dev/{null,zero,full} Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.38.2.1 retrieving revision 1.38.2.2 diff -u -w -b -B -p -r1.38.2.1 -r1.38.2.2 --- init.c 26 Sep 2007 19:41:39 -0000 1.38.2.1 +++ init.c 16 Jun 2008 19:01:16 -0000 1.38.2.2 @@ -222,6 +222,11 @@ _sysio_init() if (err) goto error; #endif +#ifdef STDDEV_DEV + err = _sysio_stddev_init(); + if (err) + goto error; +#endif #ifdef WITH_SOCKETS err = _sysio_sockets_init(); if (err) @@ -369,17 +374,22 @@ parse_mm(const char *s, dev_t *devp) unsigned long ul; char *cp; dev_t dev; + dev_t major, minor; ul = strtoul(s, &cp, 0); if (*cp != '+' || ul > USHRT_MAX) return -EINVAL; - dev = ul << 16; + major = ul; + if (major != ul) + return -ERANGE; s = (const char *)++cp; ul = strtoul(s, &cp, 0); if (*cp != '\0' || ul > USHRT_MAX) return -EINVAL; - dev |= ul & 0xffff; - *devp = dev; + minor = ul; + if (minor != ul); + return -ERANGE; + *devp = SYSIO_MKDEV(major, minor); return 0; } |
From: Ruth K. <rk...@us...> - 2008-06-16 19:01:19
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27581 Modified Files: Tag: RELEASE_1_3 Makefile.am configure.in Log Message: additional files for /dev/{null,zero,full} Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/Makefile.am,v retrieving revision 1.15 retrieving revision 1.15.16.1 diff -u -w -b -B -p -r1.15 -r1.15.16.1 --- Makefile.am 16 Jul 2004 13:34:43 -0000 1.15 +++ Makefile.am 16 Jun 2008 19:01:16 -0000 1.15.16.1 @@ -9,6 +9,7 @@ endif include $(top_srcdir)/src/module.mk include $(top_srcdir)/include/module.mk include $(top_srcdir)/tests/module.mk +include $(top_srcdir)/dev/module.mk include $(top_srcdir)/dev/stdfd/module.mk include $(top_srcdir)/drivers/incore/module.mk include $(top_srcdir)/drivers/native/module.mk @@ -23,6 +24,12 @@ else OPTIONAL_STDFD_SRCS = endif +if WITH_STDDEV_DEV +OPTIONAL_STDDEV_SRCS = $(STDDEV_SRCS) +else +OPTIONAL_STDDEV_SRCS = +endif + if WITH_INCORE_DRIVER OPTIONAL_INCORE_SRCS = $(INCORE_SRCS) else @@ -56,6 +63,7 @@ AM_CFLAGS = $(OPTIONAL_LUSTRE_CFLAGS) __LIBBUILD_DIR__libsysio_a_SOURCES = \ $(SRCDIR_SRCS) \ + $(OPTIONAL_STDDEV_SRCS) \ $(OPTIONAL_STDFD_SRCS) \ $(OPTIONAL_INCORE_SRCS) \ $(OPTIONAL_SOCKETS_SRCS) \ @@ -65,7 +73,7 @@ __LIBBUILD_DIR__libsysio_a_SOURCES = \ include $(top_srcdir)/Rules.make EXTRA_DIST = Rules.make misc/init-env.sh $(TESTS_EXTRA) $(SRCDIR_EXTRA) \ - $(INCLUDE_EXTRA) $(STDFD_EXTRA) $(INCORE_EXTRA) \ + $(INCLUDE_EXTRA) $(STDDEV_EXTRA) $(STDFD_EXTRA) $(INCORE_EXTRA) \ $(SOCKETS_EXTRA) $(NATIVE_EXTRA) $(YOD_EXTRA) AM_CPPFLAGS += ${YOD_DRIVER_FLAGS} Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.37.2.1 retrieving revision 1.37.2.2 diff -u -w -b -B -p -r1.37.2.1 -r1.37.2.2 --- configure.in 1 Nov 2007 22:17:07 -0000 1.37.2.1 +++ configure.in 16 Jun 2008 19:01:16 -0000 1.37.2.2 @@ -92,6 +92,17 @@ AC_ARG_WITH(stdfd-dev, [with_stdfd_dev=yes]) AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes) +AC_ARG_WITH(stddev-dev, + AC_HELP_STRING([--with-stddev-dev], + [build standard file descriptors pseudo-driver]), + [ case "${withval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-stddev-dev) ;; + esac], + [with_stddev_dev=yes]) +AM_CONDITIONAL(WITH_STDDEV_DEV, test x$with_stddev_dev = xyes) + AC_ARG_WITH(zero-sum-memory, AC_HELP_STRING([--with-zero-sum-memory], [free all dynamically allocated memory at the end -- useful for debugging]), |
From: Ruth K. <rk...@us...> - 2008-06-16 19:01:19
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27581/dev/stdfd Modified Files: Tag: RELEASE_1_3 stdfd.c Log Message: additional files for /dev/{null,zero,full} Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.14 retrieving revision 1.14.10.1 diff -u -w -b -B -p -r1.14 -r1.14.10.1 --- stdfd.c 25 Jan 2005 00:36:46 -0000 1.14 +++ stdfd.c 16 Jun 2008 19:01:16 -0000 1.14.10.1 @@ -91,6 +91,7 @@ int _sysio_stdfd_init() { struct inode_ops stdfd_operations; + int mjr; stdfd_operations = _sysio_nodev_ops; stdfd_operations.inop_open = stdfd_open; @@ -102,9 +103,13 @@ _sysio_stdfd_init() stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; - return _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, + mjr = + _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, "stdfd", &stdfd_operations); + if (mjr >= 0) + mjr = 0; + return mjr; } static int |
From: Lee W. <lw...@us...> - 2008-04-23 16:46:45
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27174/include Modified Files: inode.h Log Message: If P_RECLAIM_DEBUG is definded then at each reclaim a count of the number of pnode_base nodes present in the system is printed along with the number of those that are leaves and the number of interior nodes without aliases (orphpans). Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -b -B -p -r1.37 -r1.38 --- inode.h 14 Apr 2008 23:21:58 -0000 1.37 +++ inode.h 23 Apr 2008 16:46:40 -0000 1.38 @@ -216,6 +216,9 @@ struct pnode_base { LIST_HEAD(, pnode_base) pb_children; /* children if a dir */ LIST_ENTRY(pnode_base) pb_sibs; /* links to siblings */ LIST_HEAD(, pnode) pb_aliases; /* aliases */ +#ifdef P_RECLAIM_DEBUG + LIST_ENTRY(pnode_base) pb_links; /* all pbnodes links */ +#endif }; /* |
From: Lee W. <lw...@us...> - 2008-04-23 16:46:43
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27174/src Modified Files: inode.c Log Message: If P_RECLAIM_DEBUG is definded then at each reclaim a count of the number of pnode_base nodes present in the system is printed along with the number of those that are leaves and the number of interior nodes without aliases (orphpans). Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -w -b -B -p -r1.41 -r1.42 --- inode.c 23 Apr 2008 00:24:50 -0000 1.41 +++ inode.c 23 Apr 2008 16:46:40 -0000 1.42 @@ -107,6 +107,10 @@ static size_t max_names; */ struct pnodes_head _sysio_idle_pnodes; +#ifdef P_RECLAIM_DEBUG +static LIST_HEAD(, pnode_base) pbnodes; +#endif + /* * The system root -- Aka `/'. */ @@ -331,6 +335,33 @@ _sysio_i_undead(struct inode *ino) ino->i_zombie = 1; } +#ifdef P_RECLAIM_DEBUG +static void +p_reclaim_debug() +{ + struct pnode_base *nxt, *pb; + unsigned long npb, npbleaves, npborphans; + + npb = 0; + npbleaves = 0; + npborphans = 0; + + nxt = pbnodes.lh_first; + while ((pb = nxt)) { + nxt = pb->pb_links.le_next; + npb++; + if (!pb->pb_children.lh_first) + npbleaves++; + else if (!pb->pb_aliases.lh_first) + npborphans++; + } + _sysio_cprintf("PBSTATS: n %lu, leaves %lu, orphans %lu\n", + npb, + npbleaves, + npborphans); +} +#endif + /* * Garbage collect idle path (and base path) nodes tracked by the system. */ @@ -346,6 +377,10 @@ p_reclaim(unsigned count) if (count) adjust = 1; +#ifdef P_RECLAIM_DEBUG + p_reclaim_debug(); +#endif + INO_CST_UPDCNT(preclaims); next = _sysio_idle_pnodes.tqh_first; if (!next) @@ -505,6 +540,9 @@ _sysio_pb_new(struct qstr *name, struct LIST_INIT(&pb->pb_aliases); if (parent) LIST_INSERT_HEAD(&parent->pb_children, pb, pb_sibs); +#ifdef P_RECLAIM_DEBUG + LIST_INSERT_HEAD(&pbnodes, pb, pb_links); +#endif n_names++; assert(n_names); @@ -531,6 +569,9 @@ pb_destroy(struct pnode_base *pb) ncache_delete(pb); if (pb->pb_key.pbk_parent) LIST_REMOVE(pb, pb_sibs); +#ifdef P_RECLAIM_DEBUG + LIST_REMOVE(pb, pb_links); +#endif free(pb); } |
From: Lee W. <lw...@us...> - 2008-04-23 00:24:53
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11947/src Modified Files: inode.c Log Message: Lots of changes to try to eliminate the potential for dangling references. Notable changes in the way the pnode graphs are maintained; 1) Now, mnt->mnt_root->p_parent == mnt->mnt_root->p_parent 2) An automount now causes mnt->mnt_root to be referenced, meaning automounts have to be unmounted by hand, currently -- Will fix that. 3) Disconnects do not make pno->p_parent NULL any longer as we must maintain the chain to the root. 4) One must not blindly release a pnode, please. They should only be removed from the leaves, up. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -w -b -B -p -r1.40 -r1.41 --- inode.c 15 Apr 2008 16:26:19 -0000 1.40 +++ inode.c 23 Apr 2008 00:24:50 -0000 1.41 @@ -332,21 +332,6 @@ _sysio_i_undead(struct inode *ino) } /* - * Destroy path node and, if path base node is no longer referenced that - * node as well. - */ -static void -_sysio_p_kill(struct pnode *pno) -{ - struct pnode_base *pb; - - pb = pno->p_base; - _sysio_p_gone(pno); - if (!(pb->pb_aliases.lh_first || pb->pb_children.lh_first)) - _sysio_pb_gone(pb); -} - -/* * Garbage collect idle path (and base path) nodes tracked by the system. */ static void @@ -355,7 +340,7 @@ p_reclaim(unsigned count) int adjust; struct pnode *next, *pno; size_t t; - struct pnode_base *nxtpb, *pb; + struct pnode_base *pb; adjust = 0; if (count) @@ -378,22 +363,19 @@ p_reclaim(unsigned count) */ continue; } - nxtpb = pno->p_base; - INO_CST_UPDCNT(pdismissed); - _sysio_p_gone(pno); + if (pno->p_base->pb_children.lh_first) { /* - * Have to run up the tree, too. We might - * have removed the last child from the parent - * as well. + * Must not dismiss from interior nodes. There + * might be aliases on the child pointing + * at this one. */ - while ((pb = nxtpb)) { - nxtpb = NULL; - if (!(pb->pb_aliases.lh_first || - pb->pb_children.lh_first)) { - nxtpb = pb->pb_key.pbk_parent; - _sysio_pb_gone(pb); - } + continue; } + INO_CST_UPDCNT(pdismissed); + pb = pno->p_base; + _sysio_p_gone(pno); + if (!(pb->pb_children.lh_first || pb->pb_aliases.lh_first)) + _sysio_pb_gone(pb); } while ((!count || --count) && n_names > t && next); if (!adjust) @@ -576,24 +558,14 @@ _sysio_pb_gone(struct pnode_base *pb) static void _sysio_pb_disconnect(struct pnode_base *pb) { - struct pnode *pno; /* - * Disconnect all aliases associated with the referenced base node. - */ - pno = pb->pb_aliases.lh_first; - do { - assert(pno->p_parent != pno); - pno->p_parent = NULL; - } while ((pno = pno->p_links.le_next)); - /* * Remove name from the names cache so that it can't * be found anymore. */ - if (pb->pb_key.pbk_name.len) - ncache_delete(pb); - else + if (!pb->pb_key.pbk_name.len) abort(); + ncache_delete(pb); pb->pb_key.pbk_name.len = 0; } @@ -656,8 +628,10 @@ _sysio_p_path(struct pnode *pno, char ** * the root of the name-space. */ while (pno == pno->p_mount->mnt_root && - pno != pno->p_parent) + pno != pno->p_mount->mnt_covers) { pno = pno->p_mount->mnt_covers; + assert(pno); + } /* * Add length of this component to running sum and @@ -670,9 +644,10 @@ _sysio_p_path(struct pnode *pno, char ** n++; assert(n); pno = pno->p_parent; - } while (pno && pno != pno->p_parent); - if (!pno) - return -ENOENT; + assert(pno); + } while (pno != pno->p_parent || + (pno != pno->p_mount->mnt_covers && + pno->p_mount->mnt_covers)); if (!*bufp) size = len + n + 1; @@ -700,8 +675,9 @@ _sysio_p_path(struct pnode *pno, char ** * the root of the name-space. */ while (pno == pno->p_mount->mnt_root && - pno != pno->p_parent ) + pno != pno->p_mount->mnt_covers) { pno = pno->p_mount->mnt_covers; + } /* * Add component and separator. @@ -712,7 +688,9 @@ _sysio_p_path(struct pnode *pno, char ** *--cp = PATH_SEPARATOR; pno = pno->p_parent; - } while (pno != pno->p_parent); + } while (pno != pno->p_parent || + (pno != pno->p_mount->mnt_covers && + pno->p_mount->mnt_covers)); return 0; } @@ -740,6 +718,9 @@ _sysio_p_new_alias(struct pnode *parent, pno->p_mount = mnt; pno->p_cover = NULL; LIST_INSERT_HEAD(&pb->pb_aliases, pno, p_links); +#ifdef P_DEBUG + _sysio_p_show("P_CREATE_ALIAS", pno); +#endif return pno; } @@ -835,12 +816,12 @@ _sysio_p_gone(struct pnode *pno) assert(!pno->p_ref); assert(!pno->p_cover); -#ifdef P_DEBUG - _sysio_p_show("P_GONE", pno); -#endif TAILQ_REMOVE(&_sysio_idle_pnodes, pno, p_idle); LIST_REMOVE(pno, p_links); +#ifdef P_DEBUG + _sysio_p_show("P_GONE", pno); +#endif free(pno); } @@ -890,6 +871,9 @@ _sysio_p_find_alias(struct pnode *parent struct pnode_base_key key; int err; struct pnode *pno; +#ifdef P_DEBUG + int isnew; +#endif if (!parent) return -ENOENT; @@ -930,7 +914,13 @@ _sysio_p_find_alias(struct pnode *parent } pno = pno->p_links.le_next; } +#ifdef P_DEBUG + isnew = 0; +#endif if (!pno) { +#ifdef P_DEBUG + isnew = 1; +#endif /* * Hmm. No alias. Create one. */ @@ -940,6 +930,7 @@ _sysio_p_find_alias(struct pnode *parent } if (!err) { #ifdef P_DEBUG + if (!isnew) _sysio_p_show("P_FIND_ALIAS", pno); #endif *pnop = pno; @@ -973,45 +964,22 @@ _sysio_prune(struct pnode_base *rpb) } #endif -/* - * Prune idle nodes from the passed sub-tree, including the root. - * - * Returns the number of aliases on the same mount that could not be pruned. - * i.e. a zero return means the entire sub-tree is gone. - */ -size_t -_sysio_p_prune(struct pnode *root) +static size_t +p_remove_aliases(struct mount *mnt, struct pnode_base *pb) { size_t count; - struct pnode_base *nxtpb, *pb; struct pnode *nxtpno, *pno; count = 0; - nxtpb = root->p_base->pb_children.lh_first; - while ((pb = nxtpb)) { - nxtpb = pb->pb_sibs.le_next; nxtpno = pb->pb_aliases.lh_first; -#if 0 - if (!nxtpno) { - _sysio_prune(pb); - continue; - } -#endif while ((pno = nxtpno)) { nxtpno = pno->p_links.le_next; - if (pno->p_mount != root->p_mount) { + if (pno->p_mount != mnt) { /* * Not the alias we were looking for. */ continue; } - if (pno->p_base->pb_children.lh_first) { - /* - * Node is interior. Recurse. - */ - count += _sysio_p_prune(pno); - continue; - } if (pno->p_ref) { /* * Can't prune; It's active. @@ -1019,63 +987,55 @@ _sysio_p_prune(struct pnode *root) count++; continue; } - assert(!pno->p_cover); /* covered => ref'd! */ + if (pno->p_cover) { /* - * Ok to prune. + * Mounted on. */ - if (pno->p_mount->mnt_root == pno) { -#ifndef AUTOMOUNT_FILE_NAME count++; continue; -#else - /* - * This is an automount-point. Must - * unmount before reclaim. - */ - P_REF(pno); - if (_sysio_do_unmount(pno->p_mount) != 0) { - P_RELE(pno); - count++; } +#ifdef AUTOMOUNT_FILE_NAME + if (pno->p_mount->mnt_root == pno) { + count++; continue; -#endif } - _sysio_p_kill(pno); +#endif + _sysio_p_gone(pno); } + + return count; } - if (count) { - /* - * Can't get the root or we disconnect the sub-trees. - */ - if (root->p_ref) - count++; +static size_t +pb_prune(struct mount *mnt, struct pnode_base *pb) +{ + size_t count; + struct pnode_base *nxt, *child; + + count = 0; + nxt = pb->pb_children.lh_first; + while ((child = nxt)) { + nxt = child->pb_sibs.le_next; + count += pb_prune(mnt, child); + } + if (!count) { + count += p_remove_aliases(mnt, pb); + if (!(pb->pb_aliases.lh_first || pb->pb_children.lh_first)) + _sysio_pb_gone(pb); + } return count; } /* - * All that is left is the root. Try for it too. - */ - if (root->p_ref) { - count++; - } else if (root->p_mount->mnt_root == root) { -#ifndef AUTOMOUNT_FILE_NAME - count++; -#else - /* - * This is an automount-point. Must - * unmount before reclaim. + * Prune idle nodes from the passed sub-tree, including the root. + * + * Returns the number of aliases on the same mount that could not be pruned. + * i.e. a zero return means the entire sub-tree is gone. */ - P_REF(root); - if (_sysio_do_unmount(root->p_mount) != 0) { - P_RELE(root); - count++; - } -#endif - } else - _sysio_p_kill(root); - - return count; +size_t +_sysio_p_prune(struct pnode *pno) +{ + return pb_prune(pno->p_mount, pno->p_base); } /* |
From: Lee W. <lw...@us...> - 2008-04-23 00:23:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11187/src Modified Files: mount.c Log Message: In _sysio_do_mount we now test to ensure that everything is a directory that we can. Also, got rid of _sysio_p_gone use in that routine. Would like to get it everywhere, restricting it to the inode.c file only. Someday... Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -b -B -p -r1.28 -r1.29 --- mount.c 22 Apr 2008 22:02:49 -0000 1.28 +++ mount.c 23 Apr 2008 00:23:21 -0000 1.29 @@ -123,6 +123,15 @@ _sysio_do_mount(struct filesys *fs, int err; /* + * Directories only, please. + */ + if ((tocover && + !(tocover->p_base->pb_ino && + S_ISDIR(tocover->p_base->pb_ino->i_stbuf.st_mode))) || + !rootpb->pb_ino || !S_ISDIR(rootpb->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + + /* * It's really poor form to allow the new root to be a * descendant of the pnode being covered. */ @@ -167,13 +176,6 @@ _sysio_do_mount(struct filesys *fs, goto error; } /* - * It better be a directory! - */ - if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { - err = -ENOTDIR; - goto error; - } - /* * Cover up the mount point. */ mnt->mnt_covers = tocover; @@ -195,10 +197,6 @@ _sysio_do_mount(struct filesys *fs, return 0; error: - if (mnt->mnt_root) { - P_RELE(mnt->mnt_root); - _sysio_p_gone(mnt->mnt_root); - } free(mnt); return err; } |
From: Lee W. <lw...@us...> - 2008-04-22 22:02:56
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22547/src Modified Files: mount.c Log Message: Parent pointer of root of a mount no longer points to the parent of the node it covered. Instead, such nodes loop. Also, the diagnostic that prints a pnode needs some more fields to be initialized in the mount record. Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- mount.c 14 Apr 2008 23:26:13 -0000 1.27 +++ mount.c 22 Apr 2008 22:02:49 -0000 1.28 @@ -159,8 +159,9 @@ _sysio_do_mount(struct filesys *fs, /* * Get alias for the new root. */ + mnt->mnt_root = mnt->mnt_covers = NULL; mnt->mnt_root = - _sysio_p_new_alias(tocover ? tocover->p_parent : NULL, rootpb, mnt); + _sysio_p_new_alias(NULL, rootpb, mnt); if (!mnt->mnt_root) { err = -ENOMEM; goto error; @@ -236,6 +237,7 @@ _sysio_do_unmount(struct mount *mnt) struct filesys *fs; root = mnt->mnt_root; + assert(root->p_ref); if (root->p_cover && root->p_cover != root) { /* * Active mount. @@ -727,15 +729,13 @@ _sysio_automount(struct pnode *mntpno) /* * Do the deed. */ - P_REF(mntpno->p_parent); + assert(mntpno->p_parent->p_ref); err = (*fssw->fssw_ops.fsswop_mount)(source, flags, opts, mntpno->p_parent, &mnt); - if (err) - P_RELE(mntpno->p_parent); out: if (buf) |
From: Lee W. <lw...@us...> - 2008-04-22 21:56:07
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19135/src Modified Files: namei.c Log Message: Two changes: 1) Pnodes that are root of a mount now loop on themselves. Changed lookup to descend, then move up when encountering such a node now. 2) Automounts need their root to have a soft-reference, always, now. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -b -B -p -r1.28 -r1.29 --- namei.c 7 Apr 2008 19:15:49 -0000 1.28 +++ namei.c 22 Apr 2008 21:56:03 -0000 1.29 @@ -118,7 +118,11 @@ lookup(struct pnode *parent, else if (name->len == 2 && name->name[0] == '.' && name->name[1] == '.') { + while (parent->p_mount->mnt_root == parent && + parent != parent->p_mount->mnt_covers) + parent = parent->p_mount->mnt_covers; pno = parent->p_parent; + assert(pno); } if (pno) P_REF(pno); @@ -129,8 +133,6 @@ lookup(struct pnode *parent, err = _sysio_p_find_alias(parent, name, &pno); if (err) return err; - } - /* * While covered, move to the covering node. */ @@ -142,6 +144,7 @@ lookup(struct pnode *parent, P_RELE(pno); pno = cover; } + } *pnop = pno; @@ -296,6 +299,7 @@ _sysio_path_walk(struct pnode *parent, s * arrange the mount if so. */ assert(!nd->nd_pno->p_cover); + pno = NULL; err = lookup(nd->nd_pno, &_sysio_mount_file_name, @@ -304,28 +308,21 @@ _sysio_path_walk(struct pnode *parent, s NULL, 1); if (!err && (err = _sysio_automount(pno)) == 0) { - struct pnode *root; - /* * All went well. Need to switch * parent pno and ino to the * root of the newly mounted sub-tree. * * NB: - * We don't recurseively retry these + * We don't recursively retry these * things. It's OK to have the new root * be an automount-point but it's going * to take another lookup to accomplish it. * The alternative could get us into an * infinite loop. */ - root = nd->nd_pno->p_cover; - assert(root); - P_RELE(nd->nd_pno); - nd->nd_pno = root; -#if 0 + nd->nd_pno = nd->nd_pno->p_cover; P_REF(nd->nd_pno); -#endif ino = nd->nd_pno->p_base->pb_ino; assert(ino); |
From: Lee W. <lw...@us...> - 2008-04-22 21:44:44
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16060/tests Modified Files: test_getcwd.c Log Message: Modified to honor the "-v", for "verify" the path, option now. This option will cause the test to chdir to the specified directory, print the path, chdir(..), print the path, chdir(..)... Until reaching root. Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- test_getcwd.c 28 Mar 2007 21:27:12 -0000 1.8 +++ test_getcwd.c 22 Apr 2008 21:44:40 -0000 1.9 @@ -65,12 +65,17 @@ /* * Test getcwd() * - * Usage: test_cwd [<working-dir>...] + * Usage: test_cwd [-v] [<working-dir>...] * * Without any path arguments, the program reads from standard-in, dealing with * each line as an absolute or relative path until EOF. + * + * The -v option tells it to chdir back up tot he root and print the + * working directory at each point. */ +static int verify = 0; /* verify path? */ + static int doit(const char *path); static void usage(void); @@ -85,9 +90,12 @@ main(int argc, char *const argv[]) /* * Parse command line arguments. */ - while ((i = getopt(argc, argv, "")) != -1) + while ((i = getopt(argc, argv, "v")) != -1) switch (i) { + case 'v': + verify = 1; + break; default: usage(); } @@ -147,11 +155,20 @@ static int doit(const char *path) { char *buf; + struct stat stbufs[2], *st1, *st2; + unsigned count; if (SYSIO_INTERFACE_NAME(chdir)(path) != 0) { perror(path); return -1; } + st1 = &stbufs[0]; + if (SYSIO_INTERFACE_NAME(stat)(".", st1) != 0) { + perror("."); + return -1; + } + count = 0; + do { buf = SYSIO_INTERFACE_NAME(getcwd)(NULL, 0); if (!buf) { perror(path); @@ -159,6 +176,19 @@ doit(const char *path) } (void )printf("%s\n", buf); free(buf); + if (SYSIO_INTERFACE_NAME(chdir)("..") != 0) { + perror(".."); + return -1; + } + count++; + st2 = st1; + st1 = &stbufs[count & 1]; + if (SYSIO_INTERFACE_NAME(stat)(".", st1) != 0) { + perror("."); + return -1; + } + } while (verify && + (st1->st_dev != st2->st_dev || st1->st_ino != st2->st_ino)); return 0; } @@ -168,7 +198,7 @@ usage() (void )fprintf(stderr, "Usage: test_getcwd " - " [<path> ...\n]"); + " [<path> [...]]\n"); exit(1); } |
From: Lee W. <lw...@us...> - 2008-04-19 19:09:19
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12701/include Modified Files: tree.h Log Message: A new routine, _sysio_enumerate_tree, is added that supports pre-order, in-order, and post-order traversals of a tree with callbacks at each node. Index: tree.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/tree.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- tree.h 21 Sep 2007 19:35:53 -0000 1.1 +++ tree.h 19 Apr 2008 19:09:14 -0000 1.2 @@ -68,4 +68,8 @@ extern struct tree_node *_sysio_tree_del struct tree_node **rootp, int (*compar)(const void *, const void *)); +extern void _sysio_tree_enumerate(const struct tree_node *tn, + void (*pre)(const struct tree_node *), + void (*in)(const struct tree_node *), + void (*post)(const struct tree_node *)); #endif /* !defined(_TREE_H) */ |
From: Lee W. <lw...@us...> - 2008-04-19 19:09:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12701/src Modified Files: tree.c Log Message: A new routine, _sysio_enumerate_tree, is added that supports pre-order, in-order, and post-order traversals of a tree with callbacks at each node. Index: tree.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/tree.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- tree.c 21 Sep 2007 19:35:53 -0000 1.1 +++ tree.c 19 Apr 2008 19:09:14 -0000 1.2 @@ -174,3 +174,26 @@ _sysio_tree_delete(const void *key, } return tn; } + +/* + * Enumerate the passed tree calling the pre, in, and post routines at each + * node if they aren't NULL. + */ +void +_sysio_tree_enumerate(const struct tree_node *tn, + void (*pre)(const struct tree_node *), + void (*in)(const struct tree_node *), + void (*post)(const struct tree_node *)) +{ + + if (pre) + (*pre)(tn); + if (tn->tn_left) + _sysio_tree_enumerate(tn->tn_left, pre, in, post); + if (in) + (*in)(tn); + if (tn->tn_right) + _sysio_tree_enumerate(tn->tn_right, pre, in, post); + if (post) + (*post)(tn); +} |