diff options
-rw-r--r-- | fs/kernfs/dir.c | 28 | ||||
-rw-r--r-- | fs/kernfs/file.c | 172 | ||||
-rw-r--r-- | fs/kernfs/inode.c | 30 | ||||
-rw-r--r-- | fs/kernfs/kernfs-internal.h | 20 | ||||
-rw-r--r-- | fs/kernfs/mount.c | 14 | ||||
-rw-r--r-- | fs/kernfs/symlink.c | 2 | ||||
-rw-r--r-- | fs/sysfs/file.c | 10 | ||||
-rw-r--r-- | include/linux/kernfs.h | 18 |
8 files changed, 147 insertions, 147 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 51fff9d2b334..d038bb204b54 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -295,7 +295,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) | |||
295 | 295 | ||
296 | /* The sysfs dirent has been moved to a different namespace */ | 296 | /* The sysfs dirent has been moved to a different namespace */ |
297 | if (kn->parent && kernfs_ns_enabled(kn->parent) && | 297 | if (kn->parent && kernfs_ns_enabled(kn->parent) && |
298 | sysfs_info(dentry->d_sb)->ns != kn->ns) | 298 | kernfs_info(dentry->d_sb)->ns != kn->ns) |
299 | goto out_bad; | 299 | goto out_bad; |
300 | 300 | ||
301 | mutex_unlock(&sysfs_mutex); | 301 | mutex_unlock(&sysfs_mutex); |
@@ -375,7 +375,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, | |||
375 | 375 | ||
376 | /** | 376 | /** |
377 | * sysfs_addrm_start - prepare for kernfs_node add/remove | 377 | * sysfs_addrm_start - prepare for kernfs_node add/remove |
378 | * @acxt: pointer to sysfs_addrm_cxt to be used | 378 | * @acxt: pointer to kernfs_addrm_cxt to be used |
379 | * | 379 | * |
380 | * This function is called when the caller is about to add or remove | 380 | * This function is called when the caller is about to add or remove |
381 | * kernfs_node. This function acquires sysfs_mutex. @acxt is used to | 381 | * kernfs_node. This function acquires sysfs_mutex. @acxt is used to |
@@ -385,7 +385,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, | |||
385 | * Kernel thread context (may sleep). sysfs_mutex is locked on | 385 | * Kernel thread context (may sleep). sysfs_mutex is locked on |
386 | * return. | 386 | * return. |
387 | */ | 387 | */ |
388 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt) | 388 | void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt) |
389 | __acquires(sysfs_mutex) | 389 | __acquires(sysfs_mutex) |
390 | { | 390 | { |
391 | memset(acxt, 0, sizeof(*acxt)); | 391 | memset(acxt, 0, sizeof(*acxt)); |
@@ -414,11 +414,11 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt) | |||
414 | * 0 on success, -EEXIST if entry with the given name already | 414 | * 0 on success, -EEXIST if entry with the given name already |
415 | * exists. | 415 | * exists. |
416 | */ | 416 | */ |
417 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, | 417 | int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn, |
418 | struct kernfs_node *parent) | 418 | struct kernfs_node *parent) |
419 | { | 419 | { |
420 | bool has_ns = kernfs_ns_enabled(parent); | 420 | bool has_ns = kernfs_ns_enabled(parent); |
421 | struct sysfs_inode_attrs *ps_iattr; | 421 | struct kernfs_iattrs *ps_iattr; |
422 | int ret; | 422 | int ret; |
423 | 423 | ||
424 | if (has_ns != (bool)kn->ns) { | 424 | if (has_ns != (bool)kn->ns) { |
@@ -466,10 +466,10 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, | |||
466 | * LOCKING: | 466 | * LOCKING: |
467 | * Determined by sysfs_addrm_start(). | 467 | * Determined by sysfs_addrm_start(). |
468 | */ | 468 | */ |
469 | static void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, | 469 | static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt, |
470 | struct kernfs_node *kn) | 470 | struct kernfs_node *kn) |
471 | { | 471 | { |
472 | struct sysfs_inode_attrs *ps_iattr; | 472 | struct kernfs_iattrs *ps_iattr; |
473 | 473 | ||
474 | /* | 474 | /* |
475 | * Removal can be called multiple times on the same node. Only the | 475 | * Removal can be called multiple times on the same node. Only the |
@@ -505,7 +505,7 @@ static void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, | |||
505 | * LOCKING: | 505 | * LOCKING: |
506 | * sysfs_mutex is released. | 506 | * sysfs_mutex is released. |
507 | */ | 507 | */ |
508 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) | 508 | void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt) |
509 | __releases(sysfs_mutex) | 509 | __releases(sysfs_mutex) |
510 | { | 510 | { |
511 | /* release resources acquired by sysfs_addrm_start() */ | 511 | /* release resources acquired by sysfs_addrm_start() */ |
@@ -649,7 +649,7 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, | |||
649 | const void *ns) | 649 | const void *ns) |
650 | { | 650 | { |
651 | umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; | 651 | umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; |
652 | struct sysfs_addrm_cxt acxt; | 652 | struct kernfs_addrm_cxt acxt; |
653 | struct kernfs_node *kn; | 653 | struct kernfs_node *kn; |
654 | int rc; | 654 | int rc; |
655 | 655 | ||
@@ -686,7 +686,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
686 | mutex_lock(&sysfs_mutex); | 686 | mutex_lock(&sysfs_mutex); |
687 | 687 | ||
688 | if (kernfs_ns_enabled(parent)) | 688 | if (kernfs_ns_enabled(parent)) |
689 | ns = sysfs_info(dir->i_sb)->ns; | 689 | ns = kernfs_info(dir->i_sb)->ns; |
690 | 690 | ||
691 | kn = kernfs_find_ns(parent, dentry->d_name.name, ns); | 691 | kn = kernfs_find_ns(parent, dentry->d_name.name, ns); |
692 | 692 | ||
@@ -778,7 +778,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos, | |||
778 | return pos->parent; | 778 | return pos->parent; |
779 | } | 779 | } |
780 | 780 | ||
781 | static void __kernfs_remove(struct sysfs_addrm_cxt *acxt, | 781 | static void __kernfs_remove(struct kernfs_addrm_cxt *acxt, |
782 | struct kernfs_node *kn) | 782 | struct kernfs_node *kn) |
783 | { | 783 | { |
784 | struct kernfs_node *pos, *next; | 784 | struct kernfs_node *pos, *next; |
@@ -805,7 +805,7 @@ static void __kernfs_remove(struct sysfs_addrm_cxt *acxt, | |||
805 | */ | 805 | */ |
806 | void kernfs_remove(struct kernfs_node *kn) | 806 | void kernfs_remove(struct kernfs_node *kn) |
807 | { | 807 | { |
808 | struct sysfs_addrm_cxt acxt; | 808 | struct kernfs_addrm_cxt acxt; |
809 | 809 | ||
810 | sysfs_addrm_start(&acxt); | 810 | sysfs_addrm_start(&acxt); |
811 | __kernfs_remove(&acxt, kn); | 811 | __kernfs_remove(&acxt, kn); |
@@ -824,7 +824,7 @@ void kernfs_remove(struct kernfs_node *kn) | |||
824 | int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, | 824 | int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, |
825 | const void *ns) | 825 | const void *ns) |
826 | { | 826 | { |
827 | struct sysfs_addrm_cxt acxt; | 827 | struct kernfs_addrm_cxt acxt; |
828 | struct kernfs_node *kn; | 828 | struct kernfs_node *kn; |
829 | 829 | ||
830 | if (!parent) { | 830 | if (!parent) { |
@@ -971,7 +971,7 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx) | |||
971 | mutex_lock(&sysfs_mutex); | 971 | mutex_lock(&sysfs_mutex); |
972 | 972 | ||
973 | if (kernfs_ns_enabled(parent)) | 973 | if (kernfs_ns_enabled(parent)) |
974 | ns = sysfs_info(dentry->d_sb)->ns; | 974 | ns = kernfs_info(dentry->d_sb)->ns; |
975 | 975 | ||
976 | for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos); | 976 | for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos); |
977 | pos; | 977 | pos; |
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index 5277021196a7..2714a394cd81 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
@@ -18,27 +18,27 @@ | |||
18 | #include "kernfs-internal.h" | 18 | #include "kernfs-internal.h" |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * There's one sysfs_open_file for each open file and one sysfs_open_dirent | 21 | * There's one kernfs_open_file for each open file and one kernfs_open_node |
22 | * for each kernfs_node with one or more open files. | 22 | * for each kernfs_node with one or more open files. |
23 | * | 23 | * |
24 | * kernfs_node->attr.open points to sysfs_open_dirent. attr.open is | 24 | * kernfs_node->attr.open points to kernfs_open_node. attr.open is |
25 | * protected by sysfs_open_dirent_lock. | 25 | * protected by kernfs_open_node_lock. |
26 | * | 26 | * |
27 | * filp->private_data points to seq_file whose ->private points to | 27 | * filp->private_data points to seq_file whose ->private points to |
28 | * sysfs_open_file. sysfs_open_files are chained at | 28 | * kernfs_open_file. kernfs_open_files are chained at |
29 | * sysfs_open_dirent->files, which is protected by sysfs_open_file_mutex. | 29 | * kernfs_open_node->files, which is protected by kernfs_open_file_mutex. |
30 | */ | 30 | */ |
31 | static DEFINE_SPINLOCK(sysfs_open_dirent_lock); | 31 | static DEFINE_SPINLOCK(kernfs_open_node_lock); |
32 | static DEFINE_MUTEX(sysfs_open_file_mutex); | 32 | static DEFINE_MUTEX(kernfs_open_file_mutex); |
33 | 33 | ||
34 | struct sysfs_open_dirent { | 34 | struct kernfs_open_node { |
35 | atomic_t refcnt; | 35 | atomic_t refcnt; |
36 | atomic_t event; | 36 | atomic_t event; |
37 | wait_queue_head_t poll; | 37 | wait_queue_head_t poll; |
38 | struct list_head files; /* goes through sysfs_open_file.list */ | 38 | struct list_head files; /* goes through kernfs_open_file.list */ |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static struct sysfs_open_file *sysfs_of(struct file *file) | 41 | static struct kernfs_open_file *kernfs_of(struct file *file) |
42 | { | 42 | { |
43 | return ((struct seq_file *)file->private_data)->private; | 43 | return ((struct seq_file *)file->private_data)->private; |
44 | } | 44 | } |
@@ -56,7 +56,7 @@ static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn) | |||
56 | 56 | ||
57 | static void *kernfs_seq_start(struct seq_file *sf, loff_t *ppos) | 57 | static void *kernfs_seq_start(struct seq_file *sf, loff_t *ppos) |
58 | { | 58 | { |
59 | struct sysfs_open_file *of = sf->private; | 59 | struct kernfs_open_file *of = sf->private; |
60 | const struct kernfs_ops *ops; | 60 | const struct kernfs_ops *ops; |
61 | 61 | ||
62 | /* | 62 | /* |
@@ -81,7 +81,7 @@ static void *kernfs_seq_start(struct seq_file *sf, loff_t *ppos) | |||
81 | 81 | ||
82 | static void *kernfs_seq_next(struct seq_file *sf, void *v, loff_t *ppos) | 82 | static void *kernfs_seq_next(struct seq_file *sf, void *v, loff_t *ppos) |
83 | { | 83 | { |
84 | struct sysfs_open_file *of = sf->private; | 84 | struct kernfs_open_file *of = sf->private; |
85 | const struct kernfs_ops *ops = kernfs_ops(of->kn); | 85 | const struct kernfs_ops *ops = kernfs_ops(of->kn); |
86 | 86 | ||
87 | if (ops->seq_next) { | 87 | if (ops->seq_next) { |
@@ -98,7 +98,7 @@ static void *kernfs_seq_next(struct seq_file *sf, void *v, loff_t *ppos) | |||
98 | 98 | ||
99 | static void kernfs_seq_stop(struct seq_file *sf, void *v) | 99 | static void kernfs_seq_stop(struct seq_file *sf, void *v) |
100 | { | 100 | { |
101 | struct sysfs_open_file *of = sf->private; | 101 | struct kernfs_open_file *of = sf->private; |
102 | const struct kernfs_ops *ops = kernfs_ops(of->kn); | 102 | const struct kernfs_ops *ops = kernfs_ops(of->kn); |
103 | 103 | ||
104 | if (ops->seq_stop) | 104 | if (ops->seq_stop) |
@@ -110,7 +110,7 @@ static void kernfs_seq_stop(struct seq_file *sf, void *v) | |||
110 | 110 | ||
111 | static int kernfs_seq_show(struct seq_file *sf, void *v) | 111 | static int kernfs_seq_show(struct seq_file *sf, void *v) |
112 | { | 112 | { |
113 | struct sysfs_open_file *of = sf->private; | 113 | struct kernfs_open_file *of = sf->private; |
114 | 114 | ||
115 | of->event = atomic_read(&of->kn->attr.open->event); | 115 | of->event = atomic_read(&of->kn->attr.open->event); |
116 | 116 | ||
@@ -130,7 +130,7 @@ static const struct seq_operations kernfs_seq_ops = { | |||
130 | * it difficult to use seq_file. Implement simplistic custom buffering for | 130 | * it difficult to use seq_file. Implement simplistic custom buffering for |
131 | * bin files. | 131 | * bin files. |
132 | */ | 132 | */ |
133 | static ssize_t kernfs_file_direct_read(struct sysfs_open_file *of, | 133 | static ssize_t kernfs_file_direct_read(struct kernfs_open_file *of, |
134 | char __user *user_buf, size_t count, | 134 | char __user *user_buf, size_t count, |
135 | loff_t *ppos) | 135 | loff_t *ppos) |
136 | { | 136 | { |
@@ -187,7 +187,7 @@ static ssize_t kernfs_file_direct_read(struct sysfs_open_file *of, | |||
187 | static ssize_t kernfs_file_read(struct file *file, char __user *user_buf, | 187 | static ssize_t kernfs_file_read(struct file *file, char __user *user_buf, |
188 | size_t count, loff_t *ppos) | 188 | size_t count, loff_t *ppos) |
189 | { | 189 | { |
190 | struct sysfs_open_file *of = sysfs_of(file); | 190 | struct kernfs_open_file *of = kernfs_of(file); |
191 | 191 | ||
192 | if (of->kn->flags & SYSFS_FLAG_HAS_SEQ_SHOW) | 192 | if (of->kn->flags & SYSFS_FLAG_HAS_SEQ_SHOW) |
193 | return seq_read(file, user_buf, count, ppos); | 193 | return seq_read(file, user_buf, count, ppos); |
@@ -214,7 +214,7 @@ static ssize_t kernfs_file_read(struct file *file, char __user *user_buf, | |||
214 | static ssize_t kernfs_file_write(struct file *file, const char __user *user_buf, | 214 | static ssize_t kernfs_file_write(struct file *file, const char __user *user_buf, |
215 | size_t count, loff_t *ppos) | 215 | size_t count, loff_t *ppos) |
216 | { | 216 | { |
217 | struct sysfs_open_file *of = sysfs_of(file); | 217 | struct kernfs_open_file *of = kernfs_of(file); |
218 | ssize_t len = min_t(size_t, count, PAGE_SIZE); | 218 | ssize_t len = min_t(size_t, count, PAGE_SIZE); |
219 | const struct kernfs_ops *ops; | 219 | const struct kernfs_ops *ops; |
220 | char *buf; | 220 | char *buf; |
@@ -259,7 +259,7 @@ out_free: | |||
259 | static void kernfs_vma_open(struct vm_area_struct *vma) | 259 | static void kernfs_vma_open(struct vm_area_struct *vma) |
260 | { | 260 | { |
261 | struct file *file = vma->vm_file; | 261 | struct file *file = vma->vm_file; |
262 | struct sysfs_open_file *of = sysfs_of(file); | 262 | struct kernfs_open_file *of = kernfs_of(file); |
263 | 263 | ||
264 | if (!of->vm_ops) | 264 | if (!of->vm_ops) |
265 | return; | 265 | return; |
@@ -276,7 +276,7 @@ static void kernfs_vma_open(struct vm_area_struct *vma) | |||
276 | static int kernfs_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 276 | static int kernfs_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
277 | { | 277 | { |
278 | struct file *file = vma->vm_file; | 278 | struct file *file = vma->vm_file; |
279 | struct sysfs_open_file *of = sysfs_of(file); | 279 | struct kernfs_open_file *of = kernfs_of(file); |
280 | int ret; | 280 | int ret; |
281 | 281 | ||
282 | if (!of->vm_ops) | 282 | if (!of->vm_ops) |
@@ -297,7 +297,7 @@ static int kernfs_vma_page_mkwrite(struct vm_area_struct *vma, | |||
297 | struct vm_fault *vmf) | 297 | struct vm_fault *vmf) |
298 | { | 298 | { |
299 | struct file *file = vma->vm_file; | 299 | struct file *file = vma->vm_file; |
300 | struct sysfs_open_file *of = sysfs_of(file); | 300 | struct kernfs_open_file *of = kernfs_of(file); |
301 | int ret; | 301 | int ret; |
302 | 302 | ||
303 | if (!of->vm_ops) | 303 | if (!of->vm_ops) |
@@ -320,7 +320,7 @@ static int kernfs_vma_access(struct vm_area_struct *vma, unsigned long addr, | |||
320 | void *buf, int len, int write) | 320 | void *buf, int len, int write) |
321 | { | 321 | { |
322 | struct file *file = vma->vm_file; | 322 | struct file *file = vma->vm_file; |
323 | struct sysfs_open_file *of = sysfs_of(file); | 323 | struct kernfs_open_file *of = kernfs_of(file); |
324 | int ret; | 324 | int ret; |
325 | 325 | ||
326 | if (!of->vm_ops) | 326 | if (!of->vm_ops) |
@@ -342,7 +342,7 @@ static int kernfs_vma_set_policy(struct vm_area_struct *vma, | |||
342 | struct mempolicy *new) | 342 | struct mempolicy *new) |
343 | { | 343 | { |
344 | struct file *file = vma->vm_file; | 344 | struct file *file = vma->vm_file; |
345 | struct sysfs_open_file *of = sysfs_of(file); | 345 | struct kernfs_open_file *of = kernfs_of(file); |
346 | int ret; | 346 | int ret; |
347 | 347 | ||
348 | if (!of->vm_ops) | 348 | if (!of->vm_ops) |
@@ -363,7 +363,7 @@ static struct mempolicy *kernfs_vma_get_policy(struct vm_area_struct *vma, | |||
363 | unsigned long addr) | 363 | unsigned long addr) |
364 | { | 364 | { |
365 | struct file *file = vma->vm_file; | 365 | struct file *file = vma->vm_file; |
366 | struct sysfs_open_file *of = sysfs_of(file); | 366 | struct kernfs_open_file *of = kernfs_of(file); |
367 | struct mempolicy *pol; | 367 | struct mempolicy *pol; |
368 | 368 | ||
369 | if (!of->vm_ops) | 369 | if (!of->vm_ops) |
@@ -385,7 +385,7 @@ static int kernfs_vma_migrate(struct vm_area_struct *vma, | |||
385 | unsigned long flags) | 385 | unsigned long flags) |
386 | { | 386 | { |
387 | struct file *file = vma->vm_file; | 387 | struct file *file = vma->vm_file; |
388 | struct sysfs_open_file *of = sysfs_of(file); | 388 | struct kernfs_open_file *of = kernfs_of(file); |
389 | int ret; | 389 | int ret; |
390 | 390 | ||
391 | if (!of->vm_ops) | 391 | if (!of->vm_ops) |
@@ -417,7 +417,7 @@ static const struct vm_operations_struct kernfs_vm_ops = { | |||
417 | 417 | ||
418 | static int kernfs_file_mmap(struct file *file, struct vm_area_struct *vma) | 418 | static int kernfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
419 | { | 419 | { |
420 | struct sysfs_open_file *of = sysfs_of(file); | 420 | struct kernfs_open_file *of = kernfs_of(file); |
421 | const struct kernfs_ops *ops; | 421 | const struct kernfs_ops *ops; |
422 | int rc; | 422 | int rc; |
423 | 423 | ||
@@ -473,9 +473,9 @@ out_unlock: | |||
473 | } | 473 | } |
474 | 474 | ||
475 | /** | 475 | /** |
476 | * sysfs_get_open_dirent - get or create sysfs_open_dirent | 476 | * sysfs_get_open_dirent - get or create kernfs_open_node |
477 | * @kn: target kernfs_node | 477 | * @kn: target kernfs_node |
478 | * @of: sysfs_open_file for this instance of open | 478 | * @of: kernfs_open_file for this instance of open |
479 | * | 479 | * |
480 | * If @kn->attr.open exists, increment its reference count; otherwise, | 480 | * If @kn->attr.open exists, increment its reference count; otherwise, |
481 | * create one. @of is chained to the files list. | 481 | * create one. @of is chained to the files list. |
@@ -487,49 +487,49 @@ out_unlock: | |||
487 | * 0 on success, -errno on failure. | 487 | * 0 on success, -errno on failure. |
488 | */ | 488 | */ |
489 | static int sysfs_get_open_dirent(struct kernfs_node *kn, | 489 | static int sysfs_get_open_dirent(struct kernfs_node *kn, |
490 | struct sysfs_open_file *of) | 490 | struct kernfs_open_file *of) |
491 | { | 491 | { |
492 | struct sysfs_open_dirent *od, *new_od = NULL; | 492 | struct kernfs_open_node *on, *new_on = NULL; |
493 | 493 | ||
494 | retry: | 494 | retry: |
495 | mutex_lock(&sysfs_open_file_mutex); | 495 | mutex_lock(&kernfs_open_file_mutex); |
496 | spin_lock_irq(&sysfs_open_dirent_lock); | 496 | spin_lock_irq(&kernfs_open_node_lock); |
497 | 497 | ||
498 | if (!kn->attr.open && new_od) { | 498 | if (!kn->attr.open && new_on) { |
499 | kn->attr.open = new_od; | 499 | kn->attr.open = new_on; |
500 | new_od = NULL; | 500 | new_on = NULL; |
501 | } | 501 | } |
502 | 502 | ||
503 | od = kn->attr.open; | 503 | on = kn->attr.open; |
504 | if (od) { | 504 | if (on) { |
505 | atomic_inc(&od->refcnt); | 505 | atomic_inc(&on->refcnt); |
506 | list_add_tail(&of->list, &od->files); | 506 | list_add_tail(&of->list, &on->files); |
507 | } | 507 | } |
508 | 508 | ||
509 | spin_unlock_irq(&sysfs_open_dirent_lock); | 509 | spin_unlock_irq(&kernfs_open_node_lock); |
510 | mutex_unlock(&sysfs_open_file_mutex); | 510 | mutex_unlock(&kernfs_open_file_mutex); |
511 | 511 | ||
512 | if (od) { | 512 | if (on) { |
513 | kfree(new_od); | 513 | kfree(new_on); |
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | 516 | ||
517 | /* not there, initialize a new one and retry */ | 517 | /* not there, initialize a new one and retry */ |
518 | new_od = kmalloc(sizeof(*new_od), GFP_KERNEL); | 518 | new_on = kmalloc(sizeof(*new_on), GFP_KERNEL); |
519 | if (!new_od) | 519 | if (!new_on) |
520 | return -ENOMEM; | 520 | return -ENOMEM; |
521 | 521 | ||
522 | atomic_set(&new_od->refcnt, 0); | 522 | atomic_set(&new_on->refcnt, 0); |
523 | atomic_set(&new_od->event, 1); | 523 | atomic_set(&new_on->event, 1); |
524 | init_waitqueue_head(&new_od->poll); | 524 | init_waitqueue_head(&new_on->poll); |
525 | INIT_LIST_HEAD(&new_od->files); | 525 | INIT_LIST_HEAD(&new_on->files); |
526 | goto retry; | 526 | goto retry; |
527 | } | 527 | } |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * sysfs_put_open_dirent - put sysfs_open_dirent | 530 | * sysfs_put_open_dirent - put kernfs_open_node |
531 | * @kn: target kernfs_nodet | 531 | * @kn: target kernfs_nodet |
532 | * @of: associated sysfs_open_file | 532 | * @of: associated kernfs_open_file |
533 | * | 533 | * |
534 | * Put @kn->attr.open and unlink @of from the files list. If | 534 | * Put @kn->attr.open and unlink @of from the files list. If |
535 | * reference count reaches zero, disassociate and free it. | 535 | * reference count reaches zero, disassociate and free it. |
@@ -538,33 +538,33 @@ static int sysfs_get_open_dirent(struct kernfs_node *kn, | |||
538 | * None. | 538 | * None. |
539 | */ | 539 | */ |
540 | static void sysfs_put_open_dirent(struct kernfs_node *kn, | 540 | static void sysfs_put_open_dirent(struct kernfs_node *kn, |
541 | struct sysfs_open_file *of) | 541 | struct kernfs_open_file *of) |
542 | { | 542 | { |
543 | struct sysfs_open_dirent *od = kn->attr.open; | 543 | struct kernfs_open_node *on = kn->attr.open; |
544 | unsigned long flags; | 544 | unsigned long flags; |
545 | 545 | ||
546 | mutex_lock(&sysfs_open_file_mutex); | 546 | mutex_lock(&kernfs_open_file_mutex); |
547 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); | 547 | spin_lock_irqsave(&kernfs_open_node_lock, flags); |
548 | 548 | ||
549 | if (of) | 549 | if (of) |
550 | list_del(&of->list); | 550 | list_del(&of->list); |
551 | 551 | ||
552 | if (atomic_dec_and_test(&od->refcnt)) | 552 | if (atomic_dec_and_test(&on->refcnt)) |
553 | kn->attr.open = NULL; | 553 | kn->attr.open = NULL; |
554 | else | 554 | else |
555 | od = NULL; | 555 | on = NULL; |
556 | 556 | ||
557 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); | 557 | spin_unlock_irqrestore(&kernfs_open_node_lock, flags); |
558 | mutex_unlock(&sysfs_open_file_mutex); | 558 | mutex_unlock(&kernfs_open_file_mutex); |
559 | 559 | ||
560 | kfree(od); | 560 | kfree(on); |
561 | } | 561 | } |
562 | 562 | ||
563 | static int kernfs_file_open(struct inode *inode, struct file *file) | 563 | static int kernfs_file_open(struct inode *inode, struct file *file) |
564 | { | 564 | { |
565 | struct kernfs_node *kn = file->f_path.dentry->d_fsdata; | 565 | struct kernfs_node *kn = file->f_path.dentry->d_fsdata; |
566 | const struct kernfs_ops *ops; | 566 | const struct kernfs_ops *ops; |
567 | struct sysfs_open_file *of; | 567 | struct kernfs_open_file *of; |
568 | bool has_read, has_write, has_mmap; | 568 | bool has_read, has_write, has_mmap; |
569 | int error = -EACCES; | 569 | int error = -EACCES; |
570 | 570 | ||
@@ -586,9 +586,9 @@ static int kernfs_file_open(struct inode *inode, struct file *file) | |||
586 | (!(inode->i_mode & S_IRUGO) || !has_read)) | 586 | (!(inode->i_mode & S_IRUGO) || !has_read)) |
587 | goto err_out; | 587 | goto err_out; |
588 | 588 | ||
589 | /* allocate a sysfs_open_file for the file */ | 589 | /* allocate a kernfs_open_file for the file */ |
590 | error = -ENOMEM; | 590 | error = -ENOMEM; |
591 | of = kzalloc(sizeof(struct sysfs_open_file), GFP_KERNEL); | 591 | of = kzalloc(sizeof(struct kernfs_open_file), GFP_KERNEL); |
592 | if (!of) | 592 | if (!of) |
593 | goto err_out; | 593 | goto err_out; |
594 | 594 | ||
@@ -654,7 +654,7 @@ err_out: | |||
654 | static int kernfs_file_release(struct inode *inode, struct file *filp) | 654 | static int kernfs_file_release(struct inode *inode, struct file *filp) |
655 | { | 655 | { |
656 | struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; | 656 | struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; |
657 | struct sysfs_open_file *of = sysfs_of(filp); | 657 | struct kernfs_open_file *of = kernfs_of(filp); |
658 | 658 | ||
659 | sysfs_put_open_dirent(kn, of); | 659 | sysfs_put_open_dirent(kn, of); |
660 | seq_release(inode, filp); | 660 | seq_release(inode, filp); |
@@ -665,26 +665,26 @@ static int kernfs_file_release(struct inode *inode, struct file *filp) | |||
665 | 665 | ||
666 | void sysfs_unmap_bin_file(struct kernfs_node *kn) | 666 | void sysfs_unmap_bin_file(struct kernfs_node *kn) |
667 | { | 667 | { |
668 | struct sysfs_open_dirent *od; | 668 | struct kernfs_open_node *on; |
669 | struct sysfs_open_file *of; | 669 | struct kernfs_open_file *of; |
670 | 670 | ||
671 | if (!(kn->flags & SYSFS_FLAG_HAS_MMAP)) | 671 | if (!(kn->flags & SYSFS_FLAG_HAS_MMAP)) |
672 | return; | 672 | return; |
673 | 673 | ||
674 | spin_lock_irq(&sysfs_open_dirent_lock); | 674 | spin_lock_irq(&kernfs_open_node_lock); |
675 | od = kn->attr.open; | 675 | on = kn->attr.open; |
676 | if (od) | 676 | if (on) |
677 | atomic_inc(&od->refcnt); | 677 | atomic_inc(&on->refcnt); |
678 | spin_unlock_irq(&sysfs_open_dirent_lock); | 678 | spin_unlock_irq(&kernfs_open_node_lock); |
679 | if (!od) | 679 | if (!on) |
680 | return; | 680 | return; |
681 | 681 | ||
682 | mutex_lock(&sysfs_open_file_mutex); | 682 | mutex_lock(&kernfs_open_file_mutex); |
683 | list_for_each_entry(of, &od->files, list) { | 683 | list_for_each_entry(of, &on->files, list) { |
684 | struct inode *inode = file_inode(of->file); | 684 | struct inode *inode = file_inode(of->file); |
685 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); | 685 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); |
686 | } | 686 | } |
687 | mutex_unlock(&sysfs_open_file_mutex); | 687 | mutex_unlock(&kernfs_open_file_mutex); |
688 | 688 | ||
689 | sysfs_put_open_dirent(kn, NULL); | 689 | sysfs_put_open_dirent(kn, NULL); |
690 | } | 690 | } |
@@ -704,19 +704,19 @@ void sysfs_unmap_bin_file(struct kernfs_node *kn) | |||
704 | */ | 704 | */ |
705 | static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait) | 705 | static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait) |
706 | { | 706 | { |
707 | struct sysfs_open_file *of = sysfs_of(filp); | 707 | struct kernfs_open_file *of = kernfs_of(filp); |
708 | struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; | 708 | struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; |
709 | struct sysfs_open_dirent *od = kn->attr.open; | 709 | struct kernfs_open_node *on = kn->attr.open; |
710 | 710 | ||
711 | /* need parent for the kobj, grab both */ | 711 | /* need parent for the kobj, grab both */ |
712 | if (!sysfs_get_active(kn)) | 712 | if (!sysfs_get_active(kn)) |
713 | goto trigger; | 713 | goto trigger; |
714 | 714 | ||
715 | poll_wait(filp, &od->poll, wait); | 715 | poll_wait(filp, &on->poll, wait); |
716 | 716 | ||
717 | sysfs_put_active(kn); | 717 | sysfs_put_active(kn); |
718 | 718 | ||
719 | if (of->event != atomic_read(&od->event)) | 719 | if (of->event != atomic_read(&on->event)) |
720 | goto trigger; | 720 | goto trigger; |
721 | 721 | ||
722 | return DEFAULT_POLLMASK; | 722 | return DEFAULT_POLLMASK; |
@@ -733,20 +733,20 @@ static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait) | |||
733 | */ | 733 | */ |
734 | void kernfs_notify(struct kernfs_node *kn) | 734 | void kernfs_notify(struct kernfs_node *kn) |
735 | { | 735 | { |
736 | struct sysfs_open_dirent *od; | 736 | struct kernfs_open_node *on; |
737 | unsigned long flags; | 737 | unsigned long flags; |
738 | 738 | ||
739 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); | 739 | spin_lock_irqsave(&kernfs_open_node_lock, flags); |
740 | 740 | ||
741 | if (!WARN_ON(sysfs_type(kn) != SYSFS_KOBJ_ATTR)) { | 741 | if (!WARN_ON(sysfs_type(kn) != SYSFS_KOBJ_ATTR)) { |
742 | od = kn->attr.open; | 742 | on = kn->attr.open; |
743 | if (od) { | 743 | if (on) { |
744 | atomic_inc(&od->event); | 744 | atomic_inc(&on->event); |
745 | wake_up_interruptible(&od->poll); | 745 | wake_up_interruptible(&on->poll); |
746 | } | 746 | } |
747 | } | 747 | } |
748 | 748 | ||
749 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); | 749 | spin_unlock_irqrestore(&kernfs_open_node_lock, flags); |
750 | } | 750 | } |
751 | EXPORT_SYMBOL_GPL(kernfs_notify); | 751 | EXPORT_SYMBOL_GPL(kernfs_notify); |
752 | 752 | ||
@@ -780,7 +780,7 @@ struct kernfs_node *kernfs_create_file_ns_key(struct kernfs_node *parent, | |||
780 | void *priv, const void *ns, | 780 | void *priv, const void *ns, |
781 | struct lock_class_key *key) | 781 | struct lock_class_key *key) |
782 | { | 782 | { |
783 | struct sysfs_addrm_cxt acxt; | 783 | struct kernfs_addrm_cxt acxt; |
784 | struct kernfs_node *kn; | 784 | struct kernfs_node *kn; |
785 | int rc; | 785 | int rc; |
786 | 786 | ||
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index f6c0aae3dd5c..a0e0038fd570 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c | |||
@@ -46,14 +46,14 @@ void __init sysfs_inode_init(void) | |||
46 | panic("failed to init sysfs_backing_dev_info"); | 46 | panic("failed to init sysfs_backing_dev_info"); |
47 | } | 47 | } |
48 | 48 | ||
49 | static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn) | 49 | static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) |
50 | { | 50 | { |
51 | struct iattr *iattrs; | 51 | struct iattr *iattrs; |
52 | 52 | ||
53 | if (kn->iattr) | 53 | if (kn->iattr) |
54 | return kn->iattr; | 54 | return kn->iattr; |
55 | 55 | ||
56 | kn->iattr = kzalloc(sizeof(struct sysfs_inode_attrs), GFP_KERNEL); | 56 | kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); |
57 | if (!kn->iattr) | 57 | if (!kn->iattr) |
58 | return NULL; | 58 | return NULL; |
59 | iattrs = &kn->iattr->ia_iattr; | 59 | iattrs = &kn->iattr->ia_iattr; |
@@ -71,11 +71,11 @@ static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn) | |||
71 | 71 | ||
72 | static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) | 72 | static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) |
73 | { | 73 | { |
74 | struct sysfs_inode_attrs *attrs; | 74 | struct kernfs_iattrs *attrs; |
75 | struct iattr *iattrs; | 75 | struct iattr *iattrs; |
76 | unsigned int ia_valid = iattr->ia_valid; | 76 | unsigned int ia_valid = iattr->ia_valid; |
77 | 77 | ||
78 | attrs = sysfs_inode_attrs(kn); | 78 | attrs = kernfs_iattrs(kn); |
79 | if (!attrs) | 79 | if (!attrs) |
80 | return -ENOMEM; | 80 | return -ENOMEM; |
81 | 81 | ||
@@ -144,11 +144,11 @@ out: | |||
144 | static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata, | 144 | static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata, |
145 | u32 *secdata_len) | 145 | u32 *secdata_len) |
146 | { | 146 | { |
147 | struct sysfs_inode_attrs *attrs; | 147 | struct kernfs_iattrs *attrs; |
148 | void *old_secdata; | 148 | void *old_secdata; |
149 | size_t old_secdata_len; | 149 | size_t old_secdata_len; |
150 | 150 | ||
151 | attrs = sysfs_inode_attrs(kn); | 151 | attrs = kernfs_iattrs(kn); |
152 | if (!attrs) | 152 | if (!attrs) |
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | 154 | ||
@@ -167,12 +167,12 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
167 | size_t size, int flags) | 167 | size_t size, int flags) |
168 | { | 168 | { |
169 | struct kernfs_node *kn = dentry->d_fsdata; | 169 | struct kernfs_node *kn = dentry->d_fsdata; |
170 | struct sysfs_inode_attrs *attrs; | 170 | struct kernfs_iattrs *attrs; |
171 | void *secdata; | 171 | void *secdata; |
172 | int error; | 172 | int error; |
173 | u32 secdata_len = 0; | 173 | u32 secdata_len = 0; |
174 | 174 | ||
175 | attrs = sysfs_inode_attrs(kn); | 175 | attrs = kernfs_iattrs(kn); |
176 | if (!attrs) | 176 | if (!attrs) |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | 178 | ||
@@ -205,9 +205,9 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
205 | int sysfs_removexattr(struct dentry *dentry, const char *name) | 205 | int sysfs_removexattr(struct dentry *dentry, const char *name) |
206 | { | 206 | { |
207 | struct kernfs_node *kn = dentry->d_fsdata; | 207 | struct kernfs_node *kn = dentry->d_fsdata; |
208 | struct sysfs_inode_attrs *attrs; | 208 | struct kernfs_iattrs *attrs; |
209 | 209 | ||
210 | attrs = sysfs_inode_attrs(kn); | 210 | attrs = kernfs_iattrs(kn); |
211 | if (!attrs) | 211 | if (!attrs) |
212 | return -ENOMEM; | 212 | return -ENOMEM; |
213 | 213 | ||
@@ -218,9 +218,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, | |||
218 | size_t size) | 218 | size_t size) |
219 | { | 219 | { |
220 | struct kernfs_node *kn = dentry->d_fsdata; | 220 | struct kernfs_node *kn = dentry->d_fsdata; |
221 | struct sysfs_inode_attrs *attrs; | 221 | struct kernfs_iattrs *attrs; |
222 | 222 | ||
223 | attrs = sysfs_inode_attrs(kn); | 223 | attrs = kernfs_iattrs(kn); |
224 | if (!attrs) | 224 | if (!attrs) |
225 | return -ENOMEM; | 225 | return -ENOMEM; |
226 | 226 | ||
@@ -230,9 +230,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, | |||
230 | ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size) | 230 | ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size) |
231 | { | 231 | { |
232 | struct kernfs_node *kn = dentry->d_fsdata; | 232 | struct kernfs_node *kn = dentry->d_fsdata; |
233 | struct sysfs_inode_attrs *attrs; | 233 | struct kernfs_iattrs *attrs; |
234 | 234 | ||
235 | attrs = sysfs_inode_attrs(kn); | 235 | attrs = kernfs_iattrs(kn); |
236 | if (!attrs) | 236 | if (!attrs) |
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | 238 | ||
@@ -256,7 +256,7 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr) | |||
256 | 256 | ||
257 | static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) | 257 | static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) |
258 | { | 258 | { |
259 | struct sysfs_inode_attrs *attrs = kn->iattr; | 259 | struct kernfs_iattrs *attrs = kn->iattr; |
260 | 260 | ||
261 | inode->i_mode = kn->mode; | 261 | inode->i_mode = kn->mode; |
262 | if (attrs) { | 262 | if (attrs) { |
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h index 2dbb1cb95e7f..573f66988643 100644 --- a/fs/kernfs/kernfs-internal.h +++ b/fs/kernfs/kernfs-internal.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/kernfs.h> | 19 | #include <linux/kernfs.h> |
20 | 20 | ||
21 | struct sysfs_inode_attrs { | 21 | struct kernfs_iattrs { |
22 | struct iattr ia_iattr; | 22 | struct iattr ia_iattr; |
23 | void *ia_secdata; | 23 | void *ia_secdata; |
24 | u32 ia_secdata_len; | 24 | u32 ia_secdata_len; |
@@ -47,14 +47,14 @@ static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) | |||
47 | /* | 47 | /* |
48 | * Context structure to be used while adding/removing nodes. | 48 | * Context structure to be used while adding/removing nodes. |
49 | */ | 49 | */ |
50 | struct sysfs_addrm_cxt { | 50 | struct kernfs_addrm_cxt { |
51 | struct kernfs_node *removed; | 51 | struct kernfs_node *removed; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * mount.c | 55 | * mount.c |
56 | */ | 56 | */ |
57 | struct sysfs_super_info { | 57 | struct kernfs_super_info { |
58 | /* | 58 | /* |
59 | * The root associated with this super_block. Each super_block is | 59 | * The root associated with this super_block. Each super_block is |
60 | * identified by the root and ns it's associated with. | 60 | * identified by the root and ns it's associated with. |
@@ -63,13 +63,13 @@ struct sysfs_super_info { | |||
63 | 63 | ||
64 | /* | 64 | /* |
65 | * Each sb is associated with one namespace tag, currently the | 65 | * Each sb is associated with one namespace tag, currently the |
66 | * network namespace of the task which mounted this sysfs instance. | 66 | * network namespace of the task which mounted this kernfs |
67 | * If multiple tags become necessary, make the following an array | 67 | * instance. If multiple tags become necessary, make the following |
68 | * and compare kernfs_node tag against every entry. | 68 | * an array and compare kernfs_node tag against every entry. |
69 | */ | 69 | */ |
70 | const void *ns; | 70 | const void *ns; |
71 | }; | 71 | }; |
72 | #define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info)) | 72 | #define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info)) |
73 | 73 | ||
74 | extern struct kmem_cache *sysfs_dir_cachep; | 74 | extern struct kmem_cache *sysfs_dir_cachep; |
75 | 75 | ||
@@ -100,10 +100,10 @@ extern const struct inode_operations sysfs_dir_inode_operations; | |||
100 | 100 | ||
101 | struct kernfs_node *sysfs_get_active(struct kernfs_node *kn); | 101 | struct kernfs_node *sysfs_get_active(struct kernfs_node *kn); |
102 | void sysfs_put_active(struct kernfs_node *kn); | 102 | void sysfs_put_active(struct kernfs_node *kn); |
103 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt); | 103 | void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt); |
104 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, | 104 | int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn, |
105 | struct kernfs_node *parent); | 105 | struct kernfs_node *parent); |
106 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); | 106 | void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt); |
107 | struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, | 107 | struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, |
108 | const char *name, umode_t mode, int type); | 108 | const char *name, umode_t mode, int type); |
109 | 109 | ||
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 9dbbf37b1af9..e0796dcb6065 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -27,7 +27,7 @@ static const struct super_operations sysfs_ops = { | |||
27 | 27 | ||
28 | static int sysfs_fill_super(struct super_block *sb) | 28 | static int sysfs_fill_super(struct super_block *sb) |
29 | { | 29 | { |
30 | struct sysfs_super_info *info = sysfs_info(sb); | 30 | struct kernfs_super_info *info = kernfs_info(sb); |
31 | struct inode *inode; | 31 | struct inode *inode; |
32 | struct dentry *root; | 32 | struct dentry *root; |
33 | 33 | ||
@@ -61,8 +61,8 @@ static int sysfs_fill_super(struct super_block *sb) | |||
61 | 61 | ||
62 | static int sysfs_test_super(struct super_block *sb, void *data) | 62 | static int sysfs_test_super(struct super_block *sb, void *data) |
63 | { | 63 | { |
64 | struct sysfs_super_info *sb_info = sysfs_info(sb); | 64 | struct kernfs_super_info *sb_info = kernfs_info(sb); |
65 | struct sysfs_super_info *info = data; | 65 | struct kernfs_super_info *info = data; |
66 | 66 | ||
67 | return sb_info->root == info->root && sb_info->ns == info->ns; | 67 | return sb_info->root == info->root && sb_info->ns == info->ns; |
68 | } | 68 | } |
@@ -84,7 +84,7 @@ static int sysfs_set_super(struct super_block *sb, void *data) | |||
84 | */ | 84 | */ |
85 | const void *kernfs_super_ns(struct super_block *sb) | 85 | const void *kernfs_super_ns(struct super_block *sb) |
86 | { | 86 | { |
87 | struct sysfs_super_info *info = sysfs_info(sb); | 87 | struct kernfs_super_info *info = kernfs_info(sb); |
88 | 88 | ||
89 | return info->ns; | 89 | return info->ns; |
90 | } | 90 | } |
@@ -107,7 +107,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
107 | struct kernfs_root *root, const void *ns) | 107 | struct kernfs_root *root, const void *ns) |
108 | { | 108 | { |
109 | struct super_block *sb; | 109 | struct super_block *sb; |
110 | struct sysfs_super_info *info; | 110 | struct kernfs_super_info *info; |
111 | int error; | 111 | int error; |
112 | 112 | ||
113 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 113 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
@@ -144,12 +144,12 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
144 | */ | 144 | */ |
145 | void kernfs_kill_sb(struct super_block *sb) | 145 | void kernfs_kill_sb(struct super_block *sb) |
146 | { | 146 | { |
147 | struct sysfs_super_info *info = sysfs_info(sb); | 147 | struct kernfs_super_info *info = kernfs_info(sb); |
148 | struct kernfs_node *root_kn = sb->s_root->d_fsdata; | 148 | struct kernfs_node *root_kn = sb->s_root->d_fsdata; |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * Remove the superblock from fs_supers/s_instances | 151 | * Remove the superblock from fs_supers/s_instances |
152 | * so we can't find it, before freeing sysfs_super_info. | 152 | * so we can't find it, before freeing kernfs_super_info. |
153 | */ | 153 | */ |
154 | kill_anon_super(sb); | 154 | kill_anon_super(sb); |
155 | kfree(info); | 155 | kfree(info); |
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c index 5ac1a57c3807..f36e3f1b2477 100644 --- a/fs/kernfs/symlink.c +++ b/fs/kernfs/symlink.c | |||
@@ -27,7 +27,7 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, | |||
27 | struct kernfs_node *target) | 27 | struct kernfs_node *target) |
28 | { | 28 | { |
29 | struct kernfs_node *kn; | 29 | struct kernfs_node *kn; |
30 | struct sysfs_addrm_cxt acxt; | 30 | struct kernfs_addrm_cxt acxt; |
31 | int error; | 31 | int error; |
32 | 32 | ||
33 | kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO, | 33 | kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO, |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 887703a79065..fd104b282f81 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -41,7 +41,7 @@ static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) | |||
41 | */ | 41 | */ |
42 | static int sysfs_kf_seq_show(struct seq_file *sf, void *v) | 42 | static int sysfs_kf_seq_show(struct seq_file *sf, void *v) |
43 | { | 43 | { |
44 | struct sysfs_open_file *of = sf->private; | 44 | struct kernfs_open_file *of = sf->private; |
45 | struct kobject *kobj = of->kn->parent->priv; | 45 | struct kobject *kobj = of->kn->parent->priv; |
46 | const struct sysfs_ops *ops = sysfs_file_ops(of->kn); | 46 | const struct sysfs_ops *ops = sysfs_file_ops(of->kn); |
47 | ssize_t count; | 47 | ssize_t count; |
@@ -78,7 +78,7 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v) | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | static ssize_t sysfs_kf_bin_read(struct sysfs_open_file *of, char *buf, | 81 | static ssize_t sysfs_kf_bin_read(struct kernfs_open_file *of, char *buf, |
82 | size_t count, loff_t pos) | 82 | size_t count, loff_t pos) |
83 | { | 83 | { |
84 | struct bin_attribute *battr = of->kn->priv; | 84 | struct bin_attribute *battr = of->kn->priv; |
@@ -102,7 +102,7 @@ static ssize_t sysfs_kf_bin_read(struct sysfs_open_file *of, char *buf, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* kernfs write callback for regular sysfs files */ | 104 | /* kernfs write callback for regular sysfs files */ |
105 | static ssize_t sysfs_kf_write(struct sysfs_open_file *of, char *buf, | 105 | static ssize_t sysfs_kf_write(struct kernfs_open_file *of, char *buf, |
106 | size_t count, loff_t pos) | 106 | size_t count, loff_t pos) |
107 | { | 107 | { |
108 | const struct sysfs_ops *ops = sysfs_file_ops(of->kn); | 108 | const struct sysfs_ops *ops = sysfs_file_ops(of->kn); |
@@ -115,7 +115,7 @@ static ssize_t sysfs_kf_write(struct sysfs_open_file *of, char *buf, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | /* kernfs write callback for bin sysfs files */ | 117 | /* kernfs write callback for bin sysfs files */ |
118 | static ssize_t sysfs_kf_bin_write(struct sysfs_open_file *of, char *buf, | 118 | static ssize_t sysfs_kf_bin_write(struct kernfs_open_file *of, char *buf, |
119 | size_t count, loff_t pos) | 119 | size_t count, loff_t pos) |
120 | { | 120 | { |
121 | struct bin_attribute *battr = of->kn->priv; | 121 | struct bin_attribute *battr = of->kn->priv; |
@@ -136,7 +136,7 @@ static ssize_t sysfs_kf_bin_write(struct sysfs_open_file *of, char *buf, | |||
136 | return battr->write(of->file, kobj, battr, buf, pos, count); | 136 | return battr->write(of->file, kobj, battr, buf, pos, count); |
137 | } | 137 | } |
138 | 138 | ||
139 | static int sysfs_kf_bin_mmap(struct sysfs_open_file *of, | 139 | static int sysfs_kf_bin_mmap(struct kernfs_open_file *of, |
140 | struct vm_area_struct *vma) | 140 | struct vm_area_struct *vma) |
141 | { | 141 | { |
142 | struct bin_attribute *battr = of->kn->priv; | 142 | struct bin_attribute *battr = of->kn->priv; |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 092469f60e3e..757647c4cb3b 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
@@ -24,8 +24,8 @@ struct vm_area_struct; | |||
24 | struct super_block; | 24 | struct super_block; |
25 | struct file_system_type; | 25 | struct file_system_type; |
26 | 26 | ||
27 | struct sysfs_open_dirent; | 27 | struct kernfs_open_node; |
28 | struct sysfs_inode_attrs; | 28 | struct kernfs_iattrs; |
29 | 29 | ||
30 | enum kernfs_node_type { | 30 | enum kernfs_node_type { |
31 | SYSFS_DIR = 0x0001, | 31 | SYSFS_DIR = 0x0001, |
@@ -65,7 +65,7 @@ struct kernfs_elem_symlink { | |||
65 | 65 | ||
66 | struct kernfs_elem_attr { | 66 | struct kernfs_elem_attr { |
67 | const struct kernfs_ops *ops; | 67 | const struct kernfs_ops *ops; |
68 | struct sysfs_open_dirent *open; | 68 | struct kernfs_open_node *open; |
69 | loff_t size; | 69 | loff_t size; |
70 | }; | 70 | }; |
71 | 71 | ||
@@ -108,7 +108,7 @@ struct kernfs_node { | |||
108 | unsigned short flags; | 108 | unsigned short flags; |
109 | umode_t mode; | 109 | umode_t mode; |
110 | unsigned int ino; | 110 | unsigned int ino; |
111 | struct sysfs_inode_attrs *iattr; | 111 | struct kernfs_iattrs *iattr; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | struct kernfs_root { | 114 | struct kernfs_root { |
@@ -119,7 +119,7 @@ struct kernfs_root { | |||
119 | struct ida ino_ida; | 119 | struct ida ino_ida; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | struct sysfs_open_file { | 122 | struct kernfs_open_file { |
123 | /* published fields */ | 123 | /* published fields */ |
124 | struct kernfs_node *kn; | 124 | struct kernfs_node *kn; |
125 | struct file *file; | 125 | struct file *file; |
@@ -140,7 +140,7 @@ struct kernfs_ops { | |||
140 | * If seq_show() is present, seq_file path is active. Other seq | 140 | * If seq_show() is present, seq_file path is active. Other seq |
141 | * operations are optional and if not implemented, the behavior is | 141 | * operations are optional and if not implemented, the behavior is |
142 | * equivalent to single_open(). @sf->private points to the | 142 | * equivalent to single_open(). @sf->private points to the |
143 | * associated sysfs_open_file. | 143 | * associated kernfs_open_file. |
144 | * | 144 | * |
145 | * read() is bounced through kernel buffer and a read larger than | 145 | * read() is bounced through kernel buffer and a read larger than |
146 | * PAGE_SIZE results in partial operation of PAGE_SIZE. | 146 | * PAGE_SIZE results in partial operation of PAGE_SIZE. |
@@ -151,17 +151,17 @@ struct kernfs_ops { | |||
151 | void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos); | 151 | void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos); |
152 | void (*seq_stop)(struct seq_file *sf, void *v); | 152 | void (*seq_stop)(struct seq_file *sf, void *v); |
153 | 153 | ||
154 | ssize_t (*read)(struct sysfs_open_file *of, char *buf, size_t bytes, | 154 | ssize_t (*read)(struct kernfs_open_file *of, char *buf, size_t bytes, |
155 | loff_t off); | 155 | loff_t off); |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * write() is bounced through kernel buffer and a write larger than | 158 | * write() is bounced through kernel buffer and a write larger than |
159 | * PAGE_SIZE results in partial operation of PAGE_SIZE. | 159 | * PAGE_SIZE results in partial operation of PAGE_SIZE. |
160 | */ | 160 | */ |
161 | ssize_t (*write)(struct sysfs_open_file *of, char *buf, size_t bytes, | 161 | ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes, |
162 | loff_t off); | 162 | loff_t off); |
163 | 163 | ||
164 | int (*mmap)(struct sysfs_open_file *of, struct vm_area_struct *vma); | 164 | int (*mmap)(struct kernfs_open_file *of, struct vm_area_struct *vma); |
165 | 165 | ||
166 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 166 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
167 | struct lock_class_key lockdep_key; | 167 | struct lock_class_key lockdep_key; |