libsysio-commit Mailing List for libsysio (Page 46)
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: Ruth K. <rk...@us...> - 2003-08-14 18:55:10
|
Update of /cvsroot/libsysio/libsysio
In directory sc8-pr-cvs1:/tmp/cvs-serv16191
Modified Files:
Makefile.am configure.in
Log Message:
merge cplant branch into head
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -b -B -p -r1.7 -r1.8
--- Makefile.am 26 Mar 2003 00:00:15 -0000 1.7
+++ Makefile.am 14 Aug 2003 18:39:32 -0000 1.8
@@ -5,7 +5,15 @@ else
TESTS =
endif
+if WITH_CPLANT_TESTS
+SUBDIRS = $(TESTS)
+else
+if WITH_CPLANT_YOD
+SUBDIRS = src drivers dev
+else
SUBDIRS = src drivers dev $(TESTS)
+endif
+endif
EXTRA_DIST = Rules.make \
include/dev.h include/file.h include/fs.h include/inode.h \
@@ -16,6 +24,7 @@ really-clean: maintainer-clean
-rm -rf .deps
-rm -f Makefile.in \
drivers/native/Makefile.in drivers/incore/Makefile.in \
+ drivers/yod/Makefile.in \
drivers/Makefile.in \
dev/stdfd/Makefile.in \
dev/Makefile.in \
Index: configure.in
===================================================================
RCS file: /cvsroot/libsysio/libsysio/configure.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -b -B -p -r1.6 -r1.7
--- configure.in 25 Jul 2003 14:44:14 -0000 1.6
+++ configure.in 14 Aug 2003 18:39:32 -0000 1.7
@@ -19,21 +19,19 @@ AC_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_TIME
-AC_ARG_WITH(with_native_driver,
+AC_ARG_WITH(native_driver,
[ --with-native-driver build native test driver],
- [ with_native_driver=${withval}
- case "${withval}" in
+ [ case "${withval}" in
yes) ;;
no) ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
- esac],
- [with_native_driver=yes])
+ esac;],
+ [with_native_driver=yes;])
AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
-AC_ARG_WITH(with_incore_driver,
+AC_ARG_WITH(incore-driver,
[ --with-incore-driver build incore test driver],
- [ with_incore_driver=${withval}
- case "${withval}" in
+ [ case "${withval}" in
yes) ;;
no) ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
@@ -41,10 +39,9 @@ AC_ARG_WITH(with_incore_driver,
[with_incore_driver=yes])
AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
-AC_ARG_WITH(with_tests,
+AC_ARG_WITH(tests,
[ --with-tests build tests],
- [ with_tests=${withval}
- case "${withval}" in
+ [ case "${withval}" in
yes) ;;
no) ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
@@ -54,25 +51,53 @@ AM_CONDITIONAL(WITH_TESTS, test x$with_t
AC_ARG_WITH(automount,
[ --with-automount=[automount-file-name] with automounts],
- with_automount=$withval,
- [with_automount=])
-if test x$with_automount != x; then
- AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"$with_automount\\\""
-fi
+ [ if test x${withval} != x; then
+ AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
+ fi])
AC_SUBST(AUTOMOUNT)
-AC_ARG_WITH(with_stdfd_dev,
+AC_ARG_WITH(stdfd-dev,
[ --with-stdfd-dev build standard file descriptors pseudo-driver],
- [ with_stdfd_dev=${withval}
- case "${withval}" in
- yes)
- ;;
+ [ case "${withval}" in
+ yes) ;;
no) ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
esac],
[with_stdfd_dev=yes])
AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
+AC_ARG_WITH(cplant_yod,
+ [ --with-cplant-yod build cplant yod I/O driver],
+ [ case "${withval}" in
+ yes) if test x${with_stdfd_dev} != xyes; then
+ with_stdfd_dev=yes
+ AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
+ fi ;;
+ no) ;;
+ *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
+ esac],
+ [with_cplant_yod=no])
+AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
+
+AC_ARG_WITH(cplant_tests,
+ [ --with-cplant-tests=[cplant build path] build libsysio tests for cplant platform],
+ [ 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
+ CCDEPMODE=${CC}
+ CPP="${CC} -E"
+ AC_CHECK_FILE(${CC},
+ [ if test x${with_cplant_yod} != xyes; then
+ with_cplant_yod=yes
+ AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
+ fi],
+ [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
+ esac],
+ [with_cplant_tests=no])
+AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
@@ -154,7 +179,8 @@ AC_MSG_RESULT($alpha_linux_env)
AC_MSG_CHECKING(for 64 bit stat and truncate syscalls)
AC_TRY_COMPILE([
#include <sys/stat.h>
-#include <syscall.h>],
+#include <syscall.h>
+extern int syscall();],
[char path[] = "/";
int fd = 0;
struct stat buf;
@@ -174,7 +200,8 @@ fi
#
AC_MSG_CHECKING(for fdatasync system call)
AC_TRY_COMPILE([
-#include <syscall.h>],
+#include <syscall.h>
+extern int syscall();],
[int fd = 0;
syscall(SYS_fdatasync, fd);],
syscall_fdatasync_exists=yes,
@@ -188,7 +215,8 @@ fi
#
AC_MSG_CHECKING(for utime system call)
AC_TRY_COMPILE([
-#include <syscall.h>],
+#include <syscall.h>
+extern int syscall();],
[syscall(SYS_utime);],
syscall_utime_exists=yes,
syscall_utime_exists=no)
@@ -196,7 +224,7 @@ AC_MSG_RESULT($syscall_utime_exists)
if test x$syscall_utime_exists = xno; then
AC_DEFINE(USE_NATIVE_UTIME)
fi
-# Check for SYS_utime
+# Check for __st_ino
#
AC_MSG_CHECKING(for __st_ino)
AC_TRY_COMPILE([
@@ -332,6 +360,7 @@ AC_OUTPUT(
drivers/Makefile
drivers/native/Makefile
drivers/incore/Makefile
+ drivers/yod/Makefile
dev/Makefile
dev/stdfd/Makefile
tests/Makefile)
|
|
From: Sonja T. <so...@us...> - 2003-08-14 18:53:05
|
Update of /cvsroot/libsysio/libsysio/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv17651/libsysio/tests
Added Files:
Tag: libsysio_tests
populator.pl test_stdfd.pl verifier.pl
Log Message:
Adding files. This time hopefully for real
--- NEW FILE ---
#!/usr/bin/perl -w
use IPC::Open2;
use strict;
use helper;
sub usage
{
print "Usage: ./populator.pl <-seed seed> :\n";
print " <-file filename> :\n";
print " <-bytes bytes> : Create a file, filename, that\n";
print " : is bytes long and populate with\n";
print " : random numbers using the given\n";
print " : seed. Will use defaults if args\n";
print " : not given\n";
exit(-1);
}
sub get_buf
{
my $MAX_SIZE = 2147483648;
my $str;
my $num;
my $len = 0;
while ($len < 512) {
$num = rand $MAX_SIZE;
my $tmpstr = sprintf("%d", $num);
$str .= $tmpstr;
$len += length $tmpstr;
}
return ($len, $str);
}
sub write_file
{
my ($cmdfh, $outfh, $filename, $bytes) = @_;
# Allocate the read buffer
my $cmd = '$buf = ALLOC 1024'."\n";
helper::send_cmd($cmdfh, $outfh, "alloc", $cmd);
# Open (create) the new file
$cmd = '$fd = CALL open '."$filename O_RDWR|O_CREAT S_IRWXU\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmd);
# Verify the system call's output
helper::verify_cmd($cmdfh, $outfh, "open");
my $left_bytes = $bytes;
while ($left_bytes > 0) {
# Get a buffer filled with random numbers
# Buffer will be no less than 512 bytes
my ($len, $buf) = get_buf;
if ($len > $left_bytes) {
$len = $left_bytes;
}
# Need to fill $buf with the buffer
$cmd = "CALL fill $buf STR $len 0 ".'$buf'."\n";
helper::send_cmd($cmdfh, $outfh, "fill", $cmd);
# Write out $len bytes to $filename
$cmd = 'CALL write $fd $buf '."$len\n";
helper::send_cmd($cmdfh, $outfh, "write", $cmd);
my $written_bytes = helper::verify_cmd($cmdfh, $outfh, "write");
$written_bytes = oct($written_bytes);
if ($written_bytes != $len) {
helper::print_and_exit($cmdfh, $outfh, 1,
"ERROR! Meant to print out $len but only printed $written_bytes\n");
}
$left_bytes -= $len;
}
}
sub populate_file
{
my ($filename, $bytes, $is_alpha) = @_;
eval {
if ($is_alpha == 0) {
open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
"yod -batch -quiet -sz 1 ./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");
}
# Now write the file
write_file($cmdfh, $outfh, $filename, $bytes);
# Close the file
my $cmd = 'CALL close $fd'."\n";
helper::send_cmd($cmdfh, $outfh, "close", $cmd);
helper::verify_cmd($cmdfh, $outfh, "close");
# All done
helper::print_and_exit($cmdfh, $outfh, 0, "File $filename successfully created\n");
}
my $is_alpha = 0;
my $seed = time;
my $filename = "randfile.$seed.$$";
my $bytes = 1024;
for (my $i = 0; $i < @ARGV; $i++)
{
if ($ARGV[$i] eq "-file") {
$i++;
$filename = $ARGV[$i];
} elsif ($ARGV[$i] eq "-seed") {
$i++;
$seed = $ARGV[$i];
} elsif ($ARGV[$i] eq "-alpha") {
$is_alpha = 1;
} elsif ($ARGV[$i] eq "-bytes") {
$i++;
$bytes = $ARGV[$i];
}
}
# seed the randome number generator
srand $seed;
populate_file($filename, $bytes, $is_alpha);
exit $seed;
--- NEW FILE ---
#!/usr/bin/perl -w
#
# stdfd test: Verifies that stdin, stdout, and stderr can be opened and
# either written to or read from (in the case of stdin)
use IPC::Open2;
use strict;
use helper;
sub usage
{
print "Usage ./test_stdfd : Verifies that stdin, stdout, and stderr can be opened and ";
print " : either written to or read from (in the case of stdin)";
exit(-1);
}
sub mkdev
{
my ($major, $minor) = @_;
my $devno = ( (($major & 0xff) << 8) | ($minor & 0xff) );
return $devno;
}
sub statit
{
my ($cmdfh, $outfh, $do_print, $name) = @_;
my $cmd = "CALL stat $name ".'$buf'."\n";
helper::send_cmd($cmdfh, $outfh, "stat", $cmd);
helper::verify_cmd($cmdfh, $outfh, "stat $name");
# Print out the stat buffer
$cmd = 'PRINT $buf 0 8 LONG 12 24 INT 44 8 LONG 52 8 INT 64 24 LONG';
$cmd .= "\n";
helper::send_cmd($cmdfh, $outfh, "PRINT", $cmd);
my $res = <$outfh>;
chop($res);
my ( $iodev, $ioino, $iomode, $ionlink, $iouid, $iogid, $iordev,
$iosize, $ioblksize, $ioblks, $ioatime, $iomtime, $ioctime )
= split(' ', $res);
$iomode = oct($iomode);
if ($do_print == 1) {
# Print out the path
my $typechar = helper::get_type($iomode);
print STDOUT "$name: $typechar\n";
}
return 0;
}
sub do_open
{
my ($cmdfh, $outfh, $name, $mode, $num) = @_;
helper::send_cmd($cmdfh, $outfh, "open", "CALL open $name $mode\n");
my $res = helper::verify_cmd($cmdfh, $outfh, "open $name");
#chop($res);
$res = oct($res);
if ($res < 0) {
helper::print_and_exit($cmdfh, $outfh, 1, "Unable to open $name\n");
}
if ($res == $num) {
return $res;
}
helper::send_cmd($cmdfh, $outfh, "dup2", "CALL dup2 $res $num\n");
$res = helper::verify_cmd($cmdfh, $outfh, "dup2");
$res = oct($res);
if ($res != $num) {
helper::print_and_exit($cmdfh, $outfh, 1, "Unable to dup $name (res was $res)\n");
}
}
sub do_mknod
{
my ($cmdfh, $outfh, $do_print, $name, $perm_num, $minor) = @_;
my $perm = 'S_IFCHR|'.$perm_num;
my $devno = mkdev(0, $minor);
helper::send_cmd($cmdfh, $outfh, "mknod", "CALL mknod $name $perm $devno\n");
helper::verify_cmd($cmdfh, $outfh, "mknod $name");
my $statres = statit($cmdfh, $outfh, $do_print, $name);
if ($statres != 0) {
helper::print_and_exit($cmdfh, $outfh, 1, "stat on $name failed\n");
}
}
sub process_cmd
{
my ($dirname, $do_print, $is_alpha) = @_;
eval {
if ($is_alpha == 1) {
open2(\*OUTFILE, \*CMDFILE, "yod -sz 1 ./test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE, "./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 incore ".'"0777+0+0"'." 0\n");
}
my $start = 0;
# Get a stat buffer
my $cmd = '$buf = ALLOC ( $size = CALL sizeof stat )'."\n";
helper::send_cmd($cmdfh, $outfh, "alloc", $cmd);
# Make the test directory
$cmd = "CALL mkdir $dirname 0777\n";
helper::send_cmd($cmdfh, $outfh, "mkdir", $cmd);
helper::verify_cmd($cmdfh, $outfh, "mkdir");
# Change working dir to test dir
$cmd = "CALL chdir $dirname\n";
helper::send_cmd($cmdfh, $outfh, "chdir", $cmd);
helper::verify_cmd($cmdfh, $outfh, "chdir");
# Create the 3 special files
do_mknod($cmdfh, $outfh, $do_print, "stdin", "0444", 0);
do_mknod($cmdfh, $outfh, $do_print, "stdout", "0222", 1);
do_mknod($cmdfh, $outfh, $do_print, "stderr", "0222", 2);
# Open the 3 files
do_open($cmdfh, $outfh, "stdin", "O_RDONLY", 0);
do_open($cmdfh, $outfh, "stdout", "O_WRONLY", 1);
do_open($cmdfh, $outfh, "stderr", "O_WRONLY", 2);
#helper::send_cmd($cmdfh, $outfh, "debug", "CALL debug 5\n");
# Read from stdin, write to stdout and stderr
# Send "delay" option to read which will give us time to
# put something in stdin (since we can't send an eof)
$cmd = "CALL read 0 ".'$buf 38'." delay\n";
print $cmdfh $cmd;
# Give time to process command
sleep 1;
# Send random junk...
print $cmdfh "This message is exactly 38 bytes long\n";
sleep 0.5;
# Make sure read was OK
my $res = <$outfh>;
chop($res);
if ($res ne "0000 ") {
helper::print_and_exit($cmdfh, $outfh, 1, "ERROR! Command $cmd failed with code $res\n");
}
# See how many bytes we got...
my $bytes = helper::verify_cmd($cmdfh, $outfh, "read");
$bytes = oct($bytes);
if ($bytes == 0) {
helper::print_and_exit($cmdfh, $outfh, 0, "test_stdfd successful but read nothing\n");
}
if ($bytes < 0) {
helper::print_and_exit($cmdfh, $outfh, 0, "test_stdfd unsuccessful\n");
}
$cmd = "CALL write 1 ".'$buf '."$bytes\n";
print $cmdfh $cmd;
# Suck up the stdout...
$res = <$outfh>;
chop($res);
$res = <$outfh>;
chop($res);
$res = oct($res);
if ($res != 0) {
helper::print_and_exit($cmdfh, $outfh, 1, "ERROR! Command $cmd failed with code $res\n");
}
helper::verify_cmd($cmdfh, $outfh, "write stdout");
$cmd = "CALL write 2 ".'$buf '."$bytes\n";
helper::send_cmd($cmdfh, $outfh, "write stderr", $cmd);
helper::verify_cmd($cmdfh, $outfh, "write stderr");
helper::print_and_exit($cmdfh, $outfh, 0, "test_stdfd successful\n");
}
my $is_alpha = 0;
my $do_print = 0;
my $i;
for ($i=0; $i < @ARGV; $i++) {
if ($ARGV[$i] eq "-alpha") {
$is_alpha =1;
} elsif ($ARGV[$i] eq "-print") {
$do_print = 1;
}
}
$i--;
my $dirname = $ARGV[$i];
process_cmd($dirname, $do_print, $is_alpha);
exit 0;
--- NEW FILE ---
#!/usr/bin/perl -w
# Verifies that the contents of a given file produced by producer.pl with the given
# seed are good
use IPC::Open2;
use strict;
use helper;
sub usage
{
print "Usage: ./verifier.pl <-seed seed> <-file fname> : Verifies that file fname,\n";
print " : produced with the given \n";
print " : seed matches\n";
exit(-1);
}
sub get_buf
{
my $MAX_SIZE = 2147483648;
my $str;
my $num;
my $len = 0;
while ($len < 512) {
$num = rand $MAX_SIZE;
my $tmpstr = sprintf("%d", $num);
$str .= $tmpstr;
$len += length $tmpstr;
}
return ($len, $str);
}
sub check_file
{
my ($cmdfh, $outfh, $filename) = @_;
# Allocate the read buffer
my $cmd = '$buf = ALLOC 1024'."\n";
helper::send_cmd($cmdfh, $outfh, "alloc", $cmd);
# Open the file
$cmd = '$fd = CALL open '."$filename O_RDONLY\n";
helper::send_cmd($cmdfh, $outfh, "open", $cmd);
# Verify the system call's output
helper::verify_cmd($cmdfh, $outfh, "open");
my $total = 0;
my $bytes = 0;
# Read all of the file in 1024 byte chunks
do {
# Clear the buffer
$cmd = 'CALL clear $buf'."\n";
helper::send_cmd($cmdfh, $outfh, "clear", $cmd);
my ($len, $buf) = get_buf;
$cmd = 'CALL read $fd $buf '."$len\n";
helper::send_cmd($cmdfh, $outfh, "read", $cmd);
$bytes = helper::verify_cmd($cmdfh, $outfh, "read");
$bytes = oct($bytes);
$total += $bytes;
if ($bytes > 0) {
# Print out the buffer
$cmd = 'PRINT $buf 0 1 STR'."\n";
helper::send_cmd($cmdfh, $outfh, "print", $cmd);
my $str = <$outfh>;
chop($str);
if ($bytes > $len) {
$str = substr($str, 0, $len-1);
} elsif ($len > $bytes) {
$buf = substr($buf, 0, $bytes);
}
if ($str ne $buf) {
my $errstr = "ERROR! Str $str is not equal to str $buf\n";
helper::print_and_exit($cmdfh, $outfh, 1, $errstr);
}
}
} while ($bytes > 0);
}
sub verify_file
{
my ($filename, $is_alpha) = @_;
eval {
if ($is_alpha == 0) {
open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
"yod -batch -quiet -sz 1 ./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");
}
# Now check the file
check_file($cmdfh, $outfh, $filename);
# Close the file
my $cmd = 'CALL close $fd'."\n";
helper::send_cmd($cmdfh, $outfh, "close", $cmd);
helper::verify_cmd($cmdfh, $outfh, "close");
# All done
helper::print_and_exit($cmdfh, $outfh, 0, "File $filename valid\n");
}
my $is_alpha = 0;
my $seed = time;
my $filename = "randfile.$seed.$$";
my $bytes = 1024;
for (my $i = 0; $i < @ARGV; $i++)
{
if ($ARGV[$i] eq "-file") {
$i++;
$filename = $ARGV[$i];
} elsif ($ARGV[$i] eq "-seed") {
$i++;
$seed = $ARGV[$i];
} elsif ($ARGV[$i] eq "-alpha") {
$is_alpha = 1;
}
}
# seed the randome number generator
srand $seed;
verify_file($filename, $is_alpha);
exit 0;
|
|
From: Ruth K. <rk...@us...> - 2003-08-14 18:50:18
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv16191/drivers/native
Modified Files:
fs_native.c
Log Message:
merge cplant branch into head
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -b -B -p -r1.15 -r1.16
--- fs_native.c 4 Aug 2003 15:30:27 -0000 1.15
+++ fs_native.c 14 Aug 2003 18:39:33 -0000 1.16
@@ -116,9 +116,19 @@ do {
(dest)->st_gen = (src)->st_gen; \
} while (0);
+/* SYS_lseek has a different interface on alpha
+ */
+#define CALL_LSEEK(fd, off, rc, wh) \
+ (rc = syscall(SYS_lseek, fd, off, wh))
+
#else
+
#define __native_stat intnl_stat
#define COPY_STAT(src, dest) *(dest) = *(src)
+
+#define CALL_LSEEK(fd, off, rc, wh) \
+ (syscall(SYS_lseek, fd, off, &rc, wh))
+
#endif
#if defined(USE_NATIVE_STAT)
@@ -293,10 +303,12 @@ static int
native_fstat(int fd, struct intnl_stat *buf)
{
int err;
+ struct __native_stat stbuf;
- err = syscall(__SYS_FSTAT, fd, buf);
+ err = syscall(__SYS_FSTAT, fd, &stbuf);
if (err)
err = -errno;
+ COPY_STAT(&stbuf, buf);
return err;
}
@@ -829,10 +841,9 @@ native_getdirentries(struct inode *ino,
result = *basep;
if (*basep != nino->ni_fpos &&
- syscall(SYS_lseek,
- nino->ni_fd,
+ CALL_LSEEK(nino->ni_fd,
*basep,
- &result,
+ result,
SEEK_SET) == -1)
return -errno;
nino->ni_fpos = result;
@@ -1075,10 +1086,9 @@ doio(ssize_t (*f)(int, const struct iove
!(S_ISCHR(ino->i_mode) ||
S_ISSOCK(ino->i_mode) ||
S_ISFIFO(ino->i_mode)) &&
- syscall(SYS_lseek,
- nino->ni_fd,
+ CALL_LSEEK(nino->ni_fd,
ioctx->ioctx_offset,
- &result,
+ result,
SEEK_SET) == -1) {
ioctx->ioctx_cc = -1;
ioctx->ioctx_errno = errno;
|
|
From: Sonja T. <so...@us...> - 2003-08-14 18:50:03
|
Update of /cvsroot/libsysio/libsysio/drivers/incore
In directory sc8-pr-cvs1:/tmp/cvs-serv16559/libsysio/drivers/incore
Modified Files:
Tag: libsysio_tests
fs_incore.c
Log Message:
Trying to get these missing files in again...it turns out I am not very good at CVS commands..
Index: fs_incore.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -w -b -B -p -r1.4 -r1.4.6.1
--- fs_incore.c 23 Apr 2003 18:16:57 -0000 1.4
+++ fs_incore.c 14 Aug 2003 18:42:22 -0000 1.4.6.1
@@ -1024,7 +1024,7 @@ _sysio_incore_dirop_mkdir(struct pnode *
struct incore_inode *icino, *parent;
ino_t inum;
int err;
- struct intnl_dirent *de;
+ struct intnl_dirent *de = NULL;
struct inode *ino;
ino = pno->p_parent->p_base->pb_ino;
@@ -1271,7 +1271,7 @@ incore_doio(ssize_t (*f)(struct incore_i
struct ioctx *ioctx;
const struct iovec *iov;
size_t n;
- ssize_t cc;
+ ssize_t cc = 0;
ioctx = _sysio_ioctx_new(ino, ioargs);
if (!ioctx)
|
|
From: Sonja T. <so...@us...> - 2003-08-14 18:50:03
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd
In directory sc8-pr-cvs1:/tmp/cvs-serv16559/libsysio/dev/stdfd
Modified Files:
Tag: libsysio_tests
stdfd.c
Log Message:
Trying to get these missing files in again...it turns out I am not very good at CVS commands..
Index: stdfd.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -w -b -B -p -r1.2 -r1.2.8.1
--- stdfd.c 24 Mar 2003 22:09:02 -0000 1.2
+++ stdfd.c 14 Aug 2003 18:42:22 -0000 1.2.8.1
@@ -120,7 +120,7 @@ doio(ssize_t (*f)(int, char *, size_t),
struct ioctx *ioctx;
const struct iovec *iov;
size_t n;
- ssize_t cc;
+ ssize_t cc = 0;
ioctx = _sysio_ioctx_new(ino, ioargs);
if (!ioctx)
|
|
From: Sonja T. <so...@us...> - 2003-08-14 18:50:03
|
Update of /cvsroot/libsysio/libsysio
In directory sc8-pr-cvs1:/tmp/cvs-serv16559/libsysio
Modified Files:
Tag: libsysio_tests
configure.in
Log Message:
Trying to get these missing files in again...it turns out I am not very good at CVS commands..
Index: configure.in
===================================================================
RCS file: /cvsroot/libsysio/libsysio/configure.in,v
retrieving revision 1.5
retrieving revision 1.5.8.1
diff -u -w -b -B -p -r1.5 -r1.5.8.1
--- configure.in 26 Mar 2003 00:05:59 -0000 1.5
+++ configure.in 14 Aug 2003 18:42:22 -0000 1.5.8.1
@@ -209,6 +209,19 @@ AC_MSG_RESULT($have__st_ino)
if test x$have__st_ino = xyes; then
AC_DEFINE(HAVE__ST_INO)
fi
+# Check for st_gen
+#
+AC_MSG_CHECKING(for st_gen)
+AC_TRY_COMPILE([
+#include <sys/stat.h>],
+[struct stat st;
+st.st_gen = 0;],
+ have_st_gen=yes,
+ have_st_gen=no)
+AC_MSG_RESULT($have_st_gen)
+if test x$have_st_gen = xyes; then
+ AC_DEFINE(HAVE_GENERATION)
+fi
AC_MSG_CHECKING(whether .text pseudo-op must be used)
AC_CACHE_VAL(sysio_asm_dot_text, [dnl
|
|
From: Sonja T. <so...@us...> - 2003-08-14 18:45:20
|
Update of /cvsroot/libsysio/libsysio/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv14983/libsysio/tests
Modified Files:
Tag: libsysio_tests
test_all.pl
Log Message:
Merging and fixing bug
Index: test_all.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/Attic/test_all.pl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -w -b -B -p -r1.1.2.5 -r1.1.2.6
--- test_all.pl 14 Jul 2003 21:02:05 -0000 1.1.2.5
+++ test_all.pl 14 Aug 2003 18:31:53 -0000 1.1.2.6
@@ -57,6 +57,7 @@ if ($resarr[0] ne $res) {
print "path test returned $resarr[2] instead of $res\n";
$failures++;
} else {
+ print "test_path finished successfully\n";
$success++;
}
}
|
|
From: Ruth K. <rk...@us...> - 2003-08-06 17:17:03
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv31841
Modified Files:
Tag: cplant
fs_native.c
Log Message:
merge change from head
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.8.2.6
retrieving revision 1.8.2.7
diff -u -w -b -B -p -r1.8.2.6 -r1.8.2.7
--- fs_native.c 1 Aug 2003 18:49:11 -0000 1.8.2.6
+++ fs_native.c 6 Aug 2003 16:46:10 -0000 1.8.2.7
@@ -1035,7 +1035,7 @@ native_inop_unlink(struct pnode *pno)
* (usually .NFSXXXXXX, where the X's are replaced by the PID and some
* unique characters) in order to simulate the proper semantic.
*/
- if (!syscall(SYS_unlink, path))
+ if (syscall(SYS_unlink, path) != 0)
err = -errno;
free(path);
return err;
|
|
From: Ruth K. <rk...@us...> - 2003-08-04 15:37:08
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv22767
Modified Files:
Tag: RedStorm
fs_native.c
Log Message:
seek to new value
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.11.4.5
retrieving revision 1.11.4.6
diff -u -w -b -B -p -r1.11.4.5 -r1.11.4.6
--- fs_native.c 29 Jul 2003 19:05:08 -0000 1.11.4.5
+++ fs_native.c 4 Aug 2003 15:37:05 -0000 1.11.4.6
@@ -1127,7 +1127,7 @@ doio(ssize_t (*f)(int, const struct iove
* Avoid the reposition call if we're already at the right place.
* Allows us to access pipes and fifos.
*/
- result = nino->ni_fpos;
+ result = ioctx->ioctx_offset;
if (ioctx->ioctx_offset != nino->ni_fpos) {
int err;
|
|
From: Ruth K. <rk...@us...> - 2003-08-04 15:30:30
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv21474 Modified Files: fs_native.c Log Message: error check Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- fs_native.c 1 Aug 2003 18:05:07 -0000 1.14 +++ fs_native.c 4 Aug 2003 15:30:27 -0000 1.15 @@ -1024,7 +1024,7 @@ native_inop_unlink(struct pnode *pno) * (usually .NFSXXXXXX, where the X's are replaced by the PID and some * unique characters) in order to simulate the proper semantic. */ - if (!syscall(SYS_unlink, path)) + if (syscall(SYS_unlink, path) != 0) err = -errno; free(path); return err; |
|
From: Ruth K. <rk...@us...> - 2003-08-01 19:09:17
|
Update of /cvsroot/libsysio/libsysio/drivers/yod
In directory sc8-pr-cvs1:/tmp/cvs-serv19210
Modified Files:
Tag: cplant
fs_yod.c
Log Message:
changes to i_invalid fn as in native driver
Index: fs_yod.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/yod/Attic/fs_yod.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -w -b -B -p -r1.1.2.6 -r1.1.2.7
--- fs_yod.c 24 Jul 2003 22:52:57 -0000 1.1.2.6
+++ fs_yod.c 1 Aug 2003 19:09:15 -0000 1.1.2.7
@@ -284,7 +284,6 @@ yod_i_new(struct filesys *fs, struct int
nino = malloc(sizeof(struct yod_inode));
if (!nino)
return NULL;
- bzero(&nino->ni_ident, sizeof(nino->ni_ident));
nino->ni_ident.dev = buf->st_dev;
nino->ni_ident.ino = buf->st_ino;
#ifdef HAVE_GENERATION
@@ -474,25 +473,25 @@ yod_fsswop_mount(const char *source,
return err;
}
+static int
+yod_i_invalid(struct inode *inop, struct intnl_stat stbuf)
+{
/*
* Validate passed in inode against stat struct info
*/
-static int
-yod_i_validate(struct inode *inop, struct intnl_stat stbuf)
-{
struct yod_inode *nino = I2NI(inop);
- if ((nino->ni_ident.dev == stbuf.st_dev &&
- nino->ni_ident.ino == stbuf.st_ino &&
+ if ((nino->ni_ident.dev != stbuf.st_dev ||
+ nino->ni_ident.ino != stbuf.st_ino ||
#ifdef HAVE_GENERATION
- nino->ni_ident.gen == stbuf.st_gen &&
+ nino->ni_ident.gen != stbuf.st_gen ||
#endif
- ((inop)->i_mode & stbuf.st_mode) == (inop)->i_mode) &&
- (!(S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)) ||
- (inop)->i_rdev == stbuf.st_rdev))
- return 0;
-
+ ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) ||
+ (((inop)->i_rdev != stbuf.st_rdev) &&
+ (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode))))
return 1;
+
+ return 0;
}
/*
@@ -524,7 +523,7 @@ yod_iget(struct filesys *fs,
* Validate?
*/
if (*inop) {
- if (!yod_i_validate(*inop, stbuf))
+ if (!yod_i_invalid(*inop, stbuf))
return 0;
/*
* Invalidate.
@@ -535,7 +534,6 @@ yod_iget(struct filesys *fs,
/*
* I-node is not already known. Find or create it.
*/
- bzero(&ident, sizeof(ident));
ident.dev = stbuf.st_dev;
ident.ino = stbuf.st_ino;
#ifdef HAVE_GENERATION
@@ -548,7 +546,7 @@ yod_iget(struct filesys *fs,
/*
* Insertion was forced but it's already present!
*/
- if (yod_i_validate(ino, stbuf)) {
+ if (yod_i_invalid(ino, stbuf)) {
/*
* Cached inode has stale attrs
* make way for the new one
|
|
From: Ruth K. <rk...@us...> - 2003-08-01 18:49:15
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv15671
Modified Files:
Tag: cplant
fs_native.c
Log Message:
merge head changes into cplant branch
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.8.2.5
retrieving revision 1.8.2.6
diff -u -w -b -B -p -r1.8.2.5 -r1.8.2.6
--- fs_native.c 24 Jul 2003 22:52:57 -0000 1.8.2.5
+++ fs_native.c 1 Aug 2003 18:49:11 -0000 1.8.2.6
@@ -516,24 +516,24 @@ native_fsswop_mount(const char *source,
}
static int
-native_i_validate(struct inode *inop, struct intnl_stat stbuf)
+native_i_invalid(struct inode *inop, struct intnl_stat stbuf)
{
/*
* Validate passed in inode against stat struct info
*/
struct native_inode *nino = I2NI(inop);
- if ((nino->ni_ident.dev == stbuf.st_dev &&
- nino->ni_ident.ino == stbuf.st_ino &&
+ if ((nino->ni_ident.dev != stbuf.st_dev ||
+ nino->ni_ident.ino != stbuf.st_ino ||
#ifdef HAVE_GENERATION
- nino->ni_ident.gen == stbuf.st_gen &&
+ nino->ni_ident.gen != stbuf.st_gen ||
#endif
- ((inop)->i_mode & stbuf.st_mode) == (inop)->i_mode) &&
- ((!(S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)) ||
- (inop)->i_rdev == stbuf.st_rdev)))
- return 0;
-
+ ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) ||
+ (((inop)->i_rdev != stbuf.st_rdev) &&
+ (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode))))
return 1;
+
+ return 0;
}
/*
@@ -565,7 +565,7 @@ native_iget(struct filesys *fs,
* Validate?
*/
if (*inop) {
- if (!native_i_validate(*inop, stbuf))
+ if (!native_i_invalid(*inop, stbuf))
return 0;
/*
* Invalidate.
@@ -589,7 +589,7 @@ native_iget(struct filesys *fs,
/*
* Insertion was forced but it's already present!
*/
- if (native_i_validate(ino, stbuf)) {
+ if (native_i_invalid(ino, stbuf)) {
/*
* Cached inode has stale attrs
* make way for the new one
@@ -1017,7 +1017,7 @@ static int
native_inop_unlink(struct pnode *pno)
{
char *path;
- int err;
+ int err = 0;
path = _sysio_pb_path(pno->p_base, '/');
if (!path)
@@ -1035,7 +1035,8 @@ native_inop_unlink(struct pnode *pno)
* (usually .NFSXXXXXX, where the X's are replaced by the PID and some
* unique characters) in order to simulate the proper semantic.
*/
- err = syscall(SYS_unlink, path);
+ if (!syscall(SYS_unlink, path))
+ err = -errno;
free(path);
return err;
}
|
|
From: Ruth K. <rk...@us...> - 2003-08-01 18:05:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv2804
Modified Files:
fs_native.c
Log Message:
fixed mode check, rename so the if's make sense
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -b -B -p -r1.13 -r1.14
--- fs_native.c 29 Jul 2003 18:29:32 -0000 1.13
+++ fs_native.c 1 Aug 2003 18:05:07 -0000 1.14
@@ -504,24 +504,24 @@ native_fsswop_mount(const char *source,
}
static int
-native_i_validate(struct inode *inop, struct intnl_stat stbuf)
+native_i_invalid(struct inode *inop, struct intnl_stat stbuf)
{
/*
* Validate passed in inode against stat struct info
*/
struct native_inode *nino = I2NI(inop);
- if ((nino->ni_ident.dev == stbuf.st_dev &&
- nino->ni_ident.ino == stbuf.st_ino &&
+ if ((nino->ni_ident.dev != stbuf.st_dev ||
+ nino->ni_ident.ino != stbuf.st_ino ||
#ifdef HAVE_GENERATION
- nino->ni_ident.gen == stbuf.st_gen &&
+ nino->ni_ident.gen != stbuf.st_gen ||
#endif
- ((inop)->i_mode & stbuf.st_mode) == (inop)->i_mode) &&
- ((!(S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)) ||
- (inop)->i_rdev == stbuf.st_rdev)))
- return 0;
-
+ ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) ||
+ (((inop)->i_rdev != stbuf.st_rdev) &&
+ (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode))))
return 1;
+
+ return 0;
}
/*
@@ -553,7 +553,7 @@ native_iget(struct filesys *fs,
* Validate?
*/
if (*inop) {
- if (!native_i_validate(*inop, stbuf))
+ if (!native_i_invalid(*inop, stbuf))
return 0;
/*
* Invalidate.
@@ -577,7 +577,7 @@ native_iget(struct filesys *fs,
/*
* Insertion was forced but it's already present!
*/
- if (native_i_validate(ino, stbuf)) {
+ if (native_i_invalid(ino, stbuf)) {
/*
* Cached inode has stale attrs
* make way for the new one
@@ -1006,7 +1006,7 @@ static int
native_inop_unlink(struct pnode *pno)
{
char *path;
- int err;
+ int err = 0;
path = _sysio_pb_path(pno->p_base, '/');
if (!path)
|
|
From: Ruth K. <rk...@us...> - 2003-07-31 22:57:13
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25526/src
Modified Files:
lseek.c getdirentries.c
Log Message:
fix warnings
Index: lseek.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -b -B -p -r1.4 -r1.5
--- lseek.c 27 Apr 2003 13:20:01 -0000 1.4
+++ lseek.c 31 Jul 2003 22:21:35 -0000 1.5
@@ -58,7 +58,7 @@ _sysio_lseek(int fd, off64_t offset, int
{
int err;
struct file *fil;
- off_t off;
+ off_t off = 0;
struct intnl_stat stbuf;
err = 0;
Index: getdirentries.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -b -B -p -r1.1 -r1.2
--- getdirentries.c 9 Mar 2003 13:53:53 -0000 1.1
+++ getdirentries.c 31 Jul 2003 22:21:35 -0000 1.2
@@ -64,7 +64,7 @@ getdirentries(int fd, char *buf, size_t
off64_t ibase;
ssize_t cc;
struct dirent *dp, *nxtdp;
- struct dirent64 *od64p, *d64p;
+ struct dirent64 *od64p = NULL, *d64p = NULL;
size_t n;
size_t reclen;
char *cp;
|
|
From: Ruth K. <rk...@us...> - 2003-07-31 22:45:12
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv25526/dev/stdfd Modified Files: stdfd.c Log Message: fix warnings Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- stdfd.c 24 Mar 2003 22:09:02 -0000 1.2 +++ stdfd.c 31 Jul 2003 22:21:36 -0000 1.3 @@ -120,7 +120,7 @@ doio(ssize_t (*f)(int, char *, size_t), struct ioctx *ioctx; const struct iovec *iov; size_t n; - ssize_t cc; + ssize_t cc = 0; ioctx = _sysio_ioctx_new(ino, ioargs); if (!ioctx) |
|
From: Ruth K. <rk...@us...> - 2003-07-31 22:45:12
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1:/tmp/cvs-serv25526/drivers/incore Modified Files: fs_incore.c Log Message: fix warnings Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- fs_incore.c 23 Apr 2003 18:16:57 -0000 1.4 +++ fs_incore.c 31 Jul 2003 22:21:36 -0000 1.5 @@ -1024,7 +1024,7 @@ _sysio_incore_dirop_mkdir(struct pnode * struct incore_inode *icino, *parent; ino_t inum; int err; - struct intnl_dirent *de; + struct intnl_dirent *de = NULL; struct inode *ino; ino = pno->p_parent->p_base->pb_ino; @@ -1271,7 +1271,7 @@ incore_doio(ssize_t (*f)(struct incore_i struct ioctx *ioctx; const struct iovec *iov; size_t n; - ssize_t cc; + ssize_t cc = 0; ioctx = _sysio_ioctx_new(ino, ioargs); if (!ioctx) |
|
From: Lee W. <lw...@us...> - 2003-07-30 14:00:08
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv16020
Modified Files:
Tag: RedStorm
Makefile.am
Log Message:
That last merge introduced an error causing access.c to be ignored. Fixed.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v
retrieving revision 1.5.6.2
retrieving revision 1.5.6.3
diff -u -w -b -B -p -r1.5.6.2 -r1.5.6.3
--- Makefile.am 29 Jul 2003 20:17:22 -0000 1.5.6.2
+++ Makefile.am 30 Jul 2003 14:00:02 -0000 1.5.6.3
@@ -3,7 +3,6 @@ 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 \
lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \
- stat64.c symlink.c truncate.c unlink.c write.c
stat64.c symlink.c truncate.c unlink.c write.c access.c
include $(top_srcdir)/Rules.make
|
|
From: Lee W. <lw...@us...> - 2003-07-29 22:22:12
|
Update of /cvsroot/libsysio/libsysio
In directory sc8-pr-cvs1:/tmp/cvs-serv29917
Modified Files:
Tag: RedStorm
configure.in
Log Message:
Merged access(2) addition from the HEAD.
Index: configure.in
===================================================================
RCS file: /cvsroot/libsysio/libsysio/configure.in,v
retrieving revision 1.5.6.3
retrieving revision 1.5.6.4
diff -u -w -b -B -p -r1.5.6.3 -r1.5.6.4
|
|
From: Lee W. <lw...@us...> - 2003-07-29 21:42:41
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv29917/src
Modified Files:
Tag: RedStorm
Makefile.am
Added Files:
Tag: RedStorm
access.c
Log Message:
Merged access(2) addition from the HEAD.
--- NEW FILE ---
/*
* This Cplant(TM) source code is the property of Sandia National
* Laboratories.
*
* This Cplant(TM) source code is copyrighted by Sandia National
* Laboratories.
*
* The redistribution of this Cplant(TM) source code is subject to the
* terms of the GNU Lesser General Public License
* (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html)
*
* Cplant(TM) Copyright 1998-2003 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the US Government.
* Export of this program may require a license from the United States
* Government.
*/
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Questions or comments about this library should be sent to:
*
* Lee Ward
* Sandia National Laboratories, New Mexico
* P.O. Box 5800
* Albuquerque, NM 87185-1110
*
* le...@sa...
*/
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int
access(const char *path, int amode)
{
gid_t *list, *entry;
size_t n;
int err;
unsigned mask, mode;
struct stat stbuf;
int oerrno;
err = 0;
n = getgroups(0, NULL);
list = NULL;
if (n) {
list = malloc(n * sizeof(gid_t));
if (!list) {
err = -1;
goto out;
}
}
err = getgroups(n, list);
if (err)
goto out;
err = stat(path, &stbuf);
if (err)
goto out;
mask = 0;
if (amode & R_OK)
mask |= S_IRUSR;
if (amode & W_OK)
mask |= S_IWUSR;
if (amode & X_OK)
mask |= S_IXUSR;
mode = stbuf.st_mode;
if (stbuf.st_uid == getuid() && (mode & mask) != mask) {
err = -1;
goto out;
}
mask >>= 3;
entry = list;
while (n--) {
if (stbuf.st_gid == *entry++) {
if ((mode & mask) != mask) {
err = -1;
goto out;
}
break;
}
}
if (stbuf.st_gid == getgid() && (mode & mask) != mask) {
err = -1;
goto out;
}
mask >>= 3;
if ((mode & mask) != mask) {
err = -1;
goto out;
}
out:
oerrno = errno;
if (list)
free(list);
errno = oerrno;
return err;
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v
retrieving revision 1.5.6.1
retrieving revision 1.5.6.2
diff -u -w -b -B -p -r1.5.6.1 -r1.5.6.2
--- Makefile.am 12 May 2003 11:48:45 -0000 1.5.6.1
+++ Makefile.am 29 Jul 2003 20:17:22 -0000 1.5.6.2
@@ -4,5 +4,6 @@ libsysio_a_SOURCES = chdir.c chmod.c cho
fsync.c getdirentries.c init.c inode.c ioctl.c ioctx.c iowait.c \
lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \
stat64.c symlink.c truncate.c unlink.c write.c
+ stat64.c symlink.c truncate.c unlink.c write.c access.c
include $(top_srcdir)/Rules.make
|
|
From: Lee W. <lw...@us...> - 2003-07-29 21:42:40
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv29917/include
Modified Files:
Tag: RedStorm
sysio.h
Log Message:
Merged access(2) addition from the HEAD.
Index: sysio.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v
retrieving revision 1.7.6.1
retrieving revision 1.7.6.2
diff -u -w -b -B -p -r1.7.6.1 -r1.7.6.2
--- sysio.h 12 May 2003 11:48:45 -0000 1.7.6.1
+++ sysio.h 29 Jul 2003 20:17:22 -0000 1.7.6.2
@@ -135,9 +135,7 @@ extern void _sysio_shutdown(void);
* but it's not illegal to have multiple externs, so long as they are the
* same. It helps when building the library in a standalone fashion.
*/
-#if 0
extern int access(const char *path, int amode);
-#endif
extern int chdir(const char *path);
extern int chmod(const char *path, mode_t mode);
extern int chown(const char *path, uid_t owner, gid_t group);
|
|
From: Lee W. <lw...@us...> - 2003-07-29 21:31:27
|
Update of /cvsroot/libsysio/libsysio/drivers/native
In directory sc8-pr-cvs1:/tmp/cvs-serv12924/drivers/native
Modified Files:
Tag: RedStorm
fs_native.c
Log Message:
Pull in recent changes from the HEAD branch, to incorporate fixes there.
Index: fs_native.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v
retrieving revision 1.11.4.4
retrieving revision 1.11.4.5
diff -u -w -b -B -p -r1.11.4.4 -r1.11.4.5
--- fs_native.c 27 May 2003 12:35:55 -0000 1.11.4.4
+++ fs_native.c 29 Jul 2003 19:05:08 -0000 1.11.4.5
@@ -149,6 +149,9 @@ do {
struct native_inode_identifier {
dev_t dev; /* device number */
ino_t ino; /* i-number */
+#ifdef HAVE_GENERATION
+ unsigned int gen; /* generation number */
+#endif
};
/*
@@ -312,8 +315,12 @@ native_i_new(struct filesys *fs, struct
nino = malloc(sizeof(struct native_inode));
if (!nino)
return NULL;
+ bzero(&nino->ni_ident, sizeof(nino->ni_ident));
nino->ni_ident.dev = buf->st_dev;
nino->ni_ident.ino = buf->st_ino;
+#ifdef HAVE_GENERATION
+ nino->ni_ident.gen = buf->st_gen;
+#endif
nino->ni_fileid.fid_data = &nino->ni_ident;
nino->ni_fileid.fid_len = sizeof(nino->ni_ident);
nino->ni_fd = -1;
@@ -498,6 +505,27 @@ native_fsswop_mount(const char *source,
return err;
}
+static int
+native_i_validate(struct inode *inop, struct intnl_stat stbuf)
+{
+ /*
+ * Validate passed in inode against stat struct info
+ */
+ struct native_inode *nino = I2NI(inop);
+
+ if ((nino->ni_ident.dev == stbuf.st_dev &&
+ nino->ni_ident.ino == stbuf.st_ino &&
+#ifdef HAVE_GENERATION
+ nino->ni_ident.gen == stbuf.st_gen &&
+#endif
+ ((inop)->i_mode & stbuf.st_mode) == (inop)->i_mode) &&
+ ((!(S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)) ||
+ (inop)->i_rdev == stbuf.st_rdev)))
+ return 0;
+
+ return 1;
+}
+
/*
* Find, and validate, or create i-node by host-relative path. Returned i-node
* is referenced.
@@ -527,11 +555,7 @@ native_iget(struct filesys *fs,
* Validate?
*/
if (*inop) {
- struct native_inode *nino = I2NI(*inop);
-
- if (nino->ni_ident.dev == stbuf.st_dev &&
- nino->ni_ident.ino == stbuf.st_ino &&
- ((*inop)->i_mode & stbuf.st_mode) == (*inop)->i_mode)
+ if (!native_i_validate(*inop, stbuf))
return 0;
/*
* Invalidate.
@@ -542,23 +566,40 @@ native_iget(struct filesys *fs,
/*
* I-node is not already known. Find or create it.
*/
+ bzero(&ident, sizeof(ident));
ident.dev = stbuf.st_dev;
ident.ino = stbuf.st_ino;
+#ifdef HAVE_GENERATION
+ ident.gen = stbuf.st_gen;
+#endif
fileid.fid_data = &ident;
fileid.fid_len = sizeof(ident);
ino = _sysio_i_find(fs, stbuf.st_ino, &fileid);
- if (!ino) {
- ino = native_i_new(fs, &stbuf);
- if (!ino)
- err = -ENOMEM;
- } else if (forced) {
+ if (ino && forced) {
/*
* Insertion was forced but it's already present!
*/
+ if (native_i_validate(ino, stbuf)) {
+ /*
+ * Cached inode has stale attrs
+ * make way for the new one
+ */
I_RELE(ino);
- err = -EEXIST;
+ _sysio_i_undead(ino);
+ ino = NULL;
+ } else
+ /*
+ * OK to reuse cached inode
+ */
+ goto out;
}
+ if (!ino) {
+ ino = native_i_new(fs, &stbuf);
+ if (!ino)
+ err = -ENOMEM;
+ }
+out:
if (!err)
*inop = ino;
return err;
@@ -1032,7 +1073,8 @@ native_inop_unlink(struct pnode *pno)
* (usually .NFSXXXXXX, where the X's are replaced by the PID and some
* unique characters) in order to simulate the proper semantic.
*/
- err = syscall(SYS_unlink, path);
+ if (!syscall(SYS_unlink, path))
+ err = -errno;
free(path);
return err;
}
|
|
From: Lee W. <lw...@us...> - 2003-07-29 21:30:20
|
Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv12924/src
Modified Files:
Tag: RedStorm
inode.c namei.c
Log Message:
Pull in recent changes from the HEAD branch, to incorporate fixes there.
Index: inode.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -w -b -B -p -r1.7 -r1.7.4.1
--- inode.c 23 Apr 2003 19:45:52 -0000 1.7
+++ inode.c 29 Jul 2003 19:05:08 -0000 1.7.4.1
@@ -265,6 +265,7 @@ _sysio_i_gone(struct inode *ino)
if (ino->i_ref)
abort();
+ if (!ino->i_zombie)
LIST_REMOVE(ino, i_link);
TAILQ_REMOVE(&_sysio_inodes, ino, i_nodes);
(*ino->i_ops.inop_gone)(ino);
@@ -272,6 +273,17 @@ _sysio_i_gone(struct inode *ino)
assert(n_inodes);
n_inodes--;
+}
+
+/*
+ * Stale inode, zombie it and move it out of the way
+ */
+void
+_sysio_i_undead(struct inode *ino)
+{
+
+ LIST_REMOVE(ino, i_link);
+ ino->i_zombie = 1;
}
/*
Index: namei.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -w -b -B -p -r1.5 -r1.5.6.1
--- namei.c 24 Mar 2003 22:09:06 -0000 1.5
+++ namei.c 29 Jul 2003 19:05:09 -0000 1.5.6.1
@@ -293,8 +293,7 @@ _sysio_path_walk(struct pnode *parent, s
* Must send the intent-path again.
*/
path = nd->nd_path;
- } else if (err == -ENOENT)
- err = 0;
+ }
if (!err) {
P_RELE(pno);
nd->nd_amcnt++;
|
|
From: Lee W. <lw...@us...> - 2003-07-29 21:11:45
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv24209/src Modified Files: Makefile.am Added Files: access.c Log Message: It's baaaack! Added access(2) call. Doesn't know a thing about real vs. effective identifiers, of course. It will let the caller know if he could open the file, though. Oh, right, he could just open it, too. What a crock! --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int access(const char *path, int amode) { gid_t *list, *entry; size_t n; int err; unsigned mask, mode; struct stat stbuf; int oerrno; err = 0; n = getgroups(0, NULL); list = NULL; if (n) { list = malloc(n * sizeof(gid_t)); if (!list) { err = -1; goto out; } } err = getgroups(n, list); if (err) goto out; err = stat(path, &stbuf); if (err) goto out; mask = 0; if (amode & R_OK) mask |= S_IRUSR; if (amode & W_OK) mask |= S_IWUSR; if (amode & X_OK) mask |= S_IXUSR; mode = stbuf.st_mode; if (stbuf.st_uid == getuid() && (mode & mask) != mask) { err = -1; goto out; } mask >>= 3; entry = list; while (n--) { if (stbuf.st_gid == *entry++) { if ((mode & mask) != mask) { err = -1; goto out; } break; } } if (stbuf.st_gid == getgid() && (mode & mask) != mask) { err = -1; goto out; } mask >>= 3; if ((mode & mask) != mask) { err = -1; goto out; } out: oerrno = errno; if (list) free(list); errno = oerrno; return err; } Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- Makefile.am 24 Mar 2003 22:09:06 -0000 1.5 +++ Makefile.am 29 Jul 2003 19:53:33 -0000 1.6 @@ -3,6 +3,6 @@ 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 \ lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \ - stat64.c statvfs.c symlink.c truncate.c unlink.c write.c + stat64.c statvfs.c symlink.c truncate.c unlink.c write.c access.c include $(top_srcdir)/Rules.make |
|
From: Lee W. <lw...@us...> - 2003-07-29 21:11:43
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv24209/include Modified Files: sysio.h Log Message: It's baaaack! Added access(2) call. Doesn't know a thing about real vs. effective identifiers, of course. It will let the caller know if he could open the file, though. Oh, right, he could just open it, too. What a crock! Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- sysio.h 26 Mar 2003 00:06:04 -0000 1.7 +++ sysio.h 29 Jul 2003 19:53:33 -0000 1.8 @@ -124,9 +124,7 @@ extern void _sysio_shutdown(void); * but it's not illegal to have multiple externs, so long as they are the * same. It helps when building the library in a standalone fashion. */ -#if 0 extern int access(const char *path, int amode); -#endif extern int chdir(const char *path); extern int chmod(const char *path, mode_t mode); extern int chown(const char *path, uid_t owner, gid_t group); |
|
From: Lee W. <lw...@us...> - 2003-07-29 20:15:14
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv12924/include
Modified Files:
Tag: RedStorm
inode.h
Log Message:
Pull in recent changes from the HEAD branch, to incorporate fixes there.
Index: inode.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -u -w -b -B -p -r1.6.4.1 -r1.6.4.2
--- inode.h 12 May 2003 11:48:45 -0000 1.6.4.1
+++ inode.h 29 Jul 2003 19:05:08 -0000 1.6.4.2
@@ -133,6 +133,7 @@ struct inode_ops {
struct inode {
LIST_ENTRY(inode) i_link; /* FS i-nodes link */
unsigned i_immune : 1; /* immune from GC */
+ unsigned i_zombie : 1; /* stale inode */
unsigned i_ref; /* soft ref counter */
ino_t i_num; /* i-num (deprecate!) */
mode_t i_mode; /* mode (see stat.h) */
@@ -150,6 +151,7 @@ struct inode {
#define I_INIT(ino, fs, inum, mode, rdev, ops, fid, immunity, private) \
do { \
(ino)->i_immune = (immunity) ? 1 : 0; \
+ (ino)->i_zombie = 0; \
(ino)->i_ref = 0; \
(ino)->i_num = (inum); \
(ino)->i_mode = (mode); \
@@ -411,6 +413,7 @@ extern struct inode *_sysio_i_find(struc
ino_t ino,
struct file_identifier *fid);
extern void _sysio_i_gone(struct inode *ino);
+extern void _sysio_i_undead(struct inode *ino);
extern int _sysio_p_find_alias(struct pnode *parent,
struct qstr *name,
struct pnode **pnop);
|