dev_net.c (308719) | dev_net.c (328889) |
---|---|
1/* $NetBSD: dev_net.c,v 1.23 2008/04/28 20:24:06 martin Exp $ */ 2 3/*- 4 * Copyright (c) 1997 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Gordon W. Ross. --- 16 unchanged lines hidden (view full) --- 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/* $NetBSD: dev_net.c,v 1.23 2008/04/28 20:24:06 martin Exp $ */ 2 3/*- 4 * Copyright (c) 1997 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Gordon W. Ross. --- 16 unchanged lines hidden (view full) --- 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: stable/11/sys/boot/common/dev_net.c 308719 2016-11-16 07:01:52Z bapt $"); | 33__FBSDID("$FreeBSD: stable/11/sys/boot/common/dev_net.c 328889 2018-02-05 17:01:18Z kevans $"); |
34 35/*- 36 * This module implements a "raw device" interface suitable for 37 * use by the stand-alone I/O library NFS code. This interface 38 * does not support any "block" access, and exists only for the 39 * purpose of initializing the network interface, getting boot 40 * parameters, and performing the NFS mount. 41 * --- 33 unchanged lines hidden (view full) --- 75static int netdev_sock = -1; 76static int netdev_opens; 77 78static int net_init(void); 79static int net_open(struct open_file *, ...); 80static int net_close(struct open_file *); 81static void net_cleanup(void); 82static int net_strategy(); | 34 35/*- 36 * This module implements a "raw device" interface suitable for 37 * use by the stand-alone I/O library NFS code. This interface 38 * does not support any "block" access, and exists only for the 39 * purpose of initializing the network interface, getting boot 40 * parameters, and performing the NFS mount. 41 * --- 33 unchanged lines hidden (view full) --- 75static int netdev_sock = -1; 76static int netdev_opens; 77 78static int net_init(void); 79static int net_open(struct open_file *, ...); 80static int net_close(struct open_file *); 81static void net_cleanup(void); 82static int net_strategy(); |
83static void net_print(int); | 83static int net_print(int); |
84 85static int net_getparams(int sock); 86 87struct devsw netdev = { 88 "net", 89 DEVT_NET, 90 net_init, 91 net_strategy, --- 228 unchanged lines hidden (view full) --- 320 printf("net_open: server addr: %s\n", inet_ntoa(rootip)); 321 printf("net_open: server path: %s\n", rootpath); 322 } 323#endif 324 325 return (0); 326} 327 | 84 85static int net_getparams(int sock); 86 87struct devsw netdev = { 88 "net", 89 DEVT_NET, 90 net_init, 91 net_strategy, --- 228 unchanged lines hidden (view full) --- 320 printf("net_open: server addr: %s\n", inet_ntoa(rootip)); 321 printf("net_open: server path: %s\n", rootpath); 322 } 323#endif 324 325 return (0); 326} 327 |
328static void | 328static int |
329net_print(int verbose) 330{ 331 struct netif_driver *drv; 332 int i, d, cnt; | 329net_print(int verbose) 330{ 331 struct netif_driver *drv; 332 int i, d, cnt; |
333 int ret = 0; |
|
333 | 334 |
335 if (netif_drivers[0] == NULL) 336 return (ret); 337 338 printf("%s devices:", netdev.dv_name); 339 if ((ret = pager_output("\n")) != 0) 340 return (ret); 341 |
|
334 cnt = 0; 335 for (d = 0; netif_drivers[d]; d++) { 336 drv = netif_drivers[d]; 337 for (i = 0; i < drv->netif_nifs; i++) { | 342 cnt = 0; 343 for (d = 0; netif_drivers[d]; d++) { 344 drv = netif_drivers[d]; 345 for (i = 0; i < drv->netif_nifs; i++) { |
338 printf("\t%s%d:", "net", cnt++); 339 if (verbose) | 346 printf("\t%s%d:", netdev.dv_name, cnt++); 347 if (verbose) { |
340 printf(" (%s%d)", drv->netif_bname, 341 drv->netif_ifs[i].dif_unit); | 348 printf(" (%s%d)", drv->netif_bname, 349 drv->netif_ifs[i].dif_unit); |
350 } 351 if ((ret = pager_output("\n")) != 0) 352 return (ret); |
|
342 } 343 } | 353 } 354 } |
344 printf("\n"); | 355 return (ret); |
345} 346 347/* 348 * Strip the server's address off of the rootpath if present and return it in 349 * network byte order, leaving just the pathname part in the global rootpath. 350 */ 351uint32_t 352net_parse_rootpath() --- 22 unchanged lines hidden --- | 356} 357 358/* 359 * Strip the server's address off of the rootpath if present and return it in 360 * network byte order, leaving just the pathname part in the global rootpath. 361 */ 362uint32_t 363net_parse_rootpath() --- 22 unchanged lines hidden --- |