Browse Source

[ifmgmt] Optimise prototype for ifcommon_exec()

ifcommon_exec() was long-ago marked as __attribute__((regparm(2))) in
order to minimise the size of functions that call into it.  Since
then, gPXE has added -mregparm=3 as a general compilation option, and
this "optimisation" is now counter-productive.

Change (and simplify) the prototype to minimise code size given the
current compilation conditions.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
6e564323e0
2 changed files with 12 additions and 12 deletions
  1. 9
    9
      src/hci/commands/ifmgmt_cmd.c
  2. 3
    3
      src/hci/commands/ifmgmt_cmd.h

+ 9
- 9
src/hci/commands/ifmgmt_cmd.c View File

98
 /**
98
 /**
99
  * Execute if<xxx> command
99
  * Execute if<xxx> command
100
  *
100
  *
101
- * @v payload		Command to execute
102
- * @v verb		Verb describing the action of the command
103
  * @v argc		Argument count
101
  * @v argc		Argument count
104
  * @v argv		Argument list
102
  * @v argv		Argument list
103
+ * @v payload		Command to execute
104
+ * @v verb		Verb describing the action of the command
105
  * @ret rc		Exit code
105
  * @ret rc		Exit code
106
  */
106
  */
107
-__attribute__ (( regparm ( 2 ) )) int
108
-ifcommon_exec ( int ( * payload ) ( struct net_device * ),
109
-		const char *verb, int argc, char **argv ) {
107
+int ifcommon_exec ( int argc, char **argv,
108
+		    int ( * payload ) ( struct net_device * ),
109
+		    const char *verb ) {
110
 	int c;
110
 	int c;
111
 
111
 
112
 	/* Parse options */
112
 	/* Parse options */
137
 }
137
 }
138
 
138
 
139
 static int ifopen_exec ( int argc, char **argv ) {
139
 static int ifopen_exec ( int argc, char **argv ) {
140
-	return ifcommon_exec ( ifopen_payload, "Open", argc, argv );
140
+	return ifcommon_exec ( argc, argv, ifopen_payload, "Open" );
141
 }
141
 }
142
 
142
 
143
 /* "ifclose" command */
143
 /* "ifclose" command */
148
 }
148
 }
149
 
149
 
150
 static int ifclose_exec ( int argc, char **argv ) {
150
 static int ifclose_exec ( int argc, char **argv ) {
151
-	return ifcommon_exec ( ifclose_payload, "Close", argc, argv );
151
+	return ifcommon_exec ( argc, argv, ifclose_payload, "Close" );
152
 }
152
 }
153
 
153
 
154
 /* "ifstat" command */
154
 /* "ifstat" command */
159
 }
159
 }
160
 
160
 
161
 static int ifstat_exec ( int argc, char **argv ) {
161
 static int ifstat_exec ( int argc, char **argv ) {
162
-	return ifcommon_exec ( ifstat_payload, "Display status of",
163
-			       argc, argv );
162
+	return ifcommon_exec ( argc, argv,
163
+			       ifstat_payload, "Display status of" );
164
 }
164
 }
165
 
165
 
166
 /** Interface management commands */
166
 /** Interface management commands */

+ 3
- 3
src/hci/commands/ifmgmt_cmd.h View File

23
 
23
 
24
 struct net_device;
24
 struct net_device;
25
 
25
 
26
-extern int ifcommon_exec ( int ( * payload ) ( struct net_device * ),
27
-			   const char *verb, int argc, char **argv )
28
-	__attribute__ (( regparm ( 2 ) ));
26
+extern int ifcommon_exec (  int argc, char **argv,
27
+			    int ( * payload ) ( struct net_device * ),
28
+			    const char *verb );
29
 
29
 
30
 #endif /* _IFMGMT_CMD_H */
30
 #endif /* _IFMGMT_CMD_H */

Loading…
Cancel
Save