afs.h: fix out of tree build failures 57/14857/5
authorCheyenne Wills <cwills@sinenomine.net>
Tue, 11 Jan 2022 01:11:58 +0000 (18:11 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 13 Jan 2022 05:28:12 +0000 (00:28 -0500)
commit92342b099dd5ea539efc5ad119d36a87647c0895
treec10318aae1d578efadece1c2b80be95d3f1fce73
parent7a6192276b3779205fa8bc8c141eda41cf28e37e
afs.h: fix out of tree build failures

There are several compiler errors and warnings when building an out of
tree program that includes "afs/afs.h".

 - Errors for unknown type names 'afs_ucred_t' and 'wait_queue_head'
    .../afs/afs.h:1542:16: error: unknown type name ‘afs_ucred_t’
      ... | afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
    .../afs/afs.h:1605:5: error: unknown type name ‘wait_queue_head_t’
      ... |     wait_queue_head_t cond;

 - Warnings about declaring structures within missing declarations for
   the structs: osi_File, dcache and afs_FetchOutput
   .../afs/afs.h:1486:36: warning: ‘struct osi_file’ declared inside
        parameter list will not be visible outside of this definition or
        declaration
      ... |     int (*read)(void *rock, struct osi_file *tfile,
                     afs_uint32 offset,

 - Unable to find the file for the include opr/jhash.h

The missing type name 'afs_ucred_t' is due to miss-placed declarations
for some kernel only functions.

The type name 'wait_queue_head' is a data type for Linux kernel modules.

The warnings for the missing declarations are due to either references
to the structures before they are declared, or because they are not
available in any of the other public header files.

To fix the unknown type name afs_ucred_t, relocate the function
declarations that reference 'afs_ucred_t' into the KERNEL only section
(since afs_ucred_t is a kernel specific type).

To fix the unknown type name 'wait_queue_head', relocate the afs_event
structure and the afs_evhasht variable to be within the KERNEL only
section.

To resolve the warnings associated with the structures, simply declare
the structure names before they are referenced.  All references that
are resulting in the warnings are declarations for pointers.

Relocate the include for opr/jhash.h and the define for VCSIZE into the
kernel block.

Change-Id: I4135ff25b76d3221c7779c279ed829000ce31f1c
Reviewed-on: https://gerrit.openafs.org/14857
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs.h