openafs.git
13 years agoDo not compare an FD_t < 0
Rod Widdowson [Fri, 28 Jan 2011 16:49:03 +0000]
Do not compare an FD_t < 0

FD_t is an abstract type.  Invalid file decriptors are == INVALID_FD.
In most places this module does the right thing.  Fix the last
stragglers where it is testing as less than zero.

Change-Id: I9ae3db8775ce69da070a4ebef5a532e1db035977
Reviewed-on: http://gerrit.openafs.org/3768
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agolinux: 2.6.38: Make d_revalidate RCU-walk aware
Marc Dionne [Tue, 25 Jan 2011 23:18:56 +0000]
linux: 2.6.38: Make d_revalidate RCU-walk aware

Signal to the vfs that we don't support path RCU walk in
d_revalidate.  It will call back in non-RCU mode.

Change-Id: I15d0d30131b205a38577666122b067807282a7cd
Reviewed-on: http://gerrit.openafs.org/3759
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agolinux: 2.6.38: New d_op handling
Marc Dionne [Tue, 25 Jan 2011 22:17:21 +0000]
linux: 2.6.38: New d_op handling

In 2.6.38, the super block structure has a new field to hold the
default dentry ops.  The vfs will automatically set it for new
dentries in most cases.

Set s_d_op to our set of operations, and omit setting the dentry
ops where the vfs will already do it (and where new locking rules
prohibit it).

Change-Id: I9d738bdd528577d0a7ccd307246b5e935379c84d
Reviewed-on: http://gerrit.openafs.org/3758
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoRX: Avoid retrying calls on busy channels
Andrew Deason [Thu, 2 Dec 2010 23:13:17 +0000]
RX: Avoid retrying calls on busy channels

When we receive an RX_PACKET_TYPE_BUSY packet, we currently ignore it.
This is a problem when the server has a long-running call on that same
call channel that we don't know about, since we will then keep
retrying the call on the same channel and keep getting
RX_PACKET_TYPE_BUSY responses.

Try to avoid this by returning the RX_CALL_TIMEOUT error when we get a
BUSY packet and there are other free call channels available on the
conn. When the application gets the error and retries the call, we
avoid using the same call channel again where possible. When all of
the call channels appear busy, we revert to effectively the old
behavior of retrying the call on the same channel until we get an
RX_CALL_DEAD (or similar) error.

FIXES 128671

Change-Id: I29b84aa36dcc856528c30d26811e5d6c4b78a1ca
Reviewed-on: http://gerrit.openafs.org/3431
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoImport of code from heimdal
Heimdal Developers [Thu, 27 Jan 2011 12:18:44 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
8ce821c38744b30e226ff024f675668b991b984d (switch-from-svn-to-git-1998-g8ce821c)

Upstream changes are:

Asanka C. Herath (2):
      Revert use of backslash as an escape for double quote in config strings
      Condition roken's ssize_t definition for compatibility

Love Hornquist Astrand (1):
      don't undefined SLIST

Change-Id: I8855e060e88008f95eb2b24b029843081702fc04
Reviewed-on: http://gerrit.openafs.org/3761
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Correct cm_volume locking
Jeffrey Altman [Thu, 27 Jan 2011 01:10:57 +0000]
Windows: Correct cm_volume locking

cm_volume_t flags was used for two categories of flags.  The first
protected by the cm_volume_t->rw lock.  The second protected by
the global cm_volumeLock.  Separate the flags field into two
afs_uint16 fields and break the flag space into FLAG and QFLAG.

Add assertions to the volume LRU functions to ensure that they
are always called with cm_volumeLock write-locked.

Correct two locations where cm_AdjustVolumeLRU() was called
read-locked instead of write-locked.

Change-Id: I7991b995a3c981cd5d08d9cbba09badc81518a5a
Reviewed-on: http://gerrit.openafs.org/3760
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agovol-salvage: Only delete bad vnodes during !check
Andrew Deason [Tue, 25 Jan 2011 16:46:38 +0000]
vol-salvage: Only delete bad vnodes during !check

In SalvageIndex, if check is true, we're only supposed to check for
consistency and not actually change anything (this is enforced by an
assert later on). The check for vnode magic consistency breaks this
assumption, and just always fixes the vnode.

Change this so we just error out if check is set, and the vnode magic
is wrong.

Change-Id: I9e2d3bd5e9e340a9b2ac66d70d52aa110b512561
Reviewed-on: http://gerrit.openafs.org/3756
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoMacOS: fix SetFile call in growlagent makefile
Derrick Brashear [Tue, 25 Jan 2011 18:32:38 +0000]
MacOS: fix SetFile call in growlagent makefile

somehow this got corrupted earlier. fix it to use the right arg.

Change-Id: Ic597412819a9186d7b4b0b0c7e93e7c75b9a979a
Reviewed-on: http://gerrit.openafs.org/3755
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: cm_GiveUpAllCallBacksAllServersMulti()
Jeffrey Altman [Thu, 2 Dec 2010 05:36:58 +0000]
Windows: cm_GiveUpAllCallBacksAllServersMulti()

Implement a multi_RXAFS_GiveUpAllCallBacks version of
cm_GiveUpAllCallBacksAllServers() and use it in place of
the non-multi version.

Change-Id: I6d630ab7a5cf3a3434d088a9e8cde046b541cd3f
Reviewed-on: http://gerrit.openafs.org/3648
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: fix parameters and return value from nt_seek
Rod Widdowson [Sun, 23 Jan 2011 14:29:51 +0000]
Windows: fix parameters and return value from nt_seek

SetFilePointerEx takes specific values
(FILE_BEGIN/FILE_CURRENT/FILE_END) whilse fseek requires SEEK_SET,
SEK_END, SEEK_CUR.  It turns out that these overlap, but we should
not let that pass unchallenged.

SetFilePointerEx returns nonzero for success zero for failure. fseek
returns the other way around.

Neither of these changes currently matter, but we should fix them.

Change-Id: Ib31cf6265fa1e714232ff0d2e099c657e41f17e9
Reviewed-on: http://gerrit.openafs.org/3746
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: read and write take void* buffers, open takes a const char*
Rod Widdowson [Sun, 23 Jan 2011 10:59:28 +0000]
Windows: read and write take void* buffers, open takes a const char*

nt_read and nt_write were defined to take a char* buffer which was
then cast to a void *.  Meantime every call of OS_READ and
OS_WRITE were casting to a char*.

Equally every call of OS_OPEN was passing down a const char*,
causing warnings.

This checkin fixes this:
 nt_read : char* to void*
 nt_write: char* to const void*
 nt_open char*  to const char*

Change-Id: Id4e138b9d347e1a9f35241e162a105d5f462b168
Reviewed-on: http://gerrit.openafs.org/3744
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoOpenBSD: Eliminate complaint about built-in malloc.
Antoine Verheijen [Mon, 24 Jan 2011 07:38:03 +0000]
OpenBSD: Eliminate complaint about built-in malloc.

With OpenBSD 4.8, OpenBSD now uses gcc 4. With its new
defaults, the OpenAFS compile of the kernel module now
complains incessantly about the conflict between the
built-in malloc versus the kernel version (which has
extra parameters). Therefore, set -fno-builtin-malloc
when compiling the kernel module to remove the noise
since the differences can't be reconciled otherwise.

Change-Id: I7e28e6275ca90f73a8d1f65d82f1ccf2cc3a0ead
Reviewed-on: http://gerrit.openafs.org/3751
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Remove user.h from dir.c for OpenBSD 4.8
Antoine Verheijen [Mon, 24 Jan 2011 07:34:56 +0000]
OpenBSD: Remove user.h from dir.c for OpenBSD 4.8

OpenBSD 4.8 no longer needs to include h/user.h in dir.c
and it's presence now gets in the way of the compile so
remove it.

Change-Id: Ie270f94db69f344c5c1a3942db395dbe3a47d5e9
Reviewed-on: http://gerrit.openafs.org/3750
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: curproc has moved in OpenBSD 4.8
Antoine Verheijen [Mon, 24 Jan 2011 07:17:46 +0000]
OpenBSD: curproc has moved in OpenBSD 4.8

With OpenBSD 4.8, curproc has moved from h/proc.h to
h/systm.h. Fix rx_event.c to reflect this change.

Change-Id: I38d4676d445bfafa47f2ae973d789d0b9f6a687a
Reviewed-on: http://gerrit.openafs.org/3749
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Add support for OpenBSD 4.8
Antoine Verheijen [Mon, 24 Jan 2011 07:16:02 +0000]
OpenBSD: Add support for OpenBSD 4.8

Add param headers and other config info for OpenBSD 4.8
support.

Change-Id: I3af37dd79260d29bb7f3793c9a965bb84faab31f
Reviewed-on: http://gerrit.openafs.org/3748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: remove unused label in ntops.c
Rod Widdowson [Sun, 23 Jan 2011 14:32:04 +0000]
Windows: remove unused label in ntops.c

The label 'retry' in nt_open is not used and was causing a warning.  Remove it.

Change-Id: I964d954e4f9cdb672c689a6e757a5f62bea8f65c
Reviewed-on: http://gerrit.openafs.org/3747
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agoWindows: remove faulty assumptions about device names in vol-salvage
Rod Widdowson [Sun, 23 Jan 2011 12:04:59 +0000]
Windows: remove faulty assumptions about device names in vol-salvage

The implementation has an assumption that all disk volumes have an
object name of \Device\HarddiskXXX (where XXX is a number).  This is
wrong since the name is purely a convention and since about WXP they
have been called \Device\HarddiskVolumeXXX.

Either way it is spurious to assume the format and then try to compare
the XXX.  This change just compares the strings.  This is done in a
case insenstive manner which is the safer option.  It is quite
feasible, but very unlikely that someone will uses 'case sensitively
different' object names.

Change-Id: Ifa91c88f2b17f747f30541b8833b722cf5993e48
Reviewed-on: http://gerrit.openafs.org/3745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: more exports afsauthent.dll
Jeffrey Altman [Sat, 22 Jan 2011 01:13:45 +0000]
Windows: more exports afsauthent.dll

pr_SIdToName
afsconf_GetExtendedCellInfo
afsconf_UpToDate

required for new Explorer Shell functionality

Change-Id: I085d32b9786d9bf26d527cc3dd49c2d51ab1cb56
Reviewed-on: http://gerrit.openafs.org/3739
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stefan Kueng <tortoisesvn@gmail.com>
Tested-by: Stefan Kueng <tortoisesvn@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: log and invalidate invalid dir pages
Jeffrey Altman [Sat, 22 Jan 2011 17:15:03 +0000]
Windows: log and invalidate invalid dir pages

If when parsing a directory page in cm_ApplyDir the consistency
checks fail, log a message and invalidate the page in case
it was a transient failure.

Change-Id: Iab690cd876a717fbdef30fb78e4ed559fa7e0a5a
Reviewed-on: http://gerrit.openafs.org/3742
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoOpenBSD: Make OpenBSD 4.7 param headers consistent
Antoine Verheijen [Fri, 21 Jan 2011 16:25:22 +0000]
OpenBSD: Make OpenBSD 4.7 param headers consistent

OpenBSD follows the policy of using a separate common
param file (post 1.4.x). However, when introducing support
for i386 OpenBSD 4.7, this was not done and a single param
config header file was created instead. This patch changes
the param files for OpenBSD 4.7 so that they are
consistent with the other OpenBSD versions by using a
separate common param header file.

Change-Id: I9d828d2447a2d018eeea0fbe9f4c047ac819d209
Reviewed-on: http://gerrit.openafs.org/3725
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: fix CreateFile params nt_unlink and nt_open
Jeffrey Altman [Thu, 20 Jan 2011 07:15:18 +0000]
vol: fix CreateFile params nt_unlink and nt_open

nt_unlink: when opening a file handle to assign delete on close
status the caller must request DELETE permission.

nt_open: make sure that DELETE permission along with FILE_SHARE_DELETE
is requested if we wish to permit another CreateFile call in the future
to assign delete on close.

Change-Id: Ib971ecc098dbc5eb64dcbfed93c334397c9d8ac9
Reviewed-on: http://gerrit.openafs.org/3711
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: namei_ops improve readability; fix namei_create on Windows
Jeffrey Altman [Thu, 20 Jan 2011 07:19:03 +0000]
vol: namei_ops improve readability; fix namei_create on Windows

use NAMEI_SPECDIRC, NAMEI_INODESPECIAL, INVALID_FD and other
preprocessor symbols in place of numeric constants.

namei_create() on Windows must call namei_CreateDataDirectories()
and retry if the afs_open() call fails with either ENOTDIR or
ENOENT.

modify namei_HandleToName() on Windows to make its decision
process clearer.

Change-Id: Ib1dfbaa3afe81f57685c95cdcae749c67cc95598
Reviewed-on: http://gerrit.openafs.org/3712
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: add comment nt_unlink cannot with fopen handles
Jeffrey Altman [Thu, 20 Jan 2011 07:06:12 +0000]
vol: add comment nt_unlink cannot with fopen handles

On Windows, files opened via the CRT fopen or open
POSIX compatibility functions cannot be marked for delete
on close.  Add a comment until such time as the use of
fopen and open on Windows can be replaced.

Change-Id: I9cec46bef332c981b2f64ba85e310783e3c71bc9
Reviewed-on: http://gerrit.openafs.org/3707
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>

13 years agovol: remove potential data loss warnings in vol-salvage.c
Jeffrey Altman [Thu, 20 Jan 2011 07:03:56 +0000]
vol: remove potential data loss warnings in vol-salvage.c

afs_sfsize_t is not always the same size as 'int'.
Avoid warnings by using afs_sfsize_t in the appropriate locations.

Change-Id: I88f7458421c3a9c2081597e5481d352bd5a2927a
Reviewed-on: http://gerrit.openafs.org/3706
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>

13 years agovol: use correct file name base for temporary file
Jeffrey Altman [Thu, 20 Jan 2011 07:01:38 +0000]
vol: use correct file name base for temporary file

Inconsistent use of temporary file name bases resulted in
the temporary files never being deleted.

Change-Id: I0be59282488bb2db0f1b7b5200df5bd6ac285711
Reviewed-on: http://gerrit.openafs.org/3705
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: use OS_UNLINK instead of unlink
Jeffrey Altman [Thu, 20 Jan 2011 06:59:46 +0000]
vol: use OS_UNLINK instead of unlink

Use OS_UNLINK in order to ensure that platform specific
unlink functions are called.  OS_UNLINK is unlink on Unix.

Change-Id: Idcfc18345abe5532e9ebe97fc757d6f435c2af52
Reviewed-on: http://gerrit.openafs.org/3704
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: fix namei_ListAFSSubDirs on Windows
Jeffrey Altman [Thu, 20 Jan 2011 06:56:33 +0000]
vol: fix namei_ListAFSSubDirs on Windows

The directory level represented by 'dirp2' does not exist on
Windows.  Do not attempt to close the DIR object that was
never opened.

Remove unnecessary function prototypes.

Change-Id: Ib6b27e52f0120115173cb04893092ba6f2da32fe
Reviewed-on: http://gerrit.openafs.org/3703
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: use OS_DIRSEP in many more places
Jeffrey Altman [Thu, 20 Jan 2011 06:51:26 +0000]
vol: use OS_DIRSEP in many more places

For consistency use OS_DIRSEP and OS_DIRSEPC throughout the
package.

Change-Id: I7bb93b4fe7324492e71a6d303e2b74723aaefc5a
Reviewed-on: http://gerrit.openafs.org/3702
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: fix _namei_examine_reg DELETE_ZLC usage
Jeffrey Altman [Thu, 20 Jan 2011 06:45:29 +0000]
vol: fix _namei_examine_reg DELETE_ZLC usage

replace 'i' with 'dirl' and assign the new variable a value
before using it.

Change-Id: Ia93b6c75154b6f2a9238f0e9c2881d6c79c36540
Reviewed-on: http://gerrit.openafs.org/3701
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: make it clearer that SetOGM is not impl on Windows
Jeffrey Altman [Thu, 20 Jan 2011 06:39:11 +0000]
vol: make it clearer that SetOGM is not impl on Windows

Separate the SetOGM function into two implementations to
match the other OGM functions.  Implement the Windows version
as returning -1 always.

In the future, the OGM functions could be renamed to express
their purpose: saving and restoring the volume id and tag
associated with a file.   Windows currently encodes this
information using the CreationDate and the file name but
in the future this information might be stored in an alternate
data stream.

Change-Id: I7e60cceb4548b7ad3a1e045f390e7052fece4926
Reviewed-on: http://gerrit.openafs.org/3700
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: avoid double dir separators from addtoname
Jeffrey Altman [Thu, 20 Jan 2011 06:35:08 +0000]
vol: avoid double dir separators from addtoname

The manner in which addtoname() is used can often result
in double dir separators in path names.  Check for it and
avoid doubling the separator in addtoname()

Change-Id: Ie33459bec3bcc93f81f13020cd35ed8c473b6ca5
Reviewed-on: http://gerrit.openafs.org/3699
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: clear ih_synced before dropping lock
Jeffrey Altman [Thu, 20 Jan 2011 06:23:37 +0000]
vol: clear ih_synced before dropping lock

in ih_reallyclose() clear ihP->ih_synced before dropped
the IH_LOCK.  ih_reallyclose() is already committed to
performing the OS_SYNC() call.  Failing to clear the ih_synced
flag before dropping the lock permits another thread, the ih_sync_all()
thread for example, to also conclude that it must sync the
file.

Change-Id: Icb928f7d2ec2342a57ed21b440ae0580c980e9d2
Reviewed-on: http://gerrit.openafs.org/3696
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoMacOS: don't allow krb5 at login when AD plugin authenticates
Derrick Brashear [Thu, 20 Jan 2011 03:56:12 +0000]
MacOS: don't allow krb5 at login when AD plugin authenticates

if AD is being used to verify authentication (e.g. via builtin)
don't allow get krb5 at login to succeed. since a helper does this we can't
grey the option, but we can decline to act on it.

Change-Id: I1f2bb891377c3ed9765f9e58141c77ec54d3ae22
Reviewed-on: http://gerrit.openafs.org/3690
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: nt_DriveToDev must return a value
Jeffrey Altman [Thu, 20 Jan 2011 07:14:14 +0000]
vol: nt_DriveToDev must return a value

Change-Id: I27cf468e9d61542f9893367a18c2f7dd6854cdf6
Reviewed-on: http://gerrit.openafs.org/3710
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: nt_open should not create missing directories
Jeffrey Altman [Thu, 20 Jan 2011 07:11:57 +0000]
vol: nt_open should not create missing directories

Revert the prior change that added directory creation
to nt_open().  nt_open() should fail and the caller should
create the directories.  Failure to do so results in an
incomplete tree which confuses the salvager.

Change-Id: Ieb2a05baada2531dad1869e95823fe2006bdc2c6
Reviewed-on: http://gerrit.openafs.org/3709
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: Make ntops functions 64-bit capable
Jeffrey Altman [Thu, 20 Jan 2011 07:09:44 +0000]
vol: Make ntops functions 64-bit capable

Add 64-bit offset and length support to ntops functions.

Change-Id: I1804d49df344839598c39084b7763cec4100c8c7
Reviewed-on: http://gerrit.openafs.org/3708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: avoid defining unused struct on windows
Jeffrey Altman [Thu, 20 Jan 2011 06:33:27 +0000]
vol: avoid defining unused struct on windows

namei_ogm_t is not used on Windows.  There is no equivalent
to owner/group mode.

Change-Id: Ib0675f106bf5e77b006ebe5eae5d67ee232313e0
Reviewed-on: http://gerrit.openafs.org/3698
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: indent cpp definitions; add NAMEI_SPECDIRC
Jeffrey Altman [Thu, 20 Jan 2011 06:31:41 +0000]
vol: indent cpp definitions; add NAMEI_SPECDIRC

Change-Id: Id6d962a7c9e78f6a4b4bb7a6250e77efd40cc3c4
Reviewed-on: http://gerrit.openafs.org/3697
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: remove [UN]LOCKFILE data loss warnings on Windows
Jeffrey Altman [Thu, 20 Jan 2011 06:20:05 +0000]
vol: remove [UN]LOCKFILE data loss warnings on Windows

Cast to DWORD since the results of the mask and shift
are guaranteed to be 32-bit.  This avoids sixteen warnings.

Change-Id: Ifdb9356e207b4b8791b5923985a70efeb457edb1
Reviewed-on: http://gerrit.openafs.org/3695
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: build mtafsdir.lib and use it
Jeffrey Altman [Thu, 20 Jan 2011 05:57:03 +0000]
Windows: build mtafsdir.lib and use it

The executables built in src/vol are pthreaded.  Therefore, they
require a pthread safe version of the src/dir objects.  Instead
of building the dir object files in yet another directory, create
a mtafsdir.lib in src/dir and use it in src/vol, src/tviced and
src/tsalvaged.

Change-Id: I50017bd56ec741af1ff3fc1dd39208e610369088
Reviewed-on: http://gerrit.openafs.org/3693
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoFreeBSD: properly identify the rxk_Listener so that msleep() returns
Toby Burress [Thu, 20 Jan 2011 04:32:01 +0000]
FreeBSD: properly identify the rxk_Listener so that msleep() returns

afs_osi_Wakeup() was not being called with the proper argument,
causing afs_osi_Sleep() to fail forever while waiting for rxk_Listener
to wake up.

Change-Id: I1b650c57ae507987359d0cb230400d3d23984cfa
Reviewed-on: http://gerrit.openafs.org/3692
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Change code optimization setting
Antoine Verheijen [Wed, 19 Jan 2011 23:06:03 +0000]
OpenBSD: Change code optimization setting

Change the optimization level set when optimization is
enabled during build from the sytem default of '-O' to
'-O2' for OpenBSD systems.

Change-Id: I20962c124da5426409638453e1efdd37b4e5f393
Reviewed-on: http://gerrit.openafs.org/3689
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoMove check for unspecified CFLAGS in configure.ac
Antoine Verheijen [Wed, 19 Jan 2011 22:57:25 +0000]
Move check for unspecified CFLAGS in configure.ac

configure.ac provides a check to see if the user has
specified CFLAGS and if not, it sets CFLAGS to a blank
(not NULL) string so that the resultant configure script
does not set '-g' and/or '-O2' by default. This check
occurs after AC_USE_SYSTEM_EXTENSIONS in the configure.ac
file. However, on at least some systems, such as OpenBSD,
AC_USE_SYSTEM_EXTENSIONS expands to include the code that
configure uses to set '-g -O2' so the check has no effect
and '-g' or '-O2' can not be turned off. This patch moves
the "CFLAGS specified" check so that it precedes the
AC_USE_SYSTEM_EXTENSIONS directive, in which case
everything works.

Change-Id: I68ed5a3c5129a55f7dcd7413c93f35cc7cb14b9c
Reviewed-on: http://gerrit.openafs.org/3688
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: No ruid/rgid in cred structure.
Antoine Verheijen [Wed, 19 Jan 2011 21:14:47 +0000]
OpenBSD: No ruid/rgid in cred structure.

OpenBSD does not retain ruid or rgid values in the
afs_creds_t structure (ucred). This patch, therefore,
removes any references to them in the afs.h file. Since
no attempt is made to actually use the removed code (or
macros) on OpenBSD, at least at this time, this does
not result in any real functional change.

Change-Id: Iaceb792f0c39ba6f7caa205bc66af16a23193549
Reviewed-on: http://gerrit.openafs.org/3687
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Don't call non-existent routines in osi_vfsops.c
Antoine Verheijen [Wed, 19 Jan 2011 20:43:21 +0000]
OpenBSD: Don't call non-existent routines in osi_vfsops.c

The OpenBSD version of osi_vfsops.c makes calls to routines
that do not exist in the system and aren't needed. In the
past, these calls were wrappered by an #ifdef for
AFS_DISCON_ENV which was never defined. That #ifdef is now
gone so this patch removes the calls to these routines,
which are remnants of the NBSD origins for this particular
code.

Change-Id: I8cc97fde8cd5cf6c241dd3074c0f97b5d3e2ccfd
Reviewed-on: http://gerrit.openafs.org/3686
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agoOpenBSD: Fix parameters in call to afs_close()
Antoine Verheijen [Wed, 19 Jan 2011 20:30:24 +0000]
OpenBSD: Fix parameters in call to afs_close()

OpenBSD passes an extra parameter in a call to afs_close()
in its OS-specific code. It went undetected in the past
but now causes compile headaches because of more accurate
prototypes in the header file. This patch removes the
offending extra parameter (which never actually caused any
problems because it was the last one in the parameter list).

Change-Id: I6bde0c6c98867c47a574fa5e3e01ec560deb17b0
Reviewed-on: http://gerrit.openafs.org/3685
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Install no-NFS version of libafs
Antoine Verheijen [Wed, 19 Jan 2011 20:13:09 +0000]
OpenBSD: Install no-NFS version of libafs

The build process for OpenBSD builds the no-NFS version of
the kernel module but, at install time, the NFS version is
subseuquently built and installed while the no-NFS version
is ignored. The NFS version does not load and is not needed
in OpenBSD so this patch makes sure that the no-NFS version
is installed and used.

Change-Id: I1d07334121911c22aea1f6d157f34e1b40e5b780
Reviewed-on: http://gerrit.openafs.org/3684
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoMacOS: panic decoder should check for unloaded kexts
Derrick Brashear [Wed, 19 Jan 2011 19:58:59 +0000]
MacOS: panic decoder should check for unloaded kexts

if the openafs kext was unloaded from under us, try to handle that.

Change-Id: I6a5e56da3c4b6290b71dd10e919a0f374998338e
Reviewed-on: http://gerrit.openafs.org/3683
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Fix use of macros for AFS_KALLOC/AFS_KFREE
Antoine Verheijen [Wed, 19 Jan 2011 18:52:10 +0000]
OpenBSD: Fix use of macros for AFS_KALLOC/AFS_KFREE

The macro definitions for AFS_KALLOC and AFS_KFREE used by
afs_osi_alloc.c to perform OS-specific memory allocation
are only defined by the OpenBSD osi_machdep.h header file
if they already exist, which means: never. This patch fixes
this situtation and makes sure that afs_osi_alloc.c
actually uses them, eliminating a direct OS-specific call
in afs_osi_alloc.c.

Change-Id: Ida1608774de3bc5861b223574f3cbf0d9647266c
Reviewed-on: http://gerrit.openafs.org/3682
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Remove macros definitions for afs_osi_Alloc et al.
Antoine Verheijen [Wed, 19 Jan 2011 18:20:21 +0000]
OpenBSD: Remove macros definitions for afs_osi_Alloc et al.

The afs_osi_Alloc, afs_osi_Free, etc. routines are now
defined in afs_osi_alloc.c so the macro definitions defined
by osi_machdep.h for OpenBSD are no longer needed and, in
fact, interfere with the compile. Remove them.

Change-Id: I98a261b5cd5e44136e4dde677f86d90212b0cfba
Reviewed-on: http://gerrit.openafs.org/3681
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovolser: select() cannot be used to sleep on windows
Jeffrey Altman [Sun, 16 Jan 2011 21:42:15 +0000]
volser: select() cannot be used to sleep on windows

On Windows must use Sleep() instead of select() with no
fd_set parameters.

Change-Id: I693718c74dd9be0b4eb58ec26afac0882845e71c
Reviewed-on: http://gerrit.openafs.org/3675
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>

13 years agoWindows: refactor cm_CheckCBExpiration multihomed
Jeffrey Altman [Sun, 16 Jan 2011 20:49:02 +0000]
Windows: refactor cm_CheckCBExpiration multihomed

cm_CheckCBExpiration() is refactored to make it easier
to read the decision process.  cm_CheckCBExpiration()
determines when a callback is no longer usable and as a
result the object status info should be discarded.

The windows cache manager preserves status info past
callback expiration if all of the sources of a volume
became inaccessible prior to the callback expiration
time.  The cache manager was improperly preserving the
status info for objects when the callback was issued by
a multi-homed file server when only the interface that
issued the callback is down.

A separate cm_server_t object is used to represent
each file server interface.  When one interface goes
down and others are left up, the cache manager will
now replace the down cm_server_t reference for one that
is up.  This substitution is performed as a side effect
of computing the effective downTime in cm_CBServersDownTime().

Change-Id: Ia6336a3bdd0219497fd47460accddd0cd2629f00
Reviewed-on: http://gerrit.openafs.org/3674
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: use cm_ServerEqual() in cm_Analyze()
Jeffrey Altman [Fri, 14 Jan 2011 05:22:39 +0000]
Windows: use cm_ServerEqual() in cm_Analyze()

In cm_Analyze() when processing VNOVOL, VMOVED or VOFFLINE errors
do not use pointer equivalence as the test to determine if a
server is affected by the error.  Use cm_ServerEqual() instead.

Fix cm_ServerEqual() to work even when both cm_server_t objects
are not UUID aware.

Change-Id: Icb83ba77984075216a44cdeba689bc05e98ed92a
Reviewed-on: http://gerrit.openafs.org/3659
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoRe-enable rx connection hard timeout
Rainer Toebbicke [Tue, 18 Jan 2011 13:56:17 +0000]
Re-enable rx connection hard timeout

A missing "conn->" in rxi_CheckCall prevents checking hard connection timeouts.

Change-Id: I893a1ba71957e2a830029dfc4e3ac51fa461d6ca
Reviewed-on: http://gerrit.openafs.org/3677
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agovol: Windows requires binary fmode for salvaged
Andrew Deason [Mon, 17 Jan 2011 18:35:46 +0000]
vol: Windows requires binary fmode for salvaged

Same as 98f633c60d20834cee0bbc0770a3146b06642a59, but for the
salvageserver.

Change-Id: I961e31fd6a2a6e08e3bd4381793195bb1e388e7c
Reviewed-on: http://gerrit.openafs.org/3676
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agovol: use OS_UNLINK() instead of unlink()
Jeffrey Altman [Sat, 15 Jan 2011 16:49:54 +0000]
vol: use OS_UNLINK() instead of unlink()

OS_UNLINK provides the platform specific mechanism
for unlinking objects.

Change-Id: Id0a1f50e57fe3c21c46e137e86507bf28bafa046
Reviewed-on: http://gerrit.openafs.org/3670
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agovol: construct proper VolDir path on Windows
Jeffrey Altman [Sat, 15 Jan 2011 16:54:40 +0000]
vol: construct proper VolDir path on Windows

namei_HandleToInodeDir initializes the path name with
the nt_drive value.  Therefore calling addtoname(name, name->n_drive)
produces the invalid path "D:\D:\\Vol_.....".  Remove the unnecessary
addtoname() call.

Change-Id: I4933d3f4fda76050eecde3caeaa6bc30011cd974
Reviewed-on: http://gerrit.openafs.org/3672
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: fdHandleAllocateChunk should init all fields
Jeffrey Altman [Sat, 15 Jan 2011 16:52:45 +0000]
vol: fdHandleAllocateChunk should init all fields

fdHandleAllocateChunk() failed to initialize the fd_ihnext
and fd_ihprev fields.

Change-Id: I605b6fc3c4cefe6e5c4169762fbd6047fb895b70
Reviewed-on: http://gerrit.openafs.org/3671
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: use OS_DIRSEP when constructing paths
Jeffrey Altman [Sat, 15 Jan 2011 16:47:47 +0000]
vol: use OS_DIRSEP when constructing paths

Do not assume that / is the directory separator when constructing
paths for internal consumption or log messages.  Use OS_DIRSEP
or OS_DIRSEPC as appropriate.

Change-Id: Ifed618dfa30f2aee27de1ef57de5e504d6701d4d
Reviewed-on: http://gerrit.openafs.org/3669
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovolser: use OS_CLOSE() instead of close()
Jeffrey Altman [Sat, 15 Jan 2011 16:44:08 +0000]
volser: use OS_CLOSE() instead of close()

Use OS_CLOSE() instead of close() when closing vol package
allocated file descriptors.  On Windows, close() != nt_close().

Change-Id: I5737c0e4e83534bd5f4183dde195c4b8091474c1
Reviewed-on: http://gerrit.openafs.org/3668
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: initialize FdHandle_t stack objects
Jeffrey Altman [Sat, 15 Jan 2011 16:39:39 +0000]
vol: initialize FdHandle_t stack objects

In namei_create() a temporary FdHandle_t is allocated on
the stack but was never initialized.  Depending on what
prior data was on the stack the FdHandle_t could result
in subsequent operations failing in unpredictable ways.

Change-Id: I6246930adc87cf84ad9c0913cda2d00e6f851bc1
Reviewed-on: http://gerrit.openafs.org/3667
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: Fix ntops to provide expected semantics
Jeffrey Altman [Sat, 15 Jan 2011 16:07:19 +0000]
vol: Fix ntops to provide expected semantics

nt_open() can be asked to open a file with a path containing
directory components that do not yet exist.  Modify nt_open()
to automatically create directories if necessary.

nt_read() and nt_pread() should not treat partial reads due
to reaching EOF as an error.  Instead, return the bytes read.

Change-Id: If088393a842d6f6d7ad901345e94e92d23f2321c
Reviewed-on: http://gerrit.openafs.org/3666
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: Windows requires binary fmode for salvager
Jeffrey Altman [Sat, 15 Jan 2011 16:04:48 +0000]
vol: Windows requires binary fmode for salvager

In order for salvager to work properly it must read and
write data in binary mode.  On Windows, this is accomplished
by calling _set_fmode(_O_BINARY) to set the default mode for
fopen(), etc.

Change-Id: Ieb00222ceccb6f044453b60d288e2badf713e517
Reviewed-on: http://gerrit.openafs.org/3665
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agovol: fix OS_LOCKFILE/OS_UNLOCKFILE for Windows
Jeffrey Altman [Sat, 15 Jan 2011 16:01:55 +0000]
vol: fix OS_LOCKFILE/OS_UNLOCKFILE for Windows

On UNIX the OS_LOCKFILE and OS_UNLOCKFILE macros return zero
on success.  Since Windows LockFile() and UnlockFile() return
non-zero (TRUE) on success, negate the return value as part
of the macro definition.

Change-Id: Icb4c8555de9a16fdfddcaeb9ede28bbd401e76b7
Reviewed-on: http://gerrit.openafs.org/3664
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agoRX: Pre-10 Solaris lacks atomic inc/dec
Andrew Deason [Fri, 14 Jan 2011 21:13:46 +0000]
RX: Pre-10 Solaris lacks atomic inc/dec

The atomic primitives in Solaris before Solaris 10 lack atomic_inc_32
&co. Make things easier and just implement them in terms of
atomic_add_32 &co when we are older than Solaris 10.

Change-Id: I70c829ef969824efd7843df80bd48e98477a5574
Reviewed-on: http://gerrit.openafs.org/3663
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoRX: Include netinet/ip6.h before inet/ip.h
Andrew Deason [Fri, 14 Jan 2011 20:52:10 +0000]
RX: Include netinet/ip6.h before inet/ip.h

Some older Solaris (at least some Solaris 8) requires netinet/ip6.h to
be included before inet/ip.h, or the compiler chokes on some
ipv6-related declarations in inet/ip.h. So, include it.

Change-Id: Icabc32c093fab5e3442701b2ea6ae593d7fceb7e
Reviewed-on: http://gerrit.openafs.org/3662
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agomerge-pod: Be more compatible with older perl
Andrew Deason [Fri, 14 Jan 2011 20:00:14 +0000]
merge-pod: Be more compatible with older perl

merge-pod works fine with perl 5.00503, if we eliminate the 3-argument
invocation of open(). So, replace the open() calls with their
2-argument equivalent, and relax the version requirement a bit.

Change-Id: Ibeda39f2620ab1056e2d42838833d140ec3c053f
Reviewed-on: http://gerrit.openafs.org/3661
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoFBSD: remove vestiges of Giant
Ben Kaduk [Fri, 14 Jan 2011 01:16:44 +0000]
FBSD: remove vestiges of Giant

We do not support versions of FreeBSD that used Giant to
serialize access to vnode fields, and we always use the same locking
(which really ought to be MPSAFE).  Always set the MPSAFE flags
as needed, and do not bother to call VFS_[UN]LOCK_GIANT which
will never do anything for us.

Change-Id: I973a24d43563f289d4a2baa6e067fbba72d17ed9
Reviewed-on: http://gerrit.openafs.org/3656
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: fixup gettmpdir()
Jeffrey Altman [Fri, 14 Jan 2011 05:15:10 +0000]
Windows: fixup gettmpdir()

Use InterlockedCompareExchangePointer for hostparse()
instead of fudging it and leaking memory.

If the max path length is MAX_PATH must allocate MAX_PATH+1.

Change-Id: I9162188c78922202b40859249736a23beae60b3e
Reviewed-on: http://gerrit.openafs.org/3658
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: osilog param size is size_t
Jeffrey Altman [Fri, 14 Jan 2011 05:13:49 +0000]
Windows: osilog param size is size_t

The parameter size is size_t which permits pointers to be stored
on 32-bit and 64-bit systems.  Make sure we store it as size_t
instead of truncating to long.

Change-Id: I96aaf231eedef742095edf247dc1013e3d90257e
Reviewed-on: http://gerrit.openafs.org/3657
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoRX: No userspace atomic_ops in Solaris pre-10
Andrew Deason [Mon, 10 Jan 2011 23:13:15 +0000]
RX: No userspace atomic_ops in Solaris pre-10

The atomic_ops(3C) family of functions do not exist in userspace
before Solaris 10. So, only use them for rx_atomic operations if
we're on AFS_SUN510_ENV, or if we're in the kernel.

Also, include <sys/atomic.h> for kernel code and <atomic.h> for
userspace. Although they are currently equivalent, they are documented
as separate, and pre-10 lacks <atomic.h>.

Change-Id: Id71857efcd6460f8223302850b548754c19d076f
Reviewed-on: http://gerrit.openafs.org/3652
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoafsd: CellItems doesn't apply to memcache mode
Derrick Brashear [Wed, 12 Jan 2011 21:45:57 +0000]
afsd: CellItems doesn't apply to memcache mode

avoid a potential panic from passing a bogus path into the kernel for
evaluation, in memcache mode.

Change-Id: Iaa11eded2e8946207f7df9e77c3de1e5ff4f963e
Reviewed-on: http://gerrit.openafs.org/3651
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoSOLARIS: Include sys/varargs.h for kernel stdarg
Andrew Deason [Wed, 12 Jan 2011 16:29:46 +0000]
SOLARIS: Include sys/varargs.h for kernel stdarg

When compiling for the kernel, pre-10 Solaris seems to want
<sys/varargs.h> instead of <stdarg.h>, as documented in the Solaris
man pages. So include <sys/varargs.h> instead of <stdarg.h> where we
need variable arguments (afs_warn.c).

Change-Id: Id16453b1f7bb9f42d0cc9ca504ac64d04fb0b684
Reviewed-on: http://gerrit.openafs.org/3653
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoCache bypass: fix use of incorrect "states"
Marc Dionne [Tue, 11 Jan 2011 02:31:18 +0000]
Cache bypass: fix use of incorrect "states"

Test and set the correct field for cache bypass flags.  There was
some confusion between cachingStates and the states associated with
vcache entries in a few places.

Change-Id: Iae957b6f838a44d75776e49662b4aba685800d19
Reviewed-on: http://gerrit.openafs.org/3637
Reviewed-by: Matt Benjamin <matt@linuxbox.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLINUX: afs_linux_put_link is void
Andrew Deason [Mon, 10 Jan 2011 18:11:22 +0000]
LINUX: afs_linux_put_link is void

The put_link callback doesn't return a value, so declare it as such.

Change-Id: Icdc19de48747fdfbd3349b2ef0c2b51d5a369550
Reviewed-on: http://gerrit.openafs.org/3636
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agorpm: don't package files twice
Stephan Wiesand [Sat, 8 Jan 2011 16:13:27 +0000]
rpm: don't package files twice

The LICENSE and two manpages were included in the main
package as well as one of the others. Remove duplicate entries.

Change-Id: I7626d758a65fe305f18e7cc9099d1fe1b4f86c6f
Reviewed-on: http://gerrit.openafs.org/3628
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agogit-version: Do not specify --ignore-submodules
Andrew Deason [Sat, 8 Jan 2011 01:48:18 +0000]
git-version: Do not specify --ignore-submodules

Only new git versions reognize the --ignore-submodules option to
diff-index and diff-files. Do not pass this, to make git-version more
likely to work across different versions, as we don't have any
submodules in the tree anyway.

Change-Id: Ic9dbd9ec5f332f36cec291fc3d324db14615f831
Reviewed-on: http://gerrit.openafs.org/3627
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: refactor buf_Get() to improve readability
Jeffrey Altman [Sat, 8 Jan 2011 17:21:23 +0000]
Windows: refactor buf_Get() to improve readability

Refactor buf_Get() by using a switch() instead of a jumble
of if() conditionals.

Improve comments to make it clear that given the current
use and implementation of cm_BufRead() from cm_dcache.c
that created buffer pages will never be populated with
actual data.

Change-Id: Ib3f5778ae32f210127537e16ecc32e1598dbefc7
Reviewed-on: http://gerrit.openafs.org/3630
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: remove all refs to unused buf_GetNew()
Jeffrey Altman [Sat, 8 Jan 2011 17:19:07 +0000]
Windows: remove all refs to unused buf_GetNew()

Change-Id: I09b87a2042efff1b5930ebe6e50a64379d592bc2
Reviewed-on: http://gerrit.openafs.org/3629
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoprovide more verbose logging when VGetVolumeByVp_r fails
Tom Keiser [Wed, 13 Oct 2010 05:16:25 +0000]
provide more verbose logging when VGetVolumeByVp_r fails

FSYNC_com_VolOff() commits sepuku when VGetVolumeByVp_r() fails to return
a heavyweight ref to the volume.  This small patch provides more detailed
debugging information so we have a better idea why VGetVolumeByVp_r failed.

Change-Id: I9b8b6e734653701c4f35b458f4c4701a2b0d2d5e
Reviewed-on: http://gerrit.openafs.org/2969
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: remove unused vars from cm_server.c
Jeffrey Altman [Tue, 4 Jan 2011 16:18:25 +0000]
Windows: remove unused vars from cm_server.c

Change-Id: Ia2e1d5ecbc5dbc349ac8e7bfcb63b42545f876f5
Reviewed-on: http://gerrit.openafs.org/3617
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: netidmgr_plugin move roken.h to afscred.h
Jeffrey Altman [Wed, 12 May 2010 15:27:17 +0000]
Windows: netidmgr_plugin move roken.h to afscred.h

Due to historical issues with the MIT KFW headers
the netidmgr plugin must define _USE_32BIT_TIME_T
which alters the size of time_t in all C RTL data
structures that include it.   roken.h must be included
after this definition in order for it to do the right
thing in conjunction with the MIT KFW headers.  This
means that an exception to the rule that roken.h must
be one of the first three files included in every
source file in the tree must exist for this directory.
In the netidmgr_plugin directory, afscred.h includes
roken.h and afscred.h is the first header included
in all other files.

Change-Id: I11214e5eaac0144aaf04c3a21bb92d521d75c6e1
Reviewed-on: http://gerrit.openafs.org/3616
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: permit clean when switching platforms
Jeffrey Altman [Tue, 4 Jan 2011 02:07:10 +0000]
Windows: permit clean when switching platforms

When switching between i386 and amd64 in the same build tree
the "clean" make directive would fail due to NTLang.bat not
having been built in the new platform's destination directory.
Force NTLang.bat to be built as a dependency of cleanup and
delete it at the end along with the version files.

Change-Id: I49a44204c636ab9ad89be44d4fad20ed6050fdda
Reviewed-on: http://gerrit.openafs.org/3615
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoroken: Check for bswap16 and bswap32 defines
Simon Wilkinson [Mon, 3 Jan 2011 10:47:30 +0000]
roken: Check for bswap16 and bswap32 defines

Our imported roken.h provides definitions for bswap16 and bswap32,
but configure doesn't check to see if those functions already exist.
On operating systems where they do, and where the header containing
them is included in our build, this results in compilation errors.

Add a configure test for bswap16 and bswap32, which is complicated
by the fact that they may be macros, or static inline functions, so
a simple CHECK_FUNCS won't work.

Change-Id: Iae3411bf4bb22af8cfd770e01026a28e1863e078
Reviewed-on: http://gerrit.openafs.org/3613
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoUnix CM: Don't blow up if we have non-rxkad tokens
Simon Wilkinson [Sat, 11 Sep 2010 11:53:07 +0000]
Unix CM: Don't blow up if we have non-rxkad tokens

The legacy GetToken compatibility code assumed that we would always
have at least one rxkad token for a cell, and segfaulted if we didn't.

Just return as if we have no tokens if a cell doesn't have an rxkad
token.

Change-Id: Ica64882c1a64cf140ad6c277c70fbfb747ea6235
Reviewed-on: http://gerrit.openafs.org/3614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoautoconf: Tidy up header includes
Simon Wilkinson [Mon, 3 Jan 2011 10:40:56 +0000]
autoconf: Tidy up header includes

Tidy up our list of header includes so it's easier to see what
we're testing for. The list is now one-per-line, in alphabetically
sorted order.

Note that this won't affect our use of the default include set, as
autoconf will already have tested for all of those before it starts
this CHECK_HEADERS run.

Change-Id: Iffc8c3bc7cbd56d87508ebdde38e61f8747d0501
Reviewed-on: http://gerrit.openafs.org/3612
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoauth: Move key related code to its own file
Simon Wilkinson [Thu, 30 Dec 2010 16:30:37 +0000]
auth: Move key related code to its own file

Move all of the libauth code which does KeyFile management out
into its own file, in preparation for a major rewrite.

Change-Id: Id880136307cba726c04a003700ba70f3d74b297f
Reviewed-on: http://gerrit.openafs.org/3611
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agolibadmin: Don't use internal struct for key data
Simon Wilkinson [Thu, 30 Dec 2010 17:52:00 +0000]
libadmin: Don't use internal struct for key data

The afsconf_dir structure should be regarded as private to the libauth
library, which provides accessors for the commonly used parameters
within it. Rework libadmin so that it uses those accessors when looking
up key data.

Change-Id: I9a623ccadba95622894931ee25319d3bcb019136
Reviewed-on: http://gerrit.openafs.org/3608
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agotests: Add more tests for auth KeyFile handling
Simon Wilkinson [Thu, 30 Dec 2010 17:56:36 +0000]
tests: Add more tests for auth KeyFile handling

Add tests to make sure that we serialise updated KeyFiles to and
from disk correctly, and that the restriction on 8 keys in a KeyFile
is enforced by AddKey

Change-Id: Iac5bf7157534879824da92ea58f1515672d59298
Reviewed-on: http://gerrit.openafs.org/3610
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoroken: Export more snprintf symbols
Simon Wilkinson [Thu, 30 Dec 2010 17:53:59 +0000]
roken: Export more snprintf symbols

Export more of the snprintf symbols from librokenafs, so that we
can actually make use of them.

Change-Id: Ida347c516bec6444d26d0e148ffd781999f0b364
Reviewed-on: http://gerrit.openafs.org/3609
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoAdd "brief" option to rxgen
Simon Wilkinson [Sun, 14 Feb 2010 10:01:14 +0000]
Add "brief" option to rxgen

Add a new -b option to rxgen that turns on "brief" output. This makes a
number of changes to the data definitions produced by rxgen so they can
be more easily used by the calling code.

The changes are:
   *) Use the new struct rx_opaque structure for all opaque data
      definitions, rather than defining each as a unique structure.
      This permits moving opaque data between rxgen structures to be
      performed by simple assignment.
   *) Use anonymous structures for internal definitions. Currently
      rxgen also uses the field name as the structure name, which
      prevents the use of a field name more than once within a
      source file.
   *) Don't embed the structure name within the names of the elements
      within the structure. This significantly reduces the length of
      assignment code, and makes for more readable callers.

Change-Id: I8cad7e6051f12238a77cf006b0854fb38b54f61a
Reviewed-on: http://gerrit.openafs.org/2585
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agorx: Implement rx_atomic_dec_and_read
Simon Wilkinson [Thu, 16 Dec 2010 11:36:43 +0000]
rx: Implement rx_atomic_dec_and_read

Add a function which decrements an atomic counter, and returns the
result. This is essential for implementing reference counting.

Change-Id: Ib173f078bcf117369a82f981d58124018648a71c
Reviewed-on: http://gerrit.openafs.org/3581
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agorx: Protect rx_atomic.h against multiple inclusion
Simon Wilkinson [Thu, 16 Dec 2010 11:35:54 +0000]
rx: Protect rx_atomic.h against multiple inclusion

Add #ifdef guards so that rx_atomic.h can't be included in the same
C file multiple times.

Change-Id: Ic62287ce4a21b9efbfd9530e2517029a69217a56
Reviewed-on: http://gerrit.openafs.org/3580
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

13 years agoauth: Don't crash if UserList contains bogus line
Simon Wilkinson [Sat, 1 Jan 2011 23:58:20 +0000]
auth: Don't crash if UserList contains bogus line

If the first line of the UserList was bogus (caused ParseLine to
return an error), then we would attempt to free the contents of
an uninitialised identity structure, and crash. Initialise the
structure so this no longer happens.

Change-Id: I55074a5eb616ac48d8a278db2d8389d3b0e112a6
Reviewed-on: http://gerrit.openafs.org/3607
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agorx: Don't crash when emptying an empty identity
Simon Wilkinson [Sat, 1 Jan 2011 23:51:18 +0000]
rx: Don't crash when emptying an empty identity

In common with our other freeContents functions, freeing the contents
of a structure which is already empty shouldn't crash.

Change-Id: I93b54c0e450d2184c10575b50dadfd1471d43289
Reviewed-on: http://gerrit.openafs.org/3606
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: MIT license applies to parsemode()
Vincent Archer [Thu, 30 Dec 2010 16:34:28 +0000]
Windows: MIT license applies to parsemode()

Vincent Archer grants permission to OpenAFS to re-license
his MINIX contributions under the MIT license.  A copy of the
e-mail granting permission is located in OpenAFS RT issue 128805.

FIXES 128805

Change-Id: I59774d14a0099f5a48dbc9dbf13157136b8c681f
Reviewed-on: http://gerrit.openafs.org/3605
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: buf_CleanAsync scp->fid == bp->fid
Jeffrey Altman [Wed, 29 Dec 2010 16:35:17 +0000]
Windows: buf_CleanAsync scp->fid == bp->fid

If buf_CleanAsync or buf_CleanAsyncLocked are called
with a non-NULL cm_scache_t parameter, that status object's
fid must be the same as the associated cm_buf_t object.
If not, the wrong locks will be held.

If the cm_scache_t parameter is NULL and cm_FindSCache()
returns NULL, it means that the cm_scache_t object associated
with the bp->fid has been flushed from the cache.  cm_GetSCache()
must therefore be called to allocate a new status object for the
FID.  If the status object cannot be allocated, then any dirty
data stored in the buffer will be discarded.

Change-Id: Ie5d4eb8a1090d4b3c0753b7ddee2de0799485a2e
Reviewed-on: http://gerrit.openafs.org/3604
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: fs checkserver skip multi-homed up server
Jeffrey Altman [Tue, 28 Dec 2010 19:39:47 +0000]
Windows: fs checkserver skip multi-homed up server

Multi-homed file servers can be detected by comparing the
uuid for the cm_server_t entries.  If a server has at least
one up interface, do not list it as being down in the "fs checkserver"
response list.

Change-Id: I718eeee3316d05a33a4af97ca6c7fd947db41f44
Reviewed-on: http://gerrit.openafs.org/3603
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: fs checkservers should list vldb as well
Jeffrey Altman [Thu, 23 Dec 2010 04:23:48 +0000]
Windows: fs checkservers should list vldb as well

The Windows fs checkservers has only listed offline
file servers.  Include vldb as well to match the Unix
cache manager.

Change-Id: I81b8e4a1a813fcd8f19e3dc58c75ef161795518c
Reviewed-on: http://gerrit.openafs.org/3602
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agovos: do not mix memory allocation methods
Jeffrey Altman [Tue, 28 Dec 2010 00:34:14 +0000]
vos: do not mix memory allocation methods

ListVLDB mixed memory allocated with xdr_alloc() and memory
allocated with malloc().  This is not safe to do since it is
possible on some platforms for xdr_alloc() to allocated memory
using a method other than the malloc() linked to the vos
executable.

Instead of stealing the xdr_alloc()'d buffer, allocate a new
buffer and copy the contents.

Change-Id: Icdda3d4d0b7c15464fe7f48123f3e0ebed4c2cc5
Reviewed-on: http://gerrit.openafs.org/3600
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>