diff options
author | Arne Kappen <akappen@inet.tu-berlin.de> | 2016-08-18 11:35:28 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-08-26 10:38:46 +0200 |
commit | f56a7fbaa6f155c654e7d01b5c4c0594f21239d6 (patch) | |
tree | 08e2b400aa2d70cf9655274c5f7885623acdcf40 /device.h | |
parent | 61e5fa84eca4176bc5b4f9769a5af79d85cf11c6 (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 'device.h')
-rw-r--r-- | device.h | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -64,7 +64,8 @@ struct device_type { const struct uci_blob_param_list *config_params; - struct device *(*create)(const char *name, struct blob_attr *attr); + struct device *(*create)(const char *name, struct device_type *devtype, + struct blob_attr *attr); void (*config_init)(struct device *); enum dev_change_type (*reload)(struct device *, struct blob_attr *); void (*dump_info)(struct device *, struct blob_buf *buf); @@ -166,7 +167,7 @@ struct device_settings { * can be used to support VLANs as well */ struct device { - const struct device_type *type; + struct device_type *type; struct avl_node avl; struct safe_list users; @@ -217,30 +218,30 @@ struct device_hotplug_ops { }; extern const struct uci_blob_param_list device_attr_list; -extern const struct device_type simple_device_type; -extern const struct device_type bridge_device_type; -extern const struct device_type tunnel_device_type; -extern const struct device_type macvlan_device_type; -extern const struct device_type vlandev_device_type; +extern struct device_type simple_device_type; +extern struct device_type bridge_device_type; +extern struct device_type tunnel_device_type; +extern struct device_type macvlan_device_type; +extern struct device_type vlandev_device_type; void device_lock(void); void device_unlock(void); -struct device *device_create(const char *name, const struct device_type *type, +struct device *device_create(const char *name, struct device_type *type, struct blob_attr *config); void device_init_settings(struct device *dev, struct blob_attr **tb); void device_init_pending(void); enum dev_change_type -device_apply_config(struct device *dev, const struct device_type *type, +device_apply_config(struct device *dev, struct device_type *type, struct blob_attr *config); void device_reset_config(void); void device_reset_old(void); void device_set_default_ps(bool state); -void device_init_virtual(struct device *dev, const struct device_type *type, const char *name); -int device_init(struct device *iface, const struct device_type *type, const char *ifname); +void device_init_virtual(struct device *dev, struct device_type *type, const char *name); +int device_init(struct device *iface, struct device_type *type, const char *ifname); void device_cleanup(struct device *dev); struct device *device_find(const char *name); struct device *device_get(const char *name, int create); |