"bob" <op******@hotmail.com> writes:
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.
I presume LKM doesn't refer to the League of Kansas Municipalities.
I'm guessing it refers to Linux Loadable Kernel Modules, but I don't
know anything about them -- and you shouldn't expect anyone else here
to know about them either.
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. All the errors
point to the same line (49, module_par.....).
I can only guess that module_param_array is a macro, and that it
expands to an initializer or something that includes an initializer.
Without knowing what the macro definition is, I can't guess what it
expects as arguments.
There are a large number of newsgroups with "linux" in their names,
and several with both "linux" and "kernel". If I've guess right about
what you're trying to do, you should post in one of those newsgroups.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.