]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/sysfs.h
sysfs: clean up sysfs_get_dirent()
[karo-tx-linux.git] / include / linux / sysfs.h
index 11baec7c9b26dd4bfeb19ee4447c11cdda737a3c..6695040a031713ee257130e7295be38cc6aff293 100644 (file)
@@ -173,7 +173,6 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
 struct sysfs_ops {
        ssize_t (*show)(struct kobject *, struct attribute *, char *);
        ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
-       const void *(*namespace)(struct kobject *, const struct attribute *);
 };
 
 struct sysfs_dirent;
@@ -183,19 +182,23 @@ struct sysfs_dirent;
 int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
                            void *data, struct module *owner);
 
-int __must_check sysfs_create_dir(struct kobject *kobj);
+int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
 void sysfs_remove_dir(struct kobject *kobj);
-int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name);
-int __must_check sysfs_move_dir(struct kobject *kobj,
-                               struct kobject *new_parent_kobj);
-
-int __must_check sysfs_create_file(struct kobject *kobj,
-                                  const struct attribute *attr);
+int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
+                                    const void *new_ns);
+int __must_check sysfs_move_dir_ns(struct kobject *kobj,
+                                  struct kobject *new_parent_kobj,
+                                  const void *new_ns);
+
+int __must_check sysfs_create_file_ns(struct kobject *kobj,
+                                     const struct attribute *attr,
+                                     const void *ns);
 int __must_check sysfs_create_files(struct kobject *kobj,
                                   const struct attribute **attr);
 int __must_check sysfs_chmod_file(struct kobject *kobj,
                                  const struct attribute *attr, umode_t mode);
-void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
+void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
+                         const void *ns);
 void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
 
 int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -210,8 +213,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
                                          const char *name);
 void sysfs_remove_link(struct kobject *kobj, const char *name);
 
-int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
-                       const char *old_name, const char *new_name);
+int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
+                        const char *old_name, const char *new_name,
+                        const void *new_ns);
 
 void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
                        const char *name);
@@ -241,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
 
 void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
 void sysfs_notify_dirent(struct sysfs_dirent *sd);
-struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
-                                     const void *ns,
-                                     const unsigned char *name);
+struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
+                                        const unsigned char *name,
+                                        const void *ns);
 struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
 void sysfs_put(struct sysfs_dirent *sd);
 
@@ -257,7 +261,7 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
        return -ENOSYS;
 }
 
-static inline int sysfs_create_dir(struct kobject *kobj)
+static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
 {
        return 0;
 }
@@ -266,19 +270,22 @@ static inline void sysfs_remove_dir(struct kobject *kobj)
 {
 }
 
-static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
+static inline int sysfs_rename_dir_ns(struct kobject *kobj,
+                                     const char *new_name, const void *new_ns)
 {
        return 0;
 }
 
-static inline int sysfs_move_dir(struct kobject *kobj,
-                                struct kobject *new_parent_kobj)
+static inline int sysfs_move_dir_ns(struct kobject *kobj,
+                                   struct kobject *new_parent_kobj,
+                                   const void *new_ns)
 {
        return 0;
 }
 
-static inline int sysfs_create_file(struct kobject *kobj,
-                                   const struct attribute *attr)
+static inline int sysfs_create_file_ns(struct kobject *kobj,
+                                      const struct attribute *attr,
+                                      const void *ns)
 {
        return 0;
 }
@@ -295,8 +302,9 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
        return 0;
 }
 
-static inline void sysfs_remove_file(struct kobject *kobj,
-                                    const struct attribute *attr)
+static inline void sysfs_remove_file_ns(struct kobject *kobj,
+                                       const struct attribute *attr,
+                                       const void *ns)
 {
 }
 
@@ -333,8 +341,9 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
 {
 }
 
-static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
-                                   const char *old_name, const char *new_name)
+static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t,
+                                      const char *old_name,
+                                      const char *new_name, const void *ns)
 {
        return 0;
 }
@@ -413,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
 static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
 {
 }
-static inline
-struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
-                                     const void *ns,
-                                     const unsigned char *name)
+static inline struct sysfs_dirent *
+sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
+                   const void *ns)
 {
        return NULL;
 }
@@ -435,4 +443,28 @@ static inline int __must_check sysfs_init(void)
 
 #endif /* CONFIG_SYSFS */
 
+static inline int __must_check sysfs_create_file(struct kobject *kobj,
+                                                const struct attribute *attr)
+{
+       return sysfs_create_file_ns(kobj, attr, NULL);
+}
+
+static inline void sysfs_remove_file(struct kobject *kobj,
+                                    const struct attribute *attr)
+{
+       return sysfs_remove_file_ns(kobj, attr, NULL);
+}
+
+static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
+                                   const char *old_name, const char *new_name)
+{
+       return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
+}
+
+static inline struct sysfs_dirent *
+sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
+{
+       return sysfs_get_dirent_ns(parent_sd, name, NULL);
+}
+
 #endif /* _SYSFS_H_ */