diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-09-28 10:29:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-09-28 10:29:17 +0000 |
commit | b9256054419582dc35917b1cb39c7e09f489dfad (patch) | |
tree | 2ce3a816b788b3af5fa54109b765ee22d5550c5e | |
parent | c3122bca53255799f052fcc0e911b68237faa12d (diff) | |
download | busybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.tar.gz busybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.tar.bz2 busybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.zip |
assorted static vars removal
function old new delta
tcpudpsvd_main 1829 1839 +10
update_status 567 569 +2
sigterm 1 - -1
.........
dhcprelay_signal_handler 8 - -8
nfs_strerror 60 49 -11
singlemount 4579 4564 -15
static.p 16 - -16
svstatus 20 - -20
dhcprelay_xid_list 32 - -32
runsv_main 1785 1746 -39
static.buf 74 28 -46
svd 56 - -56
dhcprelay_main 1141 1080 -61
------------------------------------------------------------------------------
(add/remove: 0/20 grow/shrink: 2/10 up/down: 12/-386) Total: -374 bytes
-rw-r--r-- | ipsvd/tcpudp.c | 25 | ||||
-rw-r--r-- | networking/udhcp/dhcprelay.c | 63 | ||||
-rw-r--r-- | runit/runsv.c | 31 | ||||
-rw-r--r-- | runit/sv.c | 22 | ||||
-rw-r--r-- | util-linux/mount.c | 77 |
5 files changed, 116 insertions, 102 deletions
diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c index 6a11539c7..537a5240f 100644 --- a/ipsvd/tcpudp.c +++ b/ipsvd/tcpudp.c | |||
@@ -40,11 +40,24 @@ | |||
40 | #include "ssl_io.h" | 40 | #include "ssl_io.h" |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | static unsigned verbose; | 43 | struct globals { |
44 | static unsigned max_per_host; | 44 | unsigned verbose; |
45 | static unsigned cur_per_host; | 45 | unsigned max_per_host; |
46 | static unsigned cnum; | 46 | unsigned cur_per_host; |
47 | static unsigned cmax = 30; | 47 | unsigned cnum; |
48 | unsigned cmax; | ||
49 | }; | ||
50 | #define G (*(struct globals*)&bb_common_bufsiz1) | ||
51 | #define verbose (G.verbose ) | ||
52 | #define max_per_host (G.max_per_host) | ||
53 | #define cur_per_host (G.cur_per_host) | ||
54 | #define cnum (G.cnum ) | ||
55 | #define cmax (G.cmax ) | ||
56 | #define INIT_G() \ | ||
57 | do { \ | ||
58 | cmax = 30; \ | ||
59 | } while (0) | ||
60 | |||
48 | 61 | ||
49 | static void xsetenv_proto(const char *proto, const char *n, const char *v) | 62 | static void xsetenv_proto(const char *proto, const char *n, const char *v) |
50 | { | 63 | { |
@@ -147,6 +160,8 @@ int tcpudpsvd_main(int argc, char **argv) | |||
147 | int conn; | 160 | int conn; |
148 | unsigned backlog = 20; | 161 | unsigned backlog = 20; |
149 | 162 | ||
163 | INIT_G(); | ||
164 | |||
150 | tcp = (applet_name[0] == 't'); | 165 | tcp = (applet_name[0] == 't'); |
151 | 166 | ||
152 | /* 3+ args, -i at most once, -p implies -h, -v is counter */ | 167 | /* 3+ args, -i at most once, -p implies -h, -v is counter */ |
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index 3e1758d5c..08dc23f23 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c | |||
@@ -19,16 +19,16 @@ | |||
19 | #define MAX_LIFETIME 2*60 /* lifetime of an xid entry in sec. */ | 19 | #define MAX_LIFETIME 2*60 /* lifetime of an xid entry in sec. */ |
20 | #define MAX_INTERFACES 9 | 20 | #define MAX_INTERFACES 9 |
21 | 21 | ||
22 | |||
23 | /* This list holds information about clients. The xid_* functions manipulate this list. */ | 22 | /* This list holds information about clients. The xid_* functions manipulate this list. */ |
24 | static struct xid_item { | 23 | struct xid_item { |
24 | time_t timestamp; | ||
25 | int client; | ||
25 | uint32_t xid; | 26 | uint32_t xid; |
26 | struct sockaddr_in ip; | 27 | struct sockaddr_in ip; |
27 | int client; | ||
28 | time_t timestamp; | ||
29 | struct xid_item *next; | 28 | struct xid_item *next; |
30 | } dhcprelay_xid_list = {0, {0}, 0, 0, NULL}; | 29 | }; |
31 | 30 | ||
31 | #define dhcprelay_xid_list (*(struct xid_item*)&bb_common_bufsiz1) | ||
32 | 32 | ||
33 | static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client) | 33 | static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client) |
34 | { | 34 | { |
@@ -114,17 +114,6 @@ static int get_dhcp_packet_type(struct dhcpMessage *p) | |||
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * signal_handler - handles signals ;-) | ||
118 | * sig - sent signal | ||
119 | */ | ||
120 | static smallint dhcprelay_stopflag; | ||
121 | |||
122 | static void dhcprelay_signal_handler(int sig) | ||
123 | { | ||
124 | dhcprelay_stopflag = 1; | ||
125 | } | ||
126 | |||
127 | /** | ||
128 | * get_client_devices - parses the devices list | 117 | * get_client_devices - parses the devices list |
129 | * dev_list - comma separated list of devices | 118 | * dev_list - comma separated list of devices |
130 | * returns array | 119 | * returns array |
@@ -160,27 +149,23 @@ static char **get_client_devices(char *dev_list, int *client_number) | |||
160 | } | 149 | } |
161 | 150 | ||
162 | 151 | ||
163 | /* Creates listen sockets (in fds) and returns the number allocated. */ | 152 | /* Creates listen sockets (in fds) and returns numerically max fd. */ |
164 | static int init_sockets(char **client, int num_clients, | 153 | static int init_sockets(char **client, int num_clients, |
165 | char *server, int *fds, int *max_socket) | 154 | char *server, int *fds) |
166 | { | 155 | { |
167 | int i; | 156 | int i, n; |
168 | 157 | ||
169 | /* talk to real server on bootps */ | 158 | /* talk to real server on bootps */ |
170 | fds[0] = listen_socket(/*INADDR_ANY,*/ 67, server); | 159 | fds[0] = listen_socket(/*INADDR_ANY,*/ 67, server); |
171 | *max_socket = fds[0]; | 160 | n = fds[0]; |
172 | |||
173 | /* array starts at 1 since server is 0 */ | ||
174 | num_clients++; | ||
175 | 161 | ||
176 | for (i = 1; i < num_clients; i++) { | 162 | for (i = 1; i < num_clients; i++) { |
177 | /* listen for clients on bootps */ | 163 | /* listen for clients on bootps */ |
178 | fds[i] = listen_socket(/*NADDR_ANY,*/ 67, client[i-1]); | 164 | fds[i] = listen_socket(/*NADDR_ANY,*/ 67, client[i-1]); |
179 | if (fds[i] > *max_socket) | 165 | if (fds[i] > n) |
180 | *max_socket = fds[i]; | 166 | n = fds[i]; |
181 | } | 167 | } |
182 | 168 | return n; | |
183 | return i; | ||
184 | } | 169 | } |
185 | 170 | ||
186 | 171 | ||
@@ -253,6 +238,8 @@ static void pass_back(struct dhcpMessage *p, int packet_len, int *fds) | |||
253 | } | 238 | } |
254 | 239 | ||
255 | static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **clients, | 240 | static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **clients, |
241 | struct sockaddr_in *server_addr, uint32_t gw_ip) ATTRIBUTE_NORETURN; | ||
242 | static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **clients, | ||
256 | struct sockaddr_in *server_addr, uint32_t gw_ip) | 243 | struct sockaddr_in *server_addr, uint32_t gw_ip) |
257 | { | 244 | { |
258 | struct dhcpMessage dhcp_msg; | 245 | struct dhcpMessage dhcp_msg; |
@@ -263,7 +250,7 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli | |||
263 | struct timeval tv; | 250 | struct timeval tv; |
264 | int i; | 251 | int i; |
265 | 252 | ||
266 | while (!dhcprelay_stopflag) { | 253 | while (1) { |
267 | FD_ZERO(&rfds); | 254 | FD_ZERO(&rfds); |
268 | for (i = 0; i < num_sockets; i++) | 255 | for (i = 0; i < num_sockets; i++) |
269 | FD_SET(fds[i], &rfds); | 256 | FD_SET(fds[i], &rfds); |
@@ -298,7 +285,7 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli | |||
298 | int dhcprelay_main(int argc, char **argv); | 285 | int dhcprelay_main(int argc, char **argv); |
299 | int dhcprelay_main(int argc, char **argv) | 286 | int dhcprelay_main(int argc, char **argv) |
300 | { | 287 | { |
301 | int i, num_sockets, max_socket, fds[MAX_INTERFACES]; | 288 | int num_sockets, max_socket, fds[MAX_INTERFACES]; |
302 | uint32_t gw_ip; | 289 | uint32_t gw_ip; |
303 | char **clients; | 290 | char **clients; |
304 | struct sockaddr_in server_addr; | 291 | struct sockaddr_in server_addr; |
@@ -316,23 +303,13 @@ int dhcprelay_main(int argc, char **argv) | |||
316 | clients = get_client_devices(argv[1], &num_sockets); | 303 | clients = get_client_devices(argv[1], &num_sockets); |
317 | if (!clients) return 0; | 304 | if (!clients) return 0; |
318 | 305 | ||
319 | signal(SIGTERM, dhcprelay_signal_handler); | 306 | num_sockets++; /* for server socket at fds[0] */ |
320 | signal(SIGQUIT, dhcprelay_signal_handler); | 307 | max_socket = init_sockets(clients, num_sockets, argv[2], fds); |
321 | signal(SIGINT, dhcprelay_signal_handler); | ||
322 | |||
323 | num_sockets = init_sockets(clients, num_sockets, argv[2], fds, &max_socket); | ||
324 | 308 | ||
325 | if (read_interface(argv[2], NULL, &gw_ip, NULL)) | 309 | if (read_interface(argv[2], NULL, &gw_ip, NULL)) |
326 | return 1; | 310 | return 1; |
327 | 311 | ||
312 | /* doesn't return */ | ||
328 | dhcprelay_loop(fds, num_sockets, max_socket, clients, &server_addr, gw_ip); | 313 | dhcprelay_loop(fds, num_sockets, max_socket, clients, &server_addr, gw_ip); |
329 | 314 | /* return 0; - not reached */ | |
330 | if (ENABLE_FEATURE_CLEAN_UP) { | ||
331 | for (i = 0; i < num_sockets; i++) { | ||
332 | close(fds[i]); | ||
333 | free(clients[i]); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | return 0; | ||
338 | } | 315 | } |
diff --git a/runit/runsv.c b/runit/runsv.c index b35c26630..1ee3dda01 100644 --- a/runit/runsv.c +++ b/runit/runsv.c | |||
@@ -61,8 +61,6 @@ static void gettimeofday_ns(struct timespec *ts) | |||
61 | /* Compare possibly overflowing unsigned counters */ | 61 | /* Compare possibly overflowing unsigned counters */ |
62 | #define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0) | 62 | #define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0) |
63 | 63 | ||
64 | static int selfpipe[2]; | ||
65 | |||
66 | /* state */ | 64 | /* state */ |
67 | #define S_DOWN 0 | 65 | #define S_DOWN 0 |
68 | #define S_RUN 1 | 66 | #define S_RUN 1 |
@@ -88,12 +86,27 @@ struct svdir { | |||
88 | int fdcontrolwrite; | 86 | int fdcontrolwrite; |
89 | }; | 87 | }; |
90 | 88 | ||
91 | static struct svdir svd[2]; | 89 | struct globals { |
92 | static smallint sigterm; | 90 | smallint haslog; |
93 | static smallint haslog; | 91 | smallint sigterm; |
94 | static smallint pidchanged = 1; | 92 | smallint pidchanged; |
95 | static int logpipe[2]; | 93 | int selfpipe[2]; |
96 | static char *dir; | 94 | int logpipe[2]; |
95 | char *dir; | ||
96 | struct svdir svd[2]; | ||
97 | }; | ||
98 | #define G (*(struct globals*)&bb_common_bufsiz1) | ||
99 | #define haslog (G.haslog ) | ||
100 | #define sigterm (G.sigterm ) | ||
101 | #define pidchanged (G.pidchanged ) | ||
102 | #define selfpipe (G.selfpipe ) | ||
103 | #define logpipe (G.logpipe ) | ||
104 | #define dir (G.dir ) | ||
105 | #define svd (G.svd ) | ||
106 | #define INIT_G() \ | ||
107 | do { \ | ||
108 | pidchanged = 1; \ | ||
109 | } while (0) | ||
97 | 110 | ||
98 | static void fatal2_cannot(const char *m1, const char *m2) | 111 | static void fatal2_cannot(const char *m1, const char *m2) |
99 | { | 112 | { |
@@ -434,6 +447,8 @@ int runsv_main(int argc, char **argv) | |||
434 | int r; | 447 | int r; |
435 | char buf[256]; | 448 | char buf[256]; |
436 | 449 | ||
450 | INIT_G(); | ||
451 | |||
437 | if (!argv[1] || argv[2]) | 452 | if (!argv[1] || argv[2]) |
438 | bb_show_usage(); | 453 | bb_show_usage(); |
439 | dir = argv[1]; | 454 | dir = argv[1]; |
diff --git a/runit/sv.c b/runit/sv.c index 7283bbf7d..757391a54 100644 --- a/runit/sv.c +++ b/runit/sv.c | |||
@@ -158,12 +158,22 @@ Exit Codes | |||
158 | #include "libbb.h" | 158 | #include "libbb.h" |
159 | #include "runit_lib.h" | 159 | #include "runit_lib.h" |
160 | 160 | ||
161 | static const char *acts; | 161 | struct globals { |
162 | static char **service; | 162 | const char *acts; |
163 | static unsigned rc; | 163 | char **service; |
164 | unsigned rc; | ||
164 | /* "Bernstein" time format: unix + 0x400000000000000aULL */ | 165 | /* "Bernstein" time format: unix + 0x400000000000000aULL */ |
165 | static uint64_t tstart, tnow; | 166 | uint64_t tstart, tnow; |
166 | static svstatus_t svstatus; | 167 | svstatus_t svstatus; |
168 | }; | ||
169 | #define G (*(struct globals*)&bb_common_bufsiz1) | ||
170 | #define acts (G.acts ) | ||
171 | #define service (G.service ) | ||
172 | #define rc (G.rc ) | ||
173 | #define tstart (G.tstart ) | ||
174 | #define tnow (G.tnow ) | ||
175 | #define svstatus (G.svstatus ) | ||
176 | #define INIT_G() do { } while (0) | ||
167 | 177 | ||
168 | 178 | ||
169 | static void fatal_cannot(const char *m1) ATTRIBUTE_NORETURN; | 179 | static void fatal_cannot(const char *m1) ATTRIBUTE_NORETURN; |
@@ -418,6 +428,8 @@ int sv_main(int argc, char **argv) | |||
418 | int (*cbk)(const char*); | 428 | int (*cbk)(const char*); |
419 | int curdir; | 429 | int curdir; |
420 | 430 | ||
431 | INIT_G(); | ||
432 | |||
421 | xfunc_error_retval = 100; | 433 | xfunc_error_retval = 100; |
422 | 434 | ||
423 | x = getenv("SVDIR"); | 435 | x = getenv("SVDIR"); |
diff --git a/util-linux/mount.c b/util-linux/mount.c index d391a26e1..ea3300176 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -66,10 +66,10 @@ enum { | |||
66 | /* Standard mount options (from -o options or --options), with corresponding | 66 | /* Standard mount options (from -o options or --options), with corresponding |
67 | * flags */ | 67 | * flags */ |
68 | 68 | ||
69 | struct { | 69 | static const struct { |
70 | const char *name; | 70 | const char *name; |
71 | long flags; | 71 | long flags; |
72 | } static mount_options[] = { | 72 | } mount_options[] = { |
73 | // MS_FLAGS set a bit. ~MS_FLAGS disable that bit. 0 flags are NOPs. | 73 | // MS_FLAGS set a bit. ~MS_FLAGS disable that bit. 0 flags are NOPs. |
74 | 74 | ||
75 | USE_FEATURE_MOUNT_LOOP( | 75 | USE_FEATURE_MOUNT_LOOP( |
@@ -231,7 +231,7 @@ static llist_t *get_block_backed_filesystems(void) | |||
231 | return list; | 231 | return list; |
232 | } | 232 | } |
233 | 233 | ||
234 | llist_t *fslist = 0; | 234 | static llist_t *fslist; |
235 | 235 | ||
236 | #if ENABLE_FEATURE_CLEAN_UP | 236 | #if ENABLE_FEATURE_CLEAN_UP |
237 | static void delete_block_backed_filesystems(void) | 237 | static void delete_block_backed_filesystems(void) |
@@ -562,14 +562,12 @@ static const struct { | |||
562 | static char *nfs_strerror(int status) | 562 | static char *nfs_strerror(int status) |
563 | { | 563 | { |
564 | int i; | 564 | int i; |
565 | static char buf[sizeof("unknown nfs status return value: ") + sizeof(int)*3]; | ||
566 | 565 | ||
567 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { | 566 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { |
568 | if (nfs_errtbl[i].stat == status) | 567 | if (nfs_errtbl[i].stat == status) |
569 | return strerror(nfs_errtbl[i].errnum); | 568 | return strerror(nfs_errtbl[i].errnum); |
570 | } | 569 | } |
571 | sprintf(buf, "unknown nfs status return value: %d", status); | 570 | return xasprintf("unknown nfs status return value: %d", status); |
572 | return buf; | ||
573 | } | 571 | } |
574 | 572 | ||
575 | static bool_t xdr_fhandle(XDR *xdrs, fhandle objp) | 573 | static bool_t xdr_fhandle(XDR *xdrs, fhandle objp) |
@@ -642,11 +640,7 @@ static bool_t xdr_mountres3(XDR *xdrs, mountres3 *objp) | |||
642 | 640 | ||
643 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) | 641 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) |
644 | 642 | ||
645 | /* | 643 | static smalluint nfs_mount_version; |
646 | * nfs_mount_version according to the sources seen at compile time. | ||
647 | */ | ||
648 | static int nfs_mount_version; | ||
649 | static int kernel_version; | ||
650 | 644 | ||
651 | /* | 645 | /* |
652 | * Unfortunately, the kernel prints annoying console messages | 646 | * Unfortunately, the kernel prints annoying console messages |
@@ -662,7 +656,9 @@ static int kernel_version; | |||
662 | static void | 656 | static void |
663 | find_kernel_nfs_mount_version(void) | 657 | find_kernel_nfs_mount_version(void) |
664 | { | 658 | { |
665 | if (kernel_version) | 659 | int kernel_version; |
660 | |||
661 | if (nfs_mount_version) | ||
666 | return; | 662 | return; |
667 | 663 | ||
668 | nfs_mount_version = 4; /* default */ | 664 | nfs_mount_version = 4; /* default */ |
@@ -679,15 +675,15 @@ find_kernel_nfs_mount_version(void) | |||
679 | } | 675 | } |
680 | } | 676 | } |
681 | 677 | ||
682 | static struct pmap * | 678 | static void |
683 | get_mountport(struct sockaddr_in *server_addr, | 679 | get_mountport(struct pmap *pm_mnt, |
680 | struct sockaddr_in *server_addr, | ||
684 | long unsigned prog, | 681 | long unsigned prog, |
685 | long unsigned version, | 682 | long unsigned version, |
686 | long unsigned proto, | 683 | long unsigned proto, |
687 | long unsigned port) | 684 | long unsigned port) |
688 | { | 685 | { |
689 | struct pmaplist *pmap; | 686 | struct pmaplist *pmap; |
690 | static struct pmap p = {0, 0, 0, 0}; | ||
691 | 687 | ||
692 | server_addr->sin_port = PMAPPORT; | 688 | server_addr->sin_port = PMAPPORT; |
693 | /* glibc 2.4 (still) has pmap_getmaps(struct sockaddr_in *). | 689 | /* glibc 2.4 (still) has pmap_getmaps(struct sockaddr_in *). |
@@ -698,35 +694,34 @@ get_mountport(struct sockaddr_in *server_addr, | |||
698 | version = MAX_NFSPROT; | 694 | version = MAX_NFSPROT; |
699 | if (!prog) | 695 | if (!prog) |
700 | prog = MOUNTPROG; | 696 | prog = MOUNTPROG; |
701 | p.pm_prog = prog; | 697 | pm_mnt->pm_prog = prog; |
702 | p.pm_vers = version; | 698 | pm_mnt->pm_vers = version; |
703 | p.pm_prot = proto; | 699 | pm_mnt->pm_prot = proto; |
704 | p.pm_port = port; | 700 | pm_mnt->pm_port = port; |
705 | 701 | ||
706 | while (pmap) { | 702 | while (pmap) { |
707 | if (pmap->pml_map.pm_prog != prog) | 703 | if (pmap->pml_map.pm_prog != prog) |
708 | goto next; | 704 | goto next; |
709 | if (!version && p.pm_vers > pmap->pml_map.pm_vers) | 705 | if (!version && pm_mnt->pm_vers > pmap->pml_map.pm_vers) |
710 | goto next; | 706 | goto next; |
711 | if (version > 2 && pmap->pml_map.pm_vers != version) | 707 | if (version > 2 && pmap->pml_map.pm_vers != version) |
712 | goto next; | 708 | goto next; |
713 | if (version && version <= 2 && pmap->pml_map.pm_vers > 2) | 709 | if (version && version <= 2 && pmap->pml_map.pm_vers > 2) |
714 | goto next; | 710 | goto next; |
715 | if (pmap->pml_map.pm_vers > MAX_NFSPROT || | 711 | if (pmap->pml_map.pm_vers > MAX_NFSPROT || |
716 | (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) || | 712 | (proto && pm_mnt->pm_prot && pmap->pml_map.pm_prot != proto) || |
717 | (port && pmap->pml_map.pm_port != port)) | 713 | (port && pmap->pml_map.pm_port != port)) |
718 | goto next; | 714 | goto next; |
719 | memcpy(&p, &pmap->pml_map, sizeof(p)); | 715 | memcpy(pm_mnt, &pmap->pml_map, sizeof(*pm_mnt)); |
720 | next: | 716 | next: |
721 | pmap = pmap->pml_next; | 717 | pmap = pmap->pml_next; |
722 | } | 718 | } |
723 | if (!p.pm_vers) | 719 | if (!pm_mnt->pm_vers) |
724 | p.pm_vers = MOUNTVERS; | 720 | pm_mnt->pm_vers = MOUNTVERS; |
725 | if (!p.pm_port) | 721 | if (!pm_mnt->pm_port) |
726 | p.pm_port = MOUNTPORT; | 722 | pm_mnt->pm_port = MOUNTPORT; |
727 | if (!p.pm_prot) | 723 | if (!pm_mnt->pm_prot) |
728 | p.pm_prot = IPPROTO_TCP; | 724 | pm_mnt->pm_prot = IPPROTO_TCP; |
729 | return &p; | ||
730 | } | 725 | } |
731 | 726 | ||
732 | #if BB_MMU | 727 | #if BB_MMU |
@@ -1147,7 +1142,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) | |||
1147 | { | 1142 | { |
1148 | struct timeval total_timeout; | 1143 | struct timeval total_timeout; |
1149 | struct timeval retry_timeout; | 1144 | struct timeval retry_timeout; |
1150 | struct pmap* pm_mnt; | 1145 | struct pmap pm_mnt; |
1151 | time_t t; | 1146 | time_t t; |
1152 | time_t prevt; | 1147 | time_t prevt; |
1153 | time_t timeout; | 1148 | time_t timeout; |
@@ -1164,32 +1159,32 @@ retry: | |||
1164 | if (t - prevt < 30) | 1159 | if (t - prevt < 30) |
1165 | sleep(30); | 1160 | sleep(30); |
1166 | 1161 | ||
1167 | pm_mnt = get_mountport(&mount_server_addr, | 1162 | get_mountport(&pm_mnt, &mount_server_addr, |
1168 | mountprog, | 1163 | mountprog, |
1169 | mountvers, | 1164 | mountvers, |
1170 | proto, | 1165 | proto, |
1171 | mountport); | 1166 | mountport); |
1172 | nfsvers = (pm_mnt->pm_vers < 2) ? 2 : pm_mnt->pm_vers; | 1167 | nfsvers = (pm_mnt.pm_vers < 2) ? 2 : pm_mnt.pm_vers; |
1173 | 1168 | ||
1174 | /* contact the mount daemon via TCP */ | 1169 | /* contact the mount daemon via TCP */ |
1175 | mount_server_addr.sin_port = htons(pm_mnt->pm_port); | 1170 | mount_server_addr.sin_port = htons(pm_mnt.pm_port); |
1176 | msock = RPC_ANYSOCK; | 1171 | msock = RPC_ANYSOCK; |
1177 | 1172 | ||
1178 | switch (pm_mnt->pm_prot) { | 1173 | switch (pm_mnt.pm_prot) { |
1179 | case IPPROTO_UDP: | 1174 | case IPPROTO_UDP: |
1180 | mclient = clntudp_create(&mount_server_addr, | 1175 | mclient = clntudp_create(&mount_server_addr, |
1181 | pm_mnt->pm_prog, | 1176 | pm_mnt.pm_prog, |
1182 | pm_mnt->pm_vers, | 1177 | pm_mnt.pm_vers, |
1183 | retry_timeout, | 1178 | retry_timeout, |
1184 | &msock); | 1179 | &msock); |
1185 | if (mclient) | 1180 | if (mclient) |
1186 | break; | 1181 | break; |
1187 | mount_server_addr.sin_port = htons(pm_mnt->pm_port); | 1182 | mount_server_addr.sin_port = htons(pm_mnt.pm_port); |
1188 | msock = RPC_ANYSOCK; | 1183 | msock = RPC_ANYSOCK; |
1189 | case IPPROTO_TCP: | 1184 | case IPPROTO_TCP: |
1190 | mclient = clnttcp_create(&mount_server_addr, | 1185 | mclient = clnttcp_create(&mount_server_addr, |
1191 | pm_mnt->pm_prog, | 1186 | pm_mnt.pm_prog, |
1192 | pm_mnt->pm_vers, | 1187 | pm_mnt.pm_vers, |
1193 | &msock, 0, 0); | 1188 | &msock, 0, 0); |
1194 | break; | 1189 | break; |
1195 | default: | 1190 | default: |
@@ -1208,7 +1203,7 @@ retry: | |||
1208 | */ | 1203 | */ |
1209 | memset(&status, 0, sizeof(status)); | 1204 | memset(&status, 0, sizeof(status)); |
1210 | 1205 | ||
1211 | if (pm_mnt->pm_vers == 3) | 1206 | if (pm_mnt.pm_vers == 3) |
1212 | clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT, | 1207 | clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT, |
1213 | (xdrproc_t) xdr_dirpath, | 1208 | (xdrproc_t) xdr_dirpath, |
1214 | (caddr_t) &pathname, | 1209 | (caddr_t) &pathname, |