summaryrefslogtreecommitdiffhomepage
path: root/tunnel.c
diff options
context:
space:
mode:
authorArne Kappen <akappen@inet.tu-berlin.de>2016-08-18 11:35:28 +0200
committerFelix Fietkau <nbd@nbd.name>2016-08-26 10:38:46 +0200
commitf56a7fbaa6f155c654e7d01b5c4c0594f21239d6 (patch)
tree08e2b400aa2d70cf9655274c5f7885623acdcf40 /tunnel.c
parent61e5fa84eca4176bc5b4f9769a5af79d85cf11c6 (diff)
device: prepare for adding device handlers dynamically
- remove const from device handler struct - pass device handler type to create function Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
Diffstat (limited to 'tunnel.c')
-rw-r--r--tunnel.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tunnel.c b/tunnel.c
index 4a6c409..ec622d8 100644
--- a/tunnel.c
+++ b/tunnel.c
@@ -61,7 +61,8 @@ tunnel_reload(struct device *dev, struct blob_attr *attr)
}
static struct device *
-tunnel_create(const char *name, struct blob_attr *attr)
+tunnel_create(const char *name, struct device_type *devtype,
+ struct blob_attr *attr)
{
struct tunnel *tun;
struct device *dev;
@@ -71,10 +72,10 @@ tunnel_create(const char *name, struct blob_attr *attr)
return NULL;
dev = &tun->dev;
- device_init(dev, &tunnel_device_type, name);
+ device_init(dev, devtype, name);
tun->set_state = dev->set_state;
dev->set_state = tunnel_set_state;
- device_apply_config(dev, &tunnel_device_type, attr);
+ device_apply_config(dev, devtype, attr);
device_set_present(dev, true);
return dev;
@@ -88,7 +89,7 @@ tunnel_free(struct device *dev)
free(tun);
}
-const struct device_type tunnel_device_type = {
+struct device_type tunnel_device_type = {
.name = "IP tunnel",
.config_params = &tunnel_attr_list,
.reload = tunnel_reload,