Hi

This is a sample code below that I move from kernel source, I don't know how
to make it work...
I have no idea where to  assign the __setup_start value...
Can you help me to assign value of __setup_start and __setup_end...
Any responds is helpful.

W.B
----------------------------------------------
#include <stdio.h>

struct kernel_param {
        const char *str;
        int (*setup_func)(void);
};

struct kernel_param __setup_start, __setup_end;

#define __setup(str, fn)        \
static char __setup_str_##fn[] = str; \
static struct kernel_param __setup_##fn = { __setup_str_##fn, fn }

int f1()
{
    printf("This is f1()");
    return 1;
}
__setup("fun1",f1);

int main()
{
    struct kernel_param *p;
    p = &__setup_start;

    do {
        if (p->setup_func())
        return 1;
        p++;
    } while (p < &__setup_end);
    return 0;
}

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to