Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernfs: s/sysfs/kernfs/ in various data structures

kernfs has just been separated out from sysfs and we're already in
full conflict mode. Nothing can make the situation any worse. Let's
take the chance to name things properly.

This patch performs the following renames.

* s/sysfs_open_dirent/kernfs_open_node/
* s/sysfs_open_file/kernfs_open_file/
* s/sysfs_inode_attrs/kernfs_iattrs/
* s/sysfs_addrm_cxt/kernfs_addrm_cxt/
* s/sysfs_super_info/kernfs_super_info/
* s/sysfs_info()/kernfs_info()/
* s/sysfs_open_dirent_lock/kernfs_open_node_lock/
* s/sysfs_open_file_mutex/kernfs_open_file_mutex/
* s/sysfs_of()/kernfs_of()/

This patch is strictly rename only and doesn't introduce any
functional difference.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tejun Heo and committed by
Greg Kroah-Hartman
c525aadd adc5e8b5

+147 -147
+14 -14
fs/kernfs/dir.c
··· 295 295 296 296 /* The sysfs dirent has been moved to a different namespace */ 297 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 299 goto out_bad; 300 300 301 301 mutex_unlock(&sysfs_mutex); ··· 375 375 376 376 /** 377 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 380 * This function is called when the caller is about to add or remove 381 381 * kernfs_node. This function acquires sysfs_mutex. @acxt is used to ··· 385 385 * Kernel thread context (may sleep). sysfs_mutex is locked on 386 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 389 __acquires(sysfs_mutex) 390 390 { 391 391 memset(acxt, 0, sizeof(*acxt)); ··· 414 414 * 0 on success, -EEXIST if entry with the given name already 415 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 418 struct kernfs_node *parent) 419 419 { 420 420 bool has_ns = kernfs_ns_enabled(parent); 421 - struct sysfs_inode_attrs *ps_iattr; 421 + struct kernfs_iattrs *ps_iattr; 422 422 int ret; 423 423 424 424 if (has_ns != (bool)kn->ns) { ··· 466 466 * LOCKING: 467 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 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 475 * Removal can be called multiple times on the same node. Only the ··· 505 505 * LOCKING: 506 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 509 __releases(sysfs_mutex) 510 510 { 511 511 /* release resources acquired by sysfs_addrm_start() */ ··· 649 649 const void *ns) 650 650 { 651 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 653 struct kernfs_node *kn; 654 654 int rc; 655 655 ··· 686 686 mutex_lock(&sysfs_mutex); 687 687 688 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 691 kn = kernfs_find_ns(parent, dentry->d_name.name, ns); 692 692 ··· 778 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 782 struct kernfs_node *kn) 783 783 { 784 784 struct kernfs_node *pos, *next; ··· 805 805 */ 806 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 810 sysfs_addrm_start(&acxt); 811 811 __kernfs_remove(&acxt, kn); ··· 824 824 int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, 825 825 const void *ns) 826 826 { 827 - struct sysfs_addrm_cxt acxt; 827 + struct kernfs_addrm_cxt acxt; 828 828 struct kernfs_node *kn; 829 829 830 830 if (!parent) { ··· 971 971 mutex_lock(&sysfs_mutex); 972 972 973 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 976 for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos); 977 977 pos;
+86 -86
fs/kernfs/file.c
··· 18 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 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 25 - * protected by sysfs_open_dirent_lock. 24 + * kernfs_node->attr.open points to kernfs_open_node. attr.open is 25 + * protected by kernfs_open_node_lock. 26 26 * 27 27 * filp->private_data points to seq_file whose ->private points to 28 - * sysfs_open_file. sysfs_open_files are chained at 29 - * sysfs_open_dirent->files, which is protected by sysfs_open_file_mutex. 28 + * kernfs_open_file. kernfs_open_files are chained at 29 + * kernfs_open_node->files, which is protected by kernfs_open_file_mutex. 30 30 */ 31 - static DEFINE_SPINLOCK(sysfs_open_dirent_lock); 32 - static DEFINE_MUTEX(sysfs_open_file_mutex); 31 + static DEFINE_SPINLOCK(kernfs_open_node_lock); 32 + static DEFINE_MUTEX(kernfs_open_file_mutex); 33 33 34 - struct sysfs_open_dirent { 34 + struct kernfs_open_node { 35 35 atomic_t refcnt; 36 36 atomic_t event; 37 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 43 return ((struct seq_file *)file->private_data)->private; 44 44 } ··· 56 56 57 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 60 const struct kernfs_ops *ops; 61 61 62 62 /* ··· 81 81 82 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 85 const struct kernfs_ops *ops = kernfs_ops(of->kn); 86 86 87 87 if (ops->seq_next) { ··· 98 98 99 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 102 const struct kernfs_ops *ops = kernfs_ops(of->kn); 103 103 104 104 if (ops->seq_stop) ··· 110 110 111 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 115 of->event = atomic_read(&of->kn->attr.open->event); 116 116 ··· 130 130 * it difficult to use seq_file. Implement simplistic custom buffering for 131 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 134 char __user *user_buf, size_t count, 135 135 loff_t *ppos) 136 136 { ··· 187 187 static ssize_t kernfs_file_read(struct file *file, char __user *user_buf, 188 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 192 if (of->kn->flags & SYSFS_FLAG_HAS_SEQ_SHOW) 193 193 return seq_read(file, user_buf, count, ppos); ··· 214 214 static ssize_t kernfs_file_write(struct file *file, const char __user *user_buf, 215 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 218 ssize_t len = min_t(size_t, count, PAGE_SIZE); 219 219 const struct kernfs_ops *ops; 220 220 char *buf; ··· 259 259 static void kernfs_vma_open(struct vm_area_struct *vma) 260 260 { 261 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 264 if (!of->vm_ops) 265 265 return; ··· 276 276 static int kernfs_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 277 277 { 278 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 280 int ret; 281 281 282 282 if (!of->vm_ops) ··· 297 297 struct vm_fault *vmf) 298 298 { 299 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 301 int ret; 302 302 303 303 if (!of->vm_ops) ··· 320 320 void *buf, int len, int write) 321 321 { 322 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 324 int ret; 325 325 326 326 if (!of->vm_ops) ··· 342 342 struct mempolicy *new) 343 343 { 344 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 346 int ret; 347 347 348 348 if (!of->vm_ops) ··· 363 363 unsigned long addr) 364 364 { 365 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 367 struct mempolicy *pol; 368 368 369 369 if (!of->vm_ops) ··· 385 385 unsigned long flags) 386 386 { 387 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 389 int ret; 390 390 391 391 if (!of->vm_ops) ··· 417 417 418 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 421 const struct kernfs_ops *ops; 422 422 int rc; 423 423 ··· 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 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 480 * If @kn->attr.open exists, increment its reference count; otherwise, 481 481 * create one. @of is chained to the files list. ··· 487 487 * 0 on success, -errno on failure. 488 488 */ 489 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 494 retry: 495 - mutex_lock(&sysfs_open_file_mutex); 496 - spin_lock_irq(&sysfs_open_dirent_lock); 495 + mutex_lock(&kernfs_open_file_mutex); 496 + spin_lock_irq(&kernfs_open_node_lock); 497 497 498 - if (!kn->attr.open && new_od) { 499 - kn->attr.open = new_od; 500 - new_od = NULL; 498 + if (!kn->attr.open && new_on) { 499 + kn->attr.open = new_on; 500 + new_on = NULL; 501 501 } 502 502 503 - od = kn->attr.open; 504 - if (od) { 505 - atomic_inc(&od->refcnt); 506 - list_add_tail(&of->list, &od->files); 503 + on = kn->attr.open; 504 + if (on) { 505 + atomic_inc(&on->refcnt); 506 + list_add_tail(&of->list, &on->files); 507 507 } 508 508 509 - spin_unlock_irq(&sysfs_open_dirent_lock); 510 - mutex_unlock(&sysfs_open_file_mutex); 509 + spin_unlock_irq(&kernfs_open_node_lock); 510 + mutex_unlock(&kernfs_open_file_mutex); 511 511 512 - if (od) { 513 - kfree(new_od); 512 + if (on) { 513 + kfree(new_on); 514 514 return 0; 515 515 } 516 516 517 517 /* not there, initialize a new one and retry */ 518 - new_od = kmalloc(sizeof(*new_od), GFP_KERNEL); 519 - if (!new_od) 518 + new_on = kmalloc(sizeof(*new_on), GFP_KERNEL); 519 + if (!new_on) 520 520 return -ENOMEM; 521 521 522 - atomic_set(&new_od->refcnt, 0); 523 - atomic_set(&new_od->event, 1); 524 - init_waitqueue_head(&new_od->poll); 525 - INIT_LIST_HEAD(&new_od->files); 522 + atomic_set(&new_on->refcnt, 0); 523 + atomic_set(&new_on->event, 1); 524 + init_waitqueue_head(&new_on->poll); 525 + INIT_LIST_HEAD(&new_on->files); 526 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 531 * @kn: target kernfs_nodet 532 - * @of: associated sysfs_open_file 532 + * @of: associated kernfs_open_file 533 533 * 534 534 * Put @kn->attr.open and unlink @of from the files list. If 535 535 * reference count reaches zero, disassociate and free it. ··· 538 538 * None. 539 539 */ 540 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 544 unsigned long flags; 545 545 546 - mutex_lock(&sysfs_open_file_mutex); 547 - spin_lock_irqsave(&sysfs_open_dirent_lock, flags); 546 + mutex_lock(&kernfs_open_file_mutex); 547 + spin_lock_irqsave(&kernfs_open_node_lock, flags); 548 548 549 549 if (of) 550 550 list_del(&of->list); 551 551 552 - if (atomic_dec_and_test(&od->refcnt)) 552 + if (atomic_dec_and_test(&on->refcnt)) 553 553 kn->attr.open = NULL; 554 554 else 555 - od = NULL; 555 + on = NULL; 556 556 557 - spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); 558 - mutex_unlock(&sysfs_open_file_mutex); 557 + spin_unlock_irqrestore(&kernfs_open_node_lock, flags); 558 + mutex_unlock(&kernfs_open_file_mutex); 559 559 560 - kfree(od); 560 + kfree(on); 561 561 } 562 562 563 563 static int kernfs_file_open(struct inode *inode, struct file *file) 564 564 { 565 565 struct kernfs_node *kn = file->f_path.dentry->d_fsdata; 566 566 const struct kernfs_ops *ops; 567 - struct sysfs_open_file *of; 567 + struct kernfs_open_file *of; 568 568 bool has_read, has_write, has_mmap; 569 569 int error = -EACCES; 570 570 ··· 586 586 (!(inode->i_mode & S_IRUGO) || !has_read)) 587 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 590 error = -ENOMEM; 591 - of = kzalloc(sizeof(struct sysfs_open_file), GFP_KERNEL); 591 + of = kzalloc(sizeof(struct kernfs_open_file), GFP_KERNEL); 592 592 if (!of) 593 593 goto err_out; 594 594 ··· 654 654 static int kernfs_file_release(struct inode *inode, struct file *filp) 655 655 { 656 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 659 sysfs_put_open_dirent(kn, of); 660 660 seq_release(inode, filp); ··· 665 665 666 666 void sysfs_unmap_bin_file(struct kernfs_node *kn) 667 667 { 668 - struct sysfs_open_dirent *od; 669 - struct sysfs_open_file *of; 668 + struct kernfs_open_node *on; 669 + struct kernfs_open_file *of; 670 670 671 671 if (!(kn->flags & SYSFS_FLAG_HAS_MMAP)) 672 672 return; 673 673 674 - spin_lock_irq(&sysfs_open_dirent_lock); 675 - od = kn->attr.open; 676 - if (od) 677 - atomic_inc(&od->refcnt); 678 - spin_unlock_irq(&sysfs_open_dirent_lock); 679 - if (!od) 674 + spin_lock_irq(&kernfs_open_node_lock); 675 + on = kn->attr.open; 676 + if (on) 677 + atomic_inc(&on->refcnt); 678 + spin_unlock_irq(&kernfs_open_node_lock); 679 + if (!on) 680 680 return; 681 681 682 - mutex_lock(&sysfs_open_file_mutex); 683 - list_for_each_entry(of, &od->files, list) { 682 + mutex_lock(&kernfs_open_file_mutex); 683 + list_for_each_entry(of, &on->files, list) { 684 684 struct inode *inode = file_inode(of->file); 685 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 689 sysfs_put_open_dirent(kn, NULL); 690 690 } ··· 704 704 */ 705 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 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 711 /* need parent for the kobj, grab both */ 712 712 if (!sysfs_get_active(kn)) 713 713 goto trigger; 714 714 715 - poll_wait(filp, &od->poll, wait); 715 + poll_wait(filp, &on->poll, wait); 716 716 717 717 sysfs_put_active(kn); 718 718 719 - if (of->event != atomic_read(&od->event)) 719 + if (of->event != atomic_read(&on->event)) 720 720 goto trigger; 721 721 722 722 return DEFAULT_POLLMASK; ··· 733 733 */ 734 734 void kernfs_notify(struct kernfs_node *kn) 735 735 { 736 - struct sysfs_open_dirent *od; 736 + struct kernfs_open_node *on; 737 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 741 if (!WARN_ON(sysfs_type(kn) != SYSFS_KOBJ_ATTR)) { 742 - od = kn->attr.open; 743 - if (od) { 744 - atomic_inc(&od->event); 745 - wake_up_interruptible(&od->poll); 742 + on = kn->attr.open; 743 + if (on) { 744 + atomic_inc(&on->event); 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 751 EXPORT_SYMBOL_GPL(kernfs_notify); 752 752 ··· 780 780 void *priv, const void *ns, 781 781 struct lock_class_key *key) 782 782 { 783 - struct sysfs_addrm_cxt acxt; 783 + struct kernfs_addrm_cxt acxt; 784 784 struct kernfs_node *kn; 785 785 int rc; 786 786
+15 -15
fs/kernfs/inode.c
··· 46 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 51 struct iattr *iattrs; 52 52 53 53 if (kn->iattr) 54 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 57 if (!kn->iattr) 58 58 return NULL; 59 59 iattrs = &kn->iattr->ia_iattr; ··· 71 71 72 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 75 struct iattr *iattrs; 76 76 unsigned int ia_valid = iattr->ia_valid; 77 77 78 - attrs = sysfs_inode_attrs(kn); 78 + attrs = kernfs_iattrs(kn); 79 79 if (!attrs) 80 80 return -ENOMEM; 81 81 ··· 144 144 static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata, 145 145 u32 *secdata_len) 146 146 { 147 - struct sysfs_inode_attrs *attrs; 147 + struct kernfs_iattrs *attrs; 148 148 void *old_secdata; 149 149 size_t old_secdata_len; 150 150 151 - attrs = sysfs_inode_attrs(kn); 151 + attrs = kernfs_iattrs(kn); 152 152 if (!attrs) 153 153 return -ENOMEM; 154 154 ··· 167 167 size_t size, int flags) 168 168 { 169 169 struct kernfs_node *kn = dentry->d_fsdata; 170 - struct sysfs_inode_attrs *attrs; 170 + struct kernfs_iattrs *attrs; 171 171 void *secdata; 172 172 int error; 173 173 u32 secdata_len = 0; 174 174 175 - attrs = sysfs_inode_attrs(kn); 175 + attrs = kernfs_iattrs(kn); 176 176 if (!attrs) 177 177 return -ENOMEM; 178 178 ··· 205 205 int sysfs_removexattr(struct dentry *dentry, const char *name) 206 206 { 207 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 211 if (!attrs) 212 212 return -ENOMEM; 213 213 ··· 218 218 size_t size) 219 219 { 220 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 224 if (!attrs) 225 225 return -ENOMEM; 226 226 ··· 230 230 ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size) 231 231 { 232 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 236 if (!attrs) 237 237 return -ENOMEM; 238 238 ··· 256 256 257 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 261 inode->i_mode = kn->mode; 262 262 if (attrs) {
+10 -10
fs/kernfs/kernfs-internal.h
··· 18 18 19 19 #include <linux/kernfs.h> 20 20 21 - struct sysfs_inode_attrs { 21 + struct kernfs_iattrs { 22 22 struct iattr ia_iattr; 23 23 void *ia_secdata; 24 24 u32 ia_secdata_len; ··· 47 47 /* 48 48 * Context structure to be used while adding/removing nodes. 49 49 */ 50 - struct sysfs_addrm_cxt { 50 + struct kernfs_addrm_cxt { 51 51 struct kernfs_node *removed; 52 52 }; 53 53 54 54 /* 55 55 * mount.c 56 56 */ 57 - struct sysfs_super_info { 57 + struct kernfs_super_info { 58 58 /* 59 59 * The root associated with this super_block. Each super_block is 60 60 * identified by the root and ns it's associated with. ··· 63 63 64 64 /* 65 65 * Each sb is associated with one namespace tag, currently the 66 - * network namespace of the task which mounted this sysfs instance. 67 - * If multiple tags become necessary, make the following an array 68 - * and compare kernfs_node tag against every entry. 66 + * network namespace of the task which mounted this kernfs 67 + * instance. If multiple tags become necessary, make the following 68 + * an array and compare kernfs_node tag against every entry. 69 69 */ 70 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 74 extern struct kmem_cache *sysfs_dir_cachep; 75 75 ··· 100 100 101 101 struct kernfs_node *sysfs_get_active(struct kernfs_node *kn); 102 102 void sysfs_put_active(struct kernfs_node *kn); 103 - void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt); 104 - int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, 103 + void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt); 104 + int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn, 105 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 107 struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, 108 108 const char *name, umode_t mode, int type); 109 109
+7 -7
fs/kernfs/mount.c
··· 27 27 28 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 31 struct inode *inode; 32 32 struct dentry *root; 33 33 ··· 61 61 62 62 static int sysfs_test_super(struct super_block *sb, void *data) 63 63 { 64 - struct sysfs_super_info *sb_info = sysfs_info(sb); 65 - struct sysfs_super_info *info = data; 64 + struct kernfs_super_info *sb_info = kernfs_info(sb); 65 + struct kernfs_super_info *info = data; 66 66 67 67 return sb_info->root == info->root && sb_info->ns == info->ns; 68 68 } ··· 84 84 */ 85 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 89 return info->ns; 90 90 } ··· 107 107 struct kernfs_root *root, const void *ns) 108 108 { 109 109 struct super_block *sb; 110 - struct sysfs_super_info *info; 110 + struct kernfs_super_info *info; 111 111 int error; 112 112 113 113 info = kzalloc(sizeof(*info), GFP_KERNEL); ··· 144 144 */ 145 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 148 struct kernfs_node *root_kn = sb->s_root->d_fsdata; 149 149 150 150 /* 151 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 154 kill_anon_super(sb); 155 155 kfree(info);
+1 -1
fs/kernfs/symlink.c
··· 27 27 struct kernfs_node *target) 28 28 { 29 29 struct kernfs_node *kn; 30 - struct sysfs_addrm_cxt acxt; 30 + struct kernfs_addrm_cxt acxt; 31 31 int error; 32 32 33 33 kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
+5 -5
fs/sysfs/file.c
··· 41 41 */ 42 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 45 struct kobject *kobj = of->kn->parent->priv; 46 46 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); 47 47 ssize_t count; ··· 78 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 82 size_t count, loff_t pos) 83 83 { 84 84 struct bin_attribute *battr = of->kn->priv; ··· 102 102 } 103 103 104 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 106 size_t count, loff_t pos) 107 107 { 108 108 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); ··· 115 115 } 116 116 117 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 119 size_t count, loff_t pos) 120 120 { 121 121 struct bin_attribute *battr = of->kn->priv; ··· 136 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 140 struct vm_area_struct *vma) 141 141 { 142 142 struct bin_attribute *battr = of->kn->priv;
+9 -9
include/linux/kernfs.h
··· 24 24 struct super_block; 25 25 struct file_system_type; 26 26 27 - struct sysfs_open_dirent; 28 - struct sysfs_inode_attrs; 27 + struct kernfs_open_node; 28 + struct kernfs_iattrs; 29 29 30 30 enum kernfs_node_type { 31 31 SYSFS_DIR = 0x0001, ··· 65 65 66 66 struct kernfs_elem_attr { 67 67 const struct kernfs_ops *ops; 68 - struct sysfs_open_dirent *open; 68 + struct kernfs_open_node *open; 69 69 loff_t size; 70 70 }; 71 71 ··· 108 108 unsigned short flags; 109 109 umode_t mode; 110 110 unsigned int ino; 111 - struct sysfs_inode_attrs *iattr; 111 + struct kernfs_iattrs *iattr; 112 112 }; 113 113 114 114 struct kernfs_root { ··· 119 119 struct ida ino_ida; 120 120 }; 121 121 122 - struct sysfs_open_file { 122 + struct kernfs_open_file { 123 123 /* published fields */ 124 124 struct kernfs_node *kn; 125 125 struct file *file; ··· 140 140 * If seq_show() is present, seq_file path is active. Other seq 141 141 * operations are optional and if not implemented, the behavior is 142 142 * equivalent to single_open(). @sf->private points to the 143 - * associated sysfs_open_file. 143 + * associated kernfs_open_file. 144 144 * 145 145 * read() is bounced through kernel buffer and a read larger than 146 146 * PAGE_SIZE results in partial operation of PAGE_SIZE. ··· 151 151 void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos); 152 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 155 loff_t off); 156 156 157 157 /* 158 158 * write() is bounced through kernel buffer and a write larger than 159 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 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 166 #ifdef CONFIG_DEBUG_LOCK_ALLOC 167 167 struct lock_class_key lockdep_key;