X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=net%2Fipv4%2Fipconfig.c;h=f2509034ce72bce29573d886f59adda599e7be8e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=a0c8504dc2231389c8265c0d3963b7e54bf3d84c;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index a0c8504dc..f2509034c 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -84,8 +85,8 @@ #endif /* Define the friendly delay before and after opening net devices */ -#define CONF_PRE_OPEN (HZ/2) /* Before opening: 1/2 second */ -#define CONF_POST_OPEN (1*HZ) /* After opening: 1 second */ +#define CONF_PRE_OPEN 500 /* Before opening: 1/2 second */ +#define CONF_POST_OPEN 1 /* After opening: 1 second */ /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ @@ -109,7 +110,7 @@ */ int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */ -int ic_enable __initdata = 0; /* IP config enabled? */ +static int ic_enable __initdata = 0; /* IP config enabled? */ /* Protocol choice */ int ic_proto_enabled __initdata = 0 @@ -124,10 +125,10 @@ int ic_proto_enabled __initdata = 0 #endif ; -int ic_host_name_set __initdata = 0; /* Host name set by us? */ +static int ic_host_name_set __initdata = 0; /* Host name set by us? */ u32 ic_myaddr = INADDR_NONE; /* My IP address */ -u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */ +static u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */ u32 ic_gateway = INADDR_NONE; /* Gateway IP address */ u32 ic_servaddr = INADDR_NONE; /* Boot server IP address */ @@ -137,9 +138,9 @@ u8 root_server_path[256] = { 0, }; /* Path to mount as root */ /* Persistent data: */ -int ic_proto_used; /* Protocol used, if any */ -u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ -u8 ic_domain[64]; /* DNS (not NIS) domain name */ +static int ic_proto_used; /* Protocol used, if any */ +static u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ +static u8 ic_domain[64]; /* DNS (not NIS) domain name */ /* * Private state. @@ -152,7 +153,7 @@ static char user_dev_name[IFNAMSIZ] __initdata = { 0, }; static int ic_proto_have_if __initdata = 0; #ifdef IPCONFIG_DYNAMIC -static spinlock_t ic_recv_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(ic_recv_lock); static volatile int ic_got_reply __initdata = 0; /* Proto(s) that replied */ #endif #ifdef IPCONFIG_DHCP @@ -1102,8 +1103,8 @@ static int __init ic_dynamic(void) jiff = jiffies + (d->next ? CONF_INTER_TIMEOUT : timeout); while (time_before(jiffies, jiff) && !ic_got_reply) { - barrier(); - cpu_relax(); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(1); } #ifdef IPCONFIG_DHCP /* DHCP isn't done until we get a DHCPACK. */ @@ -1232,7 +1233,7 @@ u32 __init root_nfs_parse_addr(char *name) if (*cp == ':') *cp++ = '\0'; addr = in_aton(name); - strcpy(name, cp); + memmove(name, cp, strlen(cp) + 1); } else addr = INADDR_NONE; @@ -1245,7 +1246,6 @@ u32 __init root_nfs_parse_addr(char *name) static int __init ip_auto_config(void) { - unsigned long jiff; u32 addr; #ifdef CONFIG_PROC_FS @@ -1260,18 +1260,14 @@ static int __init ip_auto_config(void) try_try_again: #endif /* Give hardware a chance to settle */ - jiff = jiffies + CONF_PRE_OPEN; - while (time_before(jiffies, jiff)) - cpu_relax(); + msleep(CONF_PRE_OPEN); /* Setup all network devices */ if (ic_open_devs() < 0) return -1; /* Give drivers a chance to settle */ - jiff = jiffies + CONF_POST_OPEN; - while (time_before(jiffies, jiff)) - cpu_relax(); + ssleep(CONF_POST_OPEN); /* * If the config information is insufficient (e.g., our IP address or