From 39a17aa65475b0115d824b99a6b4682cd4214af3 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 21 Sep 2017 12:25:08 +0200 Subject: eth-multiplexer: Simplify device creation. * eth-multiplexer/vdev.c (add_vdev): Remove class and bucket parameter. * eth-multiplexer/vdev.h (add_vdev): Likewise. * eth-multiplexer/device_impl.c (ds_device_open): Update callsite. --- eth-multiplexer/device_impl.c | 9 +-------- eth-multiplexer/vdev.c | 5 ++--- eth-multiplexer/vdev.h | 7 ++++--- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'eth-multiplexer') diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c index d7c8beeb..3be4fb5c 100644 --- a/eth-multiplexer/device_impl.c +++ b/eth-multiplexer/device_impl.c @@ -33,9 +33,6 @@ #include "netfs_impl.h" #include "util.h" -extern struct port_bucket *port_bucket; -extern struct port_class *vdev_portclass; -extern struct port_class *other_portclass; extern struct port_info *notify_pi; /* Implementation of device interface */ @@ -60,15 +57,11 @@ ds_device_open (mach_port_t master_port, mach_port_t reply_port, * create it now. */ if (pi->po->np->nn->ln == NULL) { - extern struct port_bucket *port_bucket; - extern struct port_class *vdev_portclass; extern struct stat underlying_node_stat; static int ino_count = 0; /* Create a new light node (virtual device). */ struct lnode *ln = (struct lnode *) add_vdev (pi->po->np->nn->name, - sizeof (*ln), - vdev_portclass, - port_bucket); + sizeof (*ln)); if (ln == NULL) { ports_port_deref (pi); diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c index d6a17fb3..7d5390b2 100644 --- a/eth-multiplexer/vdev.c +++ b/eth-multiplexer/vdev.c @@ -125,8 +125,7 @@ remove_dead_port_from_dev (mach_port_t dead_port) /* Add a new virtual interface to the multiplexer. */ struct vether_device * -add_vdev (char *name, int size, - struct port_class *class, struct port_bucket *bucket) +add_vdev (char *name, size_t size) { error_t err; uint32_t hash; @@ -134,7 +133,7 @@ add_vdev (char *name, int size, if (size < sizeof (*vdev)) size = sizeof (*vdev); - err = ports_create_port (class, bucket, size, &vdev); + err = ports_create_port (vdev_portclass, port_bucket, size, &vdev); if (err) return NULL; diff --git a/eth-multiplexer/vdev.h b/eth-multiplexer/vdev.h index 6affaca1..1b263aa0 100644 --- a/eth-multiplexer/vdev.h +++ b/eth-multiplexer/vdev.h @@ -33,6 +33,9 @@ #include "queue.h" #include "util.h" +struct port_bucket *port_bucket; +struct port_class *vdev_portclass; + #define MAX_SERVERS 10 #define ETH_MTU 1500 @@ -63,9 +66,7 @@ int serv_connect (mach_port_t port); int serv_disconnect (); struct vether_device *lookup_dev_by_name (char *name); int remove_dead_port_from_dev (mach_port_t dead_port); -struct vether_device *add_vdev (char *name, int size, - struct port_class *class, - struct port_bucket *bucket); +struct vether_device *add_vdev (char *name, size_t size); void destroy_vdev (void *port); int deliver_msg (struct net_rcv_msg *msg, struct vether_device *vdev); int deliver_pack (char *data, int datalen, struct vether_device *vdev); -- cgit v1.2.3