]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Merge with upstream 1.4.2fc4 release.
authorRuss Allbery <rra@debian.org>
Tue, 26 Sep 2006 22:47:36 +0000 (22:47 +0000)
committerRuss Allbery <rra@debian.org>
Tue, 26 Sep 2006 22:47:36 +0000 (22:47 +0000)
42 files changed:
acinclude.m4
configure
configure-libafs
configure-libafs.in
configure.in
debian/changelog
debian/rules
doc/txt/winnotes/afs-changes-since-1.2.txt
regen.sh
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_module.c
src/afs/afs_osi.h
src/afs/sysincludes.h
src/auth/cellconfig.c
src/cf/linux-test4.m4
src/config/NTMakefile.amd64_w2k
src/config/NTMakefile.i386_nt40
src/config/NTMakefile.i386_w2k
src/config/afsconfig.h.in
src/kauth/authclient.c
src/libafs/afs.ppc_darwin_70.plist.in
src/libafs/afs.ppc_darwin_80.plist.in
src/libafs/afs.ppc_darwin_90.plist.in
src/libafs/afs.x86_darwin_80.plist.in
src/libafs/afs.x86_darwin_90.plist.in
src/ptserver/ptuser.c
src/rx/DARWIN/rx_knet.c
src/rx/rx_kcommon.c
src/rx/rx_prototypes.h
src/ubik/uinit.c
src/viced/afsfileprocs.c
src/viced/host.c
src/viced/viced.c
src/vol/listinodes.c
src/vol/namei_ops.c
src/vol/namei_ops.h
src/vol/ntops.c
src/vol/ntops.h
src/vol/nuke.c
src/vol/vol-salvage.c
src/volser/volmain.c

index 3eaeee37ad73201627f0f6b155b8e0757e87b093..5485607a9e20e33d0fca68ee06caaab0137475d1 100644 (file)
@@ -113,7 +113,10 @@ case $system in
                 if test "x$with_linux_kernel_headers" != "x"; then
                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
                 else
-                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/source"
+                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
+                    LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  fi
                   if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
                     LINUX_KERNEL_PATH="/usr/src/linux-2.4"
                   fi
@@ -702,6 +705,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_alloc_sem" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_ALLOC_SEM, 1, [define if your struct inode has alloc_sem])
                 fi
+                if test "x$ac_cv_linux_fs_struct_inode_has_i_blksize" = "xyes"; then 
+                 AC_DEFINE(STRUCT_INODE_HAS_I_BLKSIZE, 1, [define if your struct inode has i_blksize])
+                fi
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_devices" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
                 fi
@@ -1044,7 +1050,7 @@ else
 fi
 AC_SUBST(BUILD_LOGIN)
 
-AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec)
+AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec flock)
 AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror strcasestr)
 AC_CHECK_FUNCS(setvbuf)
 AC_FUNC_SETVBUF_REVERSED
index 73ee35f0d13749cb6a4be7d8fd93cf1494fca301..e40394697f33d3d81ede07815a6780e366498003 100755 (executable)
--- a/configure
+++ b/configure
@@ -2168,7 +2168,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=openafs
- VERSION=1.4.2fc2
+ VERSION=1.4.2fc4
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5903,7 +5903,10 @@ _ACEOF
                 if test "x$with_linux_kernel_headers" != "x"; then
                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
                 else
-                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/source"
+                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
+                    LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  fi
                   if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
                     LINUX_KERNEL_PATH="/usr/src/linux-2.4"
                   fi
@@ -11393,14 +11396,10 @@ _ACEOF
 #include <linux/rwsem.h>
 #include <linux/key.h>
 #include <linux/keyctl.h>
-#include <asm/unistd.h>
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);
 
 void conftest(void)
 {
 #ifdef CONFIG_KEYS
-keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
 request_key(NULL, NULL, NULL);
 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH)
 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH"
@@ -11438,14 +11437,10 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <linux/rwsem.h>
 #include <linux/key.h>
 #include <linux/keyctl.h>
-#include <asm/unistd.h>
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);
 int
 main ()
 {
 #ifdef CONFIG_KEYS
-keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
 request_key(NULL, NULL, NULL);
 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH)
 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH"
@@ -12909,6 +12904,13 @@ _ACEOF
 
 cat >>confdefs.h <<\_ACEOF
 #define STRUCT_INODE_HAS_I_ALLOC_SEM 1
+_ACEOF
+
+                fi
+                if test "x$ac_cv_linux_fs_struct_inode_has_i_blksize" = "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STRUCT_INODE_HAS_I_BLKSIZE 1
 _ACEOF
 
                 fi
@@ -16333,7 +16335,8 @@ fi
 
 
 
-for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec
+
+for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec flock
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
index eaca572483585b836cb10946a53510d2f11a13d4..de338b190040af2f8a9e73ebc1bf85dc27060c10 100755 (executable)
@@ -2168,7 +2168,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=openafs-libafs
- VERSION=1.4.2fc2
+ VERSION=1.4.2fc4
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5904,7 +5904,10 @@ _ACEOF
                 if test "x$with_linux_kernel_headers" != "x"; then
                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
                 else
-                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  LINUX_KERNEL_PATH="/lib/modules/`uname -r`/source"
+                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
+                    LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
+                  fi
                   if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
                     LINUX_KERNEL_PATH="/usr/src/linux-2.4"
                   fi
@@ -11393,14 +11396,10 @@ _ACEOF
 #include <linux/rwsem.h>
 #include <linux/key.h>
 #include <linux/keyctl.h>
-#include <asm/unistd.h>
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);
 
 void conftest(void)
 {
 #ifdef CONFIG_KEYS
-keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
 request_key(NULL, NULL, NULL);
 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH)
 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH"
@@ -11438,14 +11437,10 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <linux/rwsem.h>
 #include <linux/key.h>
 #include <linux/keyctl.h>
-#include <asm/unistd.h>
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);
 int
 main ()
 {
 #ifdef CONFIG_KEYS
-keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
 request_key(NULL, NULL, NULL);
 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH)
 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH"
@@ -12909,6 +12904,13 @@ _ACEOF
 
 cat >>confdefs.h <<\_ACEOF
 #define STRUCT_INODE_HAS_I_ALLOC_SEM 1
+_ACEOF
+
+                fi
+                if test "x$ac_cv_linux_fs_struct_inode_has_i_blksize" = "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STRUCT_INODE_HAS_I_BLKSIZE 1
 _ACEOF
 
                 fi
@@ -16333,7 +16335,8 @@ fi
 
 
 
-for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec
+
+for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec flock
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
index 9a5ecc4e850b609d3dc73ab25e7f8c415df5e5cb..a99a2ea1d08e1d4ab863b678ce569e8c77863cc6 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(src/libafs/Makefile.common.in)
-AM_INIT_AUTOMAKE(openafs-libafs,1.4.2fc2)
+AM_INIT_AUTOMAKE(openafs-libafs,1.4.2fc4)
 AC_CONFIG_HEADER(src/config/afsconfig.h)
 define(OPENAFS_CONFIGURE_LIBAFS)
 
index 342f4a9807ab8f7ce742ce8fd5a587dbcd7c2bec..8884f1adf484405daec82463fb5e8c5b09956c3e 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(src/config/stds.h)
-AM_INIT_AUTOMAKE(openafs,1.4.2fc2)
+AM_INIT_AUTOMAKE(openafs,1.4.2fc4)
 AC_CONFIG_HEADER(src/config/afsconfig.h)
 
 AC_PROG_CC
index 876dc465e6a7ef93b7903d5cd69644dbc5743326..464f19b15ce3fd513d06e574669fe142f49300ea 100644 (file)
@@ -1,3 +1,9 @@
+openafs (1.4.2~fc4-1) unstable; urgency=low
+
+  * New upstream release candidate.
+
+ -- Russ Allbery <rra@debian.org>  Tue, 26 Sep 2006 15:47:02 -0700
+
 openafs (1.4.2~fc2-1) unstable; urgency=low
 
   * New upstream release candidate.
index 13dfcade27bc60f9601b78eae33331b9dce93936..5fb503201aebf6995061fcedfb847ea7e89fd545 100755 (executable)
@@ -61,8 +61,8 @@ DOC_PACKAGES = libpam-openafs-kaserver openafs-dbserver openafs-fileserver \
 
 # These variable is used only by get-orig-source, which will normally only be
 # run by maintainers.
-VERSION   = 1.4.2fc2
-DEBVERS   = 1.4.2~fc2
+VERSION   = 1.4.2fc4
+DEBVERS   = 1.4.2~fc4
 UPSTREAM  = /afs/grand.central.org/software/openafs/candidate/$(VERSION)
 
 # Download the upstream source, merge in the doc tarball, and do the
index 50d4a2e56d95fea3f839486c4a2e3b624deb379a..010b3d22836c70b71ce06df0d9097e0bf12e8351 100644 (file)
@@ -1,3 +1,20 @@
+Since 1.4.2-rc3: (1.4.2-rc4 released 16 Sep 2006)
+
+ * No changes
+
+Since 1.4.2-rc2: (1.4.2-rc3 released 6 Sep 2006)
+
+ * better handling of dot directory
+
+ * fs sq adn fs mkm now behave as on UNIX
+
+ * another backconnections hostnames fix
+
+ * add license to installers
+
+ * Return Invalid Parameter error for unknown InfoLevels in
+   SMB Tran2 Search Directory.
+
 Since 1.4.2-rc1: (1.4.2-rc2 released 30 Aug 2006)
 
  * Fix rx usage of WSAStartup/WSACleanup
index bc059256c393ae57cb3c5418e970f370047310d6..dc9f489b1c3fa2b30d6f2cc8f711280b5c8f3797 100755 (executable)
--- a/regen.sh
+++ b/regen.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 echo "Updating configuration..."
 echo "Running aclocal"
 aclocal -I src/cf
@@ -11,6 +12,9 @@ autoheader
 #echo "Running automake"
 #automake
 
+echo "Deleting autom4te.cache directory"
+rm -r autom4te.cache
+
 # Rebuild the man pages, to not require those building from source to have
 # pod2man available.
 echo "Building man pages"
index caaa918ac114fba8c00d0059163b9aa2d10dabc6..ec6c21a2bfe52ee3760faec121c8898fb73f4169 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 
 RCSID
-    ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.5 2006/08/17 13:56:29 shadow Exp $");
+    ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.6 2006/09/06 20:57:17 shadow Exp $");
 
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
@@ -189,16 +189,60 @@ __setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
 }
 
 #ifdef LINUX_KEYRING_SUPPORT
-#include <asm/unistd.h>
-#include <linux/keyctl.h>
+static struct key_type *__key_type_keyring;
 
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);
-
-static long
-__join_session_keyring(char *name)
+static int
+install_session_keyring(struct task_struct *task, struct key *keyring)
 {
-       return keyctl(KEYCTL_JOIN_SESSION_KEYRING, name);
+    struct key *old;
+    char desc[20];
+    unsigned long not_in_quota;
+    int code = -EINVAL;
+
+    if (!__key_type_keyring)
+       return code;
+
+    if (!keyring) {
+
+       /* create an empty session keyring */
+       not_in_quota = KEY_ALLOC_IN_QUOTA;
+       sprintf(desc, "_ses.%u", task->tgid);
+
+#ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
+       keyring = key_alloc(__key_type_keyring, desc,
+                           task->uid, task->gid, task,
+                           (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
+                           not_in_quota);
+#else
+       keyring = key_alloc(__key_type_keyring, desc,
+                           task->uid, task->gid,
+                           (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
+                           not_in_quota);
+#endif
+       if (IS_ERR(keyring)) {
+           code = PTR_ERR(keyring);
+           goto out;
+       }
+    }
+
+    code = key_instantiate_and_link(keyring, NULL, 0, NULL, NULL);
+    if (code < 0) {
+       key_put(keyring);
+       goto out;
+    }
+
+    /* install the keyring */
+    spin_lock_irq(&task->sighand->siglock);
+    old = task->signal->session_keyring;
+    smp_wmb();
+    task->signal->session_keyring = keyring;
+    spin_unlock_irq(&task->sighand->siglock);
+
+    if (old)
+           key_put(old);
+
+out:
+    return code;
 }
 #endif /* LINUX_KEYRING_SUPPORT */
 
@@ -255,7 +299,7 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
 #ifdef LINUX_KEYRING_SUPPORT
     if (code == 0) {
 
-       (void) __join_session_keyring(NULL);
+       (void) install_session_keyring(current, NULL);
 
        if (current->signal->session_keyring) {
            struct key *key;
@@ -520,6 +564,12 @@ struct key_type key_type_afs_pag =
 
 void osi_keyring_init(void)
 {
+    struct task_struct *p;
+
+    p = find_task_by_pid(1);
+    if (p && p->user->session_keyring)
+       __key_type_keyring = p->user->session_keyring->type;
+
     register_key_type(&key_type_afs_pag);
 }
 
index 8faca60633e6bd689bd8eaabc0ad68ed0136cb3a..23d5b95f2ecb4567dc7073d3ff581dbe0183c71a 100644 (file)
@@ -227,4 +227,66 @@ do { \
 #define AFS_ASSERT_GLOCK()
 #endif
 
+#ifdef AFS_AMD64_LINUX20_ENV
+/* RHEL5 beta's kernel doesn't define these. They aren't gonna change, so... */
+
+#ifndef __NR_ia32_afs_syscall
+#define __NR_ia32_afs_syscall 137
+#endif
+#ifndef __NR_ia32_setgroups
+#define __NR_ia32_setgroups 81
+#endif
+#ifndef __NR_ia32_setgroups32
+#define __NR_ia32_setgroups32 206
+#endif
+#ifndef __NR_ia32_close
+#define __NR_ia32_close 6
+#endif
+#ifndef __NR_ia32_chdir
+#define __NR_ia32_chdir 12
+#endif
+#ifndef __NR_ia32_break
+#define __NR_ia32_break 17
+#endif
+#ifndef __NR_ia32_stty
+#define __NR_ia32_stty 31
+#endif
+#ifndef __NR_ia32_gtty
+#define __NR_ia32_gtty 32
+#endif
+#ifndef __NR_ia32_ftime
+#define __NR_ia32_ftime 35
+#endif
+#ifndef __NR_ia32_prof
+#define __NR_ia32_prof 44
+#endif
+#ifndef __NR_ia32_lock
+#define __NR_ia32_lock 53
+#endif
+#ifndef __NR_ia32_mpx
+#define __NR_ia32_mpx 56
+#endif
+#ifndef __NR_ia32_exit
+#define __NR_ia32_exit 1
+#endif
+#ifndef __NR_ia32_mount
+#define __NR_ia32_mount 21
+#endif
+#ifndef __NR_ia32_read
+#define __NR_ia32_read 3
+#endif
+#ifndef __NR_ia32_write
+#define __NR_ia32_write 4
+#endif
+#ifndef __NR_ia32_open
+#define __NR_ia32_open 5
+#endif
+#ifndef __NR_ia32_close
+#define __NR_ia32_close 6
+#endif
+#ifndef __NR_ia32_unlink
+#define __NR_ia32_unlink 10
+#endif
+#endif
+
 #endif /* OSI_MACHDEP_H_ */
index 8dba7a087e7307eb43ce463a7c590bb0739dd15f..fd94921c483b70dca4f3efc572f5d1d92b984b70 100644 (file)
@@ -15,7 +15,7 @@
 #include "afs/param.h"
 
 RCSID
-    ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.24 2006/08/14 22:09:33 shadow Exp $");
+    ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.25 2006/09/16 19:19:36 shadow Exp $");
 
 #include <linux/module.h> /* early to avoid printf->printk mapping */
 #include "afs/sysincludes.h"
@@ -366,11 +366,9 @@ init_module(void)
 
     osi_Init();
 
-#ifndef LINUX_KEYRING_SUPPORT
     err = osi_syscall_init();
     if (err)
        return err;
-#endif
     err = afs_init_inodecache();
     if (err)
        return err;
index 771c12214e037d83d1fedb2e5b0e2bf9312d6999..36b4c579ccd877a2a0735bc7fbdcddaf976664b4 100644 (file)
@@ -220,7 +220,7 @@ typedef struct timeval osi_timeval_t;
 
 #ifdef AFS_GLOBAL_SUNLOCK
 #define AFS_ASSERT_GLOCK() \
-    (ISAFS_GLOCK() || (osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
+    do { if (!ISAFS_GLOCK()) osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__); } while (0)
 #endif /* AFS_GLOBAL_SUNLOCK */
 
 #ifdef RX_ENABLE_LOCKS
index 22fe7a684e738f6a7878e904fdbb985797591ad5..df31f0f5340281c40bd5dd360e0415a0563868d7 100644 (file)
@@ -73,6 +73,9 @@
 #if defined(LINUX_KEYRING_SUPPORT)
 #include <linux/rwsem.h>
 #include <linux/key.h>
+#ifndef KEY_ALLOC_IN_QUOTA
+#define KEY_ALLOC_IN_QUOTA 1
+#endif
 #endif
 #endif
 /* Avoid conflicts with coda overloading AFS type namespace. Must precede
index 0068138266408f667818ca3d20035fbf729eae54..0d6d97bdc3b4c1d314db39d0552768f43312d086 100644 (file)
@@ -11,7 +11,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.40.2.6 2006/03/28 18:42:57 shadow Exp $");
+    ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.40.2.8 2006/09/17 05:01:56 shadow Exp $");
 
 #include <afs/stds.h>
 #include <afs/pthread_glock.h>
@@ -114,6 +114,113 @@ static int SaveKeys(struct afsconf_dir *adir);
  * CellServDB changes.
  */
 
+#if defined(AFS_SUN5_ENV) && !defined(__sparcv9)
+/* Solaris through 10 in 32 bit mode will return EMFILE if fopen can't
+   get an fd <= 255. We allow the fileserver to claim more fds than that.
+   This has always been a problem since pr_Initialize would have the same
+   issue, but hpr_Initialize makes it more likely that we would see this. 
+   Work around it. This is not generic. It's coded with the needs of
+   afsconf_* in mind only.
+
+   http://www.opensolaris.org/os/community/onnv/flag-days/pages/2006042001/
+*/
+
+#define BUFFER 4096
+
+struct afsconf_iobuffer {
+    int _file;
+    char *buffer;
+    char *ptr;
+    char *endptr;
+};
+
+typedef struct afsconf_iobuffer afsconf_FILE;
+
+static afsconf_FILE *
+afsconf_fopen(const char *fname, const char *fmode)
+{
+    int fd;
+    afsconf_FILE *iop;
+    
+    if ((fd = open(fname, O_RDONLY)) == -1) {
+       return NULL;
+    }
+    
+    iop = malloc(sizeof(struct afsconf_iobuffer));
+    if (iop == NULL) {
+       (void) close(fd);
+       errno = ENOMEM;
+       return NULL;
+    }
+    iop->_file = fd;
+    iop->buffer = malloc(BUFFER);
+    if (iop->buffer == NULL) {
+       (void) close(fd);
+       free((void *) iop);
+       errno = ENOMEM;
+       return NULL;
+    }
+    iop->ptr = iop->buffer;
+    iop->endptr = iop->buffer;
+    return iop;
+}
+
+static int
+afsconf_fclose(afsconf_FILE *iop)
+{
+    if (iop == NULL) {
+       return 0;
+    }
+    close(iop->_file);
+    free((void *)iop->buffer);
+    free((void *)iop);
+    return 0;
+}
+
+static char *
+afsconf_fgets(char *s, int n, afsconf_FILE *iop)
+{
+    char *p;
+    
+    p = s;
+    for (;;) {
+       char c;
+       
+       if (iop->ptr == iop->endptr) {
+           ssize_t len;
+           
+           if ((len = read(iop->_file, (void *)iop->buffer, BUFFER)) == -1) {
+               return NULL;
+           }
+           if (len == 0) {
+               *p = 0;
+               if (s == p) {
+                   return NULL;
+               }
+               return s;
+           }
+           iop->ptr = iop->buffer;
+           iop->endptr = iop->buffer + len;
+       }
+       c = *iop->ptr++;
+       *p++ = c;
+       if ((p - s) == (n - 1)) {
+           *p = 0;
+           return s;
+       }
+       if (c == '\n') {
+           *p = 0;
+           return s;
+       }
+    }
+}
+#define fopen afsconf_fopen
+#define fclose afsconf_fclose
+#define fgets afsconf_fgets
+#else
+#define afsconf_FILE FILE
+#endif /* AFS_SUN5_ENV && ! __sparcv9 */
+
 /* return port number in network byte order in the low 16 bits of a long; return -1 if not found */
 static afs_int32
 afsconf_FindService(register const char *aname)
@@ -311,7 +418,7 @@ afsconf_Open(register const char *adir)
        if (!(afsconf_path = getenv("AFSCONF"))) {
            /* The "AFSCONF" environment (or contents of "/.AFSCONF") will be typically set to something like "/afs/<cell>/common/etc" where, by convention, the default files for "ThisCell" and "CellServDB" will reside; note that a major drawback is that a given afs client on that cell may NOT contain the same contents... */
            char *home_dir;
-           FILE *fp;
+           afsconf_FILE *fp;
            size_t len;
 
            if (!(home_dir = getenv("HOME"))) {
@@ -366,26 +473,31 @@ afsconf_Open(register const char *adir)
     return tdir;
 }
 
-
 static int
 GetCellUnix(struct afsconf_dir *adir)
 {
     int rc;
     char tbuffer[256];
-    FILE *tf;
-
+    int fd;
+    
     strcompose(tbuffer, 256, adir->name, "/", AFSDIR_THISCELL_FILE, NULL);
-    tf = fopen(tbuffer, "r");
-    if (tf) {
-       /* FIXME: buffer overflow waiting to happen */
-       rc = fscanf(tf, "%s", tbuffer);
-       if (rc == 1) {
-           adir->cellName = (char *)malloc(strlen(tbuffer) + 1);
-           strcpy(adir->cellName, tbuffer);
-       }
-       fclose(tf);
+    fd = open(tbuffer, O_RDONLY, 0);
+    if (fd < 0) {
+        return -1;
     } else {
-       return -1;
+       int sz;
+
+       memset(tbuffer, 0, 256);
+        sz = read(fd, tbuffer, 255);
+        close(fd);
+        if (sz > 0) {
+           char *p = strchr(tbuffer, '\n');
+           if (p)
+               *p = '\0';
+
+            adir->cellName = (char *)malloc(sz + 1);
+            strncpy(adir->cellName, tbuffer, sz);
+        }
     }
     return 0;
 }
@@ -410,7 +522,7 @@ static int
 afsconf_OpenInternal(register struct afsconf_dir *adir, char *cell,
                     char clones[])
 {
-    FILE *tf;
+    afsconf_FILE *tf;
     register char *tp, *bp;
     register struct afsconf_entry *curEntry;
     struct afsconf_aliasentry *curAlias;
index 9c2e0dfb859f1b7a80723bb62fd41fb3f7805481..5485b2f232f3330bd140dbe71c258dcb0d3bb15c 100644 (file)
@@ -614,12 +614,8 @@ AC_DEFUN([LINUX_LINUX_KEYRING_SUPPORT], [
     AC_TRY_KBUILD(
 [#include <linux/rwsem.h>
 #include <linux/key.h>
-#include <linux/keyctl.h>
-#include <asm/unistd.h>
-static int errno;
-static inline _syscall2(long, keyctl, int, option, void*, arg2);],
+#include <linux/keyctl.h>],
 [#ifdef CONFIG_KEYS
-keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
 request_key(NULL, NULL, NULL);
 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH)
 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH"
index 171d8872458df614efd0d4997ca0e48cab31b572..a0c0bcfe2bc3e1020131e14c858bf84cfcbb3c3b 100644 (file)
@@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
 #define used in WinNT/2000 installation and program version display
 AFSPRODUCT_VER_MAJOR=1
 AFSPRODUCT_VER_MINOR=4
-AFSPRODUCT_VER_PATCH=0201
+AFSPRODUCT_VER_PATCH=0203
 AFSPRODUCT_VER_BUILD=0
 
 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
index c7abe79099a14d5b1e32f90c5c4638e9023c0409..9cab67a10e6340f0cff11dd749b4fdeb6964bd93 100644 (file)
@@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
 #define used in WinNT/2000 installation and program version display
 AFSPRODUCT_VER_MAJOR=1
 AFSPRODUCT_VER_MINOR=4
-AFSPRODUCT_VER_PATCH=0201
+AFSPRODUCT_VER_PATCH=0203
 AFSPRODUCT_VER_BUILD=0
 
 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
index a188ef087d9e73320c19b4b0fd8591a082de4d44..78e3101de27113f30e23e168804e240055ac86f7 100644 (file)
@@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
 #define used in WinNT/2000 installation and program version display
 AFSPRODUCT_VER_MAJOR=1
 AFSPRODUCT_VER_MINOR=4
-AFSPRODUCT_VER_PATCH=0201
+AFSPRODUCT_VER_PATCH=0203
 AFSPRODUCT_VER_BUILD=0
 
 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
index 874f11fcbc61175ebb7c1a26f42460b69cb06a27..19492a4abe65671c0f11a5d5791dc8dcb68275ed 100644 (file)
@@ -86,6 +86,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the `flock' function. */
+#undef HAVE_FLOCK
+
 /* define if compiler has __FUNCTION__ */
 #undef HAVE_FUNCTION_MACRO
 
 /* define if your struct inode has alloc_sem */
 #undef STRUCT_INODE_HAS_I_ALLOC_SEM
 
+/* define if your struct inode has i_blksize */
+#undef STRUCT_INODE_HAS_I_BLKSIZE
+
 /* define if you struct inode has i_devices */
 #undef STRUCT_INODE_HAS_I_DEVICES
 
index 9a59181932bdbb478c49ff26201beec45bd373a6..e507396ade51b8b302a845fe09105234de1f1b2d 100644 (file)
@@ -17,7 +17,7 @@
 #endif
 
 RCSID
-    ("$Header: /cvs/openafs/src/kauth/authclient.c,v 1.14.2.4 2004/12/13 19:38:51 shadow Exp $");
+    ("$Header: /cvs/openafs/src/kauth/authclient.c,v 1.14.2.5 2006/09/15 23:19:27 jaltman Exp $");
 
 #if defined(UKERNEL)
 #include "afs/sysincludes.h"
@@ -145,6 +145,7 @@ ka_GetServers(char *cell, struct afsconf_cell * cellinfo)
        }
     }
     code = myCellLookup(conf, cell, AFSCONF_KAUTHSERVICE, cellinfo);
+    afsconf_Close(conf);
     UNLOCK_GLOBAL_MUTEX;
     return code;
 }
index c247885a8fec2e1e92d86141af04ab91497c95ba..bc7125d2731c6ee436e4248ed9165dc16f456043 100644 (file)
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>OSBundleLibraries</key>
        <dict>
                <key>com.apple.kernel.bsd</key>
index 730e0afb6feae0f903cd3529f6880a642c875a75..efde736828797ace0195fe76ce66143f82fec9c5 100644 (file)
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>OSBundleLibraries</key>
        <dict>
                <key>com.apple.kpi.bsd</key>
index 730e0afb6feae0f903cd3529f6880a642c875a75..efde736828797ace0195fe76ce66143f82fec9c5 100644 (file)
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>OSBundleLibraries</key>
        <dict>
                <key>com.apple.kpi.bsd</key>
index 730e0afb6feae0f903cd3529f6880a642c875a75..efde736828797ace0195fe76ce66143f82fec9c5 100644 (file)
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>OSBundleLibraries</key>
        <dict>
                <key>com.apple.kpi.bsd</key>
index 730e0afb6feae0f903cd3529f6880a642c875a75..efde736828797ace0195fe76ce66143f82fec9c5 100644 (file)
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.4.2fc2</string>
+       <string>1.4.2fc4</string>
        <key>OSBundleLibraries</key>
        <dict>
                <key>com.apple.kpi.bsd</key>
index 6e35d2d4fd74ae4a483cf77f93715f8d4fd20123..bbea98d4efb63d0c20d07af5f42cb01d1af0dbb2 100644 (file)
@@ -15,7 +15,7 @@
 #endif
 
 RCSID
-    ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.16.2.8 2006/07/31 17:15:48 shadow Exp $");
+    ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.16.2.10 2006/09/16 19:40:52 shadow Exp $");
 
 #if defined(UKERNEL)
 #include "afs/sysincludes.h"
@@ -71,7 +71,7 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
     afs_int32 code;
     struct rx_connection *serverconns[MAXSERVERS];
     struct rx_securityClass *sc[3];
-    static struct afsconf_dir *tdir = (struct afsconf_dir *)0; /* only do this once */
+    static struct afsconf_dir *tdir = (struct afsconf_dir *)NULL;      /* only do this once */
     static char tconfDir[100] = "";
     static char tcell[64] = "";
     struct ktc_token ttoken;
@@ -117,16 +117,16 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
     }
 #endif /* defined(UKERNEL) */
 
-    if (tdir == 0 || strcmp(confDir, tconfDir) || strcmp(cell, tcell)) {
+    if (tdir == NULL || strcmp(confDir, tconfDir) || strcmp(cell, tcell)) {
        /*
         * force re-evaluation.  we either don't have an afsconf_dir,
          * the directory has changed or the cell has changed.
         */
        if (tdir && !gottdir) {
            afsconf_Close(tdir);
-            tdir = (struct afsconf_dir *)0;
+            tdir = (struct afsconf_dir *)NULL;
         }
-       pruclient = (struct ubik_client *)0;
+       pruclient = (struct ubik_client *)NULL;
         refresh = 1;
     }
 
@@ -163,8 +163,9 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
      * want, don't get a new one. Unless the security level is 2 in
      * which case we will get one (and re-read the key file).
      */
-    if (pruclient && (lastLevel == secLevel) && (secLevel != 2))
+    if (pruclient && (lastLevel == secLevel) && (secLevel != 2)) {
        return 0;
+    }
 
     code = rx_Init(0);
     if (code) {
@@ -216,6 +217,7 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
                                              ttoken.ticket);
        }
     }
+
     if (scIndex == 1)
        return PRBADARG;
     if ((scIndex == 0) && (sc[0] == 0))
index 2b27f574729acfec020235b3d2e314cc344bc0b7..beb4403d8758fb8ff66e1650394db71bf4761a9b 100644 (file)
@@ -11,7 +11,7 @@
 #include "afs/param.h"
 
 RCSID
-    ("$Header: /cvs/openafs/src/rx/DARWIN/rx_knet.c,v 1.10.2.2 2006/01/17 17:09:48 shadow Exp $");
+    ("$Header: /cvs/openafs/src/rx/DARWIN/rx_knet.c,v 1.10.2.3 2006/09/16 00:11:24 shadow Exp $");
 
 #include "rx/rx_kcommon.h"
 
@@ -127,7 +127,9 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
                *addr = *(struct sockaddr_in *)sa;
        } else
            printf("Unknown socket family %d in NetReceive\n", sa->sa_family);
+#ifndef AFS_DARWIN80_ENV
        FREE(sa, M_SONAME);
+#endif
     }
     return code;
 }
index 7d369b475f53d488db286b2ddb844ccb78b5979e..4843dd5f0a81d961c813ce842ef8736252fff07a 100644 (file)
@@ -15,7 +15,7 @@
 #include "afs/param.h"
 
 RCSID
-    ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.12 2006/07/31 15:08:20 shadow Exp $");
+    ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.13 2006/08/31 04:54:55 shadow Exp $");
 
 #include "rx/rx_kcommon.h"
 
@@ -124,6 +124,7 @@ rxi_GetUDPSocket(u_short port)
     return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
 }
 
+#if !defined(AFS_LINUX26_ENV)
 void
 osi_Panic(msg, a1, a2, a3)
      char *msg;
@@ -132,7 +133,7 @@ osi_Panic(msg, a1, a2, a3)
        msg = "Unknown AFS panic";
 
     printf(msg, a1, a2, a3);
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX20_ENV
     * ((char *) 0) = 0; 
 #else
     panic(msg);
@@ -261,6 +262,13 @@ osi_AssertFailK(const char *expr, const char *file, int line)
 
     osi_Panic(buf);
 }
+#else
+void
+osi_AssertFailK(const char *expr, const char *file, int line)
+{
+    printk(KERN_CRIT "assertion failed: %s, file: %s, line: %d\n", expr, file, line);
+}
+#endif
 
 #ifndef UKERNEL
 /* This is the server process request loop. Kernel server
index 2599a003b46527e3b79597a0d119271e1b9f5d01..c8b1a05eafd7d77845173da7a7454a87b930cd45 100644 (file)
@@ -334,7 +334,14 @@ extern int rxk_DelPort(u_short aport);
 extern void rxk_shutdownPorts(void);
 extern osi_socket rxi_GetUDPSocket(u_short port);
 extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
-extern void osi_Panic();
+#if defined(KERNEL) && defined(AFS_LINUX26_ENV)
+#define osi_Panic(msg...) do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0)
+#undef osi_Assert
+#define osi_Assert(expr) \
+    do { if (!(expr)) { osi_AssertFailK(#expr, __FILE__, __LINE__); BUG(); } } while (0)
+#else
+extern void osi_Panic();       /* leave without args till stdarg rewrite */
+#endif
 extern int osi_utoa(char *buf, size_t len, unsigned long val);
 extern void rxi_InitPeerParams(register struct rx_peer *pp);
 extern void shutdown_rxkernel(void);
@@ -565,7 +572,6 @@ extern pthread_mutex_t rx_if_mutex;
 extern osi_socket rxi_GetUDPSocket(u_short port);
 extern void osi_AssertFailU(const char *expr, const char *file, int line);
 extern int rx_getAllAddr(afs_int32 * buffer, int maxSize);
-extern void osi_Panic();       /* leave without args till stdarg rewrite */
 extern void rxi_InitPeerParams(struct rx_peer *pp);
 
 #if defined(AFS_AIX32_ENV) && !defined(KERNEL)
index 7e91bbb4964b6258ceb8f15d217a1116c4abfc76..a03dcbb87123ff83380e0e56ece3e17f83d942f7 100644 (file)
@@ -11,7 +11,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.6.2.2 2004/11/09 17:09:41 shadow Exp $");
+    ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.6.2.3 2006/09/15 23:19:28 jaltman Exp $");
 
 #include <afs/stds.h>
 #ifdef AFS_NT40_ENV
@@ -87,6 +87,7 @@ ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
        }
        code = afsconf_ClientAuth(tdir, &sc, &scIndex); /* sets sc,scIndex */
        if (code) {
+           afsconf_Close(tdir);
            fprintf(stderr,
                    "%s: Could not get security object for -localAuth\n",
                    funcName);
@@ -96,6 +97,7 @@ ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
            afsconf_GetCellInfo(tdir, tdir->cellName, serviceid,
                                &info);
        if (code) {
+           afsconf_Close(tdir);
            fprintf(stderr,
                    "%s: can't find cell %s's hosts in %s/%s\n",
                    funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH,
index e90e9226ae1ae64bf8d54222122a5f23ec9f4fc0..92d127d14221f6a6c79162e3b53e55e707b956da 100644 (file)
@@ -29,7 +29,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.33 2006/08/01 22:33:47 shadow Exp $");
+    ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.36 2006/09/14 23:59:36 shadow Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -308,6 +308,8 @@ CallPreamble(register struct rx_call *acall, int activecall,
     char hoststr[16], hoststr2[16];
     struct ubik_client *uclient;
 
+    *ahostp = NULL;
+
     if (!tconn) {
        ViceLog(0, ("CallPreamble: unexpected null tconn!\n"));
        return -1;
@@ -427,14 +429,19 @@ CallPostamble(register struct rx_connection *aconn, afs_int32 ret,
     held = h_Held_r(thost);
     if (held)
        h_Release_r(thost);
-    if (ahost != thost) {
+    if (ahost && ahost != thost) {
        char hoststr[16], hoststr2[16]; 
        ViceLog(0, ("CallPostamble: ahost %s:%d (%x) != thost %s:%d (%x)\n",
-               afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port),
+               afs_inet_ntoa_r(ahost->host, hoststr), ntohs(ahost->port),
                ahost, 
                afs_inet_ntoa_r(thost->host, hoststr2), ntohs(thost->port),
                thost));
        h_Release_r(ahost);
+    } else if (!ahost) {
+       char hoststr[16];       
+       ViceLog(0, ("CallPostamble: null ahost for thost %s:%d (%x)\n",
+               afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port),
+               thost));
     }
     H_UNLOCK;
     return (translate ? sys_error_to_et(ret) : ret);
@@ -7388,9 +7395,13 @@ init_sys_error_to_et(void)
     sys2et[ENAMETOOLONG] = UAENAMETOOLONG;
     sys2et[ENOLCK] = UAENOLCK;
     sys2et[ENOSYS] = UAENOSYS;
+#if (ENOTEMPTY != EEXIST)
     sys2et[ENOTEMPTY] = UAENOTEMPTY;
+#endif
     sys2et[ELOOP] = UAELOOP;
+#if (EWOULDBLOCK != EAGAIN)
     sys2et[EWOULDBLOCK] = UAEWOULDBLOCK;
+#endif
     sys2et[ENOMSG] = UAENOMSG;
     sys2et[EIDRM] = UAEIDRM;
     sys2et[ECHRNG] = UAECHRNG;
index 547e6aa18f927c8cab781ca2514d870317c1f4ef..99d10431cd84ab1a0628e009d92c900d932efbad 100644 (file)
@@ -11,7 +11,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.43 2006/08/24 04:33:02 shadow Exp $");
+    ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.44 2006/09/05 22:09:00 shadow Exp $");
 
 #include <stdio.h>
 #include <errno.h>
@@ -272,31 +272,27 @@ hpr_Initialize(struct ubik_client **uclient)
 
     tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
     if (!tdir) {
-       fprintf(stderr,
-               "libprot: Could not open configuration directory: %s.\n",
-               AFSDIR_SERVER_ETC_DIRPATH);
-      return -1;
+       ViceLog(0, ("hpr_Initialize: Could not open configuration directory: %s", AFSDIR_SERVER_ETC_DIRPATH));
+       return -1;
     }
     
     code = afsconf_GetLocalCell(tdir, cellstr, sizeof(cellstr));
     if (code) {
-       fprintf(stderr,
-               "libprot: Could not get local cell. [%d]\n", code);
+       ViceLog(0, ("hpr_Initialize: Could not get local cell. [%d]", code));
        afsconf_Close(tdir);
        return code;
     }
     
     code = afsconf_GetCellInfo(tdir, cellstr, "afsprot", &info);
     if (code) {
-       fprintf(stderr, "libprot: Could not locate cell %s in %s/%s\n",
-               cellstr, confDir, AFSDIR_CELLSERVDB_FILE);
+       ViceLog(0, ("hpr_Initialize: Could not locate cell %s in %s/%s", cellstr, confDir, AFSDIR_CELLSERVDB_FILE));
        afsconf_Close(tdir);
        return code;
     }
     
     code = rx_Init(0);
     if (code) {
-        fprintf(stderr, "libprot:  Could not initialize rx.\n");
+       ViceLog(0, ("hpr_Initialize: Could not initialize rx."));
        afsconf_Close(tdir);
         return code;
     }
@@ -311,9 +307,7 @@ hpr_Initialize(struct ubik_client **uclient)
     if ((afsconf_GetLatestKey(tdir, 0, 0) == 0)) {
         code = afsconf_ClientAuthSecure(tdir, &sc[2], &scIndex);
         if (code)
-            fprintf(stderr,
-                    "libprot: clientauthsecure returns %d %s"
-                    " (so trying noauth)\n", code, error_message(code));
+           ViceLog(0, ("hpr_Initialize: clientauthsecure returns %d %s (so trying noauth)", code, error_message(code)));
         if (code)
             scIndex = 0;        /* use noauth */
         if (scIndex != 2)
@@ -332,9 +326,7 @@ hpr_Initialize(struct ubik_client **uclient)
                 /* this is a kerberos ticket, set scIndex accordingly */
                 scIndex = 2;
             else {
-                fprintf(stderr,
-                        "libprot: funny kvno (%d) in ticket, proceeding\n",
-                        ttoken.kvno);
+                ViceLog(0, ("hpr_Initialize: funny kvno (%d) in ticket, proceeding", ttoken.kvno));
                 scIndex = 2;
             }
             sc[2] =
@@ -346,8 +338,7 @@ hpr_Initialize(struct ubik_client **uclient)
     if ((scIndex == 0) && (sc[0] == 0))
         sc[0] = rxnull_NewClientSecurityObject();
     if ((scIndex == 0))
-        com_err("fileserver", code,
-                "Could not get afs tokens, running unauthenticated.");
+       ViceLog(0, ("hpr_Initialize: Could not get afs tokens, running unauthenticated. [%d]", code));
     
     memset(serverconns, 0, sizeof(serverconns));        /* terminate list!!! */
     for (i = 0; i < info.numServers; i++) {
@@ -359,7 +350,7 @@ hpr_Initialize(struct ubik_client **uclient)
 
     code = ubik_ClientInit(serverconns, uclient);
     if (code) {
-        com_err("fileserver", code, "ubik client init failed.");
+       ViceLog(0, ("hpr_Initialize: ubik client init failed. [%d]", code));
     }
     afsconf_Close(tdir);
     code = rxs_Release(sc[scIndex]);
index c50971081ab46c7531c8965e73a22eee6e44f1a4..1ec8786463f06d035312a4441b06d7d663508a6b 100644 (file)
@@ -20,7 +20,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.16 2006/08/24 02:35:59 shadow Exp $");
+    ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.18 2006/09/15 23:19:28 jaltman Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -150,8 +150,6 @@ struct afsconf_dir *confDir;        /* Configuration dir object */
 
 int restartMode = RESTART_ORDINARY;
 
-int Testing = 0;               /* for ListViceInodes */
-
 /*
  * Home for the performance statistics.
  */
@@ -1374,6 +1372,7 @@ vl_Initialize(char *confDir)
                             info.hostAddr[i].sin_port, USER_SERVICE_ID, sc,
                             scIndex);
     code = ubik_ClientInit(serverconns, &cstruct);
+    afsconf_Close(tdir);
     if (code) {
        ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
        return code;
index 192350297b41b14b319a06167cd35d4376966421..c45a57026dbc8bdd97dbaba48710975bcff64c19 100644 (file)
@@ -21,7 +21,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/vol/listinodes.c,v 1.13.2.3 2005/11/01 16:45:44 shadow Exp $");
+    ("$Header: /cvs/openafs/src/vol/listinodes.c,v 1.13.2.4 2006/09/03 05:51:42 shadow Exp $");
 
 #ifndef AFS_NAMEI_ENV
 #if defined(AFS_LINUX20_ENV) || defined(AFS_SUN4_ENV)
@@ -135,7 +135,7 @@ extern off_t afs_lseek(int FD, off_t O, int F);
 
 #define        ROOTINODE       2
 static char *partition;
-extern int Testing;
+int Testing=0;
 int pfd;
 
 #ifdef AFS_AIX32_ENV
index 53c3f6dd50730e0a2429cc165e11475928713478..f4e3497d6275d88f76800b31dd70d4ef98657971 100644 (file)
@@ -13,7 +13,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.6 2006/07/31 15:18:51 shadow Exp $");
+    ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.10 2006/09/20 05:52:35 shadow Exp $");
 
 #ifdef AFS_NAMEI_ENV
 #include <stdio.h>
@@ -27,9 +27,6 @@ RCSID
 #include <sys/file.h>
 #include <sys/param.h>
 #include <lock.h>
-#ifdef AFS_AIX_ENV
-#include <sys/lockf.h>
-#endif
 #if defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
 #include <unistd.h>
 #endif
@@ -69,7 +66,41 @@ extern off_t afs_lseek(int FD, off_t O, int F);
 
 /*@printflike@*/ extern void Log(const char *format, ...);
 
+#ifndef LOCK_SH
+#define   LOCK_SH   1    /* shared lock */
+#define   LOCK_EX   2    /* exclusive lock */
+#define   LOCK_NB   4    /* don't block when locking */
+#define   LOCK_UN   8    /* unlock */
+#endif
+
+#ifndef HAVE_FLOCK
+#include <fcntl.h>
+
+/*
+ * This function emulates a subset of flock()
+ */
+int 
+emul_flock(int fd, int cmd)
+{    struct flock f;
+
+    memset(&f, 0, sizeof (f));
+
+    if (cmd & LOCK_UN)
+        f.l_type = F_UNLCK;
+    if (cmd & LOCK_SH)
+        f.l_type = F_RDLCK;
+    if (cmd & LOCK_EX)
+        f.l_type = F_WRLCK;
+
+    return fcntl(fd, (cmd & LOCK_NB) ? F_SETLK : F_SETLKW, &f);
+}
+
+#define flock(f,c)      emul_flock(f,c)
+#endif
+
 extern char *volutil_PartitionName_r(int volid, char *buf, int buflen);
+int Testing=0;
+
 
 afs_sfsize_t
 namei_iread(IHandle_t * h, afs_foff_t offset, char *buf, afs_fsize_t size)
@@ -149,7 +180,8 @@ typedef struct {
     int ogm_mode;
 } namei_ogm_t;
 
-int namei_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked);
+static int namei_GetLinkCount2(FdHandle_t * h, Inode ino, int lockit, int fixup, int nowrite);
+
 static int GetFreeTag(IHandle_t * ih, int vno);
 
 /* namei_HandleToInodeDir
@@ -858,43 +890,65 @@ namei_GetLCOffsetAndIndexFromIno(Inode ino, afs_foff_t * offset, int *index)
  * If lockit is set, lock the file and leave it locked upon a successful
  * return.
  */
-int
-namei_GetLinkCount(FdHandle_t * h, Inode ino, int lockit)
+static int
+namei_GetLinkCount2(FdHandle_t * h, Inode ino, int lockit, int fixup, int nowrite)
 {
     unsigned short row = 0;
     afs_foff_t offset;
+    ssize_t rc;
     int index;
 
+    /* there's no linktable yet. the salvager will create one later */
+    if (h->fd_fd == -1 && fixup)
+       return 1;
     namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
 
     if (lockit) {
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-       if (lockf(h->fd_fd, F_LOCK, 0) < 0)
-#else
        if (flock(h->fd_fd, LOCK_EX) < 0)
-#endif
            return -1;
     }
 
     if (afs_lseek(h->fd_fd, offset, SEEK_SET) == -1)
        goto bad_getLinkByte;
 
-    if (read(h->fd_fd, (char *)&row, sizeof(row)) != sizeof(row)) {
+    rc = read(h->fd_fd, (char *)&row, sizeof(row));
+    if ((rc == 0 || !((row >> index) & NAMEI_TAGMASK)) && fixup && nowrite)
+        return 1;
+    if (rc == 0 && fixup) {
+        struct stat st;
+        if (fstat(h->fd_fd, &st) || st.st_size >= offset+sizeof(row))
+          goto bad_getLinkByte;
+        FDH_TRUNC(h, offset+sizeof(row));
+        row = 1 << index;
+        rc = write(h->fd_fd, (char *)&row, sizeof(row));
+    }
+    if (rc != sizeof(row)) {
        goto bad_getLinkByte;
     }
 
+    if (fixup && !((row >> index) & NAMEI_TAGMASK)) {
+        row |= 1<<index;
+        if (afs_lseek(h->fd_fd, offset, SEEK_SET) == -1)
+           goto bad_getLinkByte;
+        rc = write(h->fd_fd, (char *)&row, sizeof(row));
+        if (rc != sizeof(row))
+           goto bad_getLinkByte;
+    }
     return (int)((row >> index) & NAMEI_TAGMASK);
 
   bad_getLinkByte:
     if (lockit)
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-       lockf(h->fd_fd, F_ULOCK, 0);
-#else
        flock(h->fd_fd, LOCK_UN);
-#endif
     return -1;
 }
 
+int
+namei_GetLinkCount(FdHandle_t * h, Inode ino, int lockit) 
+{
+    return namei_GetLinkCount2(h, ino, lockit, 0, 1);
+}
+
 /* Return a free column index for this vnode. */
 static int
 GetFreeTag(IHandle_t * ih, int vno)
@@ -912,11 +966,7 @@ GetFreeTag(IHandle_t * ih, int vno)
        return -1;
 
     /* Only one manipulates at a time. */
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-    if (lockf(fdP->fd_fd, F_LOCK, 0) < 0) {
-#else
     if (flock(fdP->fd_fd, LOCK_EX) < 0) {
-#endif
        FDH_REALLYCLOSE(fdP);
        return -1;
     }
@@ -952,20 +1002,12 @@ GetFreeTag(IHandle_t * ih, int vno)
        goto badGetFreeTag;
     }
     FDH_SYNC(fdP);
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-    lockf(fdP->fd_fd, F_ULOCK, 0);
-#else
     flock(fdP->fd_fd, LOCK_UN);
-#endif
     FDH_REALLYCLOSE(fdP);
     return col;;
 
   badGetFreeTag:
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-    lockf(fdP->fd_fd, F_ULOCK, 0);
-#else
     flock(fdP->fd_fd, LOCK_UN);
-#endif
     FDH_REALLYCLOSE(fdP);
     return -1;
 }
@@ -988,11 +1030,7 @@ namei_SetLinkCount(FdHandle_t * fdP, Inode ino, int count, int locked)
     namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
 
     if (!locked) {
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-       if (lockf(fdP->fd_fd, F_LOCK, 0) < 0) {
-#else
        if (flock(fdP->fd_fd, LOCK_EX) < 0) {
-#endif
            return -1;
        }
     }
@@ -1031,11 +1069,7 @@ namei_SetLinkCount(FdHandle_t * fdP, Inode ino, int count, int locked)
 
 
   bad_SetLinkCount:
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV)
-    lockf(fdP->fd_fd, F_ULOCK, 0);
-#else
     flock(fdP->fd_fd, LOCK_UN);
-#endif
 
     return code;
 }
@@ -1289,9 +1323,9 @@ namei_ListAFSSubDirs(IHandle_t * dirIH,
                /* Open this handle */
                (void)afs_snprintf(path2, sizeof path2, "%s/%s", path1,
                                   dp1->d_name);
-               linkHandle.fd_fd = afs_open(path2, O_RDONLY, 0666);
+               linkHandle.fd_fd = afs_open(path2, Testing ? O_RDONLY : O_RDWR, 0666);
                info.linkCount =
-                   namei_GetLinkCount(&linkHandle, (Inode) 0, 0);
+                   namei_GetLinkCount2(&linkHandle, (Inode) 0, 1, 1, Testing);
            }
            if (judgeFun && !(*judgeFun) (&info, singleVolumeNumber, rock))
                continue;
@@ -1342,8 +1376,8 @@ namei_ListAFSSubDirs(IHandle_t * dirIH,
                                (path3, dp3->d_name, &info, myIH.ih_vid) < 0)
                                continue;
                            info.linkCount =
-                               namei_GetLinkCount(&linkHandle,
-                                                  info.inodeNumber, 0);
+                               namei_GetLinkCount2(&linkHandle,
+                                                  info.inodeNumber, 1, 1, Testing);
                            if (info.linkCount == 0) {
 #ifdef DELETE_ZLC
                                Log("Found 0 link count file %s/%s, deleting it.\n", path3, dp3->d_name);
index 9f0df4a923ace5bf64711a54cd7cf8d730a9c56e..d32f8208c71f9f8f01f956c0cac2445650133658 100644 (file)
@@ -42,6 +42,7 @@ afs_sfsize_t namei_iwrite(IHandle_t * h, afs_foff_t offset, char *buf,
 extern int namei_dec(IHandle_t * h, Inode ino, int p1);
 extern int namei_inc(IHandle_t * h, Inode ino, int p1);
 extern int namei_GetLinkCount(FdHandle_t * h, Inode ino, int lockit);
+extern int namei_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked);
 extern int namei_ViceREADME(char *partition);
 #include "nfs.h"
 #include "viceinode.h"
index f64644acca800075491c2a6ec547cc59bc113b69..2991fe0ebf946f43d2b91ab85bae49945839dc8e 100644 (file)
@@ -13,7 +13,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/vol/ntops.c,v 1.7.2.1 2004/10/18 07:12:28 shadow Exp $");
+    ("$Header: /cvs/openafs/src/vol/ntops.c,v 1.7.2.2 2006/09/05 14:50:57 shadow Exp $");
 
 #ifdef AFS_NT40_ENV
 #include <stdio.h>
@@ -41,6 +41,8 @@ RCSID
 
 #define BASEFILEATTRIBUTE FILE_ATTRIBUTE_NORMAL
 
+int Testing = 0;
+
 static void AddToZLCDeleteList(char dir, char *name);
 
 /* nt_unlink - unlink a case sensitive name.
@@ -837,13 +839,17 @@ nt_GetLCOffsetAndIndexFromIno(Inode ino, int *offset, int *index)
  * If lockit is set, lock the file and leave it locked upon a successful
  * return.
  */
-int
-nt_GetLinkCount(FdHandle_t * h, Inode ino, int lockit)
+static int
+nt_GetLinkCountInternal(FdHandle_t * h, Inode ino, int lockit, int fixup)
 {
     unsigned short row = 0;
-    int junk;
+    DWORD bytesRead, bytesWritten;
     int offset, index;
 
+    /* there's no linktable yet. the salvager will create one later */
+    if (h->fd_fd == INVALID_HANDLE_VALUE && fixup)
+       return 1;
+
     nt_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
 
     if (lockit) {
@@ -854,10 +860,25 @@ nt_GetLinkCount(FdHandle_t * h, Inode ino, int lockit)
     if (!SetFilePointer(h->fd_fd, (LONG) offset, NULL, FILE_BEGIN))
        goto bad_getLinkByte;
 
-    if (!ReadFile(h->fd_fd, (void *)&row, 2, &junk, NULL)) {
+    if (!ReadFile(h->fd_fd, (void *)&row, 2, &bytesRead, NULL)) 
        goto bad_getLinkByte;
+    
+    if (bytesRead == 0 && fixup) { 
+       LARGE_INTEGER size;
+
+       if (!GetFileSizeEx(h->fd_fd, &size) || size.QuadPart >= offset+sizeof(row))
+           goto bad_getLinkByte;
+       FDH_TRUNC(h, offset+sizeof(row));
+       row = 1 << index;
+      rewrite:
+       WriteFile(h->fd_fd, (char *)&row, sizeof(row), &bytesWritten, NULL);
     }
 
+    if (fixup && !((row >> index) & NT_TAGMASK)) {
+        row |= 1<<index;
+        goto rewrite;
+    }
     return (int)((row >> index) & NT_TAGMASK);
 
   bad_getLinkByte:
@@ -866,7 +887,17 @@ nt_GetLinkCount(FdHandle_t * h, Inode ino, int lockit)
     return -1;
 }
 
+int
+nt_GetLinkCount(FdHandle_t * h, Inode ino, int lockit)
+{
+    return nt_GetLinkCountInternal(h, ino, lockit, 0);
+}
 
+void
+nt_SetNonZLC(FdHandle_t * h, Inode ino) 
+{
+    (void)nt_GetLinkCountInternal(h, ino, 0, 1);
+}
 
 
 /* nt_SetLinkCount
@@ -878,7 +909,7 @@ nt_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked)
 {
     int offset, index;
     unsigned short row;
-    int junk;
+    DWORD bytesRead, bytesWritten;
     int code = -1;
 
     nt_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
@@ -896,16 +927,16 @@ nt_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked)
     }
 
 
-    if (!ReadFile(h->fd_fd, (void *)&row, 2, &junk, NULL)) {
+    if (!ReadFile(h->fd_fd, (void *)&row, 2, &bytesRead, NULL)) {
        errno = nterr_nt2unix(GetLastError(), EBADF);
        goto bad_SetLinkCount;
     }
-    if (junk == 0)
+    if (bytesRead == 0)
        row = 0;
 
-    junk = 7 << index;
+    bytesRead = 7 << index;
     count <<= index;
-    row &= (unsigned short)~junk;
+    row &= (unsigned short)~bytesRead;
     row |= (unsigned short)count;
 
     if (!SetFilePointer(h->fd_fd, (LONG) offset, NULL, FILE_BEGIN)) {
@@ -913,7 +944,7 @@ nt_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked)
        goto bad_SetLinkCount;
     }
 
-    if (!WriteFile(h->fd_fd, (void *)&row, 2, &junk, NULL)) {
+    if (!WriteFile(h->fd_fd, (void *)&row, 2, &bytesWritten, NULL)) {
        errno = nterr_nt2unix(GetLastError(), EBADF);
        goto bad_SetLinkCount;
     }
index f1f1f36a47153308afd12fb72c4cd41cba7a10fd..572e5ee1da6c23f31384835070fdfd46436836de 100644 (file)
@@ -60,4 +60,6 @@ int ListViceInodes(char *devname, char *mountedOn, char *resultFile,
 int nt_HandleToName(char *name, IHandle_t * h);
 char *nt_HandleToVolDir(char *name, IHandle_t * h);
 
+extern int Testing;
+
 #endif /* _NTOPS_H_ */
index d9172c48c5d1b09e80e6a8867136e808c897fc9a..9bd9ef114b1edb9b4632c4cdd20603b53aa12574 100644 (file)
@@ -11,7 +11,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/vol/nuke.c,v 1.13.2.2 2004/10/18 17:44:06 shadow Exp $");
+    ("$Header: /cvs/openafs/src/vol/nuke.c,v 1.13.2.3 2006/09/03 05:38:09 shadow Exp $");
 
 #include <rx/xdr.h>
 #include <afs/afsint.h>
@@ -72,7 +72,7 @@ struct ilist {
  * Note that ainfo->u.param[0] is always the volume ID, for any vice inode.
  */
 static int
-NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist *allInodes)
+NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist **allInodes)
 {
     struct ilist *ti;
     register afs_int32 i;
@@ -85,13 +85,13 @@ NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist *allInodes)
     if (ainfo->u.param[0] != avolid)
        return 0;               /* don't want this one */
     /* record the info */
-    if (!allInodes || allInodes->freePtr >= MAXATONCE) {
+    if (!*allInodes || (*allInodes)->freePtr >= MAXATONCE) {
        ti = (struct ilist *)malloc(sizeof(struct ilist));
        memset(ti, 0, sizeof(*ti));
-       ti->next = allInodes;
-       allInodes = ti;
+       ti->next = *allInodes;
+       *allInodes = ti;
     } else
-       ti = allInodes;         /* use the one with space */
+       ti = *allInodes;                /* use the one with space */
     i = ti->freePtr++;         /* find our slot in this mess */
     ti->inode[i] = ainfo->inodeNumber;
     ti->count[i] = ainfo->linkCount;
@@ -170,11 +170,11 @@ nuke(char *aname, afs_int32 avolid)
 #ifdef AFS_NAMEI_ENV
     code =
        ListViceInodes(lastDevComp, aname, NULL, NukeProc, avolid, &forceSal,
-                      0, wpath, allInodes);
+                      0, wpath, &allInodes);
 #else
     code =
        ListViceInodes(lastDevComp, aname, "/tmp/vNukeXX", NukeProc, avolid,
-                      &forceSal, 0, wpath, allInodes);
+                      &forceSal, 0, wpath, &allInodes);
     unlink("/tmp/vNukeXX");    /* clean it up now */
 #endif
     if (code == 0) {
index db9983b75e3b6ea38c45acf921a44a29dcd63dc4..215c72e85a436960a5cdf37b5ea8b89fc237bd0c 100644 (file)
@@ -92,7 +92,7 @@ Vnodes with 0 inode pointers in RW volumes are now deleted.
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.41.2.8 2006/06/30 13:59:10 shadow Exp $");
+    ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.41.2.12 2006/09/05 23:48:50 jaltman Exp $");
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -227,7 +227,7 @@ static char *TimeStamp(time_t clock, int precision);
 
 
 int debug;                     /* -d flag */
-int Testing = 0;               /* -n flag */
+extern int Testing;            /* -n flag */
 int ListInodeOption;           /* -i flag */
 int ShowRootFiles;             /* -r flag */
 int RebuildDirs;               /* -sal flag */
@@ -1849,7 +1849,7 @@ CreateLinkTable(register struct InodeSummary *isp, Inode ino)
        Abort("Can't open link table for volume %u (error = %d)\n",
              isp->RWvolumeId, errno);
 
-    if (FDH_TRUNC(fdP, 0) < 0)
+    if (FDH_TRUNC(fdP, sizeof(version) + sizeof(short)) < 0)
        Abort("Can't truncate link table for volume %u (error = %d)\n",
              isp->RWvolumeId, errno);
 
@@ -1971,7 +1971,23 @@ DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols)
        if (Testing) {
            IH_INIT(VGLinkH, fileSysDevice, -1, -1);
        } else {
+            int i, j;
+            struct ViceInodeInfo *ip;
            CreateLinkTable(isp, ino);
+           fdP = IH_OPEN(VGLinkH);
+            /* Sync fake 1 link counts to the link table, now that it exists */
+            if (fdP) {
+               for (i = 0; i < nVols; i++) {
+                       ip = allInodes + isp[i].index;
+                        for (j = isp[i].nSpecialInodes; j < isp[i].nInodes; j++) {
+#ifdef AFS_NT40_ENV
+                                nt_SetLinkCount(fdP, ip[j].inodeNumber, 1, 1);
+#else
+                                namei_SetLinkCount(fdP, ip[j].inodeNumber, 1, 1);
+#endif
+                   }
+               }
+           }
        }
     }
     if (fdP)
index 08de5699cd7ab1dd3dda046dbb73938295152fbe..58c41d5f7daf1595b9b2d3dc5b6db0392789557d 100644 (file)
@@ -11,7 +11,7 @@
 #include <afs/param.h>
 
 RCSID
-    ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.18.2.7 2006/08/24 20:21:52 shadow Exp $");
+    ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.18.2.8 2006/09/03 05:51:42 shadow Exp $");
 
 #include <sys/types.h>
 #ifdef AFS_NT40_ENV
@@ -95,7 +95,6 @@ int DoLogging = 0;
 int lwps = 9;
 int udpBufSize = 0;            /* UDP buffer size for receive */
 
-int Testing = 0;               /* for ListViceInodes */
 int rxBind = 0;
 
 #define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */