Merge citrix into master.
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / linux / kobject.h
index c0de3d2..4cf797e 100644 (file)
@@ -4,6 +4,7 @@
 #include_next <linux/kobject.h>
 
 #include <linux/version.h>
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
 #define kobject_init(kobj, ktype) rpl_kobject_init(kobj, ktype)
 static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktype)
@@ -11,6 +12,19 @@ static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktyp
        kobj->ktype = ktype;
        (kobject_init)(kobj);
 }
+
+#define kobject_add(kobj, parent, name) rpl_kobject_add(kobj, parent, name)
+static inline int rpl_kobject_add(struct kobject *kobj,
+                                 struct kobject *parent,
+                                 const char *name)
+{
+       int err = kobject_set_name(kobj, "%s", name);
+       if (err)
+               return err;
+       kobj->parent = parent;
+       return (kobject_add)(kobj);
+}
 #endif
 
+
 #endif /* linux/kobject.h wrapper */