diff options
Diffstat (limited to 'include/linux/kernfs.h')
| -rw-r--r-- | include/linux/kernfs.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index ab25c8b6d9e3..814643f7ee52 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/lockdep.h> | 15 | #include <linux/lockdep.h> |
| 16 | #include <linux/rbtree.h> | 16 | #include <linux/rbtree.h> |
| 17 | #include <linux/atomic.h> | 17 | #include <linux/atomic.h> |
| 18 | #include <linux/uidgid.h> | ||
| 18 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
| 19 | 20 | ||
| 20 | struct file; | 21 | struct file; |
| @@ -325,12 +326,14 @@ void kernfs_destroy_root(struct kernfs_root *root); | |||
| 325 | 326 | ||
| 326 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, | 327 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, |
| 327 | const char *name, umode_t mode, | 328 | const char *name, umode_t mode, |
| 329 | kuid_t uid, kgid_t gid, | ||
| 328 | void *priv, const void *ns); | 330 | void *priv, const void *ns); |
| 329 | struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, | 331 | struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, |
| 330 | const char *name); | 332 | const char *name); |
| 331 | struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, | 333 | struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, |
| 332 | const char *name, | 334 | const char *name, umode_t mode, |
| 333 | umode_t mode, loff_t size, | 335 | kuid_t uid, kgid_t gid, |
| 336 | loff_t size, | ||
| 334 | const struct kernfs_ops *ops, | 337 | const struct kernfs_ops *ops, |
| 335 | void *priv, const void *ns, | 338 | void *priv, const void *ns, |
| 336 | struct lock_class_key *key); | 339 | struct lock_class_key *key); |
| @@ -415,12 +418,14 @@ static inline void kernfs_destroy_root(struct kernfs_root *root) { } | |||
| 415 | 418 | ||
| 416 | static inline struct kernfs_node * | 419 | static inline struct kernfs_node * |
| 417 | kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, | 420 | kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, |
| 418 | umode_t mode, void *priv, const void *ns) | 421 | umode_t mode, kuid_t uid, kgid_t gid, |
| 422 | void *priv, const void *ns) | ||
| 419 | { return ERR_PTR(-ENOSYS); } | 423 | { return ERR_PTR(-ENOSYS); } |
| 420 | 424 | ||
| 421 | static inline struct kernfs_node * | 425 | static inline struct kernfs_node * |
| 422 | __kernfs_create_file(struct kernfs_node *parent, const char *name, | 426 | __kernfs_create_file(struct kernfs_node *parent, const char *name, |
| 423 | umode_t mode, loff_t size, const struct kernfs_ops *ops, | 427 | umode_t mode, kuid_t uid, kgid_t gid, |
| 428 | loff_t size, const struct kernfs_ops *ops, | ||
| 424 | void *priv, const void *ns, struct lock_class_key *key) | 429 | void *priv, const void *ns, struct lock_class_key *key) |
| 425 | { return ERR_PTR(-ENOSYS); } | 430 | { return ERR_PTR(-ENOSYS); } |
| 426 | 431 | ||
| @@ -498,12 +503,15 @@ static inline struct kernfs_node * | |||
| 498 | kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, | 503 | kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, |
| 499 | void *priv) | 504 | void *priv) |
| 500 | { | 505 | { |
| 501 | return kernfs_create_dir_ns(parent, name, mode, priv, NULL); | 506 | return kernfs_create_dir_ns(parent, name, mode, |
| 507 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, | ||
| 508 | priv, NULL); | ||
| 502 | } | 509 | } |
| 503 | 510 | ||
| 504 | static inline struct kernfs_node * | 511 | static inline struct kernfs_node * |
| 505 | kernfs_create_file_ns(struct kernfs_node *parent, const char *name, | 512 | kernfs_create_file_ns(struct kernfs_node *parent, const char *name, |
| 506 | umode_t mode, loff_t size, const struct kernfs_ops *ops, | 513 | umode_t mode, kuid_t uid, kgid_t gid, |
| 514 | loff_t size, const struct kernfs_ops *ops, | ||
| 507 | void *priv, const void *ns) | 515 | void *priv, const void *ns) |
| 508 | { | 516 | { |
| 509 | struct lock_class_key *key = NULL; | 517 | struct lock_class_key *key = NULL; |
| @@ -511,15 +519,17 @@ kernfs_create_file_ns(struct kernfs_node *parent, const char *name, | |||
| 511 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 519 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 512 | key = (struct lock_class_key *)&ops->lockdep_key; | 520 | key = (struct lock_class_key *)&ops->lockdep_key; |
| 513 | #endif | 521 | #endif |
| 514 | return __kernfs_create_file(parent, name, mode, size, ops, priv, ns, | 522 | return __kernfs_create_file(parent, name, mode, uid, gid, |
| 515 | key); | 523 | size, ops, priv, ns, key); |
| 516 | } | 524 | } |
| 517 | 525 | ||
| 518 | static inline struct kernfs_node * | 526 | static inline struct kernfs_node * |
| 519 | kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, | 527 | kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, |
| 520 | loff_t size, const struct kernfs_ops *ops, void *priv) | 528 | loff_t size, const struct kernfs_ops *ops, void *priv) |
| 521 | { | 529 | { |
| 522 | return kernfs_create_file_ns(parent, name, mode, size, ops, priv, NULL); | 530 | return kernfs_create_file_ns(parent, name, mode, |
| 531 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, | ||
| 532 | size, ops, priv, NULL); | ||
| 523 | } | 533 | } |
| 524 | 534 | ||
| 525 | static inline int kernfs_remove_by_name(struct kernfs_node *parent, | 535 | static inline int kernfs_remove_by_name(struct kernfs_node *parent, |
