Messages in this thread | | | Date | Wed, 30 Jan 2002 15:52:45 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: [PATCH] Slab cache name fixes / reiserfs boot bug fix. |
| |
On Thu, 31 Jan 2002, Andi Kleen wrote: > > Patch against 2.5.3. Please apply.
Plase make some of the uglier stuff a bit cleaner.
For example:
> static const int bvec_pool_sizes[BIOVEC_NR_POOLS] = { 1, 4, 16, 64, 128, 256 }; > +static char bvec_pool_names[BIOVEC_NR_POOLS][16];
together with a sprintf for constant strings just looks uglee.
Why not just do
#define VEC(x) { x, "biovec-" #x } static const struct { int size, char *name; } bvec_pools[BIOVEC_NR_POOLS] = { VEC(1), VEC(4), VEC(16), VEC(64), VEC(128), VEC(256) };
and then register them with a nice
for (i = 0; i < BIOVEC_NR_POOLS; i++) { bp->slab = kmem_cache_create( bvec_pools[i].name, bvec_pools[i].size, ...
which is just simpler and doesn't have issues like fixed 16-byte arrays etc.
Linus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |