From: Russ Allbery Date: Thu, 12 Feb 2009 18:53:04 +0000 (-0800) Subject: Apply upstream STABLE14-libuafs-updates-20081229 X-Git-Tag: debian/1.4.8.dfsg1-1~30 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c1f8041ddff64d26603e3447a3c5514546c1d657;p=packages%2Fo%2Fopenafs.git Apply upstream STABLE14-libuafs-updates-20081229 Not particularly important for Debian, but it's a prerequisite for other deltas to apply cleanly. --- diff --git a/debian/changelog b/debian/changelog index 9a4c5ecc6..f5ac050b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ openafs (1.4.8.dfsg1-1) UNRELEASED; urgency=low - Check at compile time that the kernel has keyring support rather than building non-functional modules. (Closes: #500850) - Include vos clone man page. (LP: #324449) + * Apply upstream CVS deltas: + - STABLE14-libuafs-updates-20081229: prerequisite for other deltas. * Make dynroot the default for new installations. It works much better with systems that don't bring up their network until late in the boot process, such as wireless laptops. (LP: #249240, #318605) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index b4dcf21ca..608704dd9 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.9 2008/10/27 23:54:09 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.10 2008/12/29 21:26:24 shadow Exp $"); #ifdef UKERNEL @@ -56,7 +56,7 @@ char afs_LclCellName[64]; struct usr_vnode *afs_FileTable[MAX_OSI_FILES]; int afs_FileFlags[MAX_OSI_FILES]; -int afs_FileOffsets[MAX_OSI_FILES]; +off_t afs_FileOffsets[MAX_OSI_FILES]; #define MAX_CACHE_LOOPS 4 @@ -107,8 +107,8 @@ int usr_udpcksum = 0; usr_key_t afs_global_u_key; -struct usr_proc *afs_global_procp; -struct usr_ucred *afs_global_ucredp; +struct usr_proc *afs_global_procp = NULL; +struct usr_ucred *afs_global_ucredp = NULL; struct usr_sysent usr_sysent[200]; #ifdef AFS_USR_OSF_ENV @@ -1562,7 +1562,7 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, cacheStatEntries = cacheStatEntriesParam; } strcpy(cacheBaseDir, cacheBaseDirParam); - if (nDaemons != 0) { + if (nDaemonsParam != 0) { nDaemons = nDaemonsParam; } else { nDaemons = 3; @@ -1847,7 +1847,11 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, (long)pathname_for_V[currVFile], 0, 0, 0); } /*end for */ -#ifndef NETSCAPE_NSAPI +/*#ifndef NETSCAPE_NSAPI*/ +#if 0 +/* this breaks solaris if the kernel-mode client has never been installed, + * and it doesn't seem to work now anyway, so just disable it */ + /* * Copy our tokens from the kernel to the user space client */ @@ -2692,6 +2696,7 @@ uafs_open_r(char *path, int flags, int mode) errno = code; return -1; } + fileP = AFSTOV(vc); } else { fileP = NULL; code = uafs_LookupName(nameP, dirP, &fileP, 1, 0); @@ -2764,6 +2769,7 @@ uafs_open_r(char *path, int flags, int mode) */ if ((flags & O_TRUNC) && (attrs.va_size != 0)) { usr_vattr_null(&attrs); + attrs.va_mask = ATTR_SIZE; attrs.va_size = 0; code = afs_setattr(VTOAFS(fileP), &attrs, u.u_cred); if (code != 0) { @@ -2835,13 +2841,23 @@ uafs_write(int fd, char *buf, int len) { int retval; AFS_GLOCK(); - retval = uafs_write_r(fd, buf, len); + retval = uafs_pwrite_r(fd, buf, len, afs_FileOffsets[fd]); + AFS_GUNLOCK(); + return retval; +} + +int +uafs_pwrite(int fd, char *buf, int len, off_t offset) +{ + int retval; + AFS_GLOCK(); + retval = uafs_pwrite_r(fd, buf, len, offset); AFS_GUNLOCK(); return retval; } int -uafs_write_r(int fd, char *buf, int len) +uafs_pwrite_r(int fd, char *buf, int len, off_t offset) { int code; struct usr_uio uio; @@ -2864,7 +2880,7 @@ uafs_write_r(int fd, char *buf, int len) iov[0].iov_len = len; uio.uio_iov = &iov[0]; uio.uio_iovcnt = 1; - uio.uio_offset = afs_FileOffsets[fd]; + uio.uio_offset = offset; uio.uio_segflg = 0; uio.uio_fmode = FWRITE; uio.uio_resid = len; @@ -2891,13 +2907,23 @@ uafs_read(int fd, char *buf, int len) { int retval; AFS_GLOCK(); - retval = uafs_read_r(fd, buf, len); + retval = uafs_pread_r(fd, buf, len, afs_FileOffsets[fd]); + AFS_GUNLOCK(); + return retval; +} + +int +uafs_pread(int fd, char *buf, int len, off_t offset) +{ + int retval; + AFS_GLOCK(); + retval = uafs_pread_r(fd, buf, len, offset); AFS_GUNLOCK(); return retval; } int -uafs_read_r(int fd, char *buf, int len) +uafs_pread_r(int fd, char *buf, int len, off_t offset) { int code; struct usr_uio uio; @@ -2921,7 +2947,7 @@ uafs_read_r(int fd, char *buf, int len) iov[0].iov_len = len; uio.uio_iov = &iov[0]; uio.uio_iovcnt = 1; - uio.uio_offset = afs_FileOffsets[fd]; + uio.uio_offset = offset; uio.uio_segflg = 0; uio.uio_fmode = FREAD; uio.uio_resid = len; @@ -3105,6 +3131,7 @@ uafs_chmod_r(char *path, int mode) return -1; } usr_vattr_null(&attrs); + attrs.va_mask = ATTR_MODE; attrs.va_mode = mode; code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); VN_RELE(vp); @@ -3141,6 +3168,7 @@ uafs_fchmod_r(int fd, int mode) return -1; } usr_vattr_null(&attrs); + attrs.va_mask = ATTR_MODE; attrs.va_mode = mode; code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); if (code != 0) { @@ -3176,6 +3204,7 @@ uafs_truncate_r(char *path, int length) return -1; } usr_vattr_null(&attrs); + attrs.va_mask = ATTR_SIZE; attrs.va_size = length; code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); VN_RELE(vp); @@ -3212,6 +3241,7 @@ uafs_ftruncate_r(int fd, int length) return -1; } usr_vattr_null(&attrs); + attrs.va_mask = ATTR_SIZE; attrs.va_size = length; code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); if (code != 0) { diff --git a/src/afs/UKERNEL/afs_usrops.h b/src/afs/UKERNEL/afs_usrops.h index a806e5a09..d475fe5dd 100644 --- a/src/afs/UKERNEL/afs_usrops.h +++ b/src/afs/UKERNEL/afs_usrops.h @@ -61,7 +61,7 @@ extern struct usr_vnode *afs_RootVnode; extern struct usr_vnode *afs_CurrentDir; extern struct usr_vnode *afs_FileTable[]; extern int afs_FileFlags[]; -extern int afs_FileOffsets[]; +extern off_t afs_FileOffsets[]; extern char afs_mountDir[]; extern int afs_mountDirLen; @@ -90,9 +90,11 @@ extern int uafs_open_r(char *path, int flags, int mode); extern int uafs_creat(char *path, int mode); extern int uafs_creat_r(char *path, int mode); extern int uafs_write(int fd, char *buf, int len); -extern int uafs_write_r(int fd, char *buf, int len); +extern int uafs_pwrite(int fd, char *buf, int len, off_t offset); +extern int uafs_pwrite_r(int fd, char *buf, int len, off_t offset); extern int uafs_read(int fd, char *buf, int len); -extern int uafs_read_r(int fd, char *buf, int len); +extern int uafs_pread(int fd, char *buf, int leni, off_t offset); +extern int uafs_pread_r(int fd, char *buf, int len, off_t offset); extern int uafs_fsync(int fd); extern int uafs_fsync_r(int fd); extern int uafs_close(int fd); diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index ab6d449af..ebe576ee8 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -1017,22 +1017,28 @@ struct usr_statfs { unsigned long f_files; }; +#define ATTR_MODE (1 << 0) +#define ATTR_UID (1 << 1) +#define ATTR_GID (1 << 2) +#define ATTR_MTIME (1 << 3) +#define ATTR_SIZE (1 << 4) + struct usr_vattr { - long va_mask; + int va_mask; /* bitmask of ATTR_* values above */ usr_vtype_t va_type; - unsigned short va_mode; - long va_uid; - long va_gid; - unsigned long va_fsid; - unsigned long va_nodeid; - unsigned long va_nlink; - unsigned long va_size; + mode_t va_mode; + uid_t va_uid; + gid_t va_gid; + int va_fsid; + ino_t va_nodeid; + nlink_t va_nlink; + afs_size_t va_size; struct timeval va_atime; struct timeval va_mtime; struct timeval va_ctime; - unsigned long va_rdev; + dev_t va_rdev; unsigned long va_blocksize; - unsigned long va_blocks; + blkcnt_t va_blocks; unsigned long va_vcode; }; diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index cc430ec84..21fdbdff0 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -24,7 +24,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.11 2006/11/10 00:08:57 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.12 2008/12/29 21:26:25 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -344,7 +344,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, #elif defined(AFS_AIX_ENV) /* Boy, was this machine dependent bogosity hard to swallow????.... */ if (av->va_mode != -1) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (av->va_mask & ATTR_MODE) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_MODE) { @@ -363,7 +363,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, } #if defined(AFS_DARWIN80_ENV) if (VATTR_IS_ACTIVE(av, va_gid)) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (av->va_mask & ATTR_GID) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_GID) { @@ -383,7 +383,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, } #if defined(AFS_DARWIN80_ENV) if (VATTR_IS_ACTIVE(av, va_uid)) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (av->va_mask & ATTR_UID) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_UID) { @@ -403,7 +403,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, } #if defined(AFS_DARWIN80_ENV) if (VATTR_IS_ACTIVE(av, va_modify_time)) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (av->va_mask & ATTR_MTIME) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_MTIME) { @@ -482,7 +482,7 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, */ #if defined(AFS_DARWIN80_ENV) if (VATTR_IS_ACTIVE(attrs, va_data_size)) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (attrs->va_mask & ATTR_SIZE) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (attrs->va_mask & AT_SIZE) { @@ -515,14 +515,16 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, #endif #if defined(AFS_DARWIN80_ENV) if (VATTR_IS_ACTIVE(attrs, va_data_size)) { -#elif defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL) if (attrs->va_mask & ATTR_SIZE) { #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (attrs->va_mask & AT_SIZE) { #elif defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV) if (attrs->va_size != VNOVAL) { -#else +#elif defined(AFS_AIX41_ENV) if (attrs->va_size != -1) { +#else + if (attrs->va_size != ~0) { #endif afs_size_t tsize = attrs->va_size; ObtainWriteLock(&avc->lock, 128); diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index b9b5cb392..3fd21586d 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.10 2007/12/08 18:00:45 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.11 2008/12/29 21:26:25 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -217,6 +217,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, VATTR_INIT(attrs); VATTR_SET_SUPPORTED(attrs, va_data_size); VATTR_SET_ACTIVE(attrs, va_data_size); +#elif defined(UKERNEL) + attrs->va_mask = ATTR_SIZE; #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) attrs->va_mask = AT_SIZE; #else