[OpenAFS-devel] osi_curcred()

Jim Rees rees@umich.edu
Wed, 02 Oct 2002 11:30:20 -0400


The Transarc code used to have a macro, osi_curcred(), that resolved to the
cred struct for the current proc.  I don't know what happened to that, but
I'd like to re-introduce it.

So in osi_machdep.h you'd have something like this:

AFS_AIX41_ENV || AFS_LINUX22_ENV:
#define afs_osi_curcred() crref()

AFS_HPUX101_ENV:
#define afs_osi_curcred() p_cred(u.u_procp)

AFS_SGI_ENV:
#define afs_osi_curcred() OSI_GET_CURRENT_CRED()

...

Does that seem like a good idea?  It would eliminate a lot of #ifdefs from
the source.

Also, is #elif considered ok to use?  I see it's used in some places but not
others.  Can I replace #else/#if with #elif to make the code more readable?

Take a look at afs_pioctl.c:afs_syscall_pioctl() to see the kind of garbage
I'm trying to eliminate.