volser: use also vn_length_hi in dump size calculation

Only the low order 32 bits of the file length were used.
Now using macro VNDISK_GET_LEN instead of direct FillInt64.

FIXES 131819

Change-Id: Iaecd68764f4b071d6b8c838362e7e657578d9b2f
Reviewed-on: http://gerrit.openafs.org/10876
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Make struct CallBack indentation uniform again

Align the per-field comments.

Change-Id: Ic9da32851c518b29e110fb80428a1f261bbd9cbf
Reviewed-on: http://gerrit.openafs.org/10929
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
libafs: reset global icl set pointers on shutdown

Avoid panicking when an icl tracing function is called after
shutdown_icl.

There is a window during shutdown in which pioctls can be requested
after the shutdown_icl is issued. Reset the global icl set pointers
so tracing is disabled after the shutdown_icl, instead of using
pointers to freed memory.

Removed the unneeded afs_icl_FindSet calls and use the global
pointers which were set during the initialization.

Change-Id: I3310868a28850236a2870b8dab858ecb7a815c11
Reviewed-on: http://gerrit.openafs.org/10884
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
libadmin: add missing bubasics dependency

bubasics is a dependency of libadmin. Add it to the top level
makefile.

This missing dependency was found by analyzing the libadmin header
file includes.

Change-Id: I300669387cea95a0fe800cffb4024356641591e6
Reviewed-on: http://gerrit.openafs.org/10727
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
vos: GetServer search for non-loopback address

GetServer() is used to obtain an IP address for the 'aname' parameter.
'aname' can be either a dotted address or a host name.   If it is a dotted
address, it is returned immediately.  If it is a host name, then
gethostbyname() is used to obtain an IP address.

The prior version of this function had two failings:

1. It assumed that a struct hostent only contained a single address.
   It used the former h_addr field.  For all platforms supported by
   OpenAFS h_addr is a macro referencing the first address in the
   h_addr_list array.  If h_addr was a loopback address, it would
   ignore any additional addresses that might be in the list.

2. It assumed that if gethostbyname(aname) returned a loopback
   address as h_addr that 'aname' must be referring to the machine
   that the vos command is being executed on.  It therefore used
   gethostname() to obtain an alternate name to use for a gethostbyname()
   query.  The results of this query were not checked to be a loopback.
   As a result, a loopback address could be returned to the caller which
   in turn could be set into the VLDB.

Change-Id: Ib8d513be9daf650045e9c40718b0187f6b9770a2
Reviewed-on: http://gerrit.openafs.org/10585
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Harald Barth <haba+gerrit@kth.se>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
volser: remove commented code

Apparently this predates AFS 3.0 so it should be safe to remove.

Change-Id: Ifec145c71da4668066bf428fb594943dfce20e88
Reviewed-on: http://gerrit.openafs.org/10935
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
vlserver: Add auditing to some more RPC's

A future commit will conditionally restrict access to these RPC's.
Auditing will allow debugging and monitoring of this feature.

Change-Id: Id8a8a1831c82ef967eb6cced1609915d1d6b774f
Reviewed-on: http://gerrit.openafs.org/10939
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
bcrypt keys are in the rxkad list, not the rxgk list

Fix the presumed typo in the loop intended to skip them.

Change-Id: I863fb12792b82d528938ad0598aa626880f11a41
Reviewed-on: http://gerrit.openafs.org/10947
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Linux: Do drop dentry if lookup returns ENOENT

Commit 997f7fce437787a45ae0584beaae43affbd37cce switched to using
d_invalidate instead of d_drop to prevent unhashing dentries
which are only temporarily invalid and may still be referenced
by someone having a current working directory pointing to it.
This could result in getting ENOENT from getcwd() after some
transient problems, even when the directory is there and
accessible.

The change had the side effect of potentially leaving something
visible when it has actually been removed, for instance a mountpoint
removed by "fs rm".

If afs_lookup returns ENOENT, we want to forcibly drop (unhash)
the dentry, even if it has current users.

Change-Id: I0e7b6e09b2c4ae551fa6c84235ed31f7df476b45
Reviewed-on: http://gerrit.openafs.org/10928
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
compile_et macros to generate source and headers separately

Common makefile macros to generate headers and source files
separately using the new compile_et -emit option.

Change-Id: I5848922fbe1d94f9d3cec829a3ed657e7f63d191
Reviewed-on: http://gerrit.openafs.org/10869
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
libafs: afs_InitVolSlot function

Add a new local function to initialize newly gotten volume slots and
move that code out of afs_SetupVolume().  Initialize the slot before
putting the volume in the volume hash table list.

Make it more clear to avoid using record 0. The volume items record 0 is
not used, so avoid setting the tf pointer to the static fvolume buffer
when reading record 0.

Change-Id: Iffba52fbf8d72459c9a36015964e61d485f22ad4
Reviewed-on: http://gerrit.openafs.org/10877
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
libafs: put volume disk cache i/o in afs_UFSGetVolSlot

Move the reading of the volume items file to the afs_UFSGetVolSlot()
to make it more clear the volume items file is not accessed when
memcache is in effect.

This changes the afs_GetVolSlot to return an intialized volume slot,
if one can be gotten.

Change-Id: I0c76ca8c8e1cc19677ce950bfb454755bbbee86a
Reviewed-on: http://gerrit.openafs.org/10878
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
libafs: afs_SetupVolSlot function

Move the code block to get and setup volume slots out of
afs_SetupVolume to a new local function called afs_SetupVolSlot.
This new function acquires the afs_xvolume lock and releases it
before returning.

Change-Id: I1bd33f13e0525f9ff050d7e161cf29a511e5c4b8
Reviewed-on: http://gerrit.openafs.org/10879
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
libafs: allow bkg daemon requests without creds

Make the creds argument optional for background daemon
requests which do not need to pass a cred.

Change-Id: Ic4ac69d746e8a84993069e37bdd0440622febd70
Reviewed-on: http://gerrit.openafs.org/10880
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
fs: display cell not available on ESRCH

The cache manager pioctls abuse ESRCH to represent errors due to
unavailable cell information.  Give a more sensible error message to
the user when a pioctl returns an ESRCH error, instead of "no such
process", which is the conventional meaning of ESRCH.

The new error message is consistent with the Windows implementation
of fs.

For example, on a host with a misconfigured ThisCell and/or CellServDB.

    $ fs wscell
    fs: No such process

becomes:

    $ fs wscell
    fs: Cell name not recognized.

Change-Id: Ibdcb0957118205b9540cae07b3cafa65c51ff497
Reviewed-on: http://gerrit.openafs.org/10824
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
pioctl.c: removed unused variable

The 'rval' variable is only actually used in the LINUX20 case;
adding another conditional block is making the LINUX20 case
different enough that it should get split out entirely.
Doing so lets the 'else' clause be simpler.

Found by clang on FreeBSD 10.0.

Change-Id: I60c56af355fdb68752d9596ff2cd7a4259b43fe9
Reviewed-on: http://gerrit.openafs.org/10819
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
aklog: those pesky assignments in conditionals

This one should actually be an assignment, and the compiler warning
for having two sets of parentheses is helpful.

Found by clang on FreeBSD 10.0.

Change-Id: Ic906cbdc50a20bcd0b91555581b60c518da2bc81
Reviewed-on: http://gerrit.openafs.org/10823
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
volscan: avoid printing null mount-point cellname

The 'mcell' field is null when there is no cell set in the mount point,
so do not try to print it.

Change-Id: I363310665313f7bbcca783a4d9be87aaa7b0a8fe
Reviewed-on: http://gerrit.openafs.org/10226
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
volscan: hide -mask option

The -mask option is unneccessary and sets a bad precedent, so
deprecate and hide this option. The vnodes of interest can be found
can be found easily and much more flexibly with a simple command
pipeline.

Change-Id: Ibe75928c6b041d135c0cb5867228947cd7f4e889
Reviewed-on: http://gerrit.openafs.org/10901
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
volinfo: refactor global options

Move the global options to a structure and pass it to the vol-info
functions. This is a precursor for creating separate volinfo and
volscan programs.

Change-Id: I86ea9e875f73831e6c7ea4b50591e31df3e0c39f
Reviewed-on: http://gerrit.openafs.org/10902
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>