From: Rusty Russell <rusty@rustcorp.com.au>
To: Tejun Heo <tj@home-tj.org>
Cc: mochel@osdl.org,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCH] Per-device parameter support (13/16)
Date: Mon, 25 Oct 2004 16:08:10 +1000 [thread overview]
Message-ID: <1098684490.8098.54.camel@localhost.localdomain> (raw)
In-Reply-To: <20041023043138.GN3456@home-tj.org>
On Sat, 2004-10-23 at 13:31 +0900, Tejun Heo wrote:
> +/* For some reason, gcc aligns structures which contain other
> + structures to 32-byte boundary even when __alignof__() the strucure
> + is smaller than that. As we're gonna assemble paramset array
> + manually, we need to set alignment explicitly. Also, we put all
> + paramset array elements into .data.1 to avoid intervening variables
> + of different types (kparam_string, kparam_array for now). */
You need __attribute__((aligned(sizeof(void *))): see moduleparam.h.
The padding between structures is arch-dependent (x86-64 found out the
hard way when we changed kernel_param previously). Not sure why you're
using a separate section here anyway.
> +/* Bit flag */
> +#define __DEVICE_PARAM_FLAG(Name, Field, Flag, Dfl, Inv, Perm, Desc) \
> + param_check_uint(__devparam_data(Name), \
> + &(((__devparam_type *)0)->Field)); \
> + static struct kparam_flag __devparam_data(__param_flag_##Name) \
> + __devparam_extra_section = { 0, Flag, Inv }; \
> + __DEVICE_PARAM_CALL_RANGED(Name, param_set_flag, param_get_flag,\
> + &__devparam_data(__param_flag_##Name), \
> + sizeof(struct kparam_flag), 1, 0, Dfl, 0, Perm, Desc, \
> + offsetof(struct kparam_flag, pflags), \
> + offsetof(__devparam_type, Field), -1, -1)
> +
> +#define DEVICE_PARAM_FLAG(Name, Field, Flag, Dfl, Perm, Desc) \
> + __DEVICE_PARAM_FLAG(Name, Field, Flag, Dfl, 0, Perm, Desc)
Haven't read closely, but why is FLAG special?
I think your macros might be better off always having the range, which
would reduce the number of functions.. I like including the description
in the macros: that's an improvement.
I always disliked the _NAMED versions (if it's a good name for users,
it's usually a good name for the variable and vice versa), but you might
want to consider always having it if that's the common case.
Cheers,
Rusty.
--
A bad analogy is like a leaky screwdriver -- Richard Braakman
next prev parent reply other threads:[~2004-10-25 6:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-23 4:31 [RFC/PATCH] Per-device parameter support (13/16) Tejun Heo
2004-10-25 5:04 ` Rusty Russell
2004-10-25 5:56 ` Rusty Russell
2004-10-25 8:00 ` Tejun Heo
2004-10-25 6:08 ` Rusty Russell [this message]
2004-10-25 8:28 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1098684490.8098.54.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
--cc=tj@home-tj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.