/* * Called by devopen after it sets f->f_dev to our devsw entry. * This opens the low-level device and sets f->f_devdata. */ int net_open(struct of_dev *op) { int error = 0; /* * On first open, do netif open, mount, etc. */ if (open_count == 0) { /* Find network interface. */ if ((netdev_sock = netif_open(op)) < 0) { error = errno; goto bad; } if ((error = net_mountroot()) != 0) goto bad; } open_count++; bad: if (netdev_sock >= 0 && open_count == 0) { netif_close(netdev_sock); netdev_sock = -1; } return error; }
/* * Called by devopen after it sets f->f_dev to our devsw entry. * This opens the low-level device and sets f->f_devdata. */ int net_open(struct open_file *f, char *devname) { int error = 0; /* On first open, do netif open, mount, etc. */ if (open_count == 0) { /* Find network interface. */ if ((netdev_sock = netif_open(devname)) < 0) return (error=ENXIO); if ((error = net_mountroot(f, devname)) != 0) return (error); } open_count++; f->f_devdata = nfs_root_node; return (error); }
/* * Called by devopen after it sets f->f_dev to our devsw entry. * This opens the low-level device and sets f->f_devdata. */ int net_open(struct promdata *pd) { int error = 0; /* On first open, do netif open, mount, etc. */ if (open_count == 0) { /* Find network interface. */ if ((netdev_sock = netif_open(pd)) < 0) { error = errno; goto bad; } if ((error = net_mountroot()) != 0) goto bad; } open_count++; bad: return (error); }