[BusyBox-cvs] busybox/modutils insmod.c, 1.108, 1.109 modprobe.c, 1.24, 1.25 rmmod.c, 1.25, 1.26

Erik Andersen andersen at busybox.net
Wed Dec 24 20:30:47 UTC 2003


Update of /var/cvs/busybox/modutils
In directory nail:/tmp/cvs-serv17665

Modified Files:
	insmod.c modprobe.c rmmod.c 
Log Message:
re-indent


Index: modprobe.c
===================================================================
RCS file: /var/cvs/busybox/modutils/modprobe.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- modprobe.c	19 Dec 2003 21:04:19 -0000	1.24
+++ modprobe.c	24 Dec 2003 20:30:45 -0000	1.25
@@ -36,20 +36,20 @@
 struct dep_t {
 	char *  m_module;
 	char *  m_options;
-	
+
 	int     m_isalias  : 1;
 	int     m_reserved : 15;
-	
+
 	int     m_depcnt   : 16;	
 	char ** m_deparr;
-	
+
 	struct dep_t * m_next;
 };
 
 struct mod_list_t {
 	char *  m_module;
 	char *  m_options;
-	
+
 	struct mod_list_t * m_prev;
 	struct mod_list_t * m_next;
 };
@@ -74,7 +74,7 @@
 
 	*ptag = tag;
 	*pvalue = value;
-	
+
 	return bb_strlen( tag ) && bb_strlen( value );
 }
 
@@ -85,16 +85,16 @@
 static char *reads ( int fd, char *buffer, size_t len )
 {
 	int n = read ( fd, buffer, len );
-	
+
 	if ( n > 0 ) {
 		char *p;
-	
+
 		buffer [len-1] = 0;
 		p = strchr ( buffer, '\n' );
-		
+
 		if ( p ) {
 			off_t 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
 
@@ -102,7 +102,7 @@
 		}
 		return buffer;
 	}
-	
+
 	else
 		return 0;
 }
@@ -116,11 +116,11 @@
 	char buffer[256];
 	char *filename = buffer;
 	int continuation_line = 0;
-	
+
 	k_version = 0;
 	if ( uname ( &un ))
 		return 0;
-		
+
 	// check for buffer overflow in following code
 	if ( bb_strlen ( un.release ) > ( sizeof( buffer ) - 64 )) {
 		return 0;
@@ -128,7 +128,7 @@
 	if (un.release[0] == '2') {
 		k_version = un.release[2] - '0';
 	}
-				
+
 	strcpy ( filename, "/lib/modules/" );
 	strcat ( filename, un.release );
 	strcat ( filename, "/modules.dep" );
@@ -144,44 +144,44 @@
 	while ( reads ( fd, buffer, sizeof( buffer ))) {
 		int l = bb_strlen ( buffer );
 		char *p = 0;
-		
+
 		while ( isspace ( buffer [l-1] )) {
 			buffer [l-1] = 0;
 			l--;
 		}
-		
+
 		if ( l == 0 ) {
 			continuation_line = 0;
 			continue;
 		}
-		
+
 		if ( !continuation_line ) {		
 			char *col = strchr ( buffer, ':' );
-		
+
 			if ( col ) {
 				char *mods;
 				char *mod;
 				int ext = 0;
-				
+
 				*col = 0;
 				mods = strrchr ( buffer, '/' );
-				
+
 				if ( !mods )
 					mods = buffer;
 				else
 					mods++;
-					
+
 #if defined(CONFIG_FEATURE_2_6_MODULES)
 				if ((k_version > 4) && ( *(col-3) == '.' ) &&
-					( *(col-2) == 'k' ) && ( *(col-1) == 'o' ))
+						( *(col-2) == 'k' ) && ( *(col-1) == 'o' ))
 					ext = 3;
 				else
 #endif
-				if (( *(col-2) == '.' ) && ( *(col-1) == 'o' ))
-					ext = 2;
-				
+					if (( *(col-2) == '.' ) && ( *(col-1) == 'o' ))
+						ext = 2;
+
 				mod = bb_xstrndup ( mods, col - mods - ext );
-					
+
 				if ( !current ) {
 					first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t ));
 				}
@@ -195,9 +195,9 @@
 				current-> m_depcnt  = 0;
 				current-> m_deparr  = 0;
 				current-> m_next    = 0;
-						
+
 				//printf ( "%s:\n", mod );
-						
+
 				p = col + 1;		
 			}
 			else
@@ -205,49 +205,49 @@
 		}
 		else
 			p = buffer;
-			
+
 		if ( p && *p ) {
 			char *end = &buffer [l-1];
 			char *deps = strrchr ( end, '/' );
 			char *dep;
 			int ext = 0;
-			
+
 			while ( isblank ( *end ) || ( *end == '\\' ))
 				end--;
-				
+
 			deps = strrchr ( p, '/' );
-			
+
 			if ( !deps || ( deps < p )) {
 				deps = p;
-		
+
 				while ( isblank ( *deps ))
 					deps++;
 			}
 			else
 				deps++;
-			
+
 #if defined(CONFIG_FEATURE_2_6_MODULES)
 			if ((k_version > 4) && ( *(end-2) == '.' ) && *(end-1) == 'k'  &&
-				( *end == 'o' ))
+					( *end == 'o' ))
 				ext = 3;
 			else
 #endif
-			if (( *(end-1) == '.' ) && ( *end == 'o' ))
-				ext = 2;
+				if (( *(end-1) == '.' ) && ( *end == 'o' ))
+					ext = 2;
 
 			/* Cope with blank lines */
 			if ((end-deps-ext+1) <= 0)
 				continue;
-			
+
 			dep = bb_xstrndup ( deps, end - 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;		
-			
+
 			//printf ( "    %d) %s\n", current-> m_depcnt, current-> m_deparr [current-> m_depcnt -1] );
 		}
-	
+
 		if ( buffer [l-1] == '\\' )
 			continuation_line = 1;
 		else
@@ -260,35 +260,35 @@
 	if (( fd = open ( "/etc/modules.conf", O_RDONLY )) < 0 )
 		if (( fd = open ( "/etc/conf.modules", O_RDONLY )) < 0 )
 			return first;
-	
+
 	continuation_line = 0;
 	while ( reads ( fd, buffer, sizeof( buffer ))) {
 		int l;
 		char *p;
-		
+
 		p = strchr ( buffer, '#' );	
 		if ( p )
 			*p = 0;
-			
+
 		l = bb_strlen ( buffer );
-	
+
 		while ( l && isspace ( buffer [l-1] )) {
 			buffer [l-1] = 0;
 			l--;
 		}
-		
+
 		if ( l == 0 ) {
 			continuation_line = 0;
 			continue;
 		}
-		
+
 		if ( !continuation_line ) {		
 			if (( strncmp ( buffer, "alias", 5 ) == 0 ) && isspace ( buffer [5] )) {
 				char *alias, *mod;
 
 				if ( parse_tag_value ( buffer + 6, &alias, &mod )) {
 					// fprintf ( stderr, "ALIAS: '%s' -> '%s'\n", alias, mod );
-				
+
 					if ( !current ) {
 						first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t ));
 					}
@@ -298,7 +298,7 @@
 					}
 					current-> m_module  = bb_xstrdup ( alias );
 					current-> m_isalias = 1;
-					
+
 					if (( strcmp ( alias, "off" ) == 0 ) || ( strcmp ( alias, "null" ) == 0 )) {
 						current-> m_depcnt = 0;
 						current-> m_deparr = 0;
@@ -313,10 +313,10 @@
 			}				
 			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 ) 
 							break;
@@ -324,7 +324,7 @@
 					if ( dt ) {
 						dt-> m_options = xrealloc ( dt-> m_options, bb_strlen( opt ) + 1 );
 						strcpy ( dt-> m_options, opt );
-						
+
 						// fprintf ( stderr, "OPTION: '%s' -> '%s'\n", dt-> m_module, dt-> m_options );
 					}
 				}
@@ -332,7 +332,7 @@
 		}
 	}
 	close ( fd );
-	
+
 	return first;
 }
 
@@ -377,7 +377,7 @@
 			if (already_loaded (list->m_module) != 0)
 				snprintf ( lcmd, sizeof( lcmd ) - 1, "rmmod %s %s", do_syslog ? "-s" : "", list-> m_module );
 		}
-		
+
 		if ( verbose )
 			printf ( "%s\n", lcmd );
 		if ( !show_only && *lcmd) {
@@ -385,7 +385,7 @@
 			if (do_insert) rc = rc2; /* only last module matters */
 			else if (!rc2) rc = 0; /* success if remove any mod */
 		}
-			
+
 		list = do_insert ? list-> m_prev : list-> m_next;
 	}
 	return (show_only) ? 0 : rc;
@@ -403,12 +403,12 @@
 
 #if defined(CONFIG_FEATURE_2_6_MODULES)
 	if ((k_version > 4) && ( mod [lm-3] == '.' ) &&
-		( mod [lm-2] == 'k' ) && ( mod [lm-1] == 'o' ))
+			( mod [lm-2] == 'k' ) && ( mod [lm-1] == 'o' ))
 		mod [lm-3] = 0;
 	else
 #endif
-	if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' ))
-		mod [lm-2] = 0;
+		if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' ))
+			mod [lm-2] = 0;
 
 	// check dependencies
 	for ( dt = depend; dt; dt = dt-> m_next ) {
@@ -417,12 +417,12 @@
 			break;
 		}
 	}
-	
+
 	// resolve alias names
 	while ( dt && dt-> m_isalias ) {
 		if ( dt-> m_depcnt == 1 ) {
 			struct dep_t *adt;
-		
+
 			for ( adt = depend; adt; adt = adt-> m_next ) {
 				if ( strcmp ( adt-> m_module, dt-> m_deparr [0] ) == 0 )
 					break;
@@ -439,7 +439,7 @@
 		else
 			return;			
 	}
-	
+
 	// search for duplicates
 	for ( find = *head; find; find = find-> m_next ) {
 		if ( !strcmp ( mod, find-> m_module )) {
@@ -449,12 +449,12 @@
 				find-> m_prev-> m_next = find-> m_next;
 			else
 				*head = find-> m_next;
-					
+
 			if ( find-> m_next )
 				find-> m_next-> m_prev = find-> m_prev;
 			else
 				*tail = find-> m_prev;
-					
+
 			break; // there can be only one duplicate
 		}				
 	}
@@ -474,10 +474,10 @@
 	if ( !*head )
 		*head = find;
 	*tail = find;
-		
+
 	if ( dt ) {	
 		int i;
-		
+
 		for ( i = 0; i < dt-> m_depcnt; i++ )
 			check_dep ( dt-> m_deparr [i], head, tail );
 	}
@@ -490,34 +490,34 @@
 	struct mod_list_t *tail = 0;
 	struct mod_list_t *head = 0; 	
 	int rc;
-	
+
 	// get dep list for module mod
 	check_dep ( mod, &head, &tail );
-	
+
 	if ( head && tail ) {
 		if ( argc ) {
 			int i;		
 			int l = 0;
-	
+
 			// append module args
 			for ( i = 0; i < argc; i++ ) 
 				l += ( bb_strlen ( argv [i] ) + 1 );
-		
+
 			head-> m_options = xrealloc ( head-> m_options, l + 1 );
 			head-> m_options [0] = 0;
-		
+
 			for ( i = 0; i < argc; i++ ) {
 				strcat ( head-> m_options, argv [i] );
 				strcat ( head-> m_options, " " );
 			}
 		}
-		
+
 		// process tail ---> head
 		rc = mod_process ( tail, 1 );
 	}
 	else
 		rc = 1;
-	
+
 	return rc;
 }
 
@@ -525,21 +525,21 @@
 {
 	int rc;
 	static struct mod_list_t rm_a_dummy = { "-a", 0, 0 }; 
-	
+
 	struct mod_list_t *head = 0;
 	struct mod_list_t *tail = 0;
-	
+
 	if ( mod )
 		check_dep ( mod, &head, &tail );
 	else  // autoclean
 		head = tail = &rm_a_dummy;
-	
+
 	if ( head && tail )
 		rc = mod_process ( head, 0 );  // process head ---> tail
 	else
 		rc = 1;
 	return rc;
-	
+
 }
 
 
@@ -553,67 +553,67 @@
 
 	while ((opt = getopt(argc, argv, "acdklnqrst:vVC:")) != -1) {
 		switch(opt) {
-		case 'c': // no config used
-		case 'l': // no pattern matching
-			return EXIT_SUCCESS;
-			break;
-		case 'C': // no config used
-		case 't': // no pattern matching
-			bb_error_msg_and_die("-t and -C not supported");
+			case 'c': // no config used
+			case 'l': // no pattern matching
+				return EXIT_SUCCESS;
+				break;
+			case 'C': // no config used
+			case 't': // no pattern matching
+				bb_error_msg_and_die("-t and -C not supported");
 
-		case 'a': // ignore
-		case 'd': // ignore
-			break;
-		case 'k':
-			autoclean++;
-			break;
-		case 'n':
-			show_only++;
-			break;
-		case 'q':
-			quiet++;
-			break;
-		case 'r':
-			remove_opt++;
-			break;
-		case 's':
-			do_syslog++;
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case 'V':
-		default:
-			bb_show_usage();
-			break;
+			case 'a': // ignore
+			case 'd': // ignore
+				break;
+			case 'k':
+				autoclean++;
+				break;
+			case 'n':
+				show_only++;
+				break;
+			case 'q':
+				quiet++;
+				break;
+			case 'r':
+				remove_opt++;
+				break;
+			case 's':
+				do_syslog++;
+				break;
+			case 'v':
+				verbose++;
+				break;
+			case 'V':
+			default:
+				bb_show_usage();
+				break;
 		}
 	}
-	
+
 	depend = build_dep ( );	
 
 	if ( !depend ) 
 		bb_error_msg_and_die ( "could not parse modules.dep\n" );
-	
+
 	if (remove_opt) {
 		int rc = EXIT_SUCCESS;
 		do {
 			if (mod_remove ( optind < argc ?
-					 bb_xstrdup (argv [optind]) : NULL )) {
+						bb_xstrdup (argv [optind]) : NULL )) {
 				bb_error_msg ("failed to remove module %s",
-					argv [optind] );
+						argv [optind] );
 				rc = EXIT_FAILURE;
 			}
 		} while ( ++optind < argc );
-		
+
 		return rc;
 	}
 
 	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 )) 
 		bb_error_msg_and_die ( "failed to load module %s", argv [optind] );
-	
+
 	return EXIT_SUCCESS;
 }
 

Index: insmod.c
===================================================================
RCS file: /var/cvs/busybox/modutils/insmod.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- insmod.c	19 Dec 2003 21:04:19 -0000	1.108
+++ insmod.c	24 Dec 2003 20:30:45 -0000	1.109
@@ -295,47 +295,47 @@
 /* The symbol format used by get_kernel_syms(2).  */
 struct old_kernel_sym
 {
-  unsigned long value;
-  char name[60];
+	unsigned long value;
+	char name[60];
 };
 
 struct old_module_ref
 {
[...2646 lines suppressed...]
 	unsigned long len;
 	void *map;
 	char *filename, *options = bb_xstrdup("");
-	
+
 	filename = argv[1];
 	if (!filename) {
 		bb_show_usage();
@@ -4455,9 +4456,9 @@
 	ret = syscall(__NR_init_module, map, len, options);
 	if (ret != 0) {
 		bb_perror_msg_and_die("cannot insert `%s': %s (%li)",
-						   filename, moderror(errno), ret);
+				filename, moderror(errno), ret);
 	}
-	
+
 	return 0;
 }
 

Index: rmmod.c
===================================================================
RCS file: /var/cvs/busybox/modutils/rmmod.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rmmod.c	11 Dec 2003 01:42:13 -0000	1.25
+++ rmmod.c	24 Dec 2003 20:30:45 -0000	1.26
@@ -73,7 +73,7 @@
 	}
 
 	if (optind == argc)
-			bb_show_usage();
+		bb_show_usage();
 
 	for (n = optind; n < argc; n++) {
 		if (syscall(__NR_delete_module, argv[n], flags) < 0) {




More information about the busybox-cvs mailing list