2 setup.h (c) 1997-8 Grant R. Guenther <grant@torque.net>
3 Under the terms of the GNU General Public License.
5 This is a table driven setup function for kernel modules
6 using the module.variable=val,... command line notation.
12 1.01 GRG 1998.05.05 Allow negative and defaulted values
16 #include <linux/ctype.h>
17 #include <linux/string.h>
21 char *tag; /* variable name */
22 int size; /* number of elements in array */
23 int *iv; /* pointer to variable */
26 typedef struct setup_tab_t STT;
28 /* t is a table that describes the variables that can be set
30 n is the number of entries in the table
31 ss is a string of the form:
33 <tag>=[<val>,...]<val>
36 static void generic_setup( STT t[], int n, char *ss )
43 if (strncmp(ss,t[j].tag,k) == 0) break;
52 if (ss[k] != '=') return;
56 while (ss && (k < t[j].size)) {
59 if (*ss == '-') { ss++; sgn = -1; }
62 t[j].iv[k] = sgn * simple_strtoul(ss,NULL,0);
64 if ((ss = strchr(ss,',')) != NULL) ss++;