[OpenAFS-devel] Refactoring the Solaris libafs code base

Marcus Watts mdw@umich.edu
Sat, 30 Dec 2006 21:58:34 -0500


Russ had sent this list earlier:
...
> At least in user-space code (I don't know if kernel-space is special), at
> least all of the following C headers can be included without any guards on
> any Unix platform we care about:
>
> errno.h
> fcntl.h
> stdarg.h
> stdio.h
> stdlib.h
> string.h
> sys/stat.h
> sys/types.h
> syslog.h
> unistd.h
>
> I'm fairly sure that while there are special Autoconf probes for the
> following, we no longer need to worry about these either:
>
> sys/time.h
> sys/wait.h
> time.h
>
> All of the networking headers can be included without guards:
>
> arpa/inet.h
> netdb.h
> netinet/in.h
> sys/socket.h
...
> I don't know what specific additional requirements Windows adds for code
> that should also build on Windows.
...

Kernel side building is not nearly as standardized; there is no
completely portable way to handle includes.  Since the kernel isn't
(usually) linked against libc, many functions that are present in
userland code aren't present inside the kernel, so files such as
stdio.h simply don't make sense there.

I could go through the list in more detail, but it's not necessary;
we've got a perfectly good set of ifdefs in openafs source already, so
the main reason to mess around with them would be to remove unnecessary
architectures or include files.  The kernel ifdefs should not be depending
on normal autoconf conditional guards in any case, since those were
based on the userland environment.

Windows, of course, has no kernel component today.  It might
sprout one in the future, but if so, it's likely to be just
a small special purpose stub driver that redirects to a userland
daemon (at least that's what everyone's done with IFS + afs so far).

It would be nice if rxgen didn't know quite so much about include
files.  In src/rxgen/rpc_main.c, c_output() and h_output() (and several
others) contain ugly blobs of f_print statements to automatically
include certain files in the output.  This includes "#ifdef KERNEL"
and "#ifdef UKERNEL" lines.

					-Marcus