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. Change-Id: I71e32ca9818d28f82b4f23679868d1b9a62c44bd Reviewed-on: https://gerrit.openafs.org/14387 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
clang-10: use AFS_FALLTHROUGH for case fallthrough Clang-10 will not recognize '/* fallthrough */' as an indicator to turn off the fallthrough diagnostic due to the lack of a 'break' in a case statement. Clang-10 requires the '__attribute__((fallthrough))' statement to disable the diagnostic. In addition clang-10 is finding additional locations where fall throughs occur. Determine if the compiler supports '__attribute__((fallthrough))' to disable the implicit fallthrough diagnostic. Define a new macro 'AFS_FALLTHROUGH' that will disable the fallthrough diagnostic. Set it as a wrapper for the Linux kernel's 'fallthrough' macro if available, otherwise set it as a wrapper macro for '__attribute__((fallthrough))' if the compiler supports it. Update CODING to document the use of AFS_FALLTHROUGH when needing to fallthrough between case statements. Replace the '/* fallthrough */' comments with AFS_FALLTHROUGH, and add AFS_FALLTHROUGH as needed. Replace some fallthroughs with a break (or goto) if the flow was was just to a break (or goto). e.g. case x: case x: somestmt; somestmt; break; case y: case y: break; break; Correct a mis-indented brace '}' in src/WINNT/afsd/smb3.c Note, the clang maintainers have rejected the use of comments as a flag to turn off the fall through warnings. Change-Id: Ia5da10fc14fc1874baca035a3cf471e618e0d5f5 Reviewed-on: https://gerrit.openafs.org/14274 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Add more 'fall through' switch comments Commit a455452d (LINUX 5.3: Add comments for fallthrough switch cases) added the special /* fall through */ comment to various switch/case blocks, in order to avoid implicit-fallthrough warnings from causing the build to fail when building the Linux kernel module. In this commit, add additional /* fall through */ comments to the rest of the tree where falling through is intentional. Add a "break;" in one place in dumptool.c where falling through seems like a mistake, and flag certain functions as AFS_NORETURN to avoid needing to explicitly break or fallthrough. Check for the availability of the -Wimplicit-fallthrough compiler flag and use it when --enable-checking is set, to prevent additional cases from creeping into the tree. Note: the -Wimplicit-fallthrough compiler flag was added in gcc 7. Change-Id: Iae34e7969606603da8358d7cfa5fd04279b218dc Reviewed-on: https://gerrit.openafs.org/14125 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
salvaged: Fix "-parallel all<number>" parsing In salavageserver -parallel option takes "all<number>" argument. However the code does not parse the numeric part correctly. Due to this, only single instance of salvageserver process was running even if we provide the larger number with "all" argument. With this fix, numeric part of "all" argument will be parsed correctly and will start required number of salvageserver instances. Change-Id: Ib6318b1d57d04fecb84915e2dabe40930ea76499 Reviewed-on: https://gerrit.openafs.org/14201 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Remove DUX/OSF code Remove code for DUX/OSF platforms. DUX code was removed from the libafs client in commit 392dcf67 ("Complete removal of DUX client code") and the alpha_dux* param files were removed in dc4d9d64 ("afs: Remove AFS_BOZONLOCK_ENV"). This code has always been disabled since those commits, so remove any code referencing AFS_DUX*_ENV, AFS_OSF_ENV, and related symbols. Change-Id: I3787b83c80a48e53fe214fdecf9a9ac0b63d390c Reviewed-on: https://gerrit.openafs.org/13260 Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Suppress statement not reached warnings after noreturn functions Use the AFS_UNREACHED macro to suppress statement not reached warnings while building under Solaris Studio. These warnings are emitted for statements following functions declared with the noreturn function attribute. Change-Id: Ic18cbb3ea78124acbe69edc0eccb2473b46648fe Reviewed-on: https://gerrit.openafs.org/13010 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Suppress statement not reached warnings under Solaris Studio Solaris Studio issues warnings for statements which can not be reached, such as statements following an infinite loop. For example, the return statement will generate a 'statement not reached' warning in the following code: while (1) { /* no breaks or gotos in this body */ } return 0; Suppress these warnings by conditionally removing such statements when building under Solaris Studio. Change-Id: Ib4f465bf9c00eff0d603e5bd643db7d3a5aa0ba0 Reviewed-on: https://gerrit.openafs.org/12958 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
dafs: honor salvageserver -salvagedirs Do not ignore the -salvagedirs option when given to the salvageserver. When the salvageserver is running with this option, all directories will be rebuilt by salvages spawned by the dafs salvageserver, including all demand attach salvages and salvages of individual volumes initiated by bos salvage. This does not affect the whole partition salvages initiated by bos salvage -all. Change-Id: I4dd515ffa8f962c61e922217bee20bbd88bcd534 Reviewed-on: https://gerrit.openafs.org/12456 Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Tested-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
salvageserver: unable to write child log: out of memory Changes to salvageserver logging in commit 24fed351fd13b38bfaf9f278c914a47782dbf670 introduced a new bug in SalvageLogCleanup; the test for calloc() failure was inadvertently inverted. Fix the sense of the test. Change-Id: Id0ee4ac3e60d7285163a9ab0b32bd7d48e570ac0 Reviewed-on: https://gerrit.openafs.org/12284 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
salvageserver: segfault in DoSalvageVolume A typo in the recent logging changes for salvageserver ad455347bc99d1bd499535995958b5f77c2388ff caused a bad address to be passed to memset. Correctly memset the log options as intended. Change-Id: Ifef46defcc6da56df4e58f8ed9029717a77c0b39 Reviewed-on: https://gerrit.openafs.org/12282 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
externalize log rotation Do not create new server log files when servers are restarted by default. External log rotation tools may be used to rotate the logs by renaming log files and then signaling server processes to reopen log files. Add the -transarc-logs option to each server to provide backward compatibility with the traditional Transarc-style logging. When -transarc-logs is given, log files are renamed to an ".old" file (overwriting the existing ".old" file) and the previous the log file is truncated. Change-Id: I2eeb67e3db32b2f75fe685b68dab1159e62061e9 Reviewed-on: https://gerrit.openafs.org/11731 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Remove server logging globals Remove the global variables used to setup server logging and replace with an argument to OpenLog. Keep the LogLevel variable as a global for use by the logging macros, but provide an inline function for applications which check the log level to dump more information when the log level is increased. Provide consistency by adding syslog tags to processes that did not previously set one (salvageserver, salvager, and volserver). [kaduk@mit.edu: update commit message, use old-style log rotation for kalog, minor commenting fixes] Change-Id: I11cffbdd1418304d33f0be02dd7e600955c4a8bb Reviewed-on: https://gerrit.openafs.org/12168 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
salvager: convert salvager and salvagerserver to libutil logging Use the libutil logging facility in the salvager and DAFS salvageserver in order to have consistent logging features and time stamp formats with the other OpenAFS servers. Change-Id: I8352d7e16b4a9f96b814a3b5c0b3b79a7c48e4bc Reviewed-on: https://gerrit.openafs.org/12003 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
salvager: redd up showlog global flag Clean up the show log flag so it is only set by the salvager and is reset when spawning a child process. Change-Id: I1702cf98faca583409594d1199a8215ffe08a75e Reviewed-on: http://gerrit.openafs.org/12001 Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
dafs: log to stderr when running salvageserver in client mode When the -client option is given to the salvageserver, print Log() messages to stderr instead of losing them. Change-Id: I065e8136db9a8cc241639fbe34607db884751b95 Reviewed-on: http://gerrit.openafs.org/11729 Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
dafs: remove the salvageserver -showlog option Remove the salvagerserver option to print log messages to stdout. This was a carry over from the stand-alone salvager and is not appropriate for a daemon. Change-Id: I55b99112278cdabb3e9911948dbda6a628030951 Reviewed-on: http://gerrit.openafs.org/11815 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
dafs: remove the salvageserver -datelogs option Remove the undocumented -datelogs option from the salavageserver, which was a carry over from the standalone salvager program, but is not appropriate for a daemon. Change-Id: Ia382d6550e0641edcba55a414e00323755487e18 Reviewed-on: http://gerrit.openafs.org/11814 Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Allocate pathname buffers dynamically This change reworks numerous places which formerly used potentially large on-stack buffers (of size AFSDIR_PATH_MAX) for constructing or storing pathnames. Instead, these buffers are now allocated from the heap, either by using asprintf() to build a pathname in a correctly sized buffer or, where necessary, using malloc() to allocate a buffer of size AFSDIR_PATH_MAX. A few occurrances of AFSDIR_PATH_MAX-sized buffers are not changed; these are generally either globals or are contained within another data structure that is already allocated on the heap. [kaduk@mit.edu convert to cleanup-handler memory management where appropriate] Change-Id: Ib1986187a1c467e867d50280aaf1d8a86d9108c8 Reviewed-on: http://gerrit.openafs.org/9985 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
cmd: add flags argument to create syntax function Add the flags argument to cmd_CreateSyntax() and update all callers. The flags argument will be used to set command options, such as CMD_HIDDEN. Change-Id: Ia51be9635f262516cb084d236a9e0756f608bf16 Reviewed-on: http://gerrit.openafs.org/11430 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
vol/salvaged.c: Remove unused variable It was incremented from an uninitialized value, which caused a build error on the OS X 10.9 buildslave. Since it's unused, just remove it entirely. Change-Id: I845e9139ffd27ba7bf4e010cf4e5625658125486 Reviewed-on: http://gerrit.openafs.org/10698 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>