Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: [elad-kernelauth] src/sys/ufs/ext2fs




On Apr 20, 2006, at 9:17 AM, Christos Zoulas wrote:

The problem with this approach is that it needs <sys/kauth.h> to be
present in all the header files that use the type. Unfortunately this

No, the problem is that prototypes and other structures that use a kauth_cred_t are being exposed to userland. If you eliminate that, then you eliminate the need for userland to know anything kauth_cred- anything, and you only include <sys/kauth.h> #ifdef _KERNEL.

is a problem with the `c' language. There are no opaque types; for
the purist, the best you can do is to use a struct pointer which is
what the rest of the kernel does for all the data structures.

So you have the following choices:

1. Revolting hacks [actual code snippet]:

    #ifndef _UFS_FFS_FFS_EXTERN_H_
    #define _UFS_FFS_FFS_EXTERN_H_

    #ifndef HAVE_NBTOOL_CONFIG_H
    #include <sys/kauth.h>
    #else
    typedef void *kauth_cred_t;
    #endif /* !HAVE_NBTOOL_CONFIG_H */

2. Include <sys/kauth.h> everywhere and install it in userland.

3. Use "struct kauth_cred *" instead of "kauth_cred_t"

4. Rewrite the kernel in a different language.

I choose [3]; In fact, I have almost finished fixing all the header files
and adding explicit '#include <sys/kauth.h>' in the files that need it
rather than including <sys/kauth.h> in <sys/resource.h> and <sys/ file.h>
so that everyone gets it by side-effect.

christos

-- thorpej




Home | Main Index | Thread Index | Old Index