|
15 | 15 | #include <linux/lockdep.h> |
16 | 16 | #include <linux/rbtree.h> |
17 | 17 | #include <linux/atomic.h> |
| 18 | +#include <linux/uidgid.h> |
18 | 19 | #include <linux/wait.h> |
19 | 20 |
|
20 | 21 | struct file; |
@@ -325,12 +326,14 @@ void kernfs_destroy_root(struct kernfs_root *root); |
325 | 326 |
|
326 | 327 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, |
327 | 328 | const char *name, umode_t mode, |
| 329 | + kuid_t uid, kgid_t gid, |
328 | 330 | void *priv, const void *ns); |
329 | 331 | struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, |
330 | 332 | const char *name); |
331 | 333 | struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, |
332 | | - const char *name, |
333 | | - umode_t mode, loff_t size, |
| 334 | + const char *name, umode_t mode, |
| 335 | + kuid_t uid, kgid_t gid, |
| 336 | + loff_t size, |
334 | 337 | const struct kernfs_ops *ops, |
335 | 338 | void *priv, const void *ns, |
336 | 339 | struct lock_class_key *key); |
@@ -415,12 +418,14 @@ static inline void kernfs_destroy_root(struct kernfs_root *root) { } |
415 | 418 |
|
416 | 419 | static inline struct kernfs_node * |
417 | 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 | 423 | { return ERR_PTR(-ENOSYS); } |
420 | 424 |
|
421 | 425 | static inline struct kernfs_node * |
422 | 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 | 429 | void *priv, const void *ns, struct lock_class_key *key) |
425 | 430 | { return ERR_PTR(-ENOSYS); } |
426 | 431 |
|
@@ -498,28 +503,33 @@ static inline struct kernfs_node * |
498 | 503 | kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, |
499 | 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 | 511 | static inline struct kernfs_node * |
505 | 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 | 515 | void *priv, const void *ns) |
508 | 516 | { |
509 | 517 | struct lock_class_key *key = NULL; |
510 | 518 |
|
511 | 519 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
512 | 520 | key = (struct lock_class_key *)&ops->lockdep_key; |
513 | 521 | #endif |
514 | | - return __kernfs_create_file(parent, name, mode, size, ops, priv, ns, |
515 | | - key); |
| 522 | + return __kernfs_create_file(parent, name, mode, uid, gid, |
| 523 | + size, ops, priv, ns, key); |
516 | 524 | } |
517 | 525 |
|
518 | 526 | static inline struct kernfs_node * |
519 | 527 | kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, |
520 | 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 | 535 | static inline int kernfs_remove_by_name(struct kernfs_node *parent, |
|
0 commit comments