X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=device.h;h=338138f42803411ea0e884b6c454c9e8f10cf6a0;hp=a3728f3bc1cb38ea4d6706bc64b45a633e9b7816;hb=9393ff39a8be91ad90d1392cc4e093aa859c5005;hpb=10741b4974b85c825036eb0717ddc7112f96f5fb diff --git a/device.h b/device.h index a3728f3..338138f 100644 --- a/device.h +++ b/device.h @@ -16,6 +16,7 @@ enum { DEV_ATTR_MTU, DEV_ATTR_MACADDR, DEV_ATTR_TXQUEUELEN, + DEV_ATTR_ENABLED, __DEV_ATTR_MAX, }; @@ -88,9 +89,11 @@ struct device { struct blob_attr *config; bool config_pending; + bool sys_present; bool present; int active; bool external; + bool disabled; bool current_config; bool default_config; @@ -111,6 +114,7 @@ struct device { }; struct device_hotplug_ops { + int (*prepare)(struct device *dev); int (*add)(struct device *main, struct device *member); int (*del)(struct device *main, struct device *member); }; @@ -142,17 +146,13 @@ void device_add_user(struct device_user *dep, struct device *iface); void device_remove_user(struct device_user *dep); void device_set_present(struct device *dev, bool state); +void device_set_disabled(struct device *dev, bool value); int device_claim(struct device_user *dep); void device_release(struct device_user *dep); int device_check_state(struct device *dev); void device_dump_status(struct blob_buf *b, struct device *dev); -static inline void -device_free(struct device *dev) -{ - dev->type->free(dev); -} - +void device_free(struct device *dev); void device_free_unused(struct device *dev); struct device *get_vlan_device_chain(const char *ifname, bool create);