int m_isalias : 1;
int m_reserved : 15;
- int m_depcnt : 16;
+ int m_depcnt : 16;
char ** m_deparr;
struct dep_t * m_next;
char *tag, *value;
while ( isspace ( *buffer ))
- buffer++;
+ buffer++;
tag = value = buffer;
while ( !isspace ( *value ))
value++;
/* Jump through hoops to simulate how fgets() grabs just one line at a
* time... Don't use any stdio since modprobe gets called from a kernel
- * thread and stdio junk can overflow the limited stack...
+ * thread and stdio junk can overflow the limited stack...
*/
static char *reads ( int fd, char *buffer, size_t len )
{
if ( p ) {
off_t offset;
- offset = lseek ( fd, 0L, SEEK_CUR ); // Get the current file descriptor offset
+ offset = lseek ( fd, 0L, SEEK_CUR ); // Get the current file descriptor offset
lseek ( fd, offset-n + (p-buffer) + 1, SEEK_SET ); // Set the file descriptor offset to right after the \n
p[1] = 0;
continue;
}
- if ( !continuation_line ) {
+ if ( !continuation_line ) {
char *col = strchr ( buffer, ':' );
if ( col ) {
current-> m_next = 0;
//printf ( "%s:\n", mod );
- p = col + 1;
+ p = col + 1;
}
else
p = 0;
else
next = end;
- deps = strrchr ( p, '/' );
+ deps = strrchr ( p, '/' );
- if ( !deps || ( deps < p )) {
- deps = p;
+ if ( !deps || ( deps < p )) {
+ deps = p;
- while ( isblank ( *deps ))
+ while ( isblank ( *deps ))
+ deps++;
+ }
+ else
deps++;
- }
- else
- deps++;
#if defined(CONFIG_FEATURE_2_6_MODULES)
if ((k_version > 4) && ( *(next-2) == '.' ) && *(next-1) == 'k' &&
( *next == 'o' ))
- ext = 3;
- else
+ ext = 3;
+ else
#endif
if (( *(next-1) == '.' ) && ( *next == 'o' ))
- ext = 2;
+ ext = 2;
- /* Cope with blank lines */
+ /* Cope with blank lines */
if ((next-deps-ext+1) <= 0)
- continue;
+ continue;
dep = bb_xstrndup ( deps, next - deps - ext + 1 );
- current-> m_depcnt++;
- current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt );
- current-> m_deparr [current-> m_depcnt - 1] = dep;
+ current-> m_depcnt++;
+ current-> m_deparr = (char **) xrealloc ( current-> m_deparr,
+ sizeof ( char *) * current-> m_depcnt );
+ current-> m_deparr [current-> m_depcnt - 1] = dep;
- //printf ( " %d) %s\n", current-> m_depcnt, current-> m_deparr [current-> m_depcnt -1] );
- p = next + 2;
+ //printf ( " %d) %s\n", current-> m_depcnt, current-> m_deparr [current-> m_depcnt -1] );
+ p = next + 2;
} while (next < end);
}
int l;
char *p;
- p = strchr ( buffer, '#' );
+ p = strchr ( buffer, '#' );
if ( p )
*p = 0;
continue;
}
- if ( !continuation_line ) {
+ if ( !continuation_line ) {
if (( strncmp ( buffer, "alias", 5 ) == 0 ) && isspace ( buffer [5] )) {
char *alias, *mod;
current-> m_deparr = xmalloc ( 1 * sizeof( char * ));
current-> m_deparr[0] = bb_xstrdup ( mod );
}
- current-> m_next = 0;
+ current-> m_next = 0;
}
- }
- else if (( strncmp ( buffer, "options", 7 ) == 0 ) && isspace ( buffer [7] )) {
+ }
+ else if (( strncmp ( buffer, "options", 7 ) == 0 ) && isspace ( buffer [7] )) {
char *mod, *opt;
if ( parse_tag_value ( buffer + 8, &mod, &opt )) {
struct dep_t *dt;
for ( dt = first; dt; dt = dt-> m_next ) {
- if ( strcmp ( dt-> m_module, mod ) == 0 )
+ if ( strcmp ( dt-> m_module, mod ) == 0 )
break;
}
if ( dt ) {
*lcmd = '\0';
if ( do_insert ) {
if (already_loaded (list->m_module) != 1)
- snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s", do_syslog ? "-s" : "", autoclean ? "-k" : "", quiet ? "-q" : "", list-> m_module, list-> m_options ? list-> m_options : "" );
+ snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s",
+ do_syslog ? "-s" : "", autoclean ? "-k" : "",
+ quiet ? "-q" : "", list-> m_module, list-> m_options ?
+ list-> m_options : "" );
} else {
if (already_loaded (list->m_module) != 0)
- snprintf ( lcmd, sizeof( lcmd ) - 1, "rmmod %s %s", do_syslog ? "-s" : "", list-> m_module );
+ snprintf ( lcmd, sizeof( lcmd ) - 1, "rmmod %s %s",
+ do_syslog ? "-s" : "", list-> m_module );
}
if ( verbose )
break;
}
if ( adt ) {
- dt = adt;
+ dt = adt;
mod = dt-> m_module;
if ( !opt )
opt = dt-> m_options;
return;
}
else
- return;
+ return;
}
// search for duplicates
*tail = find-> m_prev;
break; // there can be only one duplicate
- }
+ }
}
if ( !find ) { // did not find a duplicate
- find = (struct mod_list_t *) xmalloc ( sizeof(struct mod_list_t));
+ find = (struct mod_list_t *) xmalloc ( sizeof(struct mod_list_t));
find-> m_module = mod;
find-> m_options = opt;
}
- // enqueue at tail
+ // enqueue at tail
if ( *tail )
(*tail)-> m_next = find;
find-> m_prev = *tail;
*head = find;
*tail = find;
- if ( dt ) {
+ if ( dt ) {
int i;
for ( i = 0; i < dt-> m_depcnt; i++ )
static int mod_insert ( char *mod, int argc, char **argv )
{
struct mod_list_t *tail = 0;
- struct mod_list_t *head = 0;
+ struct mod_list_t *head = 0;
int rc;
// get dep list for module mod
if ( head && tail ) {
if ( argc ) {
- int i;
+ int i;
int l = 0;
// append module args
- for ( i = 0; i < argc; i++ )
+ for ( i = 0; i < argc; i++ )
l += ( bb_strlen ( argv [i] ) + 1 );
head-> m_options = xrealloc ( head-> m_options, l + 1 );
static int mod_remove ( char *mod )
{
int rc;
- static struct mod_list_t rm_a_dummy = { "-a", 0, 0 };
+ static struct mod_list_t rm_a_dummy = { "-a", 0, 0 };
struct mod_list_t *head = 0;
struct mod_list_t *tail = 0;
}
}
- depend = build_dep ( );
+ depend = build_dep ( );
- if ( !depend )
+ if ( !depend )
bb_error_msg_and_die ( "could not parse modules.dep\n" );
if (remove_opt) {
return rc;
}
- if (optind >= argc)
+ if (optind >= argc)
bb_error_msg_and_die ( "No module or pattern provided\n" );
- if ( mod_insert ( bb_xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 ))
+ if ( mod_insert ( bb_xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 ))
bb_error_msg_and_die ( "failed to load module %s", argv [optind] );
return EXIT_SUCCESS;