Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    kernel programming

    I have a question about Linux kernel programming and I hope you will answer it:
    structure "slab" is defined in kernel code named "slab.c" (it is not defined in any kernel header).
    struct slab {
           struct list_head list;
           unsigned long colouroff;
           void *s_mem;            /* including colour offset */
           unsigned int inuse;     /* num of objs active in slab */
           unsigned short nodeid;
    I want to use it in my code. how can I typedef it ?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    The fact that it is not declared in a header means that it is for the private use of the kernel. You can simply cut/paste the definition to your own code and typedef it as you desire, bearing in mind that if the kernel changes this structure your code will no longer be in sync with the kernel if that is important to you.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts