Changeset View
Changeset View
Standalone View
Standalone View
stand/common/dev_net.c
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
int debug = 0; | int debug = 0; | ||||
#endif | #endif | ||||
static char *netdev_name; | static char *netdev_name; | ||||
static int netdev_sock = -1; | static int netdev_sock = -1; | ||||
static int netdev_opens; | static int netdev_opens; | ||||
static int net_init(void); | static int net_init(void); | ||||
static int net_open(struct open_file *, ...); | static int net_open(struct open_file *); | ||||
static int net_close(struct open_file *); | static int net_close(struct open_file *); | ||||
static void net_cleanup(void); | static void net_cleanup(void); | ||||
static int net_strategy(void *, int, daddr_t, size_t, char *, size_t *); | static int net_strategy(void *, int, daddr_t, size_t, char *, size_t *); | ||||
static int net_print(int); | static int net_print(int); | ||||
static int net_getparams(int sock); | static int net_getparams(int sock); | ||||
struct devsw netdev = { | struct devsw netdev = { | ||||
Show All 21 Lines | |||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Called by devopen after it sets f->f_dev to our devsw entry. | * Called by devopen after it sets f->f_dev to our devsw entry. | ||||
* This opens the low-level device and sets dev->d_opendata. | * This opens the low-level device and sets dev->d_opendata. | ||||
* This is declared with variable arguments... | |||||
*/ | */ | ||||
static int | static int | ||||
net_open(struct open_file *f, ...) | net_open(struct open_file *f) | ||||
tsoome: f is unused | |||||
{ | { | ||||
struct iodesc *d; | |||||
va_list args; | |||||
struct devdesc *dev; | struct devdesc *dev; | ||||
struct iodesc *d; | |||||
impUnsubmitted Not Done Inline Actionsmight be better to have this first so the variables are in alphabetical order... But this is also super-duper picky and likely doesn't matter if you don't want to change it. imp: might be better to have this first so the variables are in alphabetical order... But this is… | |||||
const char *devname; /* Device part of file name (or NULL). */ | const char *devname; /* Device part of file name (or NULL). */ | ||||
int error = 0; | int error = 0; | ||||
va_start(args, f); | dev = f->f_devdata; | ||||
dev = va_arg(args, struct devdesc *); | |||||
va_end(args); | |||||
devname = dev->d_dev->dv_name; | devname = dev->d_dev->dv_name; | ||||
/* Before opening another interface, close the previous one first. */ | /* Before opening another interface, close the previous one first. */ | ||||
if (netdev_sock >= 0 && strcmp(devname, netdev_name) != 0) | if (netdev_sock >= 0 && strcmp(devname, netdev_name) != 0) | ||||
net_cleanup(); | net_cleanup(); | ||||
/* On first open, do netif open, mount, etc. */ | /* On first open, do netif open, mount, etc. */ | ||||
if (netdev_opens == 0) { | if (netdev_opens == 0) { | ||||
/* Find network interface. */ | /* Find network interface. */ | ||||
▲ Show 20 Lines • Show All 301 Lines • Show Last 20 Lines |
f is unused