[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <501AF555.3050004@gmail.com>
Date: Thu, 02 Aug 2012 23:47:01 +0200
From: Sasha Levin <levinsasha928@...il.com>
To: Josh Triplett <josh@...htriplett.org>
CC: Tejun Heo <tj@...nel.org>, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, paul.gortmaker@...driver.com
Subject: Re: [RFC 1/4] hashtable: introduce a small and naive hashtable
On 08/02/2012 10:41 PM, Josh Triplett wrote:
> On Thu, Aug 02, 2012 at 07:54:42PM +0200, Sasha Levin wrote:
>> /* I've "preprocessed" the DEFINE macro below */
>> union {
>> struct hash_table table;
>> struct {
>> size_t bits;
>> struct hlist_head buckets[32];
>> }
>> } my_hashtable;
>
> That expansion doesn't match the macros. Using the most recent
> definitions of DEFINE_HASHTABLE and DEFINE_STATIC_HASHTABLE from above,
> the definition would look something like this:
>
> static union {
> struct hash_table my_hashtable;
> struct {
> size_t bits;
> struct hlist_head buckets[1 << 5];
> } __my_hashtable;
> } = { .my_hashtable.bits = 5 };
It's different because I don't think you can do what you did above with global variables.
You won't be defining any instances of that anonymous struct, so my_hashtable won't exist anywhere.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists