4 #include <libubox/avl.h>
7 struct device_hotplug_ops;
9 typedef int (*device_state_cb)(struct device *, bool up);
14 void (*dump_status)(struct device *, struct blob_buf *buf);
15 int (*check_state)(struct device *);
16 void (*free)(struct device *);
20 * link layer device. typically represents a linux network device.
21 * can be used to support VLANs as well
24 const struct device_type *type;
27 struct list_head users;
29 char ifname[IFNAMSIZ + 1];
35 /* set interface up or down */
36 device_state_cb set_state;
38 const struct device_hotplug_ops *hotplug_ops;
41 /* events broadcasted to all users of a device */
56 * device dependency with callbacks
59 struct list_head list;
62 void (*cb)(struct device_user *, enum device_event);
65 struct device_hotplug_ops {
66 int (*add)(struct device *main, struct device *member);
67 int (*del)(struct device *main, struct device *member);
70 void init_virtual_device(struct device *dev, const struct device_type *type, const char *name);
71 int init_device(struct device *iface, const struct device_type *type, const char *ifname);
72 void cleanup_device(struct device *iface);
73 struct device *get_device(const char *name, bool create);
74 void add_device_user(struct device_user *dep, struct device *iface);
75 void remove_device_user(struct device_user *dep);
77 void set_device_present(struct device *dev, bool state);
78 int claim_device(struct device *dev);
79 void release_device(struct device *dev);
80 int check_device_state(struct device *dev);
82 struct device *get_vlan_device_chain(const char *ifname, bool create);