david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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.
This commit is contained in:
Michael Brown 2009-06-28 20:24:54 +01:00
parent ee1d315ac0
commit 6e564323e0
2 changed files with 12 additions and 12 deletions

View File

@ -98,15 +98,15 @@ static int ifcommon_do_list ( int ( * payload ) ( struct net_device * ),
/** /**
* Execute if<xxx> command * Execute if<xxx> command
* *
* @v payload Command to execute
* @v verb Verb describing the action of the command
* @v argc Argument count * @v argc Argument count
* @v argv Argument list * @v argv Argument list
* @v payload Command to execute
* @v verb Verb describing the action of the command
* @ret rc Exit code * @ret rc Exit code
*/ */
__attribute__ (( regparm ( 2 ) )) int int ifcommon_exec ( int argc, char **argv,
ifcommon_exec ( int ( * payload ) ( struct net_device * ), int ( * payload ) ( struct net_device * ),
const char *verb, int argc, char **argv ) { const char *verb ) {
int c; int c;
/* Parse options */ /* Parse options */
@ -137,7 +137,7 @@ static int ifopen_payload ( struct net_device *netdev ) {
} }
static int ifopen_exec ( int argc, char **argv ) { static int ifopen_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifopen_payload, "Open", argc, argv ); return ifcommon_exec ( argc, argv, ifopen_payload, "Open" );
} }
/* "ifclose" command */ /* "ifclose" command */
@ -148,7 +148,7 @@ static int ifclose_payload ( struct net_device *netdev ) {
} }
static int ifclose_exec ( int argc, char **argv ) { static int ifclose_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifclose_payload, "Close", argc, argv ); return ifcommon_exec ( argc, argv, ifclose_payload, "Close" );
} }
/* "ifstat" command */ /* "ifstat" command */
@ -159,8 +159,8 @@ static int ifstat_payload ( struct net_device *netdev ) {
} }
static int ifstat_exec ( int argc, char **argv ) { static int ifstat_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifstat_payload, "Display status of", return ifcommon_exec ( argc, argv,
argc, argv ); ifstat_payload, "Display status of" );
} }
/** Interface management commands */ /** Interface management commands */

View File

@ -23,8 +23,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct net_device; struct net_device;
extern int ifcommon_exec ( int ( * payload ) ( struct net_device * ), extern int ifcommon_exec ( int argc, char **argv,
const char *verb, int argc, char **argv ) int ( * payload ) ( struct net_device * ),
__attribute__ (( regparm ( 2 ) )); const char *verb );
#endif /* _IFMGMT_CMD_H */ #endif /* _IFMGMT_CMD_H */