diff options
| -rw-r--r-- | fs/ecryptfs/main.c | 10 | ||||
| -rw-r--r-- | kernel/ksysfs.c | 35 | ||||
| -rw-r--r-- | kernel/power/disk.c | 18 | ||||
| -rw-r--r-- | kernel/power/main.c | 12 | ||||
| -rw-r--r-- | kernel/power/power.h | 2 | ||||
| -rw-r--r-- | lib/kobject.c | 10 |
6 files changed, 54 insertions, 33 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index bdeac3877a84..6ded37b467ff 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -736,12 +736,13 @@ static int ecryptfs_init_kmem_caches(void) | |||
| 736 | 736 | ||
| 737 | static struct kset *ecryptfs_kset; | 737 | static struct kset *ecryptfs_kset; |
| 738 | 738 | ||
| 739 | static ssize_t version_show(struct kset *kset, char *buff) | 739 | static ssize_t version_show(struct kobject *kobj, |
| 740 | struct kobj_attribute *attr, char *buff) | ||
| 740 | { | 741 | { |
| 741 | return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK); | 742 | return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK); |
| 742 | } | 743 | } |
| 743 | 744 | ||
| 744 | static struct subsys_attribute version_attr = __ATTR_RO(version); | 745 | static struct kobj_attribute version_attr = __ATTR_RO(version); |
| 745 | 746 | ||
| 746 | static struct ecryptfs_version_str_map_elem { | 747 | static struct ecryptfs_version_str_map_elem { |
| 747 | u32 flag; | 748 | u32 flag; |
| @@ -755,7 +756,8 @@ static struct ecryptfs_version_str_map_elem { | |||
| 755 | {ECRYPTFS_VERSIONING_MULTKEY, "multiple keys per file"} | 756 | {ECRYPTFS_VERSIONING_MULTKEY, "multiple keys per file"} |
| 756 | }; | 757 | }; |
| 757 | 758 | ||
| 758 | static ssize_t version_str_show(struct kset *kset, char *buff) | 759 | static ssize_t version_str_show(struct kobject *kobj, |
| 760 | struct kobj_attribute *attr, char *buff) | ||
| 759 | { | 761 | { |
| 760 | int i; | 762 | int i; |
| 761 | int remaining = PAGE_SIZE; | 763 | int remaining = PAGE_SIZE; |
| @@ -782,7 +784,7 @@ out: | |||
| 782 | return total_written; | 784 | return total_written; |
| 783 | } | 785 | } |
| 784 | 786 | ||
| 785 | static struct subsys_attribute version_attr_str = __ATTR_RO(version_str); | 787 | static struct kobj_attribute version_attr_str = __ATTR_RO(version_str); |
| 786 | 788 | ||
| 787 | static struct attribute *attributes[] = { | 789 | static struct attribute *attributes[] = { |
| 788 | &version_attr.attr, | 790 | &version_attr.attr, |
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index cf02d4ba9add..dd0f9e7f3414 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
| @@ -17,30 +17,34 @@ | |||
| 17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
| 18 | 18 | ||
| 19 | #define KERNEL_ATTR_RO(_name) \ | 19 | #define KERNEL_ATTR_RO(_name) \ |
| 20 | static struct subsys_attribute _name##_attr = __ATTR_RO(_name) | 20 | static struct kobj_attribute _name##_attr = __ATTR_RO(_name) |
| 21 | 21 | ||
| 22 | #define KERNEL_ATTR_RW(_name) \ | 22 | #define KERNEL_ATTR_RW(_name) \ |
| 23 | static struct subsys_attribute _name##_attr = \ | 23 | static struct kobj_attribute _name##_attr = \ |
| 24 | __ATTR(_name, 0644, _name##_show, _name##_store) | 24 | __ATTR(_name, 0644, _name##_show, _name##_store) |
| 25 | 25 | ||
| 26 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 26 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
| 27 | /* current uevent sequence number */ | 27 | /* current uevent sequence number */ |
| 28 | static ssize_t uevent_seqnum_show(struct kset *kset, char *page) | 28 | static ssize_t uevent_seqnum_show(struct kobject *kobj, |
| 29 | struct kobj_attribute *attr, char *buf) | ||
| 29 | { | 30 | { |
| 30 | return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); | 31 | return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum); |
| 31 | } | 32 | } |
| 32 | KERNEL_ATTR_RO(uevent_seqnum); | 33 | KERNEL_ATTR_RO(uevent_seqnum); |
| 33 | 34 | ||
| 34 | /* uevent helper program, used during early boo */ | 35 | /* uevent helper program, used during early boo */ |
| 35 | static ssize_t uevent_helper_show(struct kset *kset, char *page) | 36 | static ssize_t uevent_helper_show(struct kobject *kobj, |
| 37 | struct kobj_attribute *attr, char *buf) | ||
| 36 | { | 38 | { |
| 37 | return sprintf(page, "%s\n", uevent_helper); | 39 | return sprintf(buf, "%s\n", uevent_helper); |
| 38 | } | 40 | } |
| 39 | static ssize_t uevent_helper_store(struct kset *kset, const char *page, size_t count) | 41 | static ssize_t uevent_helper_store(struct kobject *kobj, |
| 42 | struct kobj_attribute *attr, | ||
| 43 | const char *buf, size_t count) | ||
| 40 | { | 44 | { |
| 41 | if (count+1 > UEVENT_HELPER_PATH_LEN) | 45 | if (count+1 > UEVENT_HELPER_PATH_LEN) |
| 42 | return -ENOENT; | 46 | return -ENOENT; |
| 43 | memcpy(uevent_helper, page, count); | 47 | memcpy(uevent_helper, buf, count); |
| 44 | uevent_helper[count] = '\0'; | 48 | uevent_helper[count] = '\0'; |
| 45 | if (count && uevent_helper[count-1] == '\n') | 49 | if (count && uevent_helper[count-1] == '\n') |
| 46 | uevent_helper[count-1] = '\0'; | 50 | uevent_helper[count-1] = '\0'; |
| @@ -50,21 +54,24 @@ KERNEL_ATTR_RW(uevent_helper); | |||
| 50 | #endif | 54 | #endif |
| 51 | 55 | ||
| 52 | #ifdef CONFIG_KEXEC | 56 | #ifdef CONFIG_KEXEC |
| 53 | static ssize_t kexec_loaded_show(struct kset *kset, char *page) | 57 | static ssize_t kexec_loaded_show(struct kobject *kobj, |
| 58 | struct kobj_attribute *attr, char *buf) | ||
| 54 | { | 59 | { |
| 55 | return sprintf(page, "%d\n", !!kexec_image); | 60 | return sprintf(buf, "%d\n", !!kexec_image); |
| 56 | } | 61 | } |
| 57 | KERNEL_ATTR_RO(kexec_loaded); | 62 | KERNEL_ATTR_RO(kexec_loaded); |
| 58 | 63 | ||
| 59 | static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page) | 64 | static ssize_t kexec_crash_loaded_show(struct kobject *kobj, |
| 65 | struct kobj_attribute *attr, char *buf) | ||
| 60 | { | 66 | { |
| 61 | return sprintf(page, "%d\n", !!kexec_crash_image); | 67 | return sprintf(buf, "%d\n", !!kexec_crash_image); |
| 62 | } | 68 | } |
| 63 | KERNEL_ATTR_RO(kexec_crash_loaded); | 69 | KERNEL_ATTR_RO(kexec_crash_loaded); |
| 64 | 70 | ||
| 65 | static ssize_t vmcoreinfo_show(struct kset *kset, char *page) | 71 | static ssize_t vmcoreinfo_show(struct kobject *kobj, |
| 72 | struct kobj_attribute *attr, char *buf) | ||
| 66 | { | 73 | { |
| 67 | return sprintf(page, "%lx %x\n", | 74 | return sprintf(buf, "%lx %x\n", |
| 68 | paddr_vmcoreinfo_note(), | 75 | paddr_vmcoreinfo_note(), |
| 69 | (unsigned int)vmcoreinfo_max_size); | 76 | (unsigned int)vmcoreinfo_max_size); |
| 70 | } | 77 | } |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index c3f0e61365dd..ef5aa2ca0ab0 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
| @@ -567,7 +567,8 @@ static const char * const hibernation_modes[] = { | |||
| 567 | * supports it (as determined by having hibernation_ops). | 567 | * supports it (as determined by having hibernation_ops). |
| 568 | */ | 568 | */ |
| 569 | 569 | ||
| 570 | static ssize_t disk_show(struct kset *kset, char *buf) | 570 | static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr, |
| 571 | char *buf) | ||
| 571 | { | 572 | { |
| 572 | int i; | 573 | int i; |
| 573 | char *start = buf; | 574 | char *start = buf; |
| @@ -597,7 +598,8 @@ static ssize_t disk_show(struct kset *kset, char *buf) | |||
| 597 | } | 598 | } |
| 598 | 599 | ||
| 599 | 600 | ||
| 600 | static ssize_t disk_store(struct kset *kset, const char *buf, size_t n) | 601 | static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 602 | const char *buf, size_t n) | ||
| 601 | { | 603 | { |
| 602 | int error = 0; | 604 | int error = 0; |
| 603 | int i; | 605 | int i; |
| @@ -642,13 +644,15 @@ static ssize_t disk_store(struct kset *kset, const char *buf, size_t n) | |||
| 642 | 644 | ||
| 643 | power_attr(disk); | 645 | power_attr(disk); |
| 644 | 646 | ||
| 645 | static ssize_t resume_show(struct kset *kset, char *buf) | 647 | static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr, |
| 648 | char *buf) | ||
| 646 | { | 649 | { |
| 647 | return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device), | 650 | return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device), |
| 648 | MINOR(swsusp_resume_device)); | 651 | MINOR(swsusp_resume_device)); |
| 649 | } | 652 | } |
| 650 | 653 | ||
| 651 | static ssize_t resume_store(struct kset *kset, const char *buf, size_t n) | 654 | static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 655 | const char *buf, size_t n) | ||
| 652 | { | 656 | { |
| 653 | unsigned int maj, min; | 657 | unsigned int maj, min; |
| 654 | dev_t res; | 658 | dev_t res; |
| @@ -674,12 +678,14 @@ static ssize_t resume_store(struct kset *kset, const char *buf, size_t n) | |||
| 674 | 678 | ||
| 675 | power_attr(resume); | 679 | power_attr(resume); |
| 676 | 680 | ||
| 677 | static ssize_t image_size_show(struct kset *kset, char *buf) | 681 | static ssize_t image_size_show(struct kobject *kobj, struct kobj_attribute *attr, |
| 682 | char *buf) | ||
| 678 | { | 683 | { |
| 679 | return sprintf(buf, "%lu\n", image_size); | 684 | return sprintf(buf, "%lu\n", image_size); |
| 680 | } | 685 | } |
| 681 | 686 | ||
| 682 | static ssize_t image_size_store(struct kset *kset, const char *buf, size_t n) | 687 | static ssize_t image_size_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 688 | const char *buf, size_t n) | ||
| 683 | { | 689 | { |
| 684 | unsigned long size; | 690 | unsigned long size; |
| 685 | 691 | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index dce2d76d66de..b8139493b856 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -289,7 +289,8 @@ struct kset *power_kset; | |||
| 289 | * proper enumerated value, and initiates a suspend transition. | 289 | * proper enumerated value, and initiates a suspend transition. |
| 290 | */ | 290 | */ |
| 291 | 291 | ||
| 292 | static ssize_t state_show(struct kset *kset, char *buf) | 292 | static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr, |
| 293 | char *buf) | ||
| 293 | { | 294 | { |
| 294 | char *s = buf; | 295 | char *s = buf; |
| 295 | #ifdef CONFIG_SUSPEND | 296 | #ifdef CONFIG_SUSPEND |
| @@ -310,7 +311,8 @@ static ssize_t state_show(struct kset *kset, char *buf) | |||
| 310 | return (s - buf); | 311 | return (s - buf); |
| 311 | } | 312 | } |
| 312 | 313 | ||
| 313 | static ssize_t state_store(struct kset *kset, const char *buf, size_t n) | 314 | static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 315 | const char *buf, size_t n) | ||
| 314 | { | 316 | { |
| 315 | #ifdef CONFIG_SUSPEND | 317 | #ifdef CONFIG_SUSPEND |
| 316 | suspend_state_t state = PM_SUSPEND_STANDBY; | 318 | suspend_state_t state = PM_SUSPEND_STANDBY; |
| @@ -347,13 +349,15 @@ power_attr(state); | |||
| 347 | #ifdef CONFIG_PM_TRACE | 349 | #ifdef CONFIG_PM_TRACE |
| 348 | int pm_trace_enabled; | 350 | int pm_trace_enabled; |
| 349 | 351 | ||
| 350 | static ssize_t pm_trace_show(struct kset *kset, char *buf) | 352 | static ssize_t pm_trace_show(struct kobject *kobj, struct kobj_attribute *attr, |
| 353 | char *buf) | ||
| 351 | { | 354 | { |
| 352 | return sprintf(buf, "%d\n", pm_trace_enabled); | 355 | return sprintf(buf, "%d\n", pm_trace_enabled); |
| 353 | } | 356 | } |
| 354 | 357 | ||
| 355 | static ssize_t | 358 | static ssize_t |
| 356 | pm_trace_store(struct kset *kset, const char *buf, size_t n) | 359 | pm_trace_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 360 | const char *buf, size_t n) | ||
| 357 | { | 361 | { |
| 358 | int val; | 362 | int val; |
| 359 | 363 | ||
diff --git a/kernel/power/power.h b/kernel/power/power.h index 1083e6b188ab..2093c3a9a994 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
| @@ -54,7 +54,7 @@ extern int pfn_is_nosave(unsigned long); | |||
| 54 | extern struct mutex pm_mutex; | 54 | extern struct mutex pm_mutex; |
| 55 | 55 | ||
| 56 | #define power_attr(_name) \ | 56 | #define power_attr(_name) \ |
| 57 | static struct subsys_attribute _name##_attr = { \ | 57 | static struct kobj_attribute _name##_attr = { \ |
| 58 | .attr = { \ | 58 | .attr = { \ |
| 59 | .name = __stringify(_name), \ | 59 | .name = __stringify(_name), \ |
| 60 | .mode = 0644, \ | 60 | .mode = 0644, \ |
diff --git a/lib/kobject.c b/lib/kobject.c index 1c343fe4ba63..99f6354a5751 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -626,7 +626,8 @@ static void dynamic_kobj_release(struct kobject *kobj) | |||
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | static struct kobj_type dynamic_kobj_ktype = { | 628 | static struct kobj_type dynamic_kobj_ktype = { |
| 629 | .release = dynamic_kobj_release, | 629 | .release = dynamic_kobj_release, |
| 630 | .sysfs_ops = &kobj_sysfs_ops, | ||
| 630 | }; | 631 | }; |
| 631 | 632 | ||
| 632 | /** | 633 | /** |
| @@ -836,7 +837,8 @@ static void kset_release(struct kobject *kobj) | |||
| 836 | kfree(kset); | 837 | kfree(kset); |
| 837 | } | 838 | } |
| 838 | 839 | ||
| 839 | static struct kobj_type kset_type = { | 840 | static struct kobj_type kset_ktype = { |
| 841 | .sysfs_ops = &kobj_sysfs_ops, | ||
| 840 | .release = kset_release, | 842 | .release = kset_release, |
| 841 | }; | 843 | }; |
| 842 | 844 | ||
| @@ -869,11 +871,11 @@ static struct kset *kset_create(const char *name, | |||
| 869 | kset->kobj.parent = parent_kobj; | 871 | kset->kobj.parent = parent_kobj; |
| 870 | 872 | ||
| 871 | /* | 873 | /* |
| 872 | * The kobject of this kset will have a type of kset_type and belong to | 874 | * The kobject of this kset will have a type of kset_ktype and belong to |
| 873 | * no kset itself. That way we can properly free it when it is | 875 | * no kset itself. That way we can properly free it when it is |
| 874 | * finished being used. | 876 | * finished being used. |
| 875 | */ | 877 | */ |
| 876 | kset->kobj.ktype = &kset_type; | 878 | kset->kobj.ktype = &kset_ktype; |
| 877 | kset->kobj.kset = NULL; | 879 | kset->kobj.kset = NULL; |
| 878 | 880 | ||
| 879 | return kset; | 881 | return kset; |
