diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kernfs.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 321ed84ad4ce..d2c439db4efa 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -111,12 +111,27 @@ struct kernfs_node { | |||
| 111 | struct kernfs_iattrs *iattr; | 111 | struct kernfs_iattrs *iattr; |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | /* | ||
| 115 | * kernfs_dir_ops may be specified on kernfs_create_root() to support | ||
| 116 | * directory manipulation syscalls. These optional callbacks are invoked | ||
| 117 | * on the matching syscalls and can perform any kernfs operations which | ||
| 118 | * don't necessarily have to be the exact operation requested. | ||
| 119 | */ | ||
| 120 | struct kernfs_dir_ops { | ||
| 121 | int (*mkdir)(struct kernfs_node *parent, const char *name, | ||
| 122 | umode_t mode); | ||
| 123 | int (*rmdir)(struct kernfs_node *kn); | ||
| 124 | int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent, | ||
| 125 | const char *new_name); | ||
| 126 | }; | ||
| 127 | |||
| 114 | struct kernfs_root { | 128 | struct kernfs_root { |
| 115 | /* published fields */ | 129 | /* published fields */ |
| 116 | struct kernfs_node *kn; | 130 | struct kernfs_node *kn; |
| 117 | 131 | ||
| 118 | /* private fields, do not use outside kernfs proper */ | 132 | /* private fields, do not use outside kernfs proper */ |
| 119 | struct ida ino_ida; | 133 | struct ida ino_ida; |
| 134 | struct kernfs_dir_ops *dir_ops; | ||
| 120 | }; | 135 | }; |
| 121 | 136 | ||
| 122 | struct kernfs_open_file { | 137 | struct kernfs_open_file { |
| @@ -206,7 +221,8 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, | |||
| 206 | void kernfs_get(struct kernfs_node *kn); | 221 | void kernfs_get(struct kernfs_node *kn); |
| 207 | void kernfs_put(struct kernfs_node *kn); | 222 | void kernfs_put(struct kernfs_node *kn); |
| 208 | 223 | ||
| 209 | struct kernfs_root *kernfs_create_root(void *priv); | 224 | struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, |
| 225 | void *priv); | ||
| 210 | void kernfs_destroy_root(struct kernfs_root *root); | 226 | void kernfs_destroy_root(struct kernfs_root *root); |
| 211 | 227 | ||
| 212 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, | 228 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, |
| @@ -255,7 +271,8 @@ kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, | |||
| 255 | static inline void kernfs_get(struct kernfs_node *kn) { } | 271 | static inline void kernfs_get(struct kernfs_node *kn) { } |
| 256 | static inline void kernfs_put(struct kernfs_node *kn) { } | 272 | static inline void kernfs_put(struct kernfs_node *kn) { } |
| 257 | 273 | ||
| 258 | static inline struct kernfs_root *kernfs_create_root(void *priv) | 274 | static inline struct kernfs_root * |
| 275 | kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv) | ||
| 259 | { return ERR_PTR(-ENOSYS); } | 276 | { return ERR_PTR(-ENOSYS); } |
| 260 | 277 | ||
| 261 | static inline void kernfs_destroy_root(struct kernfs_root *root) { } | 278 | static inline void kernfs_destroy_root(struct kernfs_root *root) { } |
