13533 Commits

Author SHA1 Message Date
Stephan Wiesand
e8ead73224 Update NEWS for 1.8.9pre2
Release notes for the second 1.8.9 prerelease.

Change-Id: I564ee4f4348ca3574a52c75fea30c55dac5e33a4
Reviewed-on: https://gerrit.openafs.org/15193
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-11-10 12:11:13 -05:00
Cheyenne Wills
fdf38483c7 Linux-6.0: Replace add_to_page_cache
Linux 6.0 removed the add_to_page_cache function in the Linux commit:
    'filemap: Remove add_to_page_cache() and add_to_page_cache_locked()'
    (2bb876b58d593d7f2522ec0f41f20a74fde76822)

The replacement function, filemap_add_folio function is exported as GPL,
but a non-GPL wrapper was provided in the Linux 5.15 commit:
    'mm/filemap: Add filemap_add_folio()'
    (9dd3d069406cea073fc633e77bc59abbfde8c6c4)
which changed the GPL exported function add_to_page_cache_lru to a
non-GPL exported function.

The function add_to_page_cache_lru functionally combines the
add_to_page_cache with lru_cache_add.  Within afs, all the calls to
add_to_page_cache follow the pattern of calling the lru_cache_add
via the wrapper afs_lru_cache_add immediately after (except in one case
noted below).

Add an autoconf check to see if add_to_page_cache_lru is available.

Introduce a new wrapper function afs_add_to_page_cache_lru that handles
calling either add_to_page_cache/afs_lru_cache_add or
add_to_page_cache_lru.

As noted above there is one function, afs_linux_bypass_readpages, that
calls add_to_page_cache but does not immediately call afs_lru_cache_add.
This function is only used in Linux kernels prior to 5.18, see the
commit:
    'Linux-5.18: replace readpages with readahead' (7a181415db)
Since this code path is only built for a Linux kernel level where
add_to_page_cache should also exists, we do not replace this call.

NOTE:
The add_to_page_cache_lru was moved into mm/folio-compat.c which has a
comment indicating that callers of these functions should migrate to
folio calls.  However the replacement folio call that is needed by afs,
filemap_add_folio, is exported as GPL.

Reviewed-on: https://gerrit.openafs.org/15132
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0ce315f0cee1cff7e19e6ebcc0e0e82e03719c20)

Change-Id: Ic0496c2fba00e7be467dbbcf52d9854495e1ad9f
Reviewed-on: https://gerrit.openafs.org/15148
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Harish Sharma <Harish.Sharma1@ibm.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-11-03 10:54:36 -04:00
Michael Meffie
79a04c3448 afs: Avoid unbounded string copy in SRXAFSCB_GetLock()
Use strlcpy() instead of strcpy() when filling in the lock name to avoid
string buffer overflows of the AFSDBLock name arrays.

This is a 1.8.x specific commit, derived from 419f0cd7aa (afs: Replace
strcpy &co by safer alternatives)

Change-Id: Ia59f6dccdeab1c0b6f267254bd264842568b7582
Reviewed-on: https://gerrit.openafs.org/15151
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Harish Sharma <Harish.Sharma1@ibm.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-11-03 10:54:18 -04:00
Cheyenne Wills
119cea2f49 Remove gssapi in autoconf and configuration
The 1.8.x specific commit in gerrit 12681, "Remove src/rxgk" (7c2ce4040)
removed rxgk from the build, however the probe for GSSAPI is still
place.

If there is no gssapi library available, configure fails:
    checking for gss_import_name in -lgssapi_krb5... no
    checking for gss_import_name in -lgss... no
    configure: error: cannot find usable GSS-API library

There are no references to gssapi other than the probe in autoconf and
2 defines in src/config/Makefile.config.in

Remove the autoconf check for GSSAPI via the RAA_LIB_GSSAPI call.
Remove the 2 GSSAPI related defines from Makefile.config.in
Update the INSTALL document to remove references to gssapi.

Change-Id: I873e46bfccfbf538740e8bf5e28a3ca8c3cd3744
Reviewed-on: https://gerrit.openafs.org/15137
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-11-03 10:53:54 -04:00
Stephan Wiesand
a2c1f9dc21 Make OpenAFS 1.8.9pre1
Update version strings for the first 1.8.9 prerelease.

Change-Id: I6fc6dff8143445ee82188a2614588068f1feeb25
Reviewed-on: https://gerrit.openafs.org/14810
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
openafs-stable-1_8_9pre1
2022-09-09 05:02:07 -04:00
Stephan Wiesand
7a44c381f1 Update NEWS for 1.8.9pre1
Release notes for the first 1.8.9 prerelease.

Change-Id: I26e4334f9f1e34b36299b097525a61a89f422aaf
Reviewed-on: https://gerrit.openafs.org/15126
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-09-09 05:00:37 -04:00
Cheyenne Wills
beb1a8a16c afs: Clean up compiler warning casting ptr to int
In osi_probe.c, the macro 'check_result' casts a pointer to an int which
on older Linux kernels (e.g. 2.6.18) produces several lines with the C
warning:

... warning: cast from pointer to integer of different size

Change the cast from int to long int.

Linux 2.6.18 doesn't provide intptr_t or uintptr_t, and stdint.h is not
available to kernel modules.  But the size of a pointer is the size of a
long (see uintptr_t in linux/types.h - Linux 2.6.24+), so
change the cast from int to long.

Note that the this code by default only gets pulled in for older Linux
kernels (e.g. 2.6.18).  For newer kernels, ENABLE_LINUX_SYSCALL_PROBING
is not defined, and so most of osi_probe.c is not built.

Reviewed-on: https://gerrit.openafs.org/14092
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 38d78e2496c3d242e44bad401ecffe15e3883388)

Change-Id: I474ad10c8cda8c414154e20f739a2aba5ba890cf
Reviewed-on: https://gerrit.openafs.org/15134
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-09-08 08:41:53 -04:00
Andrew Deason
7a8c044c09 dir: Set srcdir correctly in src/dir/test
srcdir is a magic variable that needs to be set to @srcdir@, not some
relative path like ../../.. (which will usually be somewhere in the
objdir, not srcdir). Set it correctly in here.

Without this, objdir builds can fail with:

    make[4]: Entering directory '...obj/src/dir/test'
    make[4]: *** No rule to make target 'dtest.o', needed by 'dtest'.  Stop.

Which happens because the automatic rule for dtest.o can't be
constructed, since we cannot find dtest.c automatically because srcdir
isn't set properly.

This has been broken since commit 37b4195d (dtest-20021111), but was
not noticeable until commit 192a2ff4 (dir: make dtest buildable
again), since that caused dtest to actually get built.

Also set LIBS correctly in here, using the conventional ${TOP_LIBDIR},
since ${srcdir} no longer points to "../../..".

Reviewed-on: https://gerrit.openafs.org/14384
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit bc6f50ca0ce6c17a5a9b1042fa90235613f80c95)

Change-Id: I8aff31557b6b92bb10c68abb0ba5a61a68b8f750
Reviewed-on: https://gerrit.openafs.org/15133
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-09-08 08:38:09 -04:00
Cheyenne Wills
e3edd8c43e LINUX: Use bitwise & for f_flags test
This code is clearly supposed to be masking f_flags with O_ACCMODE, and
so should be using a bitwise &, not the boolean &&.  Clang complains
about this, causing a warning (which breaks the build with
--enable-checking):

error: use of logical '&&' with constant operand [-Werror,
        -Wconstant-logical-operand]
        } else if ((file->f_flags && O_ACCMODE) != O_WRONLY) {
                                  ^  ~~~~~~~~~
.../osi_vnodeops.c:3192:28: note: use '&' for a
        bitwise operation

For the current code without this commit the behavior of this
check is as follows:

   When f_flags is:         The check is:
   ====================     =============
   O_RDONLY                 True  (as expected)
   O_WRONLY                 False (as expected)
   O_RDWR                   False (incorrect)
   has some non-O_ACCMODE   False (incorrect)
    bit is set

The incorrect check doesn't cause any problems for overall correctness,
but it does mean that in those cases afs_linux_fillpage will not be
called and that partially-written pages will be left out of date and any
reader will need to fill the page again.

Fix this by using the bitwise &.

There is also an out of date link to the Linux documentation.  Update
the comment to point to the current documentation that is in the Linux
source tree.

Reviewed-on: https://gerrit.openafs.org/14903
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 8d9545008240d7f285b140503e432f53f41e0724)

Change-Id: Iae459ffe87df9a21a90587c02a1ee2c20b360d33
Reviewed-on: https://gerrit.openafs.org/15129
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-09-08 08:37:17 -04:00
Jan Iven
c3f31cc9c3 systemd: do not load the 'openafs' module on boot
remove /etc/sysconfig/modules/openafs-client.modules, i.e no longer have
systemd run "modprobe openafs" at boot, on RPM-based systems.

This had been introduced with a reference to the Fedora packaging guide
at the time. However, this mechanism was meant just for persistent
driver modules (i.e expected to stay loaded over the runtime) - the
"openafs" module is loaded (and unloaded) by the actual systemd unit.

The systemd unit that processes the above file comes from "initscripts",
this is optional in later Fedoras/RHELs and so the file may not even be
processed (/usr/lib/modules-load.d/ would be an alternative mechanism to
load modules at boot.. if needed).

This change is mostly cosmetic, although RT#135204 showed that having
the "openafs" module loaded without a client running can actually be
harmful.

Reviewed-on: https://gerrit.openafs.org/15092
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 40b2c6036737a416f3b33624b5abeefa407c1b01)

Change-Id: Iea1475217b8ae56accfb4436248011f0b84e0c09
Reviewed-on: https://gerrit.openafs.org/15128
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-09-08 08:33:47 -04:00
Cheyenne Wills
99f04b1398 linux: Call put_page if errors in aops->readpages
Within the address_space_operations readpages function, when we remove a
page from the page->lru list, we must ensure that the page reference
count is decremented via put_page.

There are two cases within the flow of the afs_linux_readpages where
we remove a page from the page->lru list, but fail to put_page() it.

 - If we go through afs_linux_bypass_readpages we fail to call
   put_page() if the page index is larger than the index calculated from
   i_size_read for the cache file.
 - If get_dcache_readahead returns an error in afs_linux_readpages, we
   fail to put_page().  This can happen if there was a problem opening
   the cache file, or if the cache file has no a_ops->readpage.

Add a call to put_page in afs_linux_bypass_readpages when the page index
is greater than the index calculated from the i_size_read for the cache
file.

Add a call to put_page in afs_linux_readpages if get_dcache_readahead
returns an error.

Note: The condition of not calling put_page if there was an error
opening the cache file was introduced by commit 'LINUX: Don't panic on
some file open errors' (af73b9a3b1f), which replaced an assert with
code that handled the error.  The other conditions have existed since
the relevant code was introduced.

In addition, the problems addressed by this commit are not present in
Linux kernels 5.8 and greater when the commit 'Linux-5.18: replace
readpages with readahead' (7a181415db1) is present, because we call
afs_linux_readahead instead of afs_linux_readpages.

Reviewed-on: https://gerrit.openafs.org/15068
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 903dd5bf5e9328431e356abc42e20c248c5df6fd)

Change-Id: I3679969f985e83a7291a5fb735c80f7d57429c29
Reviewed-on: https://gerrit.openafs.org/15096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-25 08:50:36 -04:00
Cheyenne Wills
0ca47d0a03 Linux-5.19: Remove flags from aops->write_begin
The Linux 5.19 commits:

 fs: Remove aop flags parameter from grab_cache_page_write_begin()
  (b7446e7c)
 fs: Remove flags parameter from aops->write_begin (9d6b0cd7)

removed the flags parameter from the address space operations
'write_begin' as well as removing the flags parameter from the Linux
function 'grab_cache_page_write_begin'.

Add an autoconf test to see if grab_cache_page_write_begin takes 2 or
3 parameters. Use this as a test to determine if the address space
operations 'write_begin' takes a flags parameter.

Create a version of afs_linux_write_begin that does not take a flags
parameter, which also calls grab_cache_page_write_begin without flags.

Reviewed-on: https://gerrit.openafs.org/15041
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 52d8df218ff27c139ede221ec4decf593610fc47)

Change-Id: I20575c2e9d0979749078f4e3d6f862900c6b6561
Reviewed-on: https://gerrit.openafs.org/15095
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-25 08:49:03 -04:00
Cheyenne Wills
e8f136dd68 Linux-5.19: Rename aops readpage to read_folio
With Linux commits:
  mm,fs: Remove aops->readpage   (7e0a126519)
  fs: Introduce aops->read_folio (5efe7448a1)

the address space operations method 'readpage' was replaced with
read_folio.  The operation behaves the same, except instead of taking a
struct page parameter, the new function takes a folio structure.

Add an autoconf test for the address space operation entry read_folio

Replace the references to an address space operations' readpage with
read_folio.  Note that the function Linux page_folio can be used to
obtain the required pointer to the folio for a given page.

Introduce afs_linux_read_folio that accepts a folio and calls
afs_linux_readpage with the page associated with that folio.

Reviewed-on: https://gerrit.openafs.org/15040
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit bfb852197edcbe0c38c499faecd7c1be23308a20)

Change-Id: Iab96bd10a143d88fe37ac8aa8980b33339c76852
Reviewed-on: https://gerrit.openafs.org/15094
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-25 08:48:15 -04:00
Cheyenne Wills
43c926bf4d Linux: Introduce file mapping readpage helpers
Create a helper function that determines if a file's
 i_mapping->a_ops->readpage
is NULL.

Create a helper function that calls a file's
 i_mapping->a_ops->readpage

There are no functional changes with this commit.

Note: This commit isolates references to 'readpage' so that future
commits can change the name in a more straight forward manner.

Reviewed-on: https://gerrit.openafs.org/15039
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a81f7300f08d6e515adbde4bce4b72a3102b60f9)

Change-Id: I9268fd2622ecd48ad6971a8faaeefef8128f4024
Reviewed-on: https://gerrit.openafs.org/15093
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-25 08:46:58 -04:00
Cheyenne Wills
6997f89044 Linux-5.18: replace readpages with readahead
The linux 5.18 commit 'fs: Remove ->readpages address space
operation' (704528d8) removes the address_space_operations operation
"readpages", which is replaced with the "readahead" operation
that was introduced with the 5.8 commit 'mm: add readahead address
space operation' (8151b4c8).

When readahead is called, the pages in 'rac' have already been added to
the lru caches and are locked. For each page that we get from the 'rac'
(i.e. from 'readahead_page(rac)'), we must unlock and put_page the page;
if we successfully populated the page with data, we also set
PageUpToDate.  If we don't process all the pages in 'rac', the caller
will handle cleaning up any remaining pages; we don't need to unlock/put
them or touch them at all.
  (See Linux Documentation/filesystems/vfs.rst)

Add an autoconf test to detect the presence of 'readahead' in the
address_space_operations structure.

For the implementation of readahead (which is contained in Linux's
osi_vnodeops.c):

Add new functions 'afs_linux_bypass_readahead' and 'afs_linux_readahead'
as replacements for 'afs_bypass_readpages' and 'afs_linux_readpages'
when the linux kernel supports the readahead operation.

Notes:
  In afs_linux_bypass_readahead, the pages are already locked and are
  already in the page cache, we just need to place the page into the
  iovecp.  The page's refcount will be decremented and will be unlocked
  when processing the read request.

  In afs_linux_readahead, the lrupages is needed in case a page is added
  to the cachefp's mapping in afs_linux_read_cache (which also handles
  unlocking the page).

  In afs_linux_readahead, if there is no tdc, we must still unlock the
  page otherwise the read process will wait on that page.

Reviewed-on: https://gerrit.openafs.org/14953
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7a181415db1b2142d125714f1dea32879e2ca07d)

Change-Id: I2ed4f22bd2b12c76586ae5326841a23735a20af0
Reviewed-on: https://gerrit.openafs.org/15065
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:10:39 -04:00
Cheyenne Wills
45bf0cc73d Prevent sscanf format widths from overrunning array
cppcheck noted these instances of sscanf could wipe out the ending null
terminator.  Length is now macro expanded rather than hard coded and the
array itself is one unit longer to avoid the overrun.

Reviewed-on: https://gerrit.openafs.org/13136
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 1162fcdba6c5234f4ac36e17f29e01ae04950004)

Change-Id: I1759f4c11df003c6d0798910db9210ff91b95536
Reviewed-on: https://gerrit.openafs.org/15064
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:10:01 -04:00
Cheyenne Wills
07b78426fe opr: replace AFS_STRINGIZE with opr_stringize
To avoid adding new includes for afs/afsutil.h in order to use
'AFS_STRINGIZE', create a replacement, 'opr_stringize', in afs/opr.h.

Replace the usage of 'AFS_STRINGIZE' with opr_stringize and remove the
definition of 'AFS_STRINGIZE'

Reviewed-on: https://gerrit.openafs.org/15029
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7f54bbe1568ea66d04bf69f5f083aa0422fcb417)

Change-Id: I09fe7ba2191d1522342ac2a935afc40b1c67b7a4
Reviewed-on: https://gerrit.openafs.org/15063
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:09:31 -04:00
Cheyenne Wills
f6e6ed4b31 lwp: Ignore dangling-pointer warning in process.c
In lwp/process.c the address of a stack variable is saved as part of
creating a new context.  GCC-12 is flagging the statement with a
diagnostic:

  ./process.c:46:24: error: storing the address of local variable
      ‘stackvar’ in ‘*savearea.topstack’ [-Werror=dangling-pointer=]
   46 |     savearea->topstack = (char *)&stackvar;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

In this particular case, the code is meaning to save the address of the
stack in preparation of setting up a new context, which requires knowing
the address the current stack.

The diagnostic is changed from a warning to an error when configured
with --enable-checking.

Set the env variable CFLAGS_NODANGLING_POINTER to
'-Wno-dangling-pointer' if the compiler supports the option and update
the src/lwp/Makefile.in to use the flag when compiling process.c

Reviewed-on: https://gerrit.openafs.org/14957
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 748ae0fc25c51316d741afd9b9dfd479ffdf3250)

Change-Id: I03d2d4a77b4a391f023f40e9793968e03a50c241
Reviewed-on: https://gerrit.openafs.org/15062
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:08:44 -04:00
Cheyenne Wills
f034932791 afs: Avoid always-false NULL test on AFSTOV(avc)
GCC-12 is flagging a comparison with the following diagnostic:

 src/afs/afs_vcache.c:3161:25: error: the comparison will always
    evaluate as ‘false’ for the address of ‘v’ will never be NULL
    [-Werror=address]
 3161 |             AFSTOV(avc) == NULL || vType(avc) == VDIR ||
      |                         ^~

When the vcache structure does not have the vnode embedded the expansion
of the AFSTOV macro results in:
   ((avc)->v)
which tests contents of a 'v'.

When the vcache structure does have the vnode embedded, the expansion of
the macro results in:
   (&(avc)->v)
which tests the address of 'v', which will never be NULL in this case.

Update afs.h to add a new define 'AFS_VCACHE_EMBEDDED_VNODE' when the
vcache structure contains an embedded vnode structure.  Restructure the
preprocessor statements for the AFSTOV definition

Avoid testing AFSTOV(x) against NULL when AFS_VCACHE_EMBEDDED_VNODE is
defined.

The diagnostic is changed from a warning to an error when configured
with --enable-checking.

Reviewed-on: https://gerrit.openafs.org/14956
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 1d1a20c33258a9285a16e85a55df9c0fbf4a3ac2)

Change-Id: Ieeb2b958c20aabbb412023c8e60c6d68e961c4b8
Reviewed-on: https://gerrit.openafs.org/15061
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:08:20 -04:00
Cheyenne Wills
f5de30623d afs: introduce get_dcache_readahead
Relocate the block of code that obtains the dcache for a readahead
operation from the afs_linux_readpages function into its own static
function.

Reviewed-on: https://gerrit.openafs.org/14962
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 44e24ae5d7dc41e54d23638d5f64ab2e81e43ad0)

Change-Id: I5fce05cd241dc5a22526d931969cf11da89e3d48
Reviewed-on: https://gerrit.openafs.org/15060
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:07:55 -04:00
Cheyenne Wills
5c9ec03599 afs: introduce afs_alloc_ncr/afs_free_ncr
There is duplicated code for initializing a nocache_read_request
and also freeing the associated storage in certain cases.  Create a set
of helper functions that allocates and frees a nocache_read_request and
its associated structures.

afs_alloc_ncr allocates a nocache_read_request structure and if not
UKERNEL, will allocate and initialize the associated uio and iovec
structures.

afs_free_ncr releases a noncache_read_request structure and the
associated uio and iovec structures if not UKERNEL.

Update locations that allocate/free nocache_read_request structures to
use the new functions.

Reviewed-on: https://gerrit.openafs.org/14954
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 209eb92448001e59525413610356070d8e4f10a0)

Change-Id: Id9c23195e062c720fdbde83a9b5d36fb287aa8a4
Reviewed-on: https://gerrit.openafs.org/15059
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:07:32 -04:00
Cheyenne Wills
52061e0670 Linux-5.18 replace set_page_dirty with dirty_folio
The commits going into Linux 5.18:

  fs: Add aops->dirty_folio (6f31a5a261db)
  fs: Convert __set_page_dirty_buffers to block_dirty_folio (e621900ad2)
  fs: Remove aops ->set_page_dirty (3a3bae50af)

replaces the address_space_operations structure member set_page_dirty
which with dirty_folio.  The linux function __set_page_dirty_buffers is
replaced by block_dirty_folio.

Nothing within afs uses or implements the set_page_dirty function,
however the structure member is required to be initialized.

Add an autoconf test for the dirty_folio member and if present, set the
address_space_operations member dirty_folio to block_dirty_folio
instead of setting the set_page_dirty member.

Reviewed-on: https://gerrit.openafs.org/14939
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 6aa129e743e882cf30c35afd67eabf82274c5fca)

Change-Id: I8afccecae7971d98f87a65db816c337fb2380854
Reviewed-on: https://gerrit.openafs.org/15058
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:07:00 -04:00
Cheyenne Wills
1909260bb2 afsd: Avoid fscanf overflows when paring cacheinfo
clang-14 is producing the following diagnostic:

    afsd.c:581:44: error: 'fscanf' may overflow; destination buffer in
      argument 3 has size 1024, but the corresponding specifier may
      require size 1025 [-Werror,-Wfortify-source]
        fscanf(cachefd, "%1024[^:]:%1024[^:]:%d", tCacheMountDir,

fscanf is being used to parse the contents of a file and the buffer
sizes are hardcoded.  Simply increase the size of the 2 buffers by 1.

The diagnostic warning is changed to an error when configured with
--enable-checking.

Reviewed-on: https://gerrit.openafs.org/14958
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 82c14b9a667174f044b7421e6e081ad323720a67)

Change-Id: I81b5563599272b8f224962941d179ae2e93f7f47
Reviewed-on: https://gerrit.openafs.org/15057
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:06:29 -04:00
Cheyenne Wills
80be173ac1 vol: Use asprintf in _namei_examine_special
GCC-12 is flagging an snprintf statement with a format truncation
warning:

  namei_ops.c: In function ‘namei_ListAFSSubDirs’:
  namei_ops.c:2029:22: error: ‘%s’ directive output may be truncated
   writing up to 255 bytes into a region of size between 0 and 511
   [-Werror=format-truncation=]

Change code to use asprintf instead of snprintf.  Return an error if a
memory allocation fails.

Reviewed-on: https://gerrit.openafs.org/14955
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ae70db6cde5be5abd3bbbb26bd9af6fe68cc4b6b)

Change-Id: I742e0210ac35eec7a143a780db4a6047a0a7c3fc
Reviewed-on: https://gerrit.openafs.org/15056
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:05:45 -04:00
Cheyenne Wills
05d8ecd96d autoconf: fix detection for fallthrough attribute
Due to bug <https://savannah.gnu.org/patch/?9949>,
ax_gcc_func_attribute.m4 fails to properly detect __attribute__((fallthrough))
in clang. Until this is fixed in autoconf-archive upstream, fix our
local copy of ax_gcc_func_attribute.m4, so we can detect
__attribute__((fallthrough)) to make --enable-checking work with clang.

Reviewed-on: https://gerrit.openafs.org/14273
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 899b1af4183fb09fd55a36e3d10ffbdb9671a47e)

Change-Id: Ia7398f958897e326722a77db2e64262212ff3367
Reviewed-on: https://gerrit.openafs.org/15055
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:05:12 -04:00
Cheyenne Wills
b18c2f580f cf: Use -Werror when checking for -Wno-* flags
When detecting valid compiler flags clang behaves differently than gcc
for certain types of flags.  Specifically, gcc will ignore an unknown
"-Wno-someflag" while clang will issue a warning.  If using clang and
--enable-checking is specified, this difference causes a build failure
because the warning for the unknown flag is turned into an error.

The autoconf macro AX_APPEND_COMPILE_FLAGS (via the underlying macro
AX_CHECK_COMPILE_FLAGS) looks specifically for errors and not warnings
to determine if the flag is valid.  In order to properly catch the above
type of unknown compiler flags, a '-Werror' must be passed as an
extra-flag.

Update the autoconf functions that use AX_APPEND_COMPILE_FLAGS to use
'-Werror' as an extra flag when testing for "-Wno-..." flags.

Note, for gcc, the test may (incorrectly) think that the compiler
supports the given flag, but that is okay, since the flag will be
ignored by gcc during the build without raising any warnings or errors.

Reviewed-on: https://gerrit.openafs.org/14900
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 573be0228778873c0d445263fb09989918bea4c1)

Change-Id: Ie11cf176d4c88560d5fce9a0c5932d3a0d5dba1e
Reviewed-on: https://gerrit.openafs.org/15054
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 14:00:31 -04:00
Cheyenne Wills
e03825bf22 Linux-5.17: Kernel build uses -Wcast-function-type
The linux 5.17 commit:
  "Makefile: Enable -Wcast-function-type" (552a23a0)
added the -Wcast-function-type compiler flag for kernel module builds.

This change catches a type mismatch in the external files obtained from
heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following
type of compile time error messages.

  src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’:
  src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible
      function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’
          {aka ‘int (*)(struct hc_EVP_MD_CTX *)’}
          [-Werror=cast-function-type]
  501 |  (hc_evp_md_init)null_Init,
      |  ^

Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE
macro to disable this warning and update the CFLAGS for these 2 files
for the Linux libafs build.

Update the CODING documentation to add the new exceptions.  In addition
add a brief description on how to set up autoconf to add a new build
macro to suppress compiler warnings.

Note: upstream heimdal has committed a fix for this in:

   hcrypto: Fix return type for null_Init, null_Update and null_Final
   (fc4b3ce49b)

Reviewed-on: https://gerrit.openafs.org/14881
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 6bdfa976731ce07f3236893ecf12abb9e169b882)

Change-Id: Ibd354f663d5876c421a8b4e89b8943c9e3d59ebc
Reviewed-on: https://gerrit.openafs.org/14946
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:34:29 -04:00
Cheyenne Wills
9e1ac3f566 cf: Use common macro to test compiler flags
Use the AX_APPEND_COMPILE_FLAGS macro to test and set compiler
specific flags.

Remove the OPENAFS_GCC_SUPPORTS_MARCH check entirely (and the
associated P5PLUS_KOPTS), since nothing has used it for quite some
time.

Reviewed-on: https://gerrit.openafs.org/14132
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 790824ff749b6ee01c4d7101493cbe8773ef41c6)

Change-Id: I0880abd2e114568cbcf232197efced91bb2ea5e7
Reviewed-on: https://gerrit.openafs.org/15053
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:32:50 -04:00
Cheyenne Wills
b34c14dae1 LINUX: Don't panic on some file open errors
Commit 'LINUX: Return NULL for afs_linux_raw_open error' (f6af4a155)
updated afs_linux_raw_open to return NULL on some errors, but still
panics if obtaining the dentry fails.

Commit 'afs: Verify osi_UFSOpen worked' (c6b61a451) updated callers of
osi_UFSOpen to verify whether or not the open was successful.  This
meant osi_UFSOpen (and routines it calls) could pass back an error
indication rather than panic when an error is encountered.

Update afs_linux_raw_open to return a failure instead of panic if unable
to obtain a dentry.

Update osi_UFSOpen to return a NULL instead of panic if unable to obtain
memory or fails to open the file. All callers of osi_UFSOpen handle a
fail return, though some will still issue a panic.

Update afs_linux_readpage_fastpath and afs_linux_readpages to not panic
if afs_linux_raw_open fails.  Instead of panic, return an error.

For testing, an error can be forced by removing a file from the
cache directory.

Note this work is based on a commit by pruiter@sinenomine.net

Reviewed-on: https://gerrit.openafs.org/14242
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit af73b9a3b1fc625694807287c0897391feaad52d)

Change-Id: I1e430403561d5b85d6a4094d4bf413a6eca4ff5a
Reviewed-on: https://gerrit.openafs.org/15052
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:31:28 -04:00
Andrew Deason
a18f4845cf afs: Introduce afs_IsDCacheFresh
Numerous places in libafs check the DV of a dcache against the DV of
the vcache for the same file, in order to check if the dcache is up to
date and can be used. Consolidate all of these checks into a new
function, afs_IsDCacheFresh, to make it easier for future commits to
alter this logic.

This commit should have no visible impact; it is just code
reorganization.

Reviewed-on: https://gerrit.openafs.org/13435
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 0d8ce846ab2e6c45166a61f04eb3af271cbd27db)

Change-Id: I2d7f63339e0cd6e0df7f4b07000834ac946cb4b7
Reviewed-on: https://gerrit.openafs.org/15051
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:27:09 -04:00
Michael Meffie
524600accb Change klog.krb5 -lifetime option help description
Change the klog.krb5 -lifetime help description to show this option is
ignored.  This option name was copied from the krb4 command but is not
implemented for the krb5 version. It is retained for command line syntax
compatibility.

Reviewed-on: https://gerrit.openafs.org/15045
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit f0c9fe7f8983eccf6453e3345de72a0eed649a5a)

Change-Id: If2b34f8d9d8e65fb8b6497f0ab01ff1ef6d2196e
Reviewed-on: https://gerrit.openafs.org/15047
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:25:57 -04:00
Cheyenne Wills
0d53d4170b Linux-5.17: kernel func complete_and_exit renamed
Handle the Linux kernel function rename made in commit
 "exit: Rename complete_and_exit to kthread_complete_and_exit"
 (cead1855)

Add a new autoconf test for the linux function kthread_complete_and_exit
and if not found use a define to map kthread_complete_and_exit to
complete_and_exit.

Replace calls to complete_and_exit with kthread_complete_and_exit.

Reviewed-on: https://gerrit.openafs.org/14882
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a651d4db7f86a24ea6784f6f27d5c8482667267b)

Change-Id: Ibe96b92a84a8f876dda4019c221c37dabde93244
Reviewed-on: https://gerrit.openafs.org/14945
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:21:59 -04:00
Cheyenne Wills
fd98e964d6 clang-13: remove unused variables flagged by clang
Clang-13 changed the default for the unused-but-set-variable resulting
in build warnings/errors with the following type of messages

vsprocs.c:3493:25: error: variable 'tentries' set but not used
    [-Werror,-Wunused-but-set-variable]
       afs_int32 nentries, tentries = 0;

The locations where these local variables are being flagged show that
while the variables are being updated, they are actually never used for
anything (e.g. used as part of an assignment to another variable, passed
as a parameter, used for as returned value, etc.)

Remove the variables being flagged by the clang-13 compiler.

Removal of these variables will not alter the overall functionality of
the code.

Reviewed-on: https://gerrit.openafs.org/14775
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 8333e8e6020331013af912acb92a308e4f5a1dd2)

Change-Id: Id5e7c6a323e352106b8f6bf32b7163846c366dec
Reviewed-on: https://gerrit.openafs.org/14991
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:20:49 -04:00
Cheyenne Wills
588decb457 clang-10: ignore fallthrough warning in generated code
Clang-10 will not recognize '/* fall through */' as an indicator to
turn off the fallthrough warning due to the lack of a 'break' in a case
statement.

Code generated by flex uses the '/* fall through */' comments to turn
off compiler warnings for fallthroughs in case statements.

For code generated by flex, ignore the implicit-fallthrough via pragma
or disable the warning via a compile time flag.

Add new env variable "CFLAGS_NOIMPLICIT_FALLTHROUGH" to selectively
disable the compile check in Makefiles when checking is enabled.

Reviewed-on: https://gerrit.openafs.org/14275
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit e5f44f6e9af643cab3a66216dff901e0a4c5eda8)

Change-Id: Ibe1b95e6784ca8b422378cf2896bdc7f1a6d8e61
Reviewed-on: https://gerrit.openafs.org/14990
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:18:51 -04:00
Andrew Deason
7c8127c5a1 LINUX: Honor --enable-checking for libafs
When we build the kernel module on LINUX, we don't pass in any of our
CFLAGS, since the Linux buildsystem itself figures out what flags are
needed. However, this means that we don't pass in -Werror when
--enable-checking is turned on, so warnings may not cause the build to
fail.

To fix this, create a new autoconf variable, called CFLAGS_WERROR,
that only contains -Werror if --enable-checking is turned on. We then
pass that into the Linux module buildsystem, so -Werror is given to
the compiler when building our module.

Reviewed-on: https://gerrit.openafs.org/13682
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 6e0f1c3b45102e7644d25cf34395ca980414317f)

[cwills@sinenomine.net] On master gerrit 14106 comes after this commit.
In the 1.8.x branch the 14106 commit is already pulled in (gerrit 14217)
which causes a conflict due a difference ('-fno-common') in the line
above the change in osconf.m4.

Change-Id: I4e49d5c5fdf26399eb04d2f76196f3c3f4e7baf6
Reviewed-on: https://gerrit.openafs.org/14989
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:02:45 -04:00
Michael Meffie
0cb26f198c ptserver: Fix CreateEntry() stringop-overflow warnings
The CreateEntry() prototype has been fixed to match the function
definition, so callers are expected to provide bounded arrays for the
user or group name. Fix the InitialGroup() macro which is used to set
the built-in names using string literal to avoid stringop-overflow
warnings.

    error: ‘CreateEntry’ accessing 64 bytes in a region of size 22 [-Werror=stringop-overflow=]
            code = CreateEntry(tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \

    note: in expansion of macro ‘InitialGroup’
           InitialGroup(SYSADMINID, "system:administrators");
    note: referencing argument 2 of type ‘char *’
    note: in a call to function ‘CreateEntry’
            CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...

    (Repeated for "system:backup", "system:anyuser", "system:authuser",
    "system:ptsviewers", and "anonymous".)

Reviewed-on: https://gerrit.openafs.org/14789
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7924aecf95bf4918a485a041f2426bd1fa407ac8)

Change-Id: I6e30729f1b24beb1ed1c4b6d9162b347285b7edc
Reviewed-on: https://gerrit.openafs.org/14987
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:01:39 -04:00
Michael Meffie
07704dc7b4 libadmin: Fix isAlias may be uninitialized warning
The cfgutil_HostNameIsAlias() function has an output parameter called
isAlias, which is used when cfgutil_HostIsAlias() returns non-zero.
However, it possible for isAlias to not be set before returning. GCC 12
issues a warning about the possible use of the uninitialized isAlias
variable:

    cfginternal.c:366:32: error: ‘isAlias’ may be used uninitialized
       [-Werror=maybe-uninitialized]

Initialize the cfgutil_HostNameIsAlias() isAlias output flag to false.
Also, fix the misleading code indentation around the
cfgutil_HostNameIsAlias() call.

Reviewed-on: https://gerrit.openafs.org/14772
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 4a8d0c4089078fb3df9cc06b595c80c9b4c2ca7f)

Change-Id: I4cadcb4380962e47213fcfd310c1cac331100f65
Reviewed-on: https://gerrit.openafs.org/14986
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 13:00:38 -04:00
Michael Meffie
1f868e7bdd bucoord: Fix doDispatch() array-parameter gcc warning
The doDispatch() prototype does not match the function definition. The
targv parameter is declared as an unbounded array in the prototype, but
is defined as a bounded array. As of GCC 12, a warning is issued for the
mismatch.

    main.c:346:18: error: argument 2 of type ‘char *[100]’ with
      mismatched bound [-Werror=array-parameter=]
    bucoord_internal.h:123:40: note: previously declared as ‘char *[]’

Within doDispatch(), the targv argument is just passed to cmd_Dispatch()
(this is the only use of targv). Since cmd_Displatch() expects an
unbounded array, update the doDispatch() definition to match the
prototype.

Reviewed-on: https://gerrit.openafs.org/14771
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 92a6242de2d8ea280debc283a7c089f97c1670bc)

Change-Id: Idc674dccac5adcbe610e059463e493716cf80f57
Reviewed-on: https://gerrit.openafs.org/14985
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:59:14 -04:00
Michael Meffie
3a32158d00 Fix PrintInode() mismatched array parameter warnings
The PrintInode() prototypes do not match the function definitions.

When AFS_64BIT_IOPS_ENV is defined (which is the common case and is
required for namei), the buffer parameter is declared as a bounded
character array (afs_ino_str_t) in the prototype, but is defined as an
unbounded character pointer.  When AFS_64BIT_IOPS_ENV is not defined
(for legacy 32-bit inode vice partitions), PrintInode() is declared with
no specified parameters.

A static buffer is used to hold the formatted string when a NULL is
passed as the first argument to PrintInode(). However, this method is
only used by the volinfo and iopen utility programs.

Fix the mismatch function prototypes and definitions to use the bounded
char array (afs_ino_str_t) in all cases.  Remove the deprecated function
declaration with no specified parameters. Update vol-info and iopen to
pass an afs_ino_str_t buffer and remove the now unused static buffer.
Update the duplicated PrintInode() function definition in namei_ops.c.
(This duplicated code could be removed in a future commit.)

Reviewed-on: https://gerrit.openafs.org/14770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a1e57d2e42b6d01e5ece93d5d49a4b9f3ecd3edc)

Change-Id: Ia8685805513c2c17e9253d83aa471718a09a449a
Reviewed-on: https://gerrit.openafs.org/14984
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:58:01 -04:00
Michael Meffie
c6b47f77dc pts: Fix stringop-overflow warnings
The ptutil functions are defined to accept bounded character arrays for
user and group names. As of GCC 11, callers which provide the names as
string literals now trigger the stringop-overflow warning, since the
regions provided by the string literals are smaller than the bounded
areas.

    error: ‘pr_ChangeEntry’ accessing 64 bytes in a region of size 1
           [-Werror=stringop-overflow=]
    note: referencing argument 4 of type ‘char *’

    error: ‘pr_IsAMemberOf’ accessing 64 bytes in a region of size 22
           [-Werror=stringop-overflow=]
    note: referencing argument 2 of type ‘char *’

    error: ‘pr_CreateUser’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

    error: ‘pr_Delete’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

Update the callers in pts and testpt which pass literal strings. Instead
of passing char pointers to literal strings, assign the strings to
prname buffers and pass the prname buffers to the pr utility functions.

Reviewed-on: https://gerrit.openafs.org/14769
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a3aac5106beddc5a6f7a09c2d21c2524342aca01)

Change-Id: I38883cdf9c6db701370b3c6755ca28e50f618c82
Reviewed-on: https://gerrit.openafs.org/14983
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:55:58 -04:00
Michael Meffie
8765514b2a ptserver: Fix CreateEntry() mismatched array parameter warning
The CreateEntry() prototype does not match the function definition. The
aname parameter is declared as an unbounded array in the prototype but
is defined as a bounded array. As of GCC 12, a warning is issued for the
mismatch.

    error: argument 2 of type ‘char[64]’ with mismatched bound
           [-Werror=array-parameter=]
           CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...

    note: previously declared as ‘char[]’
          extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[], ...

Fix the prototype to declare the 'aname' parameter as a bounded array as
expected for this function.

Reviewed-on: https://gerrit.openafs.org/14768
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit fe64ddd3b49bf15222d32d443ff226dd4c2b899e)

Change-Id: If29ada7f9460591de8d2b61c17d00090465625b2
Reviewed-on: https://gerrit.openafs.org/14982
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:54:14 -04:00
Michael Meffie
5a1944282e ubik: Fix ubeacon_updateUbikNetworkAddress() mismatched array parameter warning
The ubeacon_updateUbikNetworkAddress() prototype does not match the
function definition. The ubik_host parameter is declared as an unbounded
array in the prototype but is defined as a bounded array. As of GCC 12,
a warning is issued for the mismatch:

    error: argument 1 of type ‘afs_uint32[256]’ {aka ‘unsigned int[256]’}
           with mismatched bound [-Werror=array-parameter=]
           ubeacon_updateUbikNetworkAddress(
             afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR])

    note: previously declared as ‘afs_uint32[]’ {aka ‘unsigned int[]’}
          extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]);

Restore the ubik_host array length in the function prototype, which was
dropped in commit 9020e6e2f0357b1082705dcaa6626573433969ec (ubik: Defer
updateUbikNetworkAddress until after RX startup).

Reviewed-on: https://gerrit.openafs.org/14767
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 36796bbb83af2650a872234fdb5cf7124bf6cfa8)

Change-Id: Ia27b5b9642dbd355e1310419424ed0ac04add4b2
Reviewed-on: https://gerrit.openafs.org/14981
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:53:25 -04:00
Michael Meffie
0130ff6fc4 klog.krb5 -lifetime is not implemented
The klog.krb5 -lifetime option was copied from earlier versions of log
and klog, which had the ability to set the krb4 token lifetime. However,
the -lifetime option is not feasible the krb5 version, and so is not
implemented in klog.krb5.

Update the klog.krb5 man page to document the -lifetime option has no
effect.  Remove the code which unnecessarily checks the unused klog.krb5
-lifetime command line argument.

The unused lifetime variable was discovered by Pat Riehecky using the
clang scan-build static analyzer.

Reviewed-on: https://gerrit.openafs.org/13309
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit da699c8b81e818ba97ff8115397d7f7afe0bf512)

Change-Id: I81cd0024f4727ba401df7b5813163b11f9b43bd4
Reviewed-on: https://gerrit.openafs.org/14980
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:51:57 -04:00
Michael Meffie
7d4f5fe3e2 ubik: do not reuse the offset variable for the sync site address
The ubik SendFile function performs a sanity check of the host address
before proceeding with the file transfer.  Currently this check reuses
the file offset local variable to hold the value of the sync site
address, a 32-bit IPv4 address. Not only is this confusing, but also
causes a signed/unsigned type mismatch when comparing host addresses.
Instead of being so stingy with local variables, declare a new local
variable of the correct type to hold the value of the sync site address.

This separation is also a prerequisite for supporting larger address
types in the future.

Reviewed-on: https://gerrit.openafs.org/13351
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit f0bab78cbe4f59609fa18647a480cc6989948786)

Change-Id: I2bda69a2586628b51e84c3facf116bf652e3df0a
Reviewed-on: https://gerrit.openafs.org/14979
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:49:53 -04:00
Andrew Deason
1c5c7eba38 afs: Remove redundant AFS_LINUX_ENV test
After our Linux checks were converted to AFS_LINUX_ENV in commit
6329a523 (Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV), the extra
AFS_LINUX_ENV check in this line doesn't make any sense. Get rid of
it.

Reviewed-on: https://gerrit.openafs.org/14935
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit a7d04f0770beb08ea7db2dcdc3dee80b2a57233a)

Change-Id: I797e1d677cc758d0475011167c0cbafeedf9788c
Reviewed-on: https://gerrit.openafs.org/15037
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:46:08 -04:00
Cheyenne Wills
147d3bf945 Cleanup AFS_*LINUX_ENV usage
Commit 6329a523f6305541871bc3d1694065e7b17abe77 changed all
occurrences of AFS_*LINUXnn_ENV to AFS_*LINUX_ENV, but did not perform
any refactoring of the use of these variables.

This commit completes the task by refactoring the preprocessor
conditionals that involved removing dead code or collapsing statements.

The updates should have no functional changes.

Reviewed-on: https://gerrit.openafs.org/14388
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit cbc18e4b311bdd2c461f60b7b96eb2ab8a6d1ee5)

Change-Id: I02e9f0cab5e60994c67593b0709ae1e500d23545
Reviewed-on: https://gerrit.openafs.org/14978
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:44:58 -04:00
Cheyenne Wills
4364479209 Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV
The minimum Linux kernel that is now supported is linux-2.6.18.  The
Linux versioned preprocessor macros AFS_*LINUXnn_ENV are no longer
needed to distinguish the different levels of Linux and can be merged
into just a single set of macros.

Perform a global change of _LINUX\d+_ENV to _LINUX_ENV. e.g.
   AFS_LINUX24_ENV       -> AFS_LINUX_ENV
   AFS_USR_LINUX24_ENV   -> AFS_USR_LINUX_ENV
   AFS_AMD64_LINUX20_ENV -> AFS_AMD64_LINUX_ENV

Replace the multiple definitions for the versioned 'AFS*_LINUXnn_ENV'
with just single non-version definitions 'AFS*_LINUX_ENV'.

Apart from replacing the now-redundant #define directives and tidying up
a few comments at the close of a preprocessor block to match their
current form, this commit was done using a mechanical change of the
variable names and did not reduce preprocessor statements that could now
be combined or eliminated.  Nor does this commit remove dead code.  A
follow-up commit (Cleanup AFS_*LINUX_ENV usage) will handle these
changes.

The updates should have no functional changes.

Reviewed-on: https://gerrit.openafs.org/14387
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 6329a523f6305541871bc3d1694065e7b17abe77)

[cwills@sinenomine.net] Conflicts due to:
   'afs: Set AFS_VFSFSID to a numerical value' is already in 1.8.x
   'Linux 5.15: Convert osi_Msg macro to a function' is already in 1.8.x
   'fsint: remove dead code' is not in 1.8.x (removes fsint/afsaux.c)
   'Remove rpctestlib' is not in 1.8.x (removes rpc_test_procs.c)

Change-Id: I19da50622f63db0fcad7acd834559c538e6030be
Reviewed-on: https://gerrit.openafs.org/14977
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:41:43 -04:00
Andrew Deason
a07ac7f818 Remove AFS_PARISC_LINUX24_ENV references
Since commit 91713206 (Remove LINUX24 from src/afs),
AFS_PARISC_LINUX24_ENV is never defined. Remove references to it.

Reviewed-on: https://gerrit.openafs.org/14472
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit e0e0b3cea6305cdbccc71039a05d6121c32c51cf)

Change-Id: I4871f5ba6018ab47c78d3f07d4665b5a2676102f
Reviewed-on: https://gerrit.openafs.org/14976
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:39:45 -04:00
Andrew Deason
49512eb8c9 afs: Always define our own osi_timeval32_t
Since OpenAFS 1.0, osi_GetTime has taken a timeval-like pointer, which
contains 32-bit fields (the actual type has been called either
osi_timeval_t or osi_timeval32_t over time). For platforms that have a
native timeval-like type with 32-bit fields, we just define
osi_timeval32_t to that type, and elsewhere we define our own struct
to be osi_timeval32_t. For platforms that use the native timeval, we
can then define osi_GetTime() to just be, e.g., microtime().

This approach is difficult to maintain, though, because we must keep
track of whether 'struct timeval' contains 32-bit fields on each
platform, which can depend on many factors. It's easy to make mistakes
(the current tree already contains mistakes), and there's not much
benefit.

To avoid all of this, just always define osi_timeval32_t to be our own
struct with afs_int32 fields, and provide definitions for osi_GetTime
that convert from the native time struct to our osi_timeval32_t. This
does mean that for some platforms we do an unnecessary type
conversion, but this is a small price to pay for more straightforward
and maintainable code.

To be a little more sure that our types are correct, change
osi_GetTime to be defined as an inline function instead of a macro.

At the same time, do a similar conversion for the KERNEL
implementation of the rx clock_GetTime function. Get rid of
platform-specific mess, and do a straightforward type conversion
between osi_timeval32_t and struct clock in an inline function.

Reviewed-on: https://gerrit.openafs.org/14238
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit eccd4b9778014c36a4b3af6d9e80194066bd2195)

Change-Id: Ia6ccc7ff3e3a7cfb346449c1335e7a045688aebf
Reviewed-on: https://gerrit.openafs.org/14974
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:38:51 -04:00
Andrew Deason
e01db4d01e afs: Move osi_GetTime out of param.h
Most platforms currently #define osi_GetTime in their param.h. This is
really redundant, since the definition of osi_GetTime almost never
changes for a given platform, so we end up with many copies of the
same osi_GetTime definition for a given platform.

Move osi_GetTime out of param.h for these platforms, and define it in
osi_machdep.h instead, which is where most platform-specific
definitions go.

For DFBSD, we don't have an osi_machdep.h at all yet, so create a new
one to contain the osi_GetTime definition. Currently we don't build
libafs at all on DFBSD, but do this anyway so we don't lose the
existing osi_GetTime definition.

For NBSD, we were providing (conflicting!) definitions for osi_GetTime
in param.h and in osi_machdep.h. Just remove the definitions in
param.h, since those should have been getting overridden by the
osi_machdep.h definition.

Reviewed-on: https://gerrit.openafs.org/14237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a5c3dfe99fa1831e3b416e89f52a03fd1cf9f73d)

Change-Id: I3afff0c1b4c14649cc072d555d0c3ebd6de8a0fe
Reviewed-on: https://gerrit.openafs.org/14972
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2022-08-04 12:38:00 -04:00