Re: invalid lvalue in unary '&' ... why? LKM
- From: "bob" <opster81@xxxxxxxxxxx>
- Date: 27 Jan 2006 08:50:51 -0800
Sorry for the dumb question, I figured it out.
bob wrote:
> I have little C experience and am concurrently trying to tackle C and
> LKM's (a little too ambitious maybe) anyway here is the problem I'm
> having with an example module I found.
>
>
> /*
> * hello-5.c
> */
> .
> .
>
> static int myintArray[2] = { -1, -1 };
> static int arr_argc = 0;
> .
> .
> .
> /*module _param_array(name, type, num, perm);
> *the first argument in the arrays name
> * the second argument is the arrays data type
> * The third argument is a pointer to the variable that will
> store the number
> * of elements of the array initialized by the user at module
> loading time
> *the fourth argument is the permission bits
> */
>
>
> module_param_array(myintArray, int, &arr_argc, 0000);
> MODULE_PARM_DESC(myintArray, "an array of integers");
>
> .
> .
>
> When I compile I get this error :
>
> invalid lvalue in unary '&'
> initializer element is not constant
> (near initialization for '__param_arr_myintArray.num')
>
>
> If I get rid of the address operator it will compile, but this doesn't
> seem right - as in how the macro was designed to work. I think
> module_param_array() is suppose to set the num parameter to the
> number of array elements the user supplied at the invocation
> of insmod. So if i say:
>
> insmod hello-5.ko myintArray = 42
>
> and printk the arr_argc variable I should see
>
> arr_argc = 1
>
> by getting rid of the address operator, I believe I am ignoring num via
> NULL
>
>
> All the errors point to the same line (49, module_par.....).
>
> If you go to www.tldp.org/LDP/lkmpg/2.6/html/x323.html you can see the
> whole example module.
>
>
> Thanks in advance
.
- References:
- invalid lvalue in unary '&' ... why? LKM
- From: bob
- invalid lvalue in unary '&' ... why? LKM
- Prev by Date: Re: online kernel source code
- Next by Date: fopen: pre-pending text
- Previous by thread: invalid lvalue in unary '&' ... why? LKM
- Next by thread: preemptive kernel question
- Index(es):
Relevant Pages
|