Subject: Re: how to deftopt, was The demise of DEV_BSIZE
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 10/07/1999 14:07:46
On Thu, 7 Oct 1999 13:04:55 -0700 (PDT)
Bill Studenmund <wrstuden@nas.nasa.gov> wrote:
> #ifdef PO2_ONLY /* or whatever we name it - my names suck */
> #define btodb(x, sh) ((x) >> (sh))
> etc.
> #else
> #define btodb(x, sh) ((sh >= 0) ? ((x) >> (sh)) : ((x) / (-sh))
> etc.
> #endif /* PO2_ONLY */
>
> That way the right thing just happens with one test. But
>
> #if defined(NON_PO2) || defined(LKM) works too.
>
> Thoughts?
Yes. Your latter proposal. With a twist.
#if defined(_KERNEL) && !defined(_LKM)
#include "opt_oddblocksize.h"
#endif
#if !defined(_KERNEL) || \
(defined(_LKM) || defined(ODDBLOCKSIZE))
#define btodb(x, sh) ((sh >= 0) ? ((x) >> (sh)) : ((x) / (-sh))
#else
#define btodb(x, sh) ((x) >> (sh))
#endif
...that way userland get the premium version, too.
-- Jason R. Thorpe <thorpej@nas.nasa.gov>