Add an implementation of red/black trees to our runtime library.
This is originally derived from the FreeBSD macro-based rbtree
implementation, but is heavily reworked to not use macros, to improve
legibility, and to favour speed over structure compactness.
A test suite is provided in tests/opr/
Change-Id: I123209d3f89b5f8c1b85d1e5cd7d1d650ccc68ed
Reviewed-on: http://gerrit.openafs.org/5838
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
The code to schedule a new delayed ack event is distributed throughout
the RX code. Consolidate this into a single helper function.
Change-Id: If54e36b5648f8caffe64cc2203dc0041fd06b8b3
Reviewed-on: http://gerrit.openafs.org/5837
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Add the opr_containerof macro, which can be used to find the base
address of a structure which contains a member whose location is known.
This formulation is heavily used throughout OpenAFS to determine the
base address of structures containing queue pointers - this provides
a central definition, rather than coding it from scratch each time.
Change-Id: I2a32a214252ad304238f740ad92579e5bb7287be
Reviewed-on: http://gerrit.openafs.org/5836
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Make use of the INetFwPolicy2 COM interface to configure
the Vista/Win7 firewall for all network profile types.
Change-Id: Id96d98f6e166f3529a117997f5a3c35b0051d1a4
Reviewed-on: http://gerrit.openafs.org/5812
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Use file server locks to enforce file share access modes
via the afs redirector interface. The approach taken
integrates share mode enforcement with the file server
lock tracking code in the service. The share mode
enforcement mimics that of the SMB Server interface.
This patchset includes two functional changes to
the previous locking and share mode processing:
1. The cm_scache_t fsLockCount field is used to
determine if the desired lock can be granted
by the file server. If not, the RXAFS_SetLock()
request is skipped and the request is failed
locally.
2. cm_CheckNTOpen() now accepts the desired and
and share access modes. The share access mode
is used to determine if a test lock should be
obtained at all. If the share mode is FILE_SHARE_WRITE
then no lock is requested. This change permits
Microsoft Office applications to offer the user
the ability to open the file in read-only mode
and notify the user when the document can be
opened in read-write mode.
Developed with Peter Scott <pscott@kerneldrivers.com>
FIXES 130239
Change-Id: If9b4beb74586296d4feae52dd06c03f0b8b595cd
Reviewed-on: http://gerrit.openafs.org/5823
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Oracle Solaris 11 no longer supports x86 (amd64 is required). If we
try to build the x86 module, /usr/include/sys/kobj.h complains that
the ISA is unsupported, and refuses to go on. So, just remove
MODLOAD32 from the libafs directories to build on sunx86_511.
Change-Id: Ic18936d1a0f53ed290d885617d313347aa6ce87a
Reviewed-on: http://gerrit.openafs.org/5835
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
We just unlinked the file, so we know we won't be able to rmdir() the
same thing. Give a path one level higher to
namei_RemoveDataDirectories, so we start rmdir()ing at the parent dir.
Change-Id: Ifa54d1cc07ed2d277416d09eabc45aa1e1c3803a
Reviewed-on: http://gerrit.openafs.org/5833
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
A few places were specifying both O_EXCL and O_TRUNC to open().
O_TRUNC does not make any sense with O_EXCL, and doesn't do anything,
so remove O_TRUNC from these instances to make the code more clear.
Change-Id: Ie8d9d7b9912a96683ef34f762607e75468b5ac78
Reviewed-on: http://gerrit.openafs.org/5832
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Since FSCTL_SET_REPARSE_POINT is not yet implemented
return STATUS_INVALID_PARAMETER to all requests that
do not fail validity tests.
Change-Id: I53d4b4fc9d957daa70b16d37a529778ed8bbfa5e
Reviewed-on: http://gerrit.openafs.org/5829
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
According to MS_FSCC 2.3.54 if the input buffer length is less than the size
of a REPARSE_DATA_BUFFER structure, or the input buffer length is greater
than 16,384, or a REPARSE_DATA_BUFFER structure has been specified for a
third party reparse tag, or the GUID specified for a third party reparse tag
does not match the GUID known by the operating system for this reparse
point, or the reparse tag is 0 or 1, then the return status shall be
STATUS_IO_REPARSE_DATA_INVALID.
Change-Id: I0072902afc8bc354af8f9b84b1021b37191dc23a
Reviewed-on: http://gerrit.openafs.org/5828
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista,
Windows Server 2008, Windows 7, and Windows Server 2008 R2 support the
FSCTL_IS_PATHNAME_VALID Request (section 2.3.21) and return STATUS_SUCCESS
whenever this request is invoked. We will do the same.
Change-Id: I432c8a41e1102648faaa3d8c0f3b8c36ea89bfc8
Reviewed-on: http://gerrit.openafs.org/5827
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
When populating the directory entry information for the
redirector the service must set the reparse point attribute.
Change-Id: I26db0b822f850f0a19606eeed3c29e0e72562e2f
Reviewed-on: http://gerrit.openafs.org/5824
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
The file server will set the rx call status bit (0x1)
when the rpc is in process and all of the locks are held.
At this point it is not possible for another store data rpc
to begin on the vnode prior to the completion of the current
rpc. Once this status bit is detected as set, the exclusive
store data synchronization on the cm_scache_t can be dropped.
This permits the next store data rpc to perform its biod
construction.
Change-Id: Ic856769650781b4f5f4ab4ac86df4946496bd655
Reviewed-on: http://gerrit.openafs.org/5741
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Some of the routines during a volume restore may set needsSalvaged, if
an inconsistency is detected while writing the given volume data.
However, after the data is read, we set the volume header information
to what was found in the dump stream, ignoring any needsSalvaged that
may have been set.
To ensure that inconsistent volumes in this situation actually get
demand-salvaged (for DAFS) or offlined (non-DAFS), keep the value of
needsSalvaged in the header, if it was set.
Change-Id: I575d14d84120be0fbbeb185ed2726f1285e6f2ce
Reviewed-on: http://gerrit.openafs.org/5822
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
because fileptr's handle can be reset during CopyOnWrite
we need to SetDirHandle after that call
FIXES 130215
Change-Id: I8578d30da42bdd9be2c552cdac4d2c526c22ee45
Reviewed-on: http://gerrit.openafs.org/5818
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Add the capability to do a "pretty" build, where we output something
like " CC /path/to/foo.o" to build foo.o, instead of the entire
compiler invocation, similarly to how the Linux kernel build appears.
Add the "pretty" building for CC and LD rules.
This also prints out some helpful information when a command fails,
which can sometimes otherwise be annoying to figure out post-mortem.
To enable the pretty building, make with V=0. To output everything
that is actually run with V=0, make with 'V=0 Q=' .
Note that this does not work with all makes, since not all makes will
propagate command-line-specified variables to sub-makes without -e.
Non-working makes include /usr/ccs/bin/make on HP-UX and Solaris.
However, GNU make will work, as will /usr/xpg4/bin/make on Solaris.
Change-Id: Idce0afffe7d5be88b0743ec3f926a52efb1a6a74
Reviewed-on: http://gerrit.openafs.org/4486
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
A few makefiles specify an old-style suffix rule, such as:
.c.o:
$(AFS_CCRULE) $<
Not all makes seem to interpret these rules correctly (such as Solaris
/usr/xpg4/bin/make). Since it is easy to do so, specify pattern-based
rules along with these, like so:
%.o: %.c
$(AFS_CCRULE) $<
Change-Id: I052f1156d1a7e29beedb0fb59390073c2521459e
Reviewed-on: http://gerrit.openafs.org/5819
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Add the replacement setenv and unsetenv functions to roken, for use on
(at least) HP-UX and older Solaris.
Change-Id: Id05137b6e6c88eb6648bd6a6e649f9ef311e32a4
Reviewed-on: http://gerrit.openafs.org/5801
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
we don't assign hd before dereferencing. stop dereferencing
and just use the queue cursor.
Change-Id: I023fd959c5d49575dbdf89fd4dab77341c5c52d0
Reviewed-on: http://gerrit.openafs.org/5814
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Instead of probing the DAFS-ness of the fileserver by probing which
FSSYNC opcodes it supports, detect DAFS-ness by looking at the SYNC
response header flags, which explicitly state whether or not the
endpoint is DAFS. This avoids unnecessary "protocol mismatch" log
messages when the endpoint is not DAFS.
Change-Id: Ie05a587951d6d5f69ae03cf3749f8c53e1eb6b62
Reviewed-on: http://gerrit.openafs.org/5800
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
the straight return from call_syscall isn't what we want. munge so
e.g. EDOM handling for ktc_GetToken does the right thing.
Change-Id: I3fbba799e0156bad29b27c74a1c7709ee8c50c34
Reviewed-on: http://gerrit.openafs.org/5807
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This workaround is no longer relevant. It is also error-prone and
there are far better ways to achieve a similar result, so get rid of
it.
Change-Id: If77f0cd95c8c608913d0c8717729a05c1ad67df9
Reviewed-on: http://gerrit.openafs.org/5811
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
While the -log option to volserver is supposed to print additional log
information, it shouldn't spam the log with useless data. Remove some
of the log lines that are really more "debug" information, so we log
the same amount of information as in the 1.4 series.
Change-Id: I1fd93344a7ebe11c6d5ad507dad87babe517785a
Reviewed-on: http://gerrit.openafs.org/5810
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Resolve a buffer leak in afs_readdir that was visible on all non-Linux
platforms (Linux has an independent readdir implementation)
Change-Id: Ia5106f0e5c57430d3483b6add5b1629ff3fbc7b3
Reviewed-on: http://gerrit.openafs.org/5794
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
GetVolumeHeader assumes that headers on the LRU are not associated
with a volume in an exclusive state. This is known to not be true for
some cases when salvage requests are received over FSSYNC, and may be
true in other scenarios. It's easy to just skip such headers, so skip
them.
Change-Id: I343d2e4f7af1c753641767be322420f38873c217
Reviewed-on: http://gerrit.openafs.org/5808
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
The RemoteNameLength passed in the IOCTL_AFS_CANCEL_CONNECTION call
must not include the trailing NUL. NPGetConnection() returns the
size of the buffer used which does include the trailing NUL.
Change-Id: Ic5eae51aade91db4a799bea83d898af6fbc37504
Reviewed-on: http://gerrit.openafs.org/5806
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Track whether or not the pFcb->NPFcb->Resource is held so
it can be released in all error paths.
Change-Id: I8c8bfb912329e8c11ac7857086412d85aa64fea6
Reviewed-on: http://gerrit.openafs.org/5804
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
During the Heimdal transition that default ccache type
was changed to FILE. Restore the use of API: ccaches.
Change-Id: Idd8dfb46fc9167d8c1eb44466b76906a152eef9d
Reviewed-on: http://gerrit.openafs.org/5802
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reduce the complexity of KFW_AFS_klog. Introduce
KFW_AFS_continue_aklog_processing_after_krb5_error() and
combine the input realm and realm_of_cell cases making
use of the RealmName variable.
Change-Id: I363544548652bc892f50dce00865e13e7d42de7f
Reviewed-on: http://gerrit.openafs.org/5799
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
A user on the openafs-info mailing list noted that the Admin Guide is
unclear about creating read-only replicas on different partitions on
the same fileserver. Clarify the rules here.
Change-Id: I8229b4fba36c128772bb8198e6b8310a51206c03
Reviewed-on: http://gerrit.openafs.org/5745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit updates the code imported from heimdal to
ee7340860a22f81fb869cc431efc1fd4e5c77d34 (switch-from-svn-to-git-2542-gee73408)
Upstream changes are:
Jeffrey Altman (2):
Windows: fallback to PROV_RNG if no PROV_RSA_FULL
roken: posix errnos for windows
Love Hornquist Astrand (3):
drop __restrict to please old compilers
add krb5_is_enctype_weak
Don't export tests from library, reported in bug from Tom Payeire
New files are:
roken/setenv.c
roken/unsetenv.c
Change-Id: I7e3b3db2a58eaaae9de91431565176921d79af3b
Reviewed-on: http://gerrit.openafs.org/5798
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
Various autoconf tests which use the C compiler may yield different
results depending on whether or not we are compiling for x86 or amd64
on Solaris (different libraries are available, structures may be
different, et al). So, set CFLAGS depending on which arch we are
targeting, so the autoconf results are more consistent with the actual
compilation during the build.
Change-Id: I99ddefaabc3bb2e80abe698366b348238d51408d
Reviewed-on: http://gerrit.openafs.org/5786
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
OPENAFS_OSCONF can set the C compiler we use, as well as changing
various compiler flags. These changes can alter autoconf tests, so
allow OPENAFS_OSCONF to change these before various autoconf tests are
performed which require the C compiler.
Change-Id: I8da7d10b227f230d1467c77845c0dbd4b48fa966
Reviewed-on: http://gerrit.openafs.org/5785
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
Remove the -settime option from afsd, and any code for making
RXAFS_GetTime calls in libafs. Server probes have been replaced by
calls to RXAFS_GetCapabilities, and the actual functionality of
synchronizing the system clock has been superseded by other systems
like NTP. Issue a warning for all code paths that try to enable
-settime support.
Historical note: the code that this commit is removing contains bugs.
Do not simply revert this commit to turn on -settime support again.
Change-Id: Id291f5f88b1ad84594706f2a1a02a933dddd0cb9
Reviewed-on: http://gerrit.openafs.org/5787
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Add inline function to pivot two queues.
Implementation by Simon Wilkinson.
Change-Id: I704a1ff3e0d6314e2bfe47c870226cb6ffd44b1b
Reviewed-on: http://gerrit.openafs.org/5742
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
When we import commits, the new commit does not have a Change-Id in
the commit message. Usually a git commit-msg hook will be installed to
automatically insert a Change-Id into the commit message if one does
not already exist, so trigger the hook by performing a no-op 'git
commit --amend'.
Change-Id: Ie5e83c529b83c9f3d269df6742a59e965dbc6407
Reviewed-on: http://gerrit.openafs.org/5797
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Currently, importing external commits with import-external-git.pl may
fail if the current repository checks for whitespace errors, and the
external commits contain whitespace errors. So run the commit with
--no-verify, so we can make the commit before fixing up the whitespace
errors immediately afterwards.
Change-Id: I8c9c39550e118956aa847e0ec5c5b1181f42e6cb
Reviewed-on: http://gerrit.openafs.org/5796
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Import the roken implementation of setenv and unsetenv, which are
required on HP-UX.
Change-Id: Ia91f407d696f3add27796bf9e2f5998717f4c825
Reviewed-on: http://gerrit.openafs.org/5795
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Commit df22620f66 introduced a
deadlock when retrieving file attributes for symlink objects.
To correct the deadlock, do not hold the Fcb locks during the
AFSRetrieveFileAttributes() call.
Change-Id: I8d3d2c5f54d4e5c97f690fd1fd6db62128317cf2
Reviewed-on: http://gerrit.openafs.org/5792
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Make sure that we always set the reparse point attribute
for symlinks in directory enumerations and attribute queries.
Change-Id: Ie7520cef64793e3385f229934189fc56a3edb584
Reviewed-on: http://gerrit.openafs.org/5793
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
If the mount point or symlink is opened as a reparse point
we must remember that in the Ccb so that later reparse point
processing can be implemented properly. For now remember
with the CCB_FLAG_MASK_OPENED_REPARSE_POINT flag.
Change-Id: I32997a85701a95a5be1402cdcd3335a938395760
Reviewed-on: http://gerrit.openafs.org/5791
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Set the directory file attribute for all mount points
since a mount point target is always represented as
a directory.
Change-Id: I57a8e44d1382093311e8263c18d55f22f2f745ea
Reviewed-on: http://gerrit.openafs.org/5784
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott.kd@gmail.com>
Tested-by: Peter Scott <pscott.kd@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
When a component is a symlink, correctly retrieve file
attributes during a query file information request.
FIXES 130283
Change-Id: I0e9a576ca57acf9c65a5dc0eac8c9d65ddf6ab6f
Reviewed-on: http://gerrit.openafs.org/5782
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>