Kernel programming Q: new aligned memory

B. James Phillippe (bryan@terran.org)
Fri, 4 Sep 1998 09:42:33 -0700 (PDT)


Hello Kernel Gurus,

I'm wondering what is the best way to align a chunk of kernel
memory (from kmalloc, say) on a particular byte boundary. 16 bytes, for
instance. I have started using something like this:

struct foo {
/* ... some stuff */
u32 pad1, pad2, pad3, pad4;
};

foo* p = (((long)kmalloc(sizeof(foo), FLAGS) + 0xf) & ~0xf);

But I have been told I can do it explicitly with kmalloc? I did not see
another parameter to kmalloc, and I'm not sure how get_free_page() works..
or if there is an alternative? Any advice would be greatly appreciated.

thanks,
-bp

--
B. James Phillippe <bryan@terran.org>
Linux, networks, C++ development
http://earth.terran.org/~bryan

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html