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
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
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
# Define the identity of the package.
PACKAGE=openafs
- VERSION=1.4.2fc2
+ VERSION=1.4.2fc4
cat >>confdefs.h <<_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
#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"
#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"
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
-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
# Define the identity of the package.
PACKAGE=openafs-libafs
- VERSION=1.4.2fc2
+ VERSION=1.4.2fc4
cat >>confdefs.h <<_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
#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"
#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"
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
-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
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)
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
+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.
# 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
+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
+#!/bin/sh
echo "Updating configuration..."
echo "Running aclocal"
aclocal -I src/cf
#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"
#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"
}
#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 */
#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;
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);
}
#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_ */
#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"
osi_Init();
-#ifndef LINUX_KEYRING_SUPPORT
err = osi_syscall_init();
if (err)
return err;
-#endif
err = afs_init_inodecache();
if (err)
return err;
#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
#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
#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>
* 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)
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"))) {
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;
}
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;
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"
#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)
#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)
#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)
/* 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
#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"
}
}
code = myCellLookup(conf, cell, AFSCONF_KAUTHSERVICE, cellinfo);
+ afsconf_Close(conf);
UNLOCK_GLOBAL_MUTEX;
return code;
}
<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>
<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>
<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>
<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>
<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>
#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"
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;
}
#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;
}
* 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) {
ttoken.ticket);
}
}
+
if (scIndex == 1)
return PRBADARG;
if ((scIndex == 0) && (sc[0] == 0))
#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"
*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;
}
#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"
return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
}
+#if !defined(AFS_LINUX26_ENV)
void
osi_Panic(msg, a1, a2, a3)
char *msg;
msg = "Unknown AFS panic";
printf(msg, a1, a2, a3);
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX20_ENV
* ((char *) 0) = 0;
#else
panic(msg);
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
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);
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)
#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
}
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);
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,
#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>
char hoststr[16], hoststr2[16];
struct ubik_client *uclient;
+ *ahostp = NULL;
+
if (!tconn) {
ViceLog(0, ("CallPreamble: unexpected null tconn!\n"));
return -1;
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);
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;
#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>
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;
}
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)
/* 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] =
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++) {
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]);
#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>
int restartMode = RESTART_ORDINARY;
-int Testing = 0; /* for ListViceInodes */
-
/*
* Home for the performance statistics.
*/
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;
#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)
#define ROOTINODE 2
static char *partition;
-extern int Testing;
+int Testing=0;
int pfd;
#ifdef AFS_AIX32_ENV
#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>
#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
/*@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)
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
* 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)
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;
}
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;
}
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;
}
}
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;
}
/* 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;
(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);
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"
#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>
#define BASEFILEATTRIBUTE FILE_ATTRIBUTE_NORMAL
+int Testing = 0;
+
static void AddToZLCDeleteList(char dir, char *name);
/* nt_unlink - unlink a case sensitive name.
* 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) {
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:
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
{
int offset, index;
unsigned short row;
- int junk;
+ DWORD bytesRead, bytesWritten;
int code = -1;
nt_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
}
- 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)) {
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;
}
int nt_HandleToName(char *name, IHandle_t * h);
char *nt_HandleToVolDir(char *name, IHandle_t * h);
+extern int Testing;
+
#endif /* _NTOPS_H_ */
#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>
* 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;
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;
#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) {
#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>
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 */
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);
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)
#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
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 */