kobject and kset core changes and cleanups
Subsystems (32)
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
Here's a large patch series that is in my tree and should be for 2.6.25. It does quite a few things:
- lots of struct kset work and cleanup. It's much simpler now and will be documented while I still remember what is going one...
- almost all (only 5 left) struct kset are dynamically created with the new function call, kset_create_and_register(). This fixes up a lot of issues with static kobjects in structures and other messy things like that.
- struct bus_type is now split into two, a static and a dynamic part. The dynamic part is under control of the driver core, and handles the ksets. The static part is under control of the bus that defined it.
- decl_subsys() is now gone and buried, good riddance
- subsys_attribute is now gone and replaced with:
- kobj_attribute is now availble to make attributes for kobjects MUCH simpler than ever before. I've cleaned up some portions of the kernel, and all older users of subsys_attribute have been fixed. This takes away one of the biggest complaints about dealing with "raw" kobjects.
- firmware subsystem has been all but removed as it was pointless.
I'm posting the patches here so that people can take a look at them and not be surprised when they go in to 2.6.25 in a few months and show up in the next -mm releases.
One note, the efivars sysfs file removal patch is incorrect, and I'll be fixing that up properly, so Matt, don't worry, I haven't forgotten :)
And hey, with all this work, we ended up removing more code than we added, always a very good thing.
Now, on to face that scary inbox...
thanks,
greg k-h
---------------
Documentation/vm/slabinfo.c | 2 +- Documentation/vm/slub.txt | 2 +- arch/arm/mach-omap1/pm.c | 23 ++--- arch/powerpc/platforms/pseries/power.c | 33 ++--- arch/s390/hypfs/inode.c | 15 ++- arch/s390/kernel/ipl.c | 149 +++++++++++++---------- block/genhd.c | 5 +- drivers/acpi/bus.c | 12 ++- drivers/acpi/system.c | 2 +- drivers/base/base.h | 32 +++++- drivers/base/bus.c | 142 +++++++++++++-------- drivers/base/class.c | 27 +++-- drivers/base/core.c | 24 ++-- drivers/base/dd.c | 4 +- drivers/base/driver.c | 2 +- drivers/base/firmware.c | 27 ++--- drivers/base/hypervisor.c | 14 ++- drivers/base/platform.c | 4 +- drivers/base/power/shutdown.c | 2 +- drivers/base/sys.c | 31 ++--- drivers/edac/edac_mc_sysfs.c | 2 +- drivers/firmware/edd.c | 15 ++- drivers/firmware/efivars.c | 214 ++++--------------------------- drivers/parisc/pdc_stable.c | 186 ++++++++++++++-------------- drivers/pci/hotplug/acpiphp_ibm.c | 4 +- drivers/pci/hotplug/pci_hotplug_core.c | 22 ++-- drivers/pci/hotplug/rpadlpar_sysfs.c | 2 +- drivers/pci/probe.c | 11 +- drivers/uio/uio.c | 2 +- fs/configfs/mount.c | 14 +- fs/debugfs/inode.c | 14 +- fs/dlm/lockspace.c | 22 ++-- fs/ecryptfs/main.c | 130 +++---------------- fs/fuse/inode.c | 27 +++-- fs/gfs2/locking/dlm/sysfs.c | 24 ++-- fs/gfs2/sys.c | 15 +-- fs/namespace.c | 14 ++- fs/ocfs2/cluster/masklog.c | 4 +- fs/ocfs2/cluster/sys.c | 83 +++--------- fs/sysfs/file.c | 65 ++-------- include/acpi/acpi_bus.h | 2 +- include/linux/device.h | 21 +--- include/linux/fs.h | 2 +- include/linux/kobject.h | 76 ++++-------- include/linux/module.h | 3 +- include/linux/pci_hotplug.h | 2 +- include/linux/sched.h | 9 +- kernel/ksysfs.c | 83 ++++++++----- kernel/module.c | 6 +- kernel/params.c | 26 ++--- kernel/power/disk.c | 20 ++- kernel/power/main.c | 24 ++-- kernel/power/power.h | 4 +- kernel/user.c | 104 ++++++++-------- lib/kobject.c | 129 +++++++++++++++++--- mm/slub.c | 20 ++-- security/inode.c | 12 +- 57 files changed, 900 insertions(+), 1065 deletions(-)
---------------
Greg Kroah-Hartman (50):
ecryptfs: clean up attribute mess
KOBJECT: remove struct kobj_type from struct kset
KOBJECT: remove kobj_set_kset_s as no one is using it anymore
kset: add kset_create_and_register function
kset: convert fuse to use kset_create
kset: convert securityfs to use kset_create
kset: convert debugfs to use kset_create
kset: convert configfs to use kset_create
kset: convert ecryptfs to use kset_create
kset: convert main fs kset to use kset_create
kset: convert gfs2 to use kset_create
kset: convert gfs2 dlm to use kset_create
kset: convert dlm to use kset_create
kset: convert pci hotplug to use kset_create_and_register
kset: remove decl_subsys_name
kset: convert kernel_subsys to use kset_create
kset: convert drivers/base/bus.c kset_create_and_register
kset: convert drivers/base/class.c kset_create_and_register
kset: convert drivers/base/firmware.c kset_create_and_register
kset: convert /sys/devices to use kset_create
kset: convert /sys/hypervisor to use kset_create
kset: convert /sys/devices/system to use kset_create
kset: convert slub to use kset_create
kset: move /sys/slab to /sys/kernel/slab
kset: convert /sys/module to use kset_create
kset: convert /sys/power to use kset_create
kset: convert s390 hypervisor kset to use kset_create
kset: convert struct bus_device->devices to use kset_create
kset: convert struct bus_device->drivers to use kset_create
driver core: remove owner field from struct bus_type
driver core: add way to get to bus kset
driver core: add way to get to bus device klist
driver core: remove fields from struct bus_type
ecryptfs: remove version_str file from sysfs
efivars: remove new_var and del_var files from sysfs
kobject: convert efivars to kobj_attr interface
firmware: export firmware_kset so that people can use that instead of the braindead firmware_register interface
kset: convert efivars to use kset_create for the efi subsystem.
kset: convert efivars to use kset_create for the vars sub-subsystem.
kobject: convert arm/mach-omap1/pm.c to kobj_attr interface
kobject: convert pseries/power.c to kobj_attr interface
kobject: convert s390 ipl.c to kobj_attr interface
kset: convert s390 ipl.c to use kset_create
kobject: convert parisc/pdc_stable to kobj_attr interface
kset: convert parisc/pdc_stable.c to use kset_create
kset: convert edd to use kset_create
kset: convert acpi to use kset_create
firmware: remove firmware_(un)register()
kset: convert ocfs2 to use kset_create
kset: remove decl_subsys macro
Kay Sievers (4):
Driver Core: add kobj_attribute handling Driver Core: switch all dynamic ksets to kobj_sysfs_ops fix struct user_info export's sysfs interaction Driver Core: kill subsys_attribute and default sysfs ops
PATCH 1/54 ecryptfs: clean up attribute mess
It isn't that hard to add simple kset attributes, so don't go through all the gyrations of creating your own object type and show and store functions. Just use the functions that are already present. This makes things much simpler.
Note, the version_str string violates the "one value per file" rule for sysfs. I suggest changing this now (individual files per type supported is one suggested way.)
--- fs/ecryptfs/main.c | 85 +++++++++++----------------------------------------- 1 files changed, 18 insertions(+), 67 deletions(-)
fs/ecryptfs/main.c +18 -67
@@ -730,58 +730,14 @@ static int ecryptfs_init_kmem_caches(void)return 0 ; } -struct ecryptfs_obj { -char *name; -struct list_head slot_list; -struct kobject kobj; -}; - -struct ecryptfs_attribute { -struct attribute attr; -ssize_t (*show) (struct ecryptfs_obj *,char *); -ssize_t (*store) (struct ecryptfs_obj *,const char *,size_t ); -}; - -static ssize_t -ecryptfs_attr_store (struct kobject *kobj, -struct attribute *attr,const char *buf,size_t len) -{ - struct ecryptfs_obj *obj = container_of(kobj, struct ecryptfs_obj, - kobj); -struct ecryptfs_attribute *attribute = - container_of(attr, struct ecryptfs_attribute, attr); - -return (attribute->store ? attribute->store (obj, buf, len) :0 ); -} - -static ssize_t -ecryptfs_attr_show (struct kobject *kobj,struct attribute *attr,char *buf) -{ - struct ecryptfs_obj *obj = container_of(kobj, struct ecryptfs_obj, - kobj); -struct ecryptfs_attribute *attribute = - container_of(attr, struct ecryptfs_attribute, attr); - -return (attribute->show ? attribute->show (obj, buf) :0 ); -} - -static struct sysfs_ops ecryptfs_sysfs_ops = { - .show = ecryptfs_attr_show, - .store = ecryptfs_attr_store -}; +static decl_subsys(ecryptfs, NULL, NULL); -static struct kobj_type ecryptfs_ktype = { - .sysfs_ops = &ecryptfs_sysfs_ops -}; - -static decl_subsys(ecryptfs, &ecryptfs_ktype, NULL); - -static ssize_t version_show (struct ecryptfs_obj *obj,char *buff) +static ssize_t version_show (struct kset *kset,char *buff) {return snprintf (buff,PAGE_SIZE ,"%d\n" ,ECRYPTFS_VERSIONING_MASK ); } -static struct ecryptfs_attribute sysfs_attr_version =__ATTR_RO (version); +static struct subsys_attribute version_attr =__ATTR_RO (version); static struct ecryptfs_version_str_map_elem { u32 flag;
@@ -795,7 +751,7 @@ static struct ecryptfs_version_str_map_elem { {ECRYPTFS_VERSIONING_MULTKEY, "multiple keys per file"} }; -static ssize_t version_str_show (struct ecryptfs_obj *obj,char *buff) +static ssize_t version_str_show (struct kset *kset,char *buff) {int i;int remaining =PAGE_SIZE ;
@@ -822,7 +778,17 @@ out:return total_written; } -static struct ecryptfs_attribute sysfs_attr_version_str =__ATTR_RO (version_str); +static struct subsys_attribute version_attr_str =__ATTR_RO (version_str); + +static struct attribute *attributes[] = { + &version_attr.attr, + &version_attr_str.attr, +NULL , +}; + +static struct attribute_group attr_group = { + .attrs = attributes, +};static int do_sysfs_registration (void ) {
@@ -834,23 +800,11 @@ static int do_sysfs_registration(void) "Unable to register ecryptfs sysfs subsystem\n"); goto out; } - rc =sysfs_create_file (&ecryptfs_subsys.kobj, - &sysfs_attr_version.attr); + rc =sysfs_create_group (&ecryptfs_subsys.kobj, &attr_group);if (rc) {printk (KERN_ERR -"Unable to create ecryptfs version attribute\n" ); +"Unable to create ecryptfs version attributes\n" );subsystem_unregister (&ecryptfs_subsys); - goto out; - } - rc =sysfs_create_file (&ecryptfs_subsys.kobj, - &sysfs_attr_version_str.attr); -if (rc) { -printk (KERN_ERR -"Unable to create ecryptfs version_str attribute\n" ); -sysfs_remove_file (&ecryptfs_subsys.kobj, - &sysfs_attr_version.attr); -subsystem_unregister (&ecryptfs_subsys); - goto out; } out:return rc;
@@ -858,10 +812,7 @@ out:static void do_sysfs_unregistration (void ) { -sysfs_remove_file (&ecryptfs_subsys.kobj, - &sysfs_attr_version.attr); -sysfs_remove_file (&ecryptfs_subsys.kobj, - &sysfs_attr_version_str.attr); +sysfs_remove_group (&ecryptfs_subsys.kobj, &attr_group);subsystem_unregister (&ecryptfs_subsys); }
Signature · 1 line
1.5.3.4
PATCH 2/54 KOBJECT: remove struct kobj_type from struct kset
In reply to Greg KHWe don't need a "default" ktype for a kset. We should set this explicitly every time for each kset. This change is needed so that we can make ksets dynamic, and cleans up one of the odd, undocumented assumption that the kset/kobject/ktype model has.
This patch is based on a lot of help from Kay Sievers.
--- arch/powerpc/platforms/pseries/power.c | 2 +- arch/s390/hypfs/inode.c | 4 ++-- arch/s390/kernel/ipl.c | 8 ++++---- block/genhd.c | 5 +++-- drivers/acpi/bus.c | 2 +- drivers/base/bus.c | 5 +++-- drivers/base/class.c | 8 +++++--- drivers/base/core.c | 5 +++-- drivers/base/firmware.c | 5 +++-- drivers/base/hypervisor.c | 2 +- drivers/base/sys.c | 3 ++- drivers/edac/edac_mc_sysfs.c | 2 +- drivers/firmware/edd.c | 5 +++-- drivers/firmware/efivars.c | 9 +++++---- drivers/parisc/pdc_stable.c | 9 +++++---- drivers/pci/hotplug/pci_hotplug_core.c | 7 ++++--- drivers/uio/uio.c | 2 +- fs/configfs/mount.c | 4 ++-- fs/debugfs/inode.c | 4 ++-- fs/dlm/lockspace.c | 6 ++---- fs/ecryptfs/main.c | 4 ++-- fs/fuse/inode.c | 8 ++++---- fs/gfs2/locking/dlm/sysfs.c | 6 ++---- fs/gfs2/sys.c | 6 ++---- fs/namespace.c | 2 +- fs/ocfs2/cluster/masklog.c | 2 +- fs/ocfs2/cluster/sys.c | 2 +- fs/sysfs/file.c | 4 +--- include/linux/kobject.h | 15 ++++----------- kernel/ksysfs.c | 2 +- kernel/module.c | 2 +- kernel/params.c | 9 +++++---- kernel/power/main.c | 2 +- mm/slub.c | 5 +++-- security/inode.c | 4 ++-- 35 files changed, 84 insertions(+), 86 deletions(-)
arch/powerpc/platforms/pseries/power.c +1 -1
@@ -57,7 +57,7 @@ static struct subsys_attribute auto_poweron_attr = { };#ifndef CONFIG_PM -decl_subsys (power,NULL ,NULL ); +decl_subsys (power,NULL );static struct attribute *g[] = { &auto_poweron_attr.attr,
arch/s390/hypfs/inode.c +2 -2
@@ -490,7 +490,7 @@ static struct super_operations hypfs_s_ops = { .show_options = hypfs_show_options, }; -static decl_subsys(s390, NULL, NULL); +static decl_subsys(s390, NULL);static int __init hypfs_init (void ) {
@@ -506,7 +506,7 @@ static int __init hypfs_init(void) goto fail_diag; } } -kobj_set_kset_s (&s390_subsys, hypervisor_subsys); + s390_subsys.kobj.kset = &hypervisor_subsys; rc =subsystem_register (&s390_subsys);if (rc) goto fail_sysfs;
arch/s390/kernel/ipl.c +4 -4
@@ -418,7 +418,7 @@ static struct attribute_group ipl_unknown_attr_group = { .attrs = ipl_unknown_attrs, }; -static decl_subsys(ipl, NULL, NULL); +static decl_subsys(ipl, NULL);/* * reipl section
@@ -590,7 +590,7 @@ static ssize_t reipl_type_store(struct kset *kset, const char *buf,static struct subsys_attribute reipl_type_attr =__ATTR (reipl_type,0644 , reipl_type_show, reipl_type_store); -static decl_subsys(reipl, NULL, NULL); +static decl_subsys(reipl, NULL);/* * dump section
@@ -685,13 +685,13 @@ static ssize_t dump_type_store(struct kset *kset, const char *buf,static struct subsys_attribute dump_type_attr =__ATTR (dump_type,0644 , dump_type_show, dump_type_store); -static decl_subsys(dump, NULL, NULL); +static decl_subsys(dump, NULL);/* * Shutdown actions section */ -static decl_subsys(shutdown_actions, NULL, NULL); +static decl_subsys(shutdown_actions, NULL);/* on panic */
block/genhd.c +3 -2
@@ -584,7 +584,7 @@ static struct kset_uevent_ops block_uevent_ops = { .uevent = block_uevent, }; -decl_subsys (block, &ktype_block, &block_uevent_ops); +decl_subsys (block, &block_uevent_ops);/* * aggregate disk stat collector. Uses the same stats that the sysfs
@@ -720,8 +720,9 @@ struct gendisk *alloc_disk_node(int minors, int node_id) } } disk->minors = minors; -kobj_set_kset_s (disk,block_subsys);kobject_init (&disk->kobj); + disk->kobj.kset = &block_subsys; + disk->kobj.ktype = &ktype_block;rand_initialize_disk (disk);INIT_WORK (&disk->async_notify, media_change_notify_thread);
drivers/acpi/bus.c +1 -1
@@ -744,7 +744,7 @@ static int __init acpi_bus_init(void)return -ENODEV ; } -decl_subsys (acpi,NULL ,NULL ); +decl_subsys (acpi,NULL );static int __init acpi_init (void ) {
drivers/base/bus.c +3 -2
@@ -166,7 +166,7 @@ static struct kset_uevent_ops bus_uevent_ops = { .filter = bus_uevent_filter, }; -static decl_subsys(bus, &bus_ktype, &bus_uevent_ops); +static decl_subsys(bus, &bus_uevent_ops);#ifdef CONFIG_HOTPLUG
@@ -639,6 +639,7 @@ int bus_add_driver(struct device_driver *drv)if (error) goto out_put_bus; drv->kobj.kset = &bus->drivers; + drv->kobj.ktype = &driver_ktype; error =kobject_register (&drv->kobj);if (error) goto out_put_bus;
@@ -851,6 +852,7 @@ int bus_register(struct bus_type * bus) goto out; bus->subsys.kobj.kset = &bus_subsys; + bus->subsys.kobj.ktype = &bus_ktype; retval =subsystem_register (&bus->subsys);if (retval)
@@ -868,7 +870,6 @@ int bus_register(struct bus_type * bus)kobject_set_name (&bus->drivers.kobj,"drivers" ); bus->drivers.kobj.parent = &bus->subsys.kobj; - bus->drivers.ktype = &driver_ktype; retval =kset_register (&bus->drivers);if (retval) goto bus_drivers_fail;
drivers/base/class.c +5 -3
@@ -71,7 +71,7 @@ static struct kobj_type class_ktype = { };/* Hotplug events for classes go to the class_obj subsys */ -static decl_subsys(class, &class_ktype, NULL); +static decl_subsys(class, NULL);int class_create_file (struct class * cls,const struct class_attribute * attr)
@@ -150,6 +150,7 @@ int class_register(struct class * cls)return error; cls->subsys.kobj.kset = &class_subsys; + cls->subsys.kobj.ktype = &class_ktype; error =subsystem_register (&cls->subsys);if (!error) {
@@ -452,7 +453,7 @@ static struct kset_uevent_ops class_uevent_ops = { .uevent = class_uevent, }; -static decl_subsys(class_obj, &class_device_ktype, &class_uevent_ops); +static decl_subsys(class_obj, &class_uevent_ops);static int class_device_add_attrs (struct class_device * cd)
@@ -537,7 +538,8 @@ static struct class_device_attribute class_uevent_attr =void class_device_initialize (struct class_device *class_dev) { -kobj_set_kset_s (class_dev, class_obj_subsys); + class_dev->kobj.kset = &class_obj_subsys; + class_dev->kobj.ktype = &class_device_ktype;kobject_init (&class_dev->kobj);INIT_LIST_HEAD (&class_dev->node); }
drivers/base/core.c +3 -2
@@ -405,7 +405,7 @@ static struct device_attribute devt_attr =* devices_subsys - structure to be registered with kobject core. */ -decl_subsys (devices, &device_ktype, &device_uevent_ops); +decl_subsys (devices, &device_uevent_ops);/**
@@ -525,7 +525,8 @@ static void klist_children_put(struct klist_node *n)void device_initialize (struct device *dev) { -kobj_set_kset_s (dev, devices_subsys); + dev->kobj.kset = &devices_subsys; + dev->kobj.ktype = &device_ktype;kobject_init (&dev->kobj);klist_init (&dev->klist_children, klist_children_get, klist_children_put);
drivers/base/firmware.c +3 -2
@@ -15,11 +15,12 @@#include "base.h" -static decl_subsys(firmware, NULL, NULL); +static decl_subsys(firmware, NULL);int firmware_register (struct kset *s) { -kobj_set_kset_s (s, firmware_subsys); + s->kobj.kset = &firmware_subsys; + s->kobj.ktype =NULL ;return subsystem_register (s); }
drivers/base/hypervisor.c +1 -1
@@ -11,7 +11,7 @@#include "base.h" -decl_subsys (hypervisor,NULL ,NULL ); +decl_subsys (hypervisor,NULL );EXPORT_SYMBOL_GPL (hypervisor_subsys);int __init hypervisor_init (void )
drivers/base/sys.c +2 -1
@@ -131,7 +131,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_remove_file);/* * declare system_subsys */ -static decl_subsys(system, &ktype_sysdev_class, NULL); +static decl_subsys(system, NULL);int sysdev_class_register (struct sysdev_class * cls) {
@@ -139,6 +139,7 @@ int sysdev_class_register(struct sysdev_class * cls) kobject_name(&cls->kset.kobj));INIT_LIST_HEAD (&cls->drivers); cls->kset.kobj.parent = &system_subsys.kobj; + cls->kset.kobj.ktype = &ktype_sysdev_class; cls->kset.kobj.kset = &system_subsys;return kset_register (&cls->kset); }
drivers/edac/edac_mc_sysfs.c +1 -1
@@ -744,7 +744,6 @@ static struct kobj_type ktype_mc_set_attribs = {*/ static struct kset mc_kset = { .kobj = {.ktype = &ktype_mc_set_attribs }, - .ktype = &ktype_mci, };
@@ -767,6 +766,7 @@ int edac_mc_register_sysfs_main_kobj(struct mem_ctl_info *mci)/* this instance become part of the mc_kset */ kobj_mci->kset = &mc_kset; + kobj_mci->ktype = &ktype_mci;/* set the name of the mc<id> object */ err =kobject_set_name (kobj_mci,"mc%d" , mci->mc_idx);
drivers/firmware/edd.c +3 -2
@@ -631,7 +631,7 @@ static struct kobj_type edd_ktype = { .default_attrs = def_attrs, }; -static decl_subsys(edd, &edd_ktype, NULL); +static decl_subsys(edd, NULL);/**
@@ -723,7 +723,8 @@ edd_device_register(struct edd_device *edev, int i)edd_dev_set_info (edev, i);kobject_set_name (&edev->kobj,"int13_dev%02x" ,0x80 + i); -kobj_set_kset_s (edev,edd_subsys); + edev->kobj.kset = &edd_subsys; + edev->kobj.ktype = &edd_ktype; error =kobject_register (&edev->kobj);if (!error)edd_populate_dir (edev);
drivers/firmware/efivars.c +5 -4
@@ -583,8 +583,8 @@ static struct subsys_attribute *efi_subsys_attrs[] = { NULL, /* maybe more in the future? */ }; -static decl_subsys(vars, &efivar_ktype, NULL); -static decl_subsys(efi, NULL, NULL); +static decl_subsys(vars, NULL); +static decl_subsys(efi, NULL);/* * efivar_create_sysfs_entry()
@@ -629,7 +629,8 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,efi_guid_unparse (vendor_guid, short_name +strlen (short_name));kobject_set_name (&new_efivar->kobj,"%s" , short_name); -kobj_set_kset_s (new_efivar, vars_subsys); + new_efivar->kobj.kset = &vars_subsys; + new_efivar->kobj.ktype = &efivar_ktype; i =kobject_register (&new_efivar->kobj);if (i) {kfree (short_name);
@@ -687,7 +688,7 @@ efivars_init(void) goto out_free; } -kobj_set_kset_s (&vars_subsys, efi_subsys); + vars_subsys.kobj.kset = &efi_subsys; error =subsystem_register (&vars_subsys);
drivers/parisc/pdc_stable.c +5 -4
@@ -964,8 +964,8 @@ static struct subsys_attribute *pdcs_subsys_attrs[] = { NULL, }; -static decl_subsys(paths, &ktype_pdcspath, NULL); -static decl_subsys(stable, NULL, NULL); +static decl_subsys(paths, NULL); +static decl_subsys(stable, NULL);/** * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage.
@@ -997,7 +997,8 @@ pdcs_register_pathentries(void)if ((err =kobject_set_name (&entry->kobj,"%s" , entry->name)))return err; -kobj_set_kset_s (entry, paths_subsys); + entry->kobj.kset = &paths_subsys; + entry->kobj.ktype = &ktype_pdcspath;if ((err =kobject_register (&entry->kobj)))return err;
@@ -1072,7 +1073,7 @@ pdc_stable_init(void) error =subsys_create_file (&stable_subsys, attr);/* register the paths subsys as a subsystem of stable subsys */ -kobj_set_kset_s (&paths_subsys, stable_subsys); + paths_subsys.kobj.kset = &stable_subsys;if ((rc =subsystem_register (&paths_subsys))) goto fail_subsysreg;
drivers/pci/hotplug/pci_hotplug_core.c +4 -3
@@ -96,7 +96,7 @@ static struct kobj_type hotplug_slot_ktype = { .release = &hotplug_slot_release, }; -decl_subsys_name (pci_hotplug_slots, slots, &hotplug_slot_ktype,NULL ); +decl_subsys_name (pci_hotplug_slots, slots,NULL );/* these strings match up with the values in pci_bus_speed */ static char *pci_bus_speed_strings[] = {
@@ -633,7 +633,8 @@ int pci_hp_register (struct hotplug_slot *slot) }kobject_set_name (&slot->kobj,"%s" , slot->name); -kobj_set_kset_s (slot, pci_hotplug_slots_subsys); + slot->kobj.kset = &pci_hotplug_slots_subsys; + slot->kobj.ktype = &hotplug_slot_ktype;/* this can fail if we have already registered a slot with the same name */ if (kobject_register (&slot->kobj)) {
@@ -701,7 +702,7 @@ static int __init pci_hotplug_init (void) {int result; -kobj_set_kset_s (&pci_hotplug_slots_subsys, pci_bus_type.subsys); + pci_hotplug_slots_subsys.kobj.kset = &pci_bus_type.subsys; result =subsystem_register (&pci_hotplug_slots_subsys);if (result) {err ("Register subsys with error %d\n" , result);
drivers/uio/uio.c +1 -1
@@ -160,7 +160,7 @@ static int uio_dev_add_attributes(struct uio_device *idev)if (!map_found) { map_found =1 ;kobject_set_name (&idev->map_attr_kset.kobj,"maps" ); - idev->map_attr_kset.ktype = &map_attr_type; + idev->map_attr_kset.kobj.ktype = &map_attr_type; idev->map_attr_kset.kobj.parent = &idev->dev->kobj; ret =kset_register (&idev->map_attr_kset);if (ret)
fs/configfs/mount.c +2 -2
@@ -128,7 +128,7 @@ void configfs_release_fs(void) } -static decl_subsys(config, NULL, NULL); +static decl_subsys(config, NULL);static int __init configfs_init (void ) {
@@ -140,7 +140,7 @@ static int __init configfs_init(void)if (!configfs_dir_cachep) goto out; -kobj_set_kset_s (&config_subsys, kernel_subsys); + config_subsys.kobj.kset = &kernel_subsys; err =subsystem_register (&config_subsys);if (err) {kmem_cache_destroy (configfs_dir_cachep);
fs/debugfs/inode.c +2 -2
@@ -426,13 +426,13 @@ exit: }EXPORT_SYMBOL_GPL (debugfs_rename); -static decl_subsys(debug, NULL, NULL); +static decl_subsys(debug, NULL);static int __init debugfs_init (void ) {int retval; -kobj_set_kset_s (&debug_subsys, kernel_subsys); + debug_subsys.kobj.kset = &kernel_subsys; retval =subsystem_register (&debug_subsys);if (retval)return retval;
fs/dlm/lockspace.c +2 -4
@@ -166,9 +166,7 @@ static struct kobj_type dlm_ktype = { .release = lockspace_kobj_release, }; -static struct kset dlm_kset = { - .ktype = &dlm_ktype, -}; +static struct kset dlm_kset;static int kobject_setup (struct dlm_ls *ls) {
@@ -228,7 +226,7 @@ int dlm_lockspace_init(void)spin_lock_init (&lslist_lock);kobject_set_name (&dlm_kset.kobj,"dlm" ); -kobj_set_kset_s (&dlm_kset, kernel_subsys); + dlm_kset.kobj.kset = &kernel_subsys; error =kset_register (&dlm_kset);if (error)printk ("dlm_lockspace_init: cannot register kset %d\n" , error);
fs/ecryptfs/main.c +2 -2
@@ -730,7 +730,7 @@ static int ecryptfs_init_kmem_caches(void)return 0 ; } -static decl_subsys(ecryptfs, NULL, NULL); +static decl_subsys(ecryptfs, NULL);static ssize_t version_show (struct kset *kset,char *buff) {
@@ -794,6 +794,7 @@ static int do_sysfs_registration(void) {int rc; + ecryptfs_subsys.kobj.kset = &fs_subsys; rc =subsystem_register (&ecryptfs_subsys);if (rc) { printk(KERN_ERR
@@ -841,7 +842,6 @@ static int __init ecryptfs_init(void)printk (KERN_ERR "Failed to register filesystem\n" ); goto out_free_kmem_caches; } -kobj_set_kset_s (&ecryptfs_subsys, fs_subsys); rc =do_sysfs_registration ();if (rc) {printk (KERN_ERR "sysfs registration failed\n" );
fs/fuse/inode.c +4 -4
@@ -744,8 +744,8 @@ static inline void unregister_fuseblk(void) }#endif -static decl_subsys(fuse, NULL, NULL); -static decl_subsys(connections, NULL, NULL); +static decl_subsys(fuse, NULL); +static decl_subsys(connections, NULL);static void fuse_inode_init_once (struct kmem_cache *cachep,void *foo) {
@@ -795,12 +795,12 @@ static int fuse_sysfs_init(void) {int err; -kobj_set_kset_s (&fuse_subsys, fs_subsys); + fuse_subsys.kobj.kset = &fs_subsys; err =subsystem_register (&fuse_subsys);if (err) goto out_err; -kobj_set_kset_s (&connections_subsys, fuse_subsys); + connections_subsys.kobj.kset = &fuse_subsys; err =subsystem_register (&connections_subsys);if (err) goto out_fuse_unregister;
fs/gfs2/locking/dlm/sysfs.c +2 -4
@@ -189,9 +189,7 @@ static struct kobj_type gdlm_ktype = { .sysfs_ops = &gdlm_attr_ops, }; -static struct kset gdlm_kset = { - .ktype = &gdlm_ktype, -}; +static struct kset gdlm_kset;int gdlm_kobject_setup (struct gdlm_ls *ls,struct kobject *fskobj) {
@@ -224,7 +222,7 @@ int gdlm_sysfs_init(void)int error;kobject_set_name (&gdlm_kset.kobj,"lock_dlm" ); -kobj_set_kset_s (&gdlm_kset, kernel_subsys); + gdlm_kset.kobj.kset = &kernel_subsys; error =kset_register (&gdlm_kset);if (error)printk ("lock_dlm: cannot register kset %d\n" , error);
fs/gfs2/sys.c +2 -4
@@ -221,9 +221,7 @@ static struct kobj_type gfs2_ktype = { .sysfs_ops = &gfs2_attr_ops, }; -static struct kset gfs2_kset = { - .ktype = &gfs2_ktype, -}; +static struct kset gfs2_kset;/* * display struct lm_lockstruct fields
@@ -551,7 +549,7 @@ int gfs2_sys_init(void) gfs2_sys_margs =NULL ;spin_lock_init (&gfs2_sys_margs_lock);kobject_set_name (&gfs2_kset.kobj,"gfs2" ); -kobj_set_kset_s (&gfs2_kset, fs_subsys); + gfs2_kset.kobj.kset = &fs_subsys;return kset_register (&gfs2_kset); }
fs/namespace.c +1 -1
@@ -41,7 +41,7 @@ static struct kmem_cache *mnt_cache __read_mostly;static struct rw_semaphore namespace_sem;/* /sys/fs */ -decl_subsys (fs,NULL ,NULL ); +decl_subsys (fs,NULL );EXPORT_SYMBOL_GPL (fs_subsys);static inline unsigned long hash (struct vfsmount *mnt,struct dentry *dentry)
fs/ocfs2/cluster/masklog.c +1 -1
@@ -157,7 +157,7 @@ int mlog_sys_init(struct kset *o2cb_subsys) mlog_attr_ptrs[i] =NULL ;kobject_set_name (&mlog_kset.kobj,"logmask" ); -kobj_set_kset_s (&mlog_kset, *o2cb_subsys); + mlog_kset.kobj.kset = o2cb_subsys;return kset_register (&mlog_kset); }
fs/ocfs2/cluster/sys.c +1 -1
@@ -72,7 +72,7 @@ static struct kobj_type o2cb_subsys_type = { };/* gives us o2cb_subsys */ -static decl_subsys(o2cb, NULL, NULL); +static decl_subsys(o2cb, NULL);static ssize_t o2cb_show (struct kobject * kobj,struct attribute * attr,char * buffer)
fs/sysfs/file.c +1 -3
@@ -361,9 +361,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)/* if the kobject has no ktype, then we assume that it is a subsystem * itself, and use ops for it. */ -if (kobj->kset && kobj->kset->ktype) - ops = kobj->kset->ktype->sysfs_ops; -else if (kobj->ktype) +if (kobj->ktype) ops = kobj->ktype->sysfs_ops;else ops = &subsys_sysfs_ops;
include/linux/kobject.h +4 -11
@@ -128,7 +128,6 @@ struct kset_uevent_ops {* define the attribute callbacks and other common events that happen to * a kobject. * -* @ktype: the struct kobj_type for this specific kset * @list: the list of all kobjects for this kset * @list_lock: a lock for iterating over the kobjects * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
@@ -138,7 +137,6 @@ struct kset_uevent_ops {* desired. */ struct kset { -struct kobj_type *ktype;struct list_head list;spinlock_t list_lock;struct kobject kobj;
@@ -166,12 +164,9 @@ static inline void kset_put(struct kset * k)kobject_put (&k->kobj); } -static inline struct kobj_type *get_ktype (struct kobject * k) +static inline struct kobj_type *get_ktype (struct kobject *kobj) { -if (k->kset && k->kset->ktype) -return k->kset->ktype; -else -return k->ktype; +return kobj->ktype; }extern struct kobject *kset_find_obj (struct kset *,const char *);
@@ -184,16 +179,14 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);#define set_kset_name (str) .kset = { .kobj = { .k_name = str } } -#define decl_subsys (_name,_type,_uevent_ops) \ +#define decl_subsys (_name,_uevent_ops) \ struct kset _name##_subsys = { \ .kobj = { .k_name = __stringify(_name) }, \ - .ktype = _type, \ .uevent_ops =_uevent_ops, \ } -#define decl_subsys_name (_varname,_name,_type,_uevent_ops) \ +#define decl_subsys_name (_varname,_name,_uevent_ops) \ struct kset _varname##_subsys = { \ .kobj = { .k_name = __stringify(_name) }, \ - .ktype = _type, \ .uevent_ops =_uevent_ops, \ }
kernel/ksysfs.c +1 -1
@@ -94,7 +94,7 @@ static struct bin_attribute notes_attr = { .read = ¬es_read, }; -decl_subsys (kernel,NULL ,NULL ); +decl_subsys (kernel,NULL );EXPORT_SYMBOL_GPL (kernel_subsys);static struct attribute * kernel_attrs[] = {
kernel/module.c +1 -1
@@ -1221,7 +1221,7 @@ int mod_sysfs_init(struct module *mod) err =kobject_set_name (&mod->mkobj.kobj,"%s" , mod->name);if (err) goto out; -kobj_set_kset_s (&mod->mkobj, module_subsys); + mod->mkobj.kobj.kset = &module_subsys; mod->mkobj.mod = mod;kobject_init (&mod->mkobj.kobj);
kernel/params.c +5 -4
@@ -30,6 +30,8 @@ #define DEBUGP(fmt, a...)#endif +static struct kobj_type module_ktype; +static inline char dash2underscore (char c) {if (c =='-' )
@@ -560,7 +562,8 @@ static void __init kernel_param_sysfs_setup(const char *name,BUG_ON (!mk); mk->mod =THIS_MODULE ; -kobj_set_kset_s (mk, module_subsys); + mk->kobj.kset = &module_subsys; + mk->kobj.ktype = &module_ktype;kobject_set_name (&mk->kobj, name);kobject_init (&mk->kobj); ret =kobject_add (&mk->kobj);
@@ -682,8 +685,6 @@ static struct sysfs_ops module_sysfs_ops = { .store = module_attr_store, }; -static struct kobj_type module_ktype; -static int uevent_filter (struct kset *kset,struct kobject *kobj) {struct kobj_type *ktype =get_ktype (kobj);
@@ -697,7 +698,7 @@ static struct kset_uevent_ops module_uevent_ops = { .filter = uevent_filter, }; -decl_subsys (module, &module_ktype, &module_uevent_ops); +decl_subsys (module, &module_uevent_ops);int module_sysfs_initialized;static struct kobj_type module_ktype = {
kernel/power/main.c +1 -1
@@ -273,7 +273,7 @@ EXPORT_SYMBOL(pm_suspend);#endif /* CONFIG_SUSPEND */ -decl_subsys (power,NULL ,NULL ); +decl_subsys (power,NULL );/**
mm/slub.c +3 -2
@@ -3978,7 +3978,7 @@ static struct kset_uevent_ops slab_uevent_ops = { .filter = uevent_filter, }; -static decl_subsys(slab, &slab_ktype, &slab_uevent_ops); +static decl_subsys(slab, &slab_uevent_ops);#define ID_STR_LENGTH 64
@@ -4041,8 +4041,9 @@ static int sysfs_slab_add(struct kmem_cache *s) name =create_unique_id (s); } -kobj_set_kset_s (s, slab_subsys);kobject_set_name (&s->kobj, name); + s->kobj.kset = &slab_subsys; + s->kobj.ktype = &slab_ktype;kobject_init (&s->kobj); err =kobject_add (&s->kobj);if (err)
security/inode.c +2 -2
@@ -315,13 +315,13 @@ void securityfs_remove(struct dentry *dentry) }EXPORT_SYMBOL_GPL (securityfs_remove); -static decl_subsys(security, NULL, NULL); +static decl_subsys(security, NULL);static int __init securityfs_init (void ) {int retval; -kobj_set_kset_s (&security_subsys, kernel_subsys); + security_subsys.kobj.kset = &kernel_subsys; retval =subsystem_register (&security_subsys);if (retval)return retval;
Signature · 1 line
1.5.3.4
PATCH 3/54 KOBJECT: remove kobj_set_kset_s as no one is using it anymore
In reply to Greg KHWhat a confusing name for a macro...
--- include/linux/kobject.h | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
include/linux/kobject.h +0 -18
@@ -195,24 +195,6 @@ extern struct kset kernel_subsys;/* The global /sys/hypervisor/ subsystem */ extern struct kset hypervisor_subsys; -/* -* Helpers for setting the kset of registered objects. -* Often, a registered object belongs to a kset embedded in a -* subsystem. These do no magic, just make the resulting code -* easier to follow. -*/ - -/** -* kobj_set_kset_s(obj,subsys) - set kset for embedded kobject. -* @obj: ptr to some object type. -* @subsys: a subsystem object (not a ptr). -* -* Can be used for any object type with an embedded ->kobj. -*/ - -#define kobj_set_kset_s (obj,subsys) \ - (obj)->kobj.kset = &(subsys) -extern int __must_check subsystem_register (struct kset *);extern void subsystem_unregister (struct kset *);
Signature · 1 line
1.5.3.4
PATCH 4/54 kset: add kset_create_and_register function
In reply to Greg KHNow ksets can be dynamically created on the fly, no static definitions are required. Thanks to Miklos for hints on how to make this work better for the callers.
And thanks to Kay for finding some stupid bugs in my original version.
--- include/linux/kobject.h | 5 ++- lib/kobject.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletions(-)
include/linux/kobject.h +4 -1
@@ -143,11 +143,14 @@ struct kset {struct kset_uevent_ops *uevent_ops; }; -extern void kset_init (struct kset * k);extern int __must_check kset_add (struct kset * k);extern int __must_check kset_register (struct kset * k);extern void kset_unregister (struct kset * k); +extern struct kset *__must_check kset_create_and_register (const char *name, +struct kset_uevent_ops *u, +struct kobject *parent_kobj, +struct kset *parent_kset);static inline struct kset *to_kset (struct kobject * kobj) {
lib/kobject.c +91 -0
103 lines not on this page · raw message
Signature · 1 line
1.5.3.4
PATCH 5/54 kset: convert fuse to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/fuse/inode.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
fs/fuse/inode.c +15 -12
@@ -744,9 +744,6 @@ static inline void unregister_fuseblk(void) }#endif -static decl_subsys(fuse, NULL); -static decl_subsys(connections, NULL); -static void fuse_inode_init_once (struct kmem_cache *cachep,void *foo) {struct inode * inode = foo;
@@ -791,32 +788,38 @@ static void fuse_fs_cleanup(void)kmem_cache_destroy (fuse_inode_cachep); } +static struct kset *fuse_kset; +static struct kset *connections_kset; +static int fuse_sysfs_init (void ) {int err; - fuse_subsys.kobj.kset = &fs_subsys; - err =subsystem_register (&fuse_subsys); -if (err) + fuse_kset =kset_create_and_register ("fuse" ,NULL ,NULL , &fs_subsys); +if (IS_ERR (fuse_kset)) { + err =PTR_ERR (fuse_kset); goto out_err; + } - connections_subsys.kobj.kset = &fuse_subsys; - err =subsystem_register (&connections_subsys); -if (err) + connections_kset =kset_create_and_register ("connections" ,NULL , +NULL , fuse_kset); +if (IS_ERR (connections_kset)) { + err =PTR_ERR (connections_kset); goto out_fuse_unregister; + }return 0 ; out_fuse_unregister: -subsystem_unregister (&fuse_subsys); +kset_unregister (fuse_kset); out_err:return err; }static void fuse_sysfs_cleanup (void ) { -subsystem_unregister (&connections_subsys); -subsystem_unregister (&fuse_subsys); +kset_unregister (connections_kset); +kset_unregister (fuse_kset); }static int __init fuse_init (void )
Signature · 1 line
1.5.3.4
PATCH 6/54 kset: convert securityfs to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- security/inode.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
security/inode.c +6 -6
@@ -315,20 +315,20 @@ void securityfs_remove(struct dentry *dentry) }EXPORT_SYMBOL_GPL (securityfs_remove); -static decl_subsys(security, NULL); +static struct kset *security_kset;static int __init securityfs_init (void ) {int retval; - security_subsys.kobj.kset = &kernel_subsys; - retval =subsystem_register (&security_subsys); -if (retval) -return retval; + security_kset =kset_create_and_register ("security" ,NULL ,NULL , + &kernel_subsys); +if (IS_ERR (security_kset)) +return PTR_ERR (security_kset); retval =register_filesystem (&fs_type);if (retval) -subsystem_unregister (&security_subsys); +kset_unregister (security_kset);return retval; }
Signature · 1 line
1.5.3.4
PATCH 7/54 kset: convert debugfs to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/debugfs/inode.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
fs/debugfs/inode.c +7 -7
@@ -426,20 +426,20 @@ exit: }EXPORT_SYMBOL_GPL (debugfs_rename); -static decl_subsys(debug, NULL); +static struct kset *debug_kset;static int __init debugfs_init (void ) {int retval; - debug_subsys.kobj.kset = &kernel_subsys; - retval =subsystem_register (&debug_subsys); -if (retval) -return retval; + debug_kset =kset_create_and_register ("debug" ,NULL , +NULL , &kernel_subsys); +if (IS_ERR (debug_kset)) +return PTR_ERR (debug_kset); retval =register_filesystem (&debug_fs_type);if (retval) -subsystem_unregister (&debug_subsys); +kset_unregister (debug_kset);return retval; }
@@ -447,7 +447,7 @@ static void __exit debugfs_exit(void) {simple_release_fs (&debugfs_mount, &debugfs_mount_count);unregister_filesystem (&debug_fs_type); -subsystem_unregister (&debug_subsys); +kset_unregister (debug_kset); }core_initcall (debugfs_init);
Signature · 1 line
1.5.3.4
PATCH 8/54 kset: convert configfs to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/configfs/mount.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
fs/configfs/mount.c +7 -7
@@ -128,7 +128,7 @@ void configfs_release_fs(void) } -static decl_subsys(config, NULL); +static struct kset *config_kset;static int __init configfs_init (void ) {
@@ -140,9 +140,9 @@ static int __init configfs_init(void)if (!configfs_dir_cachep) goto out; - config_subsys.kobj.kset = &kernel_subsys; - err =subsystem_register (&config_subsys); -if (err) { + config_kset =kset_create_and_register ("config" ,NULL , +NULL , &kernel_subsys); +if (IS_ERR (config_kset)) {kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ; goto out;
@@ -151,7 +151,7 @@ static int __init configfs_init(void) err =register_filesystem (&configfs_fs_type);if (err) {printk (KERN_ERR "configfs: Unable to register filesystem!\n" ); -subsystem_unregister (&config_subsys); +kset_unregister (config_kset);kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ; goto out;
@@ -160,7 +160,7 @@ static int __init configfs_init(void) err =configfs_inode_init ();if (err) {unregister_filesystem (&configfs_fs_type); -subsystem_unregister (&config_subsys); +kset_unregister (config_kset);kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ; }
@@ -171,7 +171,7 @@ out: static void __exit configfs_exit(void) {unregister_filesystem (&configfs_fs_type); -subsystem_unregister (&config_subsys); +kset_unregister (config_kset);kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ;configfs_inode_exit ();
Signature · 1 line
1.5.3.4
PATCH 9/54 kset: convert ecryptfs to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/ecryptfs/main.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
fs/ecryptfs/main.c +10 -10
@@ -730,7 +730,7 @@ static int ecryptfs_init_kmem_caches(void)return 0 ; } -static decl_subsys(ecryptfs, NULL); +static struct kset *ecryptfs_kset;static ssize_t version_show (struct kset *kset,char *buff) {
@@ -794,18 +794,18 @@ static int do_sysfs_registration(void) {int rc; - ecryptfs_subsys.kobj.kset = &fs_subsys; - rc =subsystem_register (&ecryptfs_subsys); -if (rc) { -printk (KERN_ERR -"Unable to register ecryptfs sysfs subsystem\n" ); + ecryptfs_kset =kset_create_and_register ("ecryptfs" ,NULL , +NULL , &fs_subsys); +if (IS_ERR (ecryptfs_kset)) { +printk (KERN_ERR "Unable to create ecryptfs kset\n" ); + rc =PTR_ERR (ecryptfs_kset); goto out; } - rc =sysfs_create_group (&ecryptfs_subsys.kobj, &attr_group); + rc =sysfs_create_group (&ecryptfs_kset->kobj, &attr_group);if (rc) {printk (KERN_ERR "Unable to create ecryptfs version attributes\n" ); -subsystem_unregister (&ecryptfs_subsys); +subsystem_unregister (ecryptfs_kset); } out:return rc;
@@ -813,8 +813,8 @@ out:static void do_sysfs_unregistration (void ) { -sysfs_remove_group (&ecryptfs_subsys.kobj, &attr_group); -subsystem_unregister (&ecryptfs_subsys); +sysfs_remove_group (&ecryptfs_kset->kobj, &attr_group); +subsystem_unregister (ecryptfs_kset); }static int __init ecryptfs_init (void )
Signature · 1 line
1.5.3.4
PATCH 10/54 kset: convert main fs kset to use kset_create
In reply to Greg KHThis also renames fs_subsys to fs_kset to catch all current users with a build error instead of a build warning which can easily be missed.
--- fs/ecryptfs/main.c | 2 +- fs/fuse/inode.c | 2 +- fs/gfs2/sys.c | 2 +- fs/namespace.c | 14 ++++++++------ include/linux/fs.h | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-)
fs/ecryptfs/main.c +1 -1
@@ -795,7 +795,7 @@ static int do_sysfs_registration(void)int rc; ecryptfs_kset =kset_create_and_register ("ecryptfs" ,NULL , -NULL , &fs_subsys); +NULL , fs_kset);if (IS_ERR (ecryptfs_kset)) {printk (KERN_ERR "Unable to create ecryptfs kset\n" ); rc =PTR_ERR (ecryptfs_kset);
fs/fuse/inode.c +1 -1
@@ -795,7 +795,7 @@ static int fuse_sysfs_init(void) {int err; - fuse_kset =kset_create_and_register ("fuse" ,NULL ,NULL , &fs_subsys); + fuse_kset =kset_create_and_register ("fuse" ,NULL ,NULL , fs_kset);if (IS_ERR (fuse_kset)) { err =PTR_ERR (fuse_kset); goto out_err;
fs/gfs2/sys.c +1 -1
@@ -549,7 +549,7 @@ int gfs2_sys_init(void) gfs2_sys_margs =NULL ;spin_lock_init (&gfs2_sys_margs_lock);kobject_set_name (&gfs2_kset.kobj,"gfs2" ); - gfs2_kset.kobj.kset = &fs_subsys; + gfs2_kset.kobj.kset = fs_kset;return kset_register (&gfs2_kset); }
fs/namespace.c +8 -6
@@ -41,8 +41,8 @@ static struct kmem_cache *mnt_cache __read_mostly;static struct rw_semaphore namespace_sem;/* /sys/fs */ -decl_subsys (fs,NULL ); -EXPORT_SYMBOL_GPL (fs_subsys); +struct kset *fs_kset; +EXPORT_SYMBOL_GPL (fs_kset);static inline unsigned long hash (struct vfsmount *mnt,struct dentry *dentry) {
@@ -1861,10 +1861,12 @@ void __init mnt_init(void)if (err)printk (KERN_WARNING "%s: sysfs_init error: %d\n" , __FUNCTION__, err); - err =subsystem_register (&fs_subsys); -if (err) -printk (KERN_WARNING "%s: subsystem_register error: %d\n" , - __FUNCTION__, err); + fs_kset =kset_create_and_register ("fs" ,NULL ,NULL ,NULL ); +if (IS_ERR (fs_kset)) { +printk (KERN_WARNING "%s: kset create error: %d\n" , + __FUNCTION__, (int )PTR_ERR (fs_kset)); + fs_kset =NULL ; + }init_rootfs ();init_mount_tree (); }
include/linux/fs.h +1 -1
@@ -1476,7 +1476,7 @@ extern void drop_collected_mounts(struct vfsmount *);extern int vfs_statfs (struct dentry *,struct kstatfs *);/* /sys/fs */ -extern struct kset fs_subsys; +extern struct kset *fs_kset;#define FLOCK_VERIFY_READ 1#define FLOCK_VERIFY_WRITE 2
Signature · 1 line
1.5.3.4
PATCH 11/54 kset: convert gfs2 to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/gfs2/sys.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
fs/gfs2/sys.c +7 -6
@@ -221,7 +221,7 @@ static struct kobj_type gfs2_ktype = { .sysfs_ops = &gfs2_attr_ops, }; -static struct kset gfs2_kset; +static struct kset *gfs2_kset;/* * display struct lm_lockstruct fields
@@ -493,7 +493,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) {int error; - sdp->sd_kobj.kset = &gfs2_kset; + sdp->sd_kobj.kset = gfs2_kset; sdp->sd_kobj.ktype = &gfs2_ktype; error =kobject_set_name (&sdp->sd_kobj,"%s" , sdp->sd_table_name);
@@ -548,14 +548,15 @@ int gfs2_sys_init(void) { gfs2_sys_margs =NULL ;spin_lock_init (&gfs2_sys_margs_lock); -kobject_set_name (&gfs2_kset.kobj,"gfs2" ); - gfs2_kset.kobj.kset = fs_kset; -return kset_register (&gfs2_kset); + gfs2_kset =kset_create_and_register ("gfs2" ,NULL ,NULL , fs_kset); +if (IS_ERR (gfs2_kset)) +return PTR_ERR (gfs2_kset); +return 0 ; }void gfs2_sys_uninit (void ) {kfree (gfs2_sys_margs); -kset_unregister (&gfs2_kset); +kset_unregister (gfs2_kset); }
Signature · 1 line
1.5.3.4
PATCH 12/54 kset: convert gfs2 dlm to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/gfs2/locking/dlm/sysfs.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-)
fs/gfs2/locking/dlm/sysfs.c +12 -10
@@ -189,7 +189,7 @@ static struct kobj_type gdlm_ktype = { .sysfs_ops = &gdlm_attr_ops, }; -static struct kset gdlm_kset; +static struct kset *gdlm_kset;int gdlm_kobject_setup (struct gdlm_ls *ls,struct kobject *fskobj) {
@@ -201,7 +201,7 @@ int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)return error; } - ls->kobj.kset = &gdlm_kset; + ls->kobj.kset = gdlm_kset; ls->kobj.ktype = &gdlm_ktype; ls->kobj.parent = fskobj;
@@ -221,17 +221,19 @@ int gdlm_sysfs_init(void) {int error; -kobject_set_name (&gdlm_kset.kobj,"lock_dlm" ); - gdlm_kset.kobj.kset = &kernel_subsys; - error =kset_register (&gdlm_kset); -if (error) -printk ("lock_dlm: cannot register kset %d\n" , error); - -return error; + gdlm_kset =kset_create_and_register ("lock_dlm" ,NULL , +NULL , &kernel_subsys); +if (IS_ERR (gdlm_kset)) { + error =PTR_ERR (gdlm_kset); +printk (KERN_WARNING "%s: can not create kset %d\n" , + __FUNCTION__, error); +return error; + } +return 0 ; }void gdlm_sysfs_exit (void ) { -kset_unregister (&gdlm_kset); +kset_unregister (gdlm_kset); }
Signature · 1 line
1.5.3.4
PATCH 13/54 kset: convert dlm to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- fs/dlm/lockspace.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
fs/dlm/lockspace.c +11 -9
@@ -166,7 +166,7 @@ static struct kobj_type dlm_ktype = { .release = lockspace_kobj_release, }; -static struct kset dlm_kset; +static struct kset *dlm_kset;static int kobject_setup (struct dlm_ls *ls) {
@@ -180,7 +180,7 @@ static int kobject_setup(struct dlm_ls *ls)if (error)return error; - ls->ls_kobj.kset = &dlm_kset; + ls->ls_kobj.kset = dlm_kset; ls->ls_kobj.ktype = &dlm_ktype;return 0 ; }
@@ -225,17 +225,19 @@ int dlm_lockspace_init(void)INIT_LIST_HEAD (&lslist);spin_lock_init (&lslist_lock); -kobject_set_name (&dlm_kset.kobj,"dlm" ); - dlm_kset.kobj.kset = &kernel_subsys; - error =kset_register (&dlm_kset); -if (error) -printk ("dlm_lockspace_init: cannot register kset %d\n" , error); -return error; + dlm_kset =kset_create_and_register ("dlm" ,NULL ,NULL , &kernel_subsys); +if (IS_ERR (dlm_kset)) { + error =PTR_ERR (dlm_kset); +printk (KERN_WARNING "%s: can not create kset %d\n" , + __FUNCTION__, error); +return error; + } +return 0 ; }void dlm_lockspace_exit (void ) { -kset_unregister (&dlm_kset); +kset_unregister (dlm_kset); }static int dlm_scand (void *data)
Signature · 1 line
1.5.3.4
PATCH 14/54 kset: convert pci hotplug to use kset_create_and_register
In reply to Greg KHThis also renames pci_hotplug_slots_subsys to pcis_hotplug_slots_kset catch all current users with a build error instead of a build warning which can easily be missed.
--- drivers/pci/hotplug/acpiphp_ibm.c | 4 ++-- drivers/pci/hotplug/pci_hotplug_core.c | 21 ++++++++++----------- drivers/pci/hotplug/rpadlpar_sysfs.c | 2 +- include/linux/pci_hotplug.h | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-)
drivers/pci/hotplug/acpiphp_ibm.c +2 -2
@@ -428,7 +428,7 @@ static int __init ibm_acpiphp_init(void)int retval =0 ;acpi_status status;struct acpi_device *device; -struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj; +struct kobject *sysdir = &pci_hotplug_slots_kset->kobj;dbg ("%s\n" , __FUNCTION__);
@@ -475,7 +475,7 @@ init_return: static void __exit ibm_acpiphp_exit(void) {acpi_status status; -struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj; +struct kobject *sysdir = &pci_hotplug_slots_kset->kobj;dbg ("%s\n" , __FUNCTION__);
drivers/pci/hotplug/pci_hotplug_core.c +10 -11
@@ -61,7 +61,7 @@ static int debug;static LIST_HEAD (pci_hotplug_slot_list); -struct kset pci_hotplug_slots_subsys; +struct kset *pci_hotplug_slots_kset;static ssize_t hotplug_slot_attr_show (struct kobject *kobj,struct attribute *attr,char *buf)
@@ -96,8 +96,6 @@ static struct kobj_type hotplug_slot_ktype = { .release = &hotplug_slot_release, }; -decl_subsys_name (pci_hotplug_slots, slots,NULL ); -/* these strings match up with the values in pci_bus_speed */ static char *pci_bus_speed_strings[] = {"33 MHz PCI" ,/* 0x00 */
@@ -633,7 +631,7 @@ int pci_hp_register (struct hotplug_slot *slot) }kobject_set_name (&slot->kobj,"%s" , slot->name); - slot->kobj.kset = &pci_hotplug_slots_subsys; + slot->kobj.kset = pci_hotplug_slots_kset; slot->kobj.ktype = &hotplug_slot_ktype;/* this can fail if we have already registered a slot with the same name */
@@ -702,9 +700,10 @@ static int __init pci_hotplug_init (void) {int result; - pci_hotplug_slots_subsys.kobj.kset = &pci_bus_type.subsys; - result =subsystem_register (&pci_hotplug_slots_subsys); -if (result) { + pci_hotplug_slots_kset =kset_create_and_register ("slots" ,NULL ,NULL , + &pci_bus_type.subsys); +if (IS_ERR (pci_hotplug_slots_kset)) { + result =PTR_ERR (pci_hotplug_slots_kset);err ("Register subsys with error %d\n" , result); goto exit; }
@@ -716,9 +715,9 @@ static int __init pci_hotplug_init (void)info (DRIVER_DESC " version: " DRIVER_VERSION "\n" ); goto exit; - + err_subsys: -subsystem_unregister (&pci_hotplug_slots_subsys); +kset_unregister (pci_hotplug_slots_kset); exit:return result; }
@@ -726,7 +725,7 @@ exit: static void __exit pci_hotplug_exit (void) {cpci_hotplug_exit (); -subsystem_unregister (&pci_hotplug_slots_subsys); +kset_unregister (pci_hotplug_slots_kset); }module_init (pci_hotplug_init);
@@ -738,7 +737,7 @@ MODULE_LICENSE("GPL");module_param (debug, bool,0644 );MODULE_PARM_DESC (debug,"Debugging mode enabled or not" ); -EXPORT_SYMBOL_GPL (pci_hotplug_slots_subsys); +EXPORT_SYMBOL_GPL (pci_hotplug_slots_kset);EXPORT_SYMBOL_GPL (pci_hp_register);EXPORT_SYMBOL_GPL (pci_hp_deregister);EXPORT_SYMBOL_GPL (pci_hp_change_slot_info);
drivers/pci/hotplug/rpadlpar_sysfs.c +1 -1
@@ -130,7 +130,7 @@ struct kobj_type ktype_dlpar_io = {struct kset dlpar_io_kset = { .kobj = {.ktype = &ktype_dlpar_io, - .parent = &pci_hotplug_slots_subsys.kobj}, + .parent = &pci_hotplug_slots_kset->kobj}, .ktype = &ktype_dlpar_io, };
include/linux/pci_hotplug.h +1 -1
@@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);extern int pci_hp_deregister (struct hotplug_slot *slot);extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,struct hotplug_slot_info *info); -extern struct kset pci_hotplug_slots_subsys; +extern struct kset *pci_hotplug_slots_kset;/* PCI Setting Record (Type 0) */ struct hpp_type0 {
Signature · 1 line
1.5.3.4
PATCH 15/54 kset: remove decl_subsys_name
In reply to Greg KHThe last user of this macro (pci hotplug core) is now switched over to using a dynamic kset, so this macro is no longer needed at all.
--- include/linux/kobject.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
include/linux/kobject.h +0 -5
@@ -187,11 +187,6 @@ struct kset _name##_subsys = { \ .kobj = { .k_name = __stringify(_name) }, \ .uevent_ops =_uevent_ops, \ } -#define decl_subsys_name (_varname,_name,_uevent_ops) \ -struct kset _varname##_subsys = { \ - .kobj = { .k_name = __stringify(_name) }, \ - .uevent_ops =_uevent_ops, \ -}/* The global /sys/kernel/ subsystem for people to chain off of */ extern struct kset kernel_subsys;
Signature · 1 line
1.5.3.4
PATCH 16/54 kset: convert kernel_subsys to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. We also rename kernel_subsys to kernel_kset to catch all users of this symbol with a build error instead of an easy-to-ignore build warning.
--- fs/configfs/mount.c | 2 +- fs/debugfs/inode.c | 2 +- fs/dlm/lockspace.c | 2 +- fs/gfs2/locking/dlm/sysfs.c | 2 +- include/linux/kobject.h | 4 ++-- kernel/ksysfs.c | 43 +++++++++++++++++++++++++++++++------------ kernel/user.c | 4 ++-- security/inode.c | 2 +- 8 files changed, 40 insertions(+), 21 deletions(-)
fs/configfs/mount.c +1 -1
@@ -141,7 +141,7 @@ static int __init configfs_init(void) goto out; config_kset =kset_create_and_register ("config" ,NULL , -NULL , &kernel_subsys); +NULL , kernel_kset);if (IS_ERR (config_kset)) {kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ;
fs/debugfs/inode.c +1 -1
@@ -433,7 +433,7 @@ static int __init debugfs_init(void)int retval; debug_kset =kset_create_and_register ("debug" ,NULL , -NULL , &kernel_subsys); +NULL , kernel_kset);if (IS_ERR (debug_kset))return PTR_ERR (debug_kset);
fs/dlm/lockspace.c +1 -1
@@ -225,7 +225,7 @@ int dlm_lockspace_init(void)INIT_LIST_HEAD (&lslist);spin_lock_init (&lslist_lock); - dlm_kset =kset_create_and_register ("dlm" ,NULL ,NULL , &kernel_subsys); + dlm_kset =kset_create_and_register ("dlm" ,NULL ,NULL , kernel_kset);if (IS_ERR (dlm_kset)) { error =PTR_ERR (dlm_kset); printk(KERN_WARNING "%s: can not create kset %d\n",
fs/gfs2/locking/dlm/sysfs.c +1 -1
@@ -222,7 +222,7 @@ int gdlm_sysfs_init(void)int error; gdlm_kset =kset_create_and_register ("lock_dlm" ,NULL , -NULL , &kernel_subsys); +NULL , kernel_kset);if (IS_ERR (gdlm_kset)) { error =PTR_ERR (gdlm_kset); printk(KERN_WARNING "%s: can not create kset %d\n",
include/linux/kobject.h +2 -2
@@ -188,8 +188,8 @@ struct kset _name##_subsys = { \ .uevent_ops =_uevent_ops, \ } -/* The global /sys/kernel/ subsystem for people to chain off of */ -extern struct kset kernel_subsys; +/* The global /sys/kernel/ kset for people to chain off of */ +extern struct kset *kernel_kset;/* The global /sys/hypervisor/ subsystem */ extern struct kset hypervisor_subsys;
kernel/ksysfs.c +31 -12
69 lines not on this page · raw message
kernel/user.c +2 -2
@@ -198,8 +198,8 @@ int __init uids_kobject_init(void)int error;/* create under /sys/kernel dir */ - uids_kobject.parent = &kernel_subsys.kobj; - uids_kobject.kset = &kernel_subsys; + uids_kobject.parent = &kernel_kset->kobj; + uids_kobject.kset = kernel_kset;kobject_set_name (&uids_kobject,"uids" );kobject_init (&uids_kobject);
security/inode.c +1 -1
@@ -322,7 +322,7 @@ static int __init securityfs_init(void)int retval; security_kset =kset_create_and_register ("security" ,NULL ,NULL , - &kernel_subsys); + kernel_kset);if (IS_ERR (security_kset))return PTR_ERR (security_kset);
Signature · 1 line
1.5.3.4
PATCH 17/54 kset: convert drivers/base/bus.c kset_create_and_register
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/base/bus.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
drivers/base/bus.c +9 -4
@@ -13,6 +13,7 @@#include <linux/errno.h> #include <linux/init.h> #include <linux/string.h> +#include <linux/err.h> #include "base.h" #include "power/power.h"
@@ -166,7 +167,7 @@ static struct kset_uevent_ops bus_uevent_ops = { .filter = bus_uevent_filter, }; -static decl_subsys(bus, &bus_uevent_ops); +static struct kset *bus_kset;#ifdef CONFIG_HOTPLUG
@@ -767,7 +768,7 @@ EXPORT_SYMBOL_GPL(device_reprobe);#if 0 struct bus_type *find_bus (char * name) { -struct kobject * k =kset_find_obj (&bus_subsys.kset, name); +struct kobject * k =kset_find_obj (bus_kset, name);return k ?to_bus (k) :NULL ; }#endif /* 0 */
@@ -851,7 +852,7 @@ int bus_register(struct bus_type * bus)if (retval) goto out; - bus->subsys.kobj.kset = &bus_subsys; + bus->subsys.kobj.kset = bus_kset; bus->subsys.kobj.ktype = &bus_ktype; retval =subsystem_register (&bus->subsys);
@@ -935,7 +936,11 @@ EXPORT_SYMBOL_GPL(bus_unregister_notifier);int __init buses_init (void ) { -return subsystem_register (&bus_subsys); + bus_kset =kset_create_and_register ("bus" , &bus_uevent_ops, +NULL ,NULL ); +if (IS_ERR (bus_kset)) +return PTR_ERR (bus_kset); +return 0 ; }
Signature · 1 line
1.5.3.4
PATCH 18/54 kset: convert drivers/base/class.c kset_create_and_register
In reply to Greg KHDynamically create the kset instead of declaring it statically.
The class_obj subsystem is not yet converted as it is more complex and should be going away soon with the removal of class_device from the kernel tree.
--- drivers/base/class.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/base/class.c +5 -7
@@ -71,7 +71,7 @@ static struct kobj_type class_ktype = { };/* Hotplug events for classes go to the class_obj subsys */ -static decl_subsys(class, NULL); +static struct kset *class_kset;int class_create_file (struct class * cls,const struct class_attribute * attr)
@@ -149,7 +149,7 @@ int class_register(struct class * cls)if (error)return error; - cls->subsys.kobj.kset = &class_subsys; + cls->subsys.kobj.kset = class_kset; cls->subsys.kobj.ktype = &class_ktype; error =subsystem_register (&cls->subsys);
@@ -855,11 +855,9 @@ void class_interface_unregister(struct class_interface *class_intf)int __init classes_init (void ) { -int retval; - - retval =subsystem_register (&class_subsys); -if (retval) -return retval; + class_kset =kset_create_and_register ("class" ,NULL ,NULL ,NULL ); +if (IS_ERR (class_kset)) +return PTR_ERR (class_kset);/* ick, this is ugly, the things we go through to keep from showing up * in sysfs... */
Signature · 1 line
1.5.3.4
PATCH 19/54 kset: convert drivers/base/firmware.c kset_create_and_register
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/base/firmware.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/base/firmware.c +7 -3
@@ -11,15 +11,16 @@#include <linux/kobject.h> #include <linux/module.h> #include <linux/init.h> +#include <linux/err.h> #include <linux/device.h> #include "base.h" -static decl_subsys(firmware, NULL); +static struct kset *firmware_kset;int firmware_register (struct kset *s) { - s->kobj.kset = &firmware_subsys; + s->kobj.kset = firmware_kset; s->kobj.ktype =NULL ;return subsystem_register (s); }
@@ -31,7 +32,10 @@ void firmware_unregister(struct kset *s)int __init firmware_init (void ) { -return subsystem_register (&firmware_subsys); + firmware_kset =kset_create_and_register ("firmware" ,NULL ,NULL ,NULL ); +if (IS_ERR (firmware_kset)) +return PTR_ERR (firmware_kset); +return 0 ; }EXPORT_SYMBOL_GPL (firmware_register);
Signature · 1 line
1.5.3.4
PATCH 20/54 kset: convert /sys/devices to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable.
--- drivers/base/base.h | 2 +- drivers/base/core.c | 17 +++++++++-------- drivers/base/power/shutdown.c | 2 +- drivers/base/sys.c | 4 +--- 4 files changed, 12 insertions(+), 13 deletions(-)
drivers/base/base.h +1 -1
@@ -44,4 +44,4 @@ extern char *make_class_name(const char *name, struct kobject *kobj);extern int devres_release_all (struct device *dev); -extern struct kset devices_subsys; +extern struct kset *devices_kset;
drivers/base/core.c +9 -8
@@ -401,11 +401,8 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr,static struct device_attribute devt_attr =__ATTR (dev,S_IRUGO , show_dev,NULL ); -/* -* devices_subsys - structure to be registered with kobject core. -*/ - -decl_subsys (devices, &device_uevent_ops); +/* kset to create /sys/devices/ */ +struct kset *devices_kset;/**
@@ -525,7 +522,7 @@ static void klist_children_put(struct klist_node *n)void device_initialize (struct device *dev) { - dev->kobj.kset = &devices_subsys; + dev->kobj.kset = devices_kset; dev->kobj.ktype = &device_ktype;kobject_init (&dev->kobj); klist_init(&dev->klist_children, klist_children_get,
@@ -562,7 +559,7 @@ static struct kobject *virtual_device_parent(struct device *dev)static struct kobject *virtual_dir =NULL ;if (!virtual_dir) - virtual_dir =kobject_add_dir (&devices_subsys.kobj,"virtual" ); + virtual_dir =kobject_add_dir (&devices_kset->kobj,"virtual" );return virtual_dir; }
@@ -1072,7 +1069,11 @@ struct device * device_find_child(struct device *parent, void *data,int __init devices_init (void ) { -return subsystem_register (&devices_subsys); + devices_kset =kset_create_and_register ("devices" , &device_uevent_ops, +NULL ,NULL ); +if (IS_ERR (devices_kset)) +return PTR_ERR (devices_kset); +return 0 ; }EXPORT_SYMBOL_GPL (device_for_each_child);
drivers/base/power/shutdown.c +1 -1
@@ -34,7 +34,7 @@ void device_shutdown(void) {struct device * dev, *devn; -list_for_each_entry_safe_reverse (dev, devn, &devices_subsys.list, +list_for_each_entry_safe_reverse (dev, devn, &devices_kset->list, kobj.entry) {if (dev->bus && dev->bus->shutdown) {dev_dbg (dev,"shutdown\n" );
drivers/base/sys.c +1 -3
@@ -25,8 +25,6 @@#include "base.h" -extern struct kset devices_subsys; -#define to_sysdev (k) container_of(k, struct sys_device, kobj)#define to_sysdev_attr (a) container_of(a, struct sysdev_attribute, attr)
@@ -459,7 +457,7 @@ int sysdev_resume(void)int __init system_bus_init (void ) { - system_subsys.kobj.parent = &devices_subsys.kobj; + system_subsys.kobj.parent = &devices_kset->kobj;return subsystem_register (&system_subsys); }
Signature · 1 line
1.5.3.4
PATCH 21/54 kset: convert /sys/hypervisor to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. We also rename hypervisor_subsys to hypervisor_kset to catch all users of the variable.
--- arch/s390/hypfs/inode.c | 2 +- drivers/base/hypervisor.c | 14 ++++++++++---- include/linux/kobject.h | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-)
arch/s390/hypfs/inode.c +1 -1
@@ -506,7 +506,7 @@ static int __init hypfs_init(void) goto fail_diag; } } - s390_subsys.kobj.kset = &hypervisor_subsys; + s390_subsys.kobj.kset = hypervisor_kset; rc =subsystem_register (&s390_subsys);if (rc) goto fail_sysfs;
drivers/base/hypervisor.c +10 -4
@@ -2,19 +2,25 @@* hypervisor.c - /sys/hypervisor subsystem. * * Copyright (C) IBM Corp. 2006 +* Copyright (C) 2007 Greg Kroah-Hartman <[email protected]> +* Copyright (C) 2007 Novell Inc. * * This file is released under the GPLv2 */ #include <linux/kobject.h> #include <linux/device.h> - +#include <linux/err.h> #include "base.h" -decl_subsys (hypervisor,NULL ); -EXPORT_SYMBOL_GPL (hypervisor_subsys); +struct kset *hypervisor_kset; +EXPORT_SYMBOL_GPL (hypervisor_kset);int __init hypervisor_init (void ) { -return subsystem_register (&hypervisor_subsys); + hypervisor_kset =kset_create_and_register ("hypervisor" ,NULL , +NULL ,NULL ); +if (IS_ERR (hypervisor_kset)) +return PTR_ERR (hypervisor_kset); +return 0 ; }
include/linux/kobject.h +2 -2
@@ -190,8 +190,8 @@ struct kset _name##_subsys = { \/* The global /sys/kernel/ kset for people to chain off of */ extern struct kset *kernel_kset; -/* The global /sys/hypervisor/ subsystem */ -extern struct kset hypervisor_subsys; +/* The global /sys/hypervisor/ kset for people to chain off of */ +extern struct kset *hypervisor_kset;extern int __must_check subsystem_register (struct kset *);extern void subsystem_unregister (struct kset *);
Signature · 1 line
1.5.3.4
PATCH 22/54 kset: convert /sys/devices/system to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/base/sys.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-)
drivers/base/sys.c +12 -16
@@ -126,19 +126,16 @@ void sysdev_class_remove_file(struct sysdev_class *c, }EXPORT_SYMBOL_GPL (sysdev_class_remove_file); -/* -* declare system_subsys -*/ -static decl_subsys(system, NULL); +static struct kset *system_kset;int sysdev_class_register (struct sysdev_class * cls) {pr_debug ("Registering sysdev class '%s'\n" ,kobject_name (&cls->kset.kobj));INIT_LIST_HEAD (&cls->drivers); - cls->kset.kobj.parent = &system_subsys.kobj; + cls->kset.kobj.parent = &system_kset->kobj; cls->kset.kobj.ktype = &ktype_sysdev_class; - cls->kset.kobj.kset = &system_subsys; + cls->kset.kobj.kset = system_kset;return kset_register (&cls->kset); }
@@ -297,8 +294,7 @@ void sysdev_shutdown(void)pr_debug ("Shutting Down System Devices\n" );mutex_lock (&sysdev_drivers_lock); -list_for_each_entry_reverse (cls, &system_subsys.list, - kset.kobj.entry) { +list_for_each_entry_reverse (cls, &system_kset->list, kset.kobj.entry) {struct sys_device * sysdev; pr_debug("Shutting down type '%s':\n",
@@ -360,9 +356,7 @@ int sysdev_suspend(pm_message_t state)pr_debug ("Suspending System Devices\n" ); -list_for_each_entry_reverse (cls, &system_subsys.list, - kset.kobj.entry) { - +list_for_each_entry_reverse (cls, &system_kset->list, kset.kobj.entry) {pr_debug ("Suspending type '%s':\n" ,kobject_name (&cls->kset.kobj));
@@ -413,8 +407,7 @@ aux_driver: }/* resume other classes */ -list_for_each_entry_continue (cls, &system_subsys.list, - kset.kobj.entry) { +list_for_each_entry_continue (cls, &system_kset->list, kset.kobj.entry) {list_for_each_entry (err_dev, &cls->kset.list, kobj.entry) {pr_debug (" %s\n" ,kobject_name (&err_dev->kobj));__sysdev_resume (err_dev);
@@ -439,7 +432,7 @@ int sysdev_resume(void)pr_debug ("Resuming System Devices\n" ); -list_for_each_entry (cls, &system_subsys.list, kset.kobj.entry) { +list_for_each_entry (cls, &system_kset->list, kset.kobj.entry) {struct sys_device * sysdev; pr_debug("Resuming type '%s':\n",
@@ -457,8 +450,11 @@ int sysdev_resume(void)int __init system_bus_init (void ) { - system_subsys.kobj.parent = &devices_kset->kobj; -return subsystem_register (&system_subsys); + system_kset =kset_create_and_register ("system" ,NULL , +NULL , devices_kset); +if (IS_ERR (system_kset)) +return PTR_ERR (system_kset); +return 0 ; }EXPORT_SYMBOL_GPL (sysdev_register);
Signature · 1 line
1.5.3.4
PATCH 23/54 kset: convert slub to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- mm/slub.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
mm/slub.c +10 -9
@@ -21,6 +21,7 @@#include <linux/ctype.h> #include <linux/kallsyms.h> #include <linux/memory.h> +#include <linux/err.h> /* * Lock order:
@@ -3978,7 +3979,7 @@ static struct kset_uevent_ops slab_uevent_ops = { .filter = uevent_filter, }; -static decl_subsys(slab, &slab_uevent_ops); +static struct kset *slab_kset;#define ID_STR_LENGTH 64
@@ -4031,7 +4032,7 @@ static int sysfs_slab_add(struct kmem_cache *s)* This is typically the case for debug situations. In that * case we can catch duplicate names easily. */ -sysfs_remove_link (&slab_subsys.kobj, s->name); +sysfs_remove_link (&slab_kset->kobj, s->name); name = s->name; }else {/*
@@ -4042,7 +4043,7 @@ static int sysfs_slab_add(struct kmem_cache *s) }kobject_set_name (&s->kobj, name); - s->kobj.kset = &slab_subsys; + s->kobj.kset = slab_kset; s->kobj.ktype = &slab_ktype;kobject_init (&s->kobj); err =kobject_add (&s->kobj);
@@ -4087,9 +4088,8 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)/* * If we have a leftover link then remove it. */ -sysfs_remove_link (&slab_subsys.kobj, name); -return sysfs_create_link (&slab_subsys.kobj, - &s->kobj, name); +sysfs_remove_link (&slab_kset->kobj, name); +return sysfs_create_link (&slab_kset->kobj, &s->kobj, name); } al =kmalloc (sizeof (struct saved_alias ),GFP_KERNEL );
@@ -4108,10 +4108,11 @@ static int __init slab_sysfs_init(void)struct kmem_cache *s;int err; - err =subsystem_register (&slab_subsys); -if (err) { + slab_kset =kset_create_and_register ("slab" , &slab_uevent_ops, +NULL ,NULL ); +if (IS_ERR (slab_kset)) {printk (KERN_ERR "Cannot register slab subsystem.\n" ); -return -ENOSYS ; +return PTR_ERR (slab_kset); } slab_state =SYSFS ;
Signature · 1 line
1.5.3.4
PATCH 24/54 kset: move /sys/slab to /sys/kernel/slab
In reply to Greg KH/sys/kernel is where these things should go.
Also updated the documentation and tool that used this directory.
--- Documentation/vm/slabinfo.c | 2 +- Documentation/vm/slub.txt | 2 +- mm/slub.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Documentation/vm/slabinfo.c +1 -1
@@ -1021,7 +1021,7 @@ void read_slab_dir(void)char *t;int count; -if (chdir ("/sys/slab" )) +if (chdir ("/sys/kernel/slab" ))fatal ("SYSFS support for SLUB not active\n" ); dir =opendir ("." );
Documentation/vm/slub.txt +1 -1
@@ -63,7 +63,7 @@ In case you forgot to enable debugging on the kernel command line: It is possible to enable debugging manually when the kernel is up. Look at the contents of: -/sys/slab/<slab name>/ +/sys/kernel/slab/<slab name>/ Look at the writable files. Writing 1 to them will enable the corresponding debug option. All options can be set on a slab that does
mm/slub.c +1 -1
@@ -4109,7 +4109,7 @@ static int __init slab_sysfs_init(void)int err; slab_kset =kset_create_and_register ("slab" , &slab_uevent_ops, -NULL ,NULL ); +NULL , kernel_kset);if (IS_ERR (slab_kset)) {printk (KERN_ERR "Cannot register slab subsystem.\n" );return PTR_ERR (slab_kset);
Signature · 1 line
1.5.3.4
PATCH 25/54 kset: convert /sys/module to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. We also rename module_subsys to module_kset to catch all users of the variable.
--- include/linux/module.h | 3 ++- kernel/module.c | 6 ++---- kernel/params.c | 21 ++++++++------------- 3 files changed, 12 insertions(+), 18 deletions(-)
include/linux/module.h +2 -1
@@ -574,7 +574,8 @@ struct device_driver;#ifdef CONFIG_SYSFS struct module ; -extern struct kset module_subsys; +extern struct kset *module_kset; +extern int module_sysfs_initialized;int mod_sysfs_init (struct module *mod); int mod_sysfs_setup(struct module *mod,
kernel/module.c +2 -4
@@ -47,8 +47,6 @@#include <asm/cacheflush.h> #include <linux/license.h> -extern int module_sysfs_initialized; -#if 0 #define DEBUGP printk#else
@@ -1221,7 +1219,7 @@ int mod_sysfs_init(struct module *mod) err =kobject_set_name (&mod->mkobj.kobj,"%s" , mod->name);if (err) goto out; - mod->mkobj.kobj.kset = &module_subsys; + mod->mkobj.kobj.kset = module_kset; mod->mkobj.mod = mod;kobject_init (&mod->mkobj.kobj);
@@ -2530,7 +2528,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)struct kobject *mkobj;/* Lookup built-in module entry in /sys/modules */ - mkobj =kset_find_obj (&module_subsys, drv->mod_name); + mkobj =kset_find_obj (module_kset, drv->mod_name);if (mkobj) { mk = container_of(mkobj, struct module_kobject, kobj);/* remember our module structure */
kernel/params.c +8 -13
@@ -562,7 +562,7 @@ static void __init kernel_param_sysfs_setup(const char *name,BUG_ON (!mk); mk->mod =THIS_MODULE ; - mk->kobj.kset = &module_subsys; + mk->kobj.kset = module_kset; mk->kobj.ktype = &module_ktype;kobject_set_name (&mk->kobj, name);kobject_init (&mk->kobj);
@@ -698,7 +698,7 @@ static struct kset_uevent_ops module_uevent_ops = { .filter = uevent_filter, }; -decl_subsys (module, &module_uevent_ops); +struct kset *module_kset;int module_sysfs_initialized;static struct kobj_type module_ktype = {
@@ -712,9 +712,11 @@ static int __init param_sysfs_init(void) {int ret; - ret =subsystem_register (&module_subsys); -if (ret <0 ) { -printk (KERN_WARNING "%s (%d): subsystem_register error: %d\n" , + module_kset =kset_create_and_register ("module" , &module_uevent_ops, +NULL ,NULL ); +if (IS_ERR (module_kset)) { + ret =PTR_ERR (module_kset); +printk (KERN_WARNING "%s (%d): error creating kset: %d\n" , __FILE__, __LINE__, ret);return ret; }
@@ -726,14 +728,7 @@ static int __init param_sysfs_init(void) }subsys_initcall (param_sysfs_init); -#else -#if 0 -static struct sysfs_ops module_sysfs_ops = { - .show =NULL , - .store =NULL , -}; -#endif -#endif +#endif /* CONFIG_SYSFS */ EXPORT_SYMBOL (param_set_byte);EXPORT_SYMBOL (param_get_byte);
Signature · 1 line
1.5.3.4
PATCH 26/54 kset: convert /sys/power to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. We also rename power_subsys to power_kset to catch all users of the variable and we properly export it so that people don't have to guess that it really is present in the system.
The pseries code is wierd, why is it createing /sys/power if CONFIG_PM is disabled? Oh well, stupid big boxes ignoring config options...
--- arch/arm/mach-omap1/pm.c | 3 +-- arch/powerpc/platforms/pseries/power.c | 15 +++++++-------- include/linux/kobject.h | 2 ++ kernel/power/disk.c | 2 +- kernel/power/main.c | 12 ++++++------ kernel/power/power.h | 2 -- 6 files changed, 17 insertions(+), 19 deletions(-)
arch/arm/mach-omap1/pm.c +1 -2
@@ -97,7 +97,6 @@ static struct subsys_attribute sleep_while_idle_attr = { .store = omap_pm_sleep_while_idle_store, }; -extern struct kset power_subsys;static void (*omap_sram_idle)(void ) =NULL ;static void (*omap_sram_suspend)(unsigned long r0,unsigned long r1) =NULL ;
@@ -726,7 +725,7 @@ static int __init omap_pm_init(void)omap_pm_init_proc ();#endif - error =subsys_create_file (&power_subsys, &sleep_while_idle_attr); + error =subsys_create_file (power_kset, &sleep_while_idle_attr);if (error)printk (KERN_ERR "subsys_create_file failed: %d\n" , error);
arch/powerpc/platforms/pseries/power.c +7 -8
@@ -25,6 +25,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/init.h> +#include <linux/err.h> unsigned long rtas_poweron_auto;/* default and normal state is 0 */
@@ -57,7 +58,7 @@ static struct subsys_attribute auto_poweron_attr = { };#ifndef CONFIG_PM -decl_subsys (power,NULL ); +struct kset *power_kset;static struct attribute *g[] = { &auto_poweron_attr.attr,
@@ -70,18 +71,16 @@ static struct attribute_group attr_group = {static int __init pm_init (void ) { -int error =subsystem_register (&power_subsys); -if (!error) - error =sysfs_create_group (&power_subsys.kobj, &attr_group); -return error; + power_kset =kset_create_and_register ("power" ,NULL ,NULL ,NULL ); +if (IS_ERR (power_kset)) +return PTR_ERR (power_kset); +return sysfs_create_group (&power_kset->kobj, &attr_group); }core_initcall (pm_init);#else -extern struct kset power_subsys; -static int __init apo_pm_init (void ) { -return (subsys_create_file (&power_subsys, &auto_poweron_attr)); +return (subsys_create_file (power_kset, &auto_poweron_attr)); }__initcall (apo_pm_init);#endif
include/linux/kobject.h +2 -0
@@ -192,6 +192,8 @@ struct kset _name##_subsys = { \extern struct kset *kernel_kset;/* The global /sys/hypervisor/ kset for people to chain off of */ extern struct kset *hypervisor_kset; +/* The global /sys/power/ kset for people to chain off of */ +extern struct kset *power_kset;extern int __must_check subsystem_register (struct kset *);extern void subsystem_unregister (struct kset *);
kernel/power/disk.c +1 -1
@@ -698,7 +698,7 @@ static struct attribute_group attr_group = {static int __init pm_disk_init (void ) { -return sysfs_create_group (&power_subsys.kobj, &attr_group); +return sysfs_create_group (&power_kset->kobj, &attr_group); }core_initcall (pm_disk_init);
kernel/power/main.c +6 -6
@@ -21,6 +21,7 @@#include <linux/freezer.h> #include <linux/vmstat.h> #include <linux/syscalls.h> +#include <linux/err.h> #include "power.h"
@@ -273,8 +274,7 @@ EXPORT_SYMBOL(pm_suspend);#endif /* CONFIG_SUSPEND */ -decl_subsys (power,NULL ); - +struct kset *power_kset;/** * state - control system power state.
@@ -383,10 +383,10 @@ static struct attribute_group attr_group = {static int __init pm_init (void ) { -int error =subsystem_register (&power_subsys); -if (!error) - error =sysfs_create_group (&power_subsys.kobj,&attr_group); -return error; + power_kset =kset_create_and_register ("power" ,NULL ,NULL ,NULL ); +if (IS_ERR (power_kset)) +return PTR_ERR (power_kset); +return sysfs_create_group (&power_kset->kobj, &attr_group); }core_initcall (pm_init);
kernel/power/power.h +0 -2
@@ -63,8 +63,6 @@ static struct subsys_attribute _name##_attr = { \ .store = _name##_store, \ } -extern struct kset power_subsys; -/* Preferred image size in bytes (default 500 MB) */ extern unsigned long image_size;extern int in_suspend;
Signature · 1 line
1.5.3.4
PATCH 27/54 kset: convert s390 hypervisor kset to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- arch/s390/hypfs/inode.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
arch/s390/hypfs/inode.c +9 -6
@@ -490,7 +490,7 @@ static struct super_operations hypfs_s_ops = { .show_options = hypfs_show_options, }; -static decl_subsys(s390, NULL); +static struct kset *s390_kset;static int __init hypfs_init (void ) {
@@ -506,17 +506,20 @@ static int __init hypfs_init(void) goto fail_diag; } } - s390_subsys.kobj.kset = hypervisor_kset; - rc =subsystem_register (&s390_subsys); -if (rc) + + s390_kset =kset_create_and_register ("s390" ,NULL ,NULL , + hypervisor_kset); +if (IS_PTR (s390_kset)) { + rc =PTR_ERR (s390_kset); goto fail_sysfs; + } rc =register_filesystem (&hypfs_type);if (rc) goto fail_filesystem;return 0 ; fail_filesystem: -subsystem_unregister (&s390_subsys); +kset_unregister (s390_kset); fail_sysfs:if (!MACHINE_IS_VM )hypfs_diag_exit ();
@@ -530,7 +533,7 @@ static void __exit hypfs_exit(void)if (!MACHINE_IS_VM )hypfs_diag_exit ();unregister_filesystem (&hypfs_type); -subsystem_unregister (&s390_subsys); +kset_unregister (s390_kset); }module_init (hypfs_init)
Signature · 1 line
1.5.3.4
PATCH 28/54 kset: convert struct bus_device->devices to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
Having 3 static kobjects in one structure is not only foolish, but ripe for nasty race conditions if handled improperly. We also rename the field to catch any potential users of it (not that there should be outside of the driver core...)
--- drivers/base/bus.c | 19 ++++++++++--------- include/linux/device.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/base/bus.c +10 -9
@@ -450,7 +450,7 @@ int bus_add_device(struct device * dev) error =device_add_attrs (bus, dev);if (error) goto out_put; - error =sysfs_create_link (&bus->devices.kobj, + error =sysfs_create_link (&bus->devices_kset->kobj, &dev->kobj, dev->bus_id);if (error) goto out_id;
@@ -467,7 +467,7 @@ int bus_add_device(struct device * dev) out_deprecated:sysfs_remove_link (&dev->kobj,"subsystem" ); out_subsys: -sysfs_remove_link (&bus->devices.kobj, dev->bus_id); +sysfs_remove_link (&bus->devices_kset->kobj, dev->bus_id); out_id:device_remove_attrs (bus, dev); out_put:
@@ -513,7 +513,7 @@ void bus_remove_device(struct device * dev)if (dev->bus) {sysfs_remove_link (&dev->kobj,"subsystem" );remove_deprecated_bus_links (dev); -sysfs_remove_link (&dev->bus->devices.kobj, dev->bus_id); +sysfs_remove_link (&dev->bus->devices_kset->kobj, dev->bus_id);device_remove_attrs (dev->bus, dev);if (dev->is_registered) { dev->is_registered =0 ;
@@ -863,11 +863,12 @@ int bus_register(struct bus_type * bus)if (retval) goto bus_uevent_fail; -kobject_set_name (&bus->devices.kobj,"devices" ); - bus->devices.kobj.parent = &bus->subsys.kobj; - retval =kset_register (&bus->devices); -if (retval) + bus->devices_kset =kset_create_and_register ("devices" ,NULL , + &bus->subsys.kobj,NULL ); +if (IS_ERR (bus->devices_kset)) { + retval =PTR_ERR (bus->devices_kset); goto bus_devices_fail; + }kobject_set_name (&bus->drivers.kobj,"drivers" ); bus->drivers.kobj.parent = &bus->subsys.kobj;
@@ -895,7 +896,7 @@ bus_attrs_fail: bus_probe_files_fail:kset_unregister (&bus->drivers); bus_drivers_fail: -kset_unregister (&bus->devices); +kset_unregister (bus->devices_kset); bus_devices_fail:bus_remove_file (bus, &bus_attr_uevent); bus_uevent_fail:
@@ -917,7 +918,7 @@ void bus_unregister(struct bus_type * bus)bus_remove_attrs (bus);remove_probe_files (bus);kset_unregister (&bus->drivers); -kset_unregister (&bus->devices); +kset_unregister (bus->devices_kset);bus_remove_file (bus, &bus_attr_uevent);subsystem_unregister (&bus->subsys); }
include/linux/device.h +1 -1
@@ -55,7 +55,7 @@ struct bus_type {struct kset subsys;struct kset drivers; -struct kset devices; +struct kset *devices_kset;struct klist klist_devices;struct klist klist_drivers;
Signature · 1 line
1.5.3.4
PATCH 29/54 kset: convert struct bus_device->drivers to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
Having 3 static kobjects in one structure is not only foolish, but ripe for nasty race conditions if handled improperly. We also rename the field to catch any potential users of it (not that there should be outside of the driver core...)
--- drivers/base/bus.c | 15 ++++++++------- drivers/base/driver.c | 2 +- include/linux/device.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/base/bus.c +8 -7
@@ -639,7 +639,7 @@ int bus_add_driver(struct device_driver *drv) error =kobject_set_name (&drv->kobj,"%s" , drv->name);if (error) goto out_put_bus; - drv->kobj.kset = &bus->drivers; + drv->kobj.kset = bus->drivers_kset; drv->kobj.ktype = &driver_ktype; error =kobject_register (&drv->kobj);if (error)
@@ -870,11 +870,12 @@ int bus_register(struct bus_type * bus) goto bus_devices_fail; } -kobject_set_name (&bus->drivers.kobj,"drivers" ); - bus->drivers.kobj.parent = &bus->subsys.kobj; - retval =kset_register (&bus->drivers); -if (retval) + bus->drivers_kset =kset_create_and_register ("drivers" ,NULL , + &bus->subsys.kobj,NULL ); +if (IS_ERR (bus->drivers_kset)) { + retval =PTR_ERR (bus->drivers_kset); goto bus_drivers_fail; + }klist_init (&bus->klist_devices, klist_devices_get, klist_devices_put);klist_init (&bus->klist_drivers,NULL ,NULL );
@@ -894,7 +895,7 @@ int bus_register(struct bus_type * bus) bus_attrs_fail:remove_probe_files (bus); bus_probe_files_fail: -kset_unregister (&bus->drivers); +kset_unregister (bus->drivers_kset); bus_drivers_fail:kset_unregister (bus->devices_kset); bus_devices_fail:
@@ -917,7 +918,7 @@ void bus_unregister(struct bus_type * bus)pr_debug ("bus %s: unregistering\n" , bus->name);bus_remove_attrs (bus);remove_probe_files (bus); -kset_unregister (&bus->drivers); +kset_unregister (bus->drivers_kset);kset_unregister (bus->devices_kset);bus_remove_file (bus, &bus_attr_uevent);subsystem_unregister (&bus->subsys);
drivers/base/driver.c +1 -1
@@ -185,7 +185,7 @@ void driver_unregister(struct device_driver * drv)*/ struct device_driver *driver_find (const char *name,struct bus_type *bus) { -struct kobject *k =kset_find_obj (&bus->drivers, name); +struct kobject *k =kset_find_obj (bus->drivers_kset, name);if (k)return to_drv (k);return NULL ;
include/linux/device.h +1 -1
@@ -54,7 +54,7 @@ struct bus_type {struct module * owner;struct kset subsys; -struct kset drivers; +struct kset *drivers_kset;struct kset *devices_kset;struct klist klist_devices;struct klist klist_drivers;
Signature · 1 line
1.5.3.4
PATCH 30/54 driver core: remove owner field from struct bus_type
In reply to Greg KHThis isn't used by anything in the driver core, and by no one in the 204 different usages of it in the kernel tree. Remove this field so no one gets any idea that it is needed to be used.
--- include/linux/device.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/device.h +0 -1
@@ -51,7 +51,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);struct bus_type {const char * name; -struct module * owner;struct kset subsys;struct kset *drivers_kset;
Signature · 1 line
1.5.3.4
PATCH 31/54 driver core: add way to get to bus kset
In reply to Greg KHThis allows an easier way to get to the kset associated with a struct bus_type (you have three to choose from...) This will make it easier to move these fields to be dynamic in a future patch.
--- drivers/base/bus.c | 6 ++++++ drivers/pci/hotplug/pci_hotplug_core.c | 2 +- include/linux/device.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletions(-)
drivers/base/bus.c +6 -0
@@ -936,6 +936,12 @@ int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb) }EXPORT_SYMBOL_GPL (bus_unregister_notifier); +struct kset *bus_get_kset (struct bus_type *bus) +{ +return &bus->subsys; +} +EXPORT_SYMBOL_GPL (bus_get_kset); +int __init buses_init (void ) { bus_kset = kset_create_and_register("bus", &bus_uevent_ops,
drivers/pci/hotplug/pci_hotplug_core.c +1 -1
@@ -701,7 +701,7 @@ static int __init pci_hotplug_init (void)int result; pci_hotplug_slots_kset =kset_create_and_register ("slots" ,NULL ,NULL , - &pci_bus_type.subsys); +bus_get_kset (&pci_bus_type));if (IS_ERR (pci_hotplug_slots_kset)) { result =PTR_ERR (pci_hotplug_slots_kset);err ("Register subsys with error %d\n" , result);
include/linux/device.h +2 -0
@@ -117,6 +117,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004/* driver about to be unbound */ +extern struct kset *bus_get_kset (struct bus_type *bus); +struct device_driver {const char * name;struct bus_type * bus;
Signature · 1 line
1.5.3.4
PATCH 32/54 driver core: add way to get to bus device klist
In reply to Greg KHThis allows an easier way to get to the device klist associated with a struct bus_type (you have three to choose from...) This will make it easier to move these fields to be dynamic in a future patch.
The only user of this is the PCI core which horribly abuses this interface to rearrange the order of the pci devices. This should be done using the existing bus device walking functions, but that's left for future patches.
--- drivers/base/bus.c | 6 ++++++ drivers/pci/probe.c | 11 +++++++---- include/linux/device.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-)
drivers/base/bus.c +6 -0
@@ -942,6 +942,12 @@ struct kset *bus_get_kset(struct bus_type *bus) }EXPORT_SYMBOL_GPL (bus_get_kset); +struct klist *bus_get_device_klist (struct bus_type *bus) +{ +return &bus->klist_devices; +} +EXPORT_SYMBOL_GPL (bus_get_device_klist); +int __init buses_init (void ) { bus_kset = kset_create_and_register("bus", &bus_uevent_ops,
drivers/pci/probe.c +7 -4
@@ -1251,16 +1251,19 @@ static void __init pci_sort_breadthfirst_klist(void)struct klist_node *n;struct device *dev;struct pci_dev *pdev; +struct klist *device_klist; -spin_lock (&pci_bus_type.klist_devices.k_lock); -list_for_each_safe (pos, tmp, &pci_bus_type.klist_devices.k_list) { + device_klist =bus_get_device_klist (&pci_bus_type); + +spin_lock (&device_klist->k_lock); +list_for_each_safe (pos, tmp, &device_klist->k_list) { n = container_of(pos, struct klist_node, n_node); dev = container_of(n, struct device, knode_bus); pdev =to_pci_dev (dev);pci_insertion_sort_klist (pdev, &sorted_devices); } -list_splice (&sorted_devices, &pci_bus_type.klist_devices.k_list); -spin_unlock (&pci_bus_type.klist_devices.k_lock); +list_splice (&sorted_devices, &device_klist->k_list); +spin_unlock (&device_klist->k_lock); }static void __init pci_insertion_sort_devices (struct pci_dev *a,struct list_head *list)
include/linux/device.h +1 -0
@@ -118,6 +118,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,unbound */ extern struct kset *bus_get_kset (struct bus_type *bus); +extern struct klist *bus_get_device_klist (struct bus_type *bus);struct device_driver {const char * name;
Signature · 1 line
1.5.3.4
PATCH 33/54 driver core: remove fields from struct bus_type
In reply to Greg KHstruct bus_type is static everywhere in the kernel. This moves the kobject in the structure out of it, and a bunch of other private only to the driver core fields are now moved to a private structure. This lets us dynamically create the backing kobject properly and gives us the chance to be able to document to users exactly how to use the struct bus_type as there are no fields they can improperly access.
--- drivers/base/base.h | 30 +++++++++++- drivers/base/bus.c | 120 ++++++++++++++++++++++++++-------------------- drivers/base/core.c | 6 +- drivers/base/dd.c | 4 +- drivers/base/driver.c | 2 +- drivers/base/platform.c | 4 +- include/linux/device.h | 12 +---- 7 files changed, 107 insertions(+), 71 deletions(-)
drivers/base/base.h +29 -1
@@ -1,6 +1,34 @@ -/* initialisation functions */ +/** +* struct bus_type_private - structure to hold the private to the driver core portions of the bus_type structure. +* +* @subsys - the struct kset that defines this bus. This is the main kobject +* @drivers_kset - the list of drivers associated with this bus +* @devices_kset - the list of devices associated with this bus +* @klist_devices - the klist to iterate over the @devices_kset +* @klist_drivers - the klist to iterate over the @drivers_kset +* @bus_notifier - the bus notifier list for anything that cares about things +* on this bus. +* @bus - pointer back to the struct bus_type that this structure is associated +* with. +* +* This structure is the one that is the actual kobject allowing struct +* bus_type to be statically allocated safely. Nothing outside of the driver +* core should ever touch these fields. +*/ +struct bus_type_private { +struct kset subsys; +struct kset *drivers_kset; +struct kset *devices_kset; +struct klist klist_devices; +struct klist klist_drivers; +struct blocking_notifier_head bus_notifier; +unsigned int drivers_autoprobe:1 ; +struct bus_type *bus; +}; + +/* initialisation functions */ extern int devices_init (void );extern int buses_init (void );extern int classes_init (void );
drivers/base/bus.c +68 -52
310 lines not on this page · raw message
drivers/base/core.c +3 -3
@@ -749,7 +749,7 @@ int device_add(struct device *dev)/* notify clients of device entry (new way) */ if (dev->bus) -blocking_notifier_call_chain (&dev->bus->bus_notifier, +blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_ADD_DEVICE , dev); error =device_create_file (dev, &uevent_attr);
@@ -797,7 +797,7 @@ int device_add(struct device *dev)device_pm_remove (dev); PMError:if (dev->bus) -blocking_notifier_call_chain (&dev->bus->bus_notifier, +blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_DEL_DEVICE , dev);device_remove_attrs (dev); AttrsError:
@@ -975,7 +975,7 @@ void device_del(struct device * dev)if (platform_notify_remove)platform_notify_remove (dev);if (dev->bus) -blocking_notifier_call_chain (&dev->bus->bus_notifier, +blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_DEL_DEVICE , dev);device_pm_remove (dev);kobject_uevent (&dev->kobj,KOBJ_REMOVE );
drivers/base/dd.c +2 -2
@@ -38,7 +38,7 @@ static void driver_bound(struct device *dev) dev->bus_id, dev->driver->name);if (dev->bus) -blocking_notifier_call_chain (&dev->bus->bus_notifier, +blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_BOUND_DRIVER , dev);klist_add_tail (&dev->knode_driver, &dev->driver->klist_devices);
@@ -296,7 +296,7 @@ static void __device_release_driver(struct device * dev)klist_remove (&dev->knode_driver);if (dev->bus) -blocking_notifier_call_chain (&dev->bus->bus_notifier, +blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_UNBIND_DRIVER , dev);
drivers/base/driver.c +1 -1
@@ -185,7 +185,7 @@ void driver_unregister(struct device_driver * drv)*/ struct device_driver *driver_find (const char *name,struct bus_type *bus) { -struct kobject *k =kset_find_obj (bus->drivers_kset, name); +struct kobject *k =kset_find_obj (bus->p->drivers_kset, name);if (k)return to_drv (k);return NULL ;
drivers/base/platform.c +2 -2
@@ -497,12 +497,12 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,* if the probe was successful, and make sure any forced probes of * new devices fail. */ -spin_lock (&platform_bus_type.klist_drivers.k_lock); +spin_lock (&platform_bus_type.p->klist_drivers.k_lock); drv->probe =NULL ;if (code ==0 &&list_empty (&drv->driver.klist_devices.k_list)) retval = -ENODEV ; drv->driver.probe = platform_drv_probe_fail; -spin_unlock (&platform_bus_type.klist_drivers.k_lock); +spin_unlock (&platform_bus_type.p->klist_drivers.k_lock);if (code != retval)platform_driver_unregister (drv);
include/linux/device.h +2 -10
@@ -35,6 +35,7 @@ struct device_driver;struct class ;struct class_device ;struct bus_type ; +struct bus_type_private ;struct bus_attribute {struct attribute attr;
@@ -51,15 +52,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);struct bus_type {const char * name; - -struct kset subsys; -struct kset *drivers_kset; -struct kset *devices_kset; -struct klist klist_devices; -struct klist klist_drivers; - -struct blocking_notifier_head bus_notifier; -struct bus_attribute * bus_attrs;struct device_attribute * dev_attrs;struct driver_attribute * drv_attrs;
@@ -75,7 +67,7 @@ struct bus_type {int (*resume_early)(struct device * dev);int (*resume)(struct device * dev); - unsigned int drivers_autoprobe:1; +struct bus_type_private *p; };extern int __must_check bus_register (struct bus_type * bus);
Signature · 1 line
1.5.3.4
PATCH 34/54 Driver Core: add kobj_attribute handling
In reply to Greg KHFrom: Kay Sievers <[email protected]>
Add kobj_sysfs_ops to replace subsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets.
The whole concept of any default sysfs attribute operations will go away with the upcoming removal of subsys_sysfs_ops.
--- include/linux/kobject.h | 10 ++++++++++ lib/kobject.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)
include/linux/kobject.h +10 -0
@@ -119,6 +119,16 @@ struct kset_uevent_ops { struct kobj_uevent_env *env); }; +struct kobj_attribute { +struct attribute attr; +ssize_t (*show)(struct kobject *kobj,struct kobj_attribute *attr, +char *buf); +ssize_t (*store)(struct kobject *kobj,struct kobj_attribute *attr, +const char *buf,size_t count); +}; + +extern struct sysfs_ops kobj_sysfs_ops; +/** * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. *
lib/kobject.c +29 -0
@@ -488,6 +488,35 @@ void kobject_put(struct kobject * kobj)kref_put (&kobj->kref, kobject_release); } +/* default kobject attribute operations */ +static ssize_t kobj_attr_show (struct kobject *kobj,struct attribute *attr, +char *buf) +{ +struct kobj_attribute *kattr; +ssize_t ret = -EIO ; + + kattr = container_of(attr, struct kobj_attribute, attr); +if (kattr->show) + ret = kattr->show (kobj, kattr, buf); +return ret; +} + +static ssize_t kobj_attr_store (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t count) +{ +struct kobj_attribute *kattr; +ssize_t ret = -EIO ; + + kattr = container_of(attr, struct kobj_attribute, attr); +if (kattr->store) + ret = kattr->store (kobj, kattr, buf, count); +return ret; +} + +struct sysfs_ops kobj_sysfs_ops = { + .show = kobj_attr_show, + .store = kobj_attr_store, +};static void dir_release (struct kobject *kobj) {
Signature · 1 line
1.5.3.4
PATCH 35/54 Driver Core: switch all dynamic ksets to kobj_sysfs_ops
In reply to Greg KHFrom: Kay Sievers <[email protected]>
Switch all dynamically created ksets, that export simple attributes, to kobj_attribute from subsys_attribute. Struct subsys_attribute will be removed.
--- fs/ecryptfs/main.c | 10 ++++++---- kernel/ksysfs.c | 35 +++++++++++++++++++++-------------- kernel/power/disk.c | 18 ++++++++++++------ kernel/power/main.c | 12 ++++++++---- kernel/power/power.h | 2 +- lib/kobject.c | 8 ++++---- 6 files changed, 52 insertions(+), 33 deletions(-)
fs/ecryptfs/main.c +6 -4
@@ -732,12 +732,13 @@ static int ecryptfs_init_kmem_caches(void)static struct kset *ecryptfs_kset; -static ssize_t version_show (struct kset *kset,char *buff) +static ssize_t version_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buff) {return snprintf (buff,PAGE_SIZE ,"%d\n" ,ECRYPTFS_VERSIONING_MASK ); } -static struct subsys_attribute version_attr =__ATTR_RO (version); +static struct kobj_attribute version_attr =__ATTR_RO (version); static struct ecryptfs_version_str_map_elem { u32 flag;
@@ -751,7 +752,8 @@ static struct ecryptfs_version_str_map_elem { {ECRYPTFS_VERSIONING_MULTKEY, "multiple keys per file"} }; -static ssize_t version_str_show (struct kset *kset,char *buff) +static ssize_t version_str_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buff) {int i;int remaining =PAGE_SIZE ;
@@ -778,7 +780,7 @@ out:return total_written; } -static struct subsys_attribute version_attr_str =__ATTR_RO (version_str); +static struct kobj_attribute version_attr_str =__ATTR_RO (version_str);static struct attribute *attributes[] = { &version_attr.attr,
kernel/ksysfs.c +21 -14
@@ -18,30 +18,34 @@#include <linux/err.h> #define KERNEL_ATTR_RO (_name) \ -static struct subsys_attribute _name##_attr = __ATTR_RO(_name) +static struct kobj_attribute _name##_attr = __ATTR_RO(_name)#define KERNEL_ATTR_RW (_name) \ -static struct subsys_attribute _name##_attr = \ +static struct kobj_attribute _name##_attr = \ __ATTR(_name, 0644, _name##_show, _name##_store)#if defined(CONFIG_HOTPLUG ) && defined(CONFIG_NET )/* current uevent sequence number */ -static ssize_t uevent_seqnum_show (struct kset *kset,char *page) +static ssize_t uevent_seqnum_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return sprintf (page,"%llu\n" , (unsigned long long )uevent_seqnum); +return sprintf (buf,"%llu\n" , (unsigned long long )uevent_seqnum); }KERNEL_ATTR_RO (uevent_seqnum);/* uevent helper program, used during early boo */ -static ssize_t uevent_helper_show (struct kset *kset,char *page) +static ssize_t uevent_helper_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return sprintf (page,"%s\n" , uevent_helper); +return sprintf (buf,"%s\n" , uevent_helper); } -static ssize_t uevent_helper_store (struct kset *kset,const char *page,size_t count) +static ssize_t uevent_helper_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t count) {if (count+1 >UEVENT_HELPER_PATH_LEN )return -ENOENT ; -memcpy (uevent_helper, page, count); +memcpy (uevent_helper, buf, count); uevent_helper[count] ='\0' ;if (count && uevent_helper[count-1 ] =='\n' ) uevent_helper[count-1 ] ='\0' ;
@@ -51,21 +55,24 @@ KERNEL_ATTR_RW(uevent_helper);#endif #ifdef CONFIG_KEXEC -static ssize_t kexec_loaded_show (struct kset *kset,char *page) +static ssize_t kexec_loaded_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return sprintf (page,"%d\n" , !!kexec_image); +return sprintf (buf,"%d\n" , !!kexec_image); }KERNEL_ATTR_RO (kexec_loaded); -static ssize_t kexec_crash_loaded_show (struct kset *kset,char *page) +static ssize_t kexec_crash_loaded_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return sprintf (page,"%d\n" , !!kexec_crash_image); +return sprintf (buf,"%d\n" , !!kexec_crash_image); }KERNEL_ATTR_RO (kexec_crash_loaded); -static ssize_t vmcoreinfo_show (struct kset *kset,char *page) +static ssize_t vmcoreinfo_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return sprintf (page,"%lx %x\n" , +return sprintf (buf,"%lx %x\n" ,paddr_vmcoreinfo_note (), (unsigned int )vmcoreinfo_max_size); }
kernel/power/disk.c +12 -6
@@ -557,7 +557,8 @@ static const char * const hibernation_modes[] = {* supports it (as determined by having hibernation_ops). */ -static ssize_t disk_show (struct kset *kset,char *buf) +static ssize_t disk_show (struct kobject *kobj,struct kobj_attribut *attr, +char *buf) {int i;char *start = buf;
@@ -587,7 +588,8 @@ static ssize_t disk_show(struct kset *kset, char *buf) } -static ssize_t disk_store (struct kset *kset,const char *buf,size_t n) +static ssize_t disk_store (struct kobject *kobj,struct kobj_attribut *attr, +const char *buf,size_t n) {int error =0 ;int i;
@@ -632,13 +634,15 @@ static ssize_t disk_store(struct kset *kset, const char *buf, size_t n)power_attr (disk); -static ssize_t resume_show (struct kset *kset,char *buf) +static ssize_t resume_show (struct kobject *kobj,struct kobj_attribut *attr, +char *buf) {return sprintf (buf,"%d:%d\n" ,MAJOR (swsusp_resume_device),MINOR (swsusp_resume_device)); } -static ssize_t resume_store (struct kset *kset,const char *buf,size_t n) +static ssize_t resume_store (struct kobject *kobj,struct kobj_attribut *attr, +const char *buf,size_t n) {unsigned int maj, min;dev_t res;
@@ -664,12 +668,14 @@ static ssize_t resume_store(struct kset *kset, const char *buf, size_t n)power_attr (resume); -static ssize_t image_size_show (struct kset *kset,char *buf) +static ssize_t image_size_show (struct kobject *kobj,struct kobj_attribut *attr, +char *buf) {return sprintf (buf,"%lu\n" , image_size); } -static ssize_t image_size_store (struct kset *kset,const char *buf,size_t n) +static ssize_t image_size_store (struct kobject *kobj,struct kobj_attribut *attr, +const char *buf,size_t n) {unsigned long size;
kernel/power/main.c +8 -4
@@ -287,7 +287,8 @@ struct kset *power_kset;* proper enumerated value, and initiates a suspend transition. */ -static ssize_t state_show (struct kset *kset,char *buf) +static ssize_t state_show (struct kobject *kobj,struct kobj_attribute *attr, +char *buf) {char *s = buf;#ifdef CONFIG_SUSPEND
@@ -308,7 +309,8 @@ static ssize_t state_show(struct kset *kset, char *buf)return (s - buf); } -static ssize_t state_store (struct kset *kset,const char *buf,size_t n) +static ssize_t state_store (struct kobject *kobj,struct kobj_attribute *attr, +const char *buf,size_t n) {#ifdef CONFIG_SUSPEND suspend_state_t state =PM_SUSPEND_STANDBY ;
@@ -345,13 +347,15 @@ power_attr(state);#ifdef CONFIG_PM_TRACE int pm_trace_enabled; -static ssize_t pm_trace_show (struct kset *kset,char *buf) +static ssize_t pm_trace_show (struct kobject *kobj,struct kobj_attribute *attr, +char *buf) {return sprintf (buf,"%d\n" , pm_trace_enabled); }static ssize_t -pm_trace_store (struct kset *kset,const char *buf,size_t n) +pm_trace_store (struct kobject *kobj,struct kobj_attribute *attr, +const char *buf,size_t n) {int val;
kernel/power/power.h +1 -1
@@ -54,7 +54,7 @@ extern int pfn_is_nosave(unsigned long);extern struct mutex pm_mutex;#define power_attr (_name) \ -static struct subsys_attribute _name##_attr = { \ +static struct kobj_attribute _name##_attr = { \ .attr = { \ .name = __stringify(_name), \ .mode = 0644, \
lib/kobject.c +4 -4
@@ -524,9 +524,8 @@ static void dir_release(struct kobject *kobj) }static struct kobj_type dir_ktype = { + .sysfs_ops = &kobj_sysfs_ops, .release = dir_release, - .sysfs_ops =NULL , - .default_attrs =NULL , };/**
@@ -699,7 +698,8 @@ static void kset_release(struct kobject *kobj)kfree (kset); } -static struct kobj_type kset_type = { +static struct kobj_type kset_ktype = { + .sysfs_ops = &kobj_sysfs_ops, .release = kset_release, };
@@ -741,7 +741,7 @@ static struct kset *kset_create(const char *name, kset->uevent_ops = uevent_ops; kset->kobj.parent = parent_kobj; kset->kobj.kset = parent_kset; - kset->kobj.ktype = &kset_type; + kset->kobj.ktype = &kset_ktype;return kset; }
Signature · 1 line
1.5.3.4
PATCH 36/54 fix struct user_info export's sysfs interaction
In reply to Greg KHFrom: Kay Sievers <[email protected]>
Clean up the use of ksets and kobjects. Kobjects are instances of objects (like struct user_info), ksets are collections of objects of a similar type (like the uids directory containing the user_info directories). So, use kobjects for the user_info directories, and a kset for the "uids" directory.
On object cleanup, the final kobject_put() was missing.
--- include/linux/sched.h | 9 +--- kernel/ksysfs.c | 7 +-- kernel/user.c | 104 ++++++++++++++++++++++++------------------------- 3 files changed, 55 insertions(+), 65 deletions(-)
include/linux/sched.h +2 -7
@@ -547,18 +547,13 @@ struct user_struct {#ifdef CONFIG_FAIR_USER_SCHED struct task_group *tg;#ifdef CONFIG_SYSFS -struct kset kset; -struct subsys_attribute user_attr; +struct kobject kobj;struct work_struct work;#endif #endif }; -#ifdef CONFIG_FAIR_USER_SCHED -extern int uids_kobject_init (void ); -#else -static inline int uids_kobject_init (void ) {return 0 ; } -#endif +extern int uids_sysfs_init (void );extern struct user_struct *find_user (uid_t );
kernel/ksysfs.c +2 -5
@@ -142,11 +142,8 @@ static int __init ksysfs_init(void) goto group_exit; } -/* -* Create "/sys/kernel/uids" directory and corresponding root user's -* directory under it. -*/ - error =uids_kobject_init (); +/* create the /sys/kernel/uids/ directory */ + error =uids_sysfs_init ();if (error) goto notes_exit;
kernel/user.c +51 -53
181 lines not on this page · raw message
Signature · 1 line
1.5.3.4
PATCH 37/54 ecryptfs: remove version_str file from sysfs
In reply to Greg KHThis file violates the one-value-per-file sysfs rule.
If you all want it added back, please do something like a per-feature file to show what is present and what isn't.
--- fs/ecryptfs/main.c | 43 ------------------------------------------- 1 files changed, 0 insertions(+), 43 deletions(-)
fs/ecryptfs/main.c +0 -43
@@ -740,51 +740,8 @@ static ssize_t version_show(struct kobject *kobj,static struct kobj_attribute version_attr =__ATTR_RO (version); -static struct ecryptfs_version_str_map_elem { -u32 flag; -char *str; -} ecryptfs_version_str_map[] = { - {ECRYPTFS_VERSIONING_PASSPHRASE ,"passphrase" }, - {ECRYPTFS_VERSIONING_PUBKEY ,"pubkey" }, - {ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH ,"plaintext passthrough" }, - {ECRYPTFS_VERSIONING_POLICY ,"policy" }, - {ECRYPTFS_VERSIONING_XATTR ,"metadata in extended attribute" }, - {ECRYPTFS_VERSIONING_MULTKEY ,"multiple keys per file" } -}; - -static ssize_t version_str_show (struct kobject *kobj, -struct kobj_attribute *attr,char *buff) -{ -int i; -int remaining =PAGE_SIZE ; -int total_written =0 ; - - buff[0 ] ='\0' ; -for (i =0 ; i <ARRAY_SIZE (ecryptfs_version_str_map); i++) { -int entry_size; - -if (!(ECRYPTFS_VERSIONING_MASK - & ecryptfs_version_str_map[i].flag)) -continue ; - entry_size =strlen (ecryptfs_version_str_map[i].str); -if ((entry_size +2 ) > remaining) - goto out; -memcpy (buff, ecryptfs_version_str_map[i].str, entry_size); - buff[entry_size++] ='\n' ; - buff[entry_size] ='\0' ; - buff += entry_size; - total_written += entry_size; - remaining -= entry_size; - } -out: -return total_written; -} - -static struct kobj_attribute version_attr_str =__ATTR_RO (version_str); -static struct attribute *attributes[] = { &version_attr.attr, - &version_attr_str.attr,NULL , };
Signature · 1 line
1.5.3.4
PATCH 38/54 efivars: remove new_var and del_var files from sysfs
In reply to Greg KHWTF? Passing binary structures into a sysfs file, expecting it to be in the correct format/endianness? That's just wrong on so many levels.
So, these files are deleted. If you want to add them back, please do so in configfs, or in debugfs. Or use text strings, which is what sysfs is only for.
--- drivers/firmware/efivars.c | 149 -------------------------------------------- 1 files changed, 0 insertions(+), 149 deletions(-)
drivers/firmware/efivars.c +0 -149
@@ -143,13 +143,6 @@ struct efivar_attribute efivar_attr_##_name = { \ .store = _store, \ }; -#define VAR_SUBSYS_ATTR (_name, _mode, _show, _store) \ -struct subsys_attribute var_subsys_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode}, \ - .show = _show, \ - .store = _store, \ -}; -#define to_efivar_attr (_attr) container_of(_attr, struct efivar_attribute, attr)#define to_efivar_entry (obj) container_of(obj, struct efivar_entry, kobj)
@@ -408,144 +401,12 @@ static struct kobj_type efivar_ktype = { .default_attrs = def_attrs, }; -static ssize_t -dummy (struct kset *kset,char *buf) -{ -return -ENODEV ; -} -static inline void efivar_unregister (struct efivar_entry *var) {kobject_unregister (&var->kobj); } - -static ssize_t -efivar_create (struct kset *kset,const char *buf,size_t count) -{ -struct efi_variable *new_var = (struct efi_variable *)buf; -struct efivar_entry *search_efivar, *n; -unsigned long strsize1, strsize2; -efi_status_t status =EFI_NOT_FOUND ; -int found =0 ; - -if (!capable (CAP_SYS_ADMIN )) -return -EACCES ; - -spin_lock (&efivars_lock); - -/* -* Does this variable already exist? -*/ -list_for_each_entry_safe (search_efivar, n, &efivar_list, list) { - strsize1 =utf8_strsize (search_efivar->var.VariableName,1024 ); - strsize2 =utf8_strsize (new_var->VariableName,1024 ); -if (strsize1 == strsize2 && - !memcmp (&(search_efivar->var.VariableName), - new_var->VariableName, strsize1) && - !efi_guidcmp (search_efivar->var.VendorGuid, - new_var->VendorGuid)) { - found =1 ; -break ; - } - } -if (found) { -spin_unlock (&efivars_lock); -return -EINVAL ; - } - -/* now *really* create the variable via EFI */ - status = efi.set_variable (new_var->VariableName, - &new_var->VendorGuid, - new_var->Attributes, - new_var->DataSize, - new_var->Data); - -if (status !=EFI_SUCCESS ) { -printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , - status); -spin_unlock (&efivars_lock); -return -EIO ; - } -spin_unlock (&efivars_lock); - -/* Create the entry in sysfs. Locking is not required here */ - status =efivar_create_sysfs_entry (utf8_strsize (new_var->VariableName, -1024 ), new_var->VariableName, &new_var->VendorGuid); -if (status) { -printk (KERN_WARNING "efivars: variable created, but sysfs entry wasn't.\n" ); - } -return count; -} - -static ssize_t -efivar_delete (struct kset *kset,const char *buf,size_t count) -{ -struct efi_variable *del_var = (struct efi_variable *)buf; -struct efivar_entry *search_efivar, *n; -unsigned long strsize1, strsize2; -efi_status_t status =EFI_NOT_FOUND ; -int found =0 ; - -if (!capable (CAP_SYS_ADMIN )) -return -EACCES ; - -spin_lock (&efivars_lock); - -/* -* Does this variable already exist? -*/ -list_for_each_entry_safe (search_efivar, n, &efivar_list, list) { - strsize1 =utf8_strsize (search_efivar->var.VariableName,1024 ); - strsize2 =utf8_strsize (del_var->VariableName,1024 ); -if (strsize1 == strsize2 && - !memcmp (&(search_efivar->var.VariableName), - del_var->VariableName, strsize1) && - !efi_guidcmp (search_efivar->var.VendorGuid, - del_var->VendorGuid)) { - found =1 ; -break ; - } - } -if (!found) { -spin_unlock (&efivars_lock); -return -EINVAL ; - } -/* force the Attributes/DataSize to 0 to ensure deletion */ - del_var->Attributes =0 ; - del_var->DataSize =0 ; - - status = efi.set_variable (del_var->VariableName, - &del_var->VendorGuid, - del_var->Attributes, - del_var->DataSize, - del_var->Data); - -if (status !=EFI_SUCCESS ) { -printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , - status); -spin_unlock (&efivars_lock); -return -EIO ; - } -list_del (&search_efivar->list); -/* We need to release this lock before unregistering. */ -spin_unlock (&efivars_lock); -efivar_unregister (search_efivar); - -/* It's dead Jim.... */ -return count; -} - -static VAR_SUBSYS_ATTR(new_var, 0200, dummy, efivar_create); -static VAR_SUBSYS_ATTR(del_var, 0200, dummy, efivar_delete); - -static struct subsys_attribute *var_subsys_attrs[] = { - &var_subsys_attr_new_var, - &var_subsys_attr_del_var, -NULL , -}; -/* * Let's not leave out systab information that snuck into * the efivars driver
@@ -724,16 +585,6 @@ efivars_init(void) } }while (status !=EFI_NOT_FOUND ); -/* -* Now add attributes to allow creation of new vars -* and deletion of existing ones... -*/ - -for (i =0 ; (attr = var_subsys_attrs[i]) && !error; i++) { -if (attr->show && attr->store) - error =subsys_create_file (&vars_subsys, attr); - } -/* Don't forget the systab entry */ for (i =0 ; (attr = efi_subsys_attrs[i]) && !error; i++) {
Signature · 1 line
1.5.3.4
PATCH 39/54 kobject: convert efivars to kobj_attr interface
In reply to Greg KHThis cleans up a lot of code and gets rid of a unneeded macro, and gets us one step closer to deleting the deprecated subsys_attr code.
--- drivers/firmware/efivars.c | 35 ++++++++++++++--------------------- 1 files changed, 14 insertions(+), 21 deletions(-)
drivers/firmware/efivars.c +14 -21
@@ -129,13 +129,6 @@ struct efivar_attribute { }; -#define EFI_ATTR (_name, _mode, _show, _store) \ -struct subsys_attribute efi_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode}, \ - .show = _show, \ - .store = _store, \ -}; -#define EFIVAR_ATTR (_name, _mode, _show, _store) \ struct efivar_attribute efivar_attr_##_name = { \ .attr = {.name = __stringify(_name), .mode = _mode}, \
@@ -411,12 +404,12 @@ efivar_unregister(struct efivar_entry *var)* Let's not leave out systab information that snuck into * the efivars driver */ -static ssize_t -systab_read (struct kset *kset,char *buf) +static ssize_t systab_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *str = buf; -if (!kset || !buf) +if (!kobj || !buf)return -EINVAL ;if (efi.mps !=EFI_INVALID_TABLE_ADDR )
@@ -437,13 +430,19 @@ systab_read(struct kset *kset, char *buf)return str - buf; } -static EFI_ATTR(systab, 0400, systab_read, NULL); +static struct kobj_attribute efi_attr_systab = +__ATTR (systab,0400 , systab_show,NULL ); -static struct subsys_attribute *efi_subsys_attrs[] = { - &efi_attr_systab, +static struct attribute *efi_subsys_attrs[] = { + &efi_attr_systab.attr,NULL ,/* maybe more in the future? */ }; +static struct attribute_group efi_subsys_attr_group = { + .attrs = efi_subsys_attrs, +}; + + static decl_subsys(vars, NULL); static decl_subsys(efi, NULL);
@@ -522,9 +521,8 @@ efivars_init(void)efi_status_t status =EFI_NOT_FOUND ;efi_guid_t vendor_guid;efi_char16_t *variable_name; -struct subsys_attribute *attr;unsigned long variable_name_size =1024 ; -int i, error =0 ; +int error =0 ;if (!efi_enabled)return -ENODEV ;
@@ -586,12 +584,7 @@ efivars_init(void) }while (status !=EFI_NOT_FOUND );/* Don't forget the systab entry */ - -for (i =0 ; (attr = efi_subsys_attrs[i]) && !error; i++) { -if (attr->show) - error =subsys_create_file (&efi_subsys, attr); - } - + error =sysfs_create_group (&efi_subsys.kobj, &efi_subsys_attr_group);if (error)printk (KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n" , error);else
Signature · 1 line
1.5.3.4
PATCH 40/54 firmware: export firmware_kset so that people can use that instead of the braindead firmware_register interface
In reply to Greg KHNeeded for future firmware subsystem cleanups.
In the end, the firmware_register/unregister functions will be deleted entirely, but we need this symbol so that subsystems can migrate over.
--- drivers/base/firmware.c | 3 ++- include/linux/kobject.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/base/firmware.c +2 -1
@@ -16,7 +16,8 @@#include "base.h" -static struct kset *firmware_kset; +struct kset *firmware_kset; +EXPORT_SYMBOL_GPL (firmware_kset);int firmware_register (struct kset *s) {
include/linux/kobject.h +2 -0
@@ -204,6 +204,8 @@ extern struct kset *kernel_kset;extern struct kset *hypervisor_kset;/* The global /sys/power/ kset for people to chain off of */ extern struct kset *power_kset; +/* The global /sys/firmware/ kset for people to chain off of */ +extern struct kset *firmware_kset;extern int __must_check subsystem_register (struct kset *);extern void subsystem_unregister (struct kset *);
Signature · 1 line
1.5.3.4
PATCH 41/54 kset: convert efivars to use kset_create for the efi subsystem.
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/firmware/efivars.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-)
drivers/firmware/efivars.c +8 -9
@@ -444,7 +444,7 @@ static struct attribute_group efi_subsys_attr_group = { static decl_subsys(vars, NULL); -static decl_subsys(efi, NULL); +static struct kset *efi_kset;/* * efivar_create_sysfs_entry()
@@ -539,15 +539,14 @@ efivars_init(void)/* * For now we'll register the efi subsys within this driver */ - - error =firmware_register (&efi_subsys); - -if (error) { + efi_kset =kset_create_and_register ("efi" ,NULL ,NULL , firmware_kset); +if (IS_ERR (efi_kset)) { + error =PTR_ERR (efi_kset);printk (KERN_ERR "efivars: Firmware registration failed with error %d.\n" , error); goto out_free; } - vars_subsys.kobj.kset = &efi_subsys; + vars_subsys.kobj.kset = efi_kset; error =subsystem_register (&vars_subsys);
@@ -584,7 +583,7 @@ efivars_init(void) }while (status !=EFI_NOT_FOUND );/* Don't forget the systab entry */ - error =sysfs_create_group (&efi_subsys.kobj, &efi_subsys_attr_group); + error =sysfs_create_group (&efi_kset->kobj, &efi_subsys_attr_group);if (error)printk (KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n" , error);else
@@ -593,7 +592,7 @@ efivars_init(void)subsystem_unregister (&vars_subsys); out_firmware_unregister: -firmware_unregister (&efi_subsys); +kset_unregister (efi_kset); out_free:kfree (variable_name);
@@ -614,7 +613,7 @@ efivars_exit(void) }subsystem_unregister (&vars_subsys); -firmware_unregister (&efi_subsys); +kset_unregister (efi_kset); }module_init (efivars_init);
Signature · 1 line
1.5.3.4
PATCH 42/54 kset: convert efivars to use kset_create for the vars sub-subsystem.
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/firmware/efivars.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
drivers/firmware/efivars.c +7 -9
@@ -443,7 +443,7 @@ static struct attribute_group efi_subsys_attr_group = { }; -static decl_subsys(vars, NULL); +static struct kset *vars_kset;static struct kset *efi_kset;/*
@@ -489,7 +489,7 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,efi_guid_unparse (vendor_guid, short_name +strlen (short_name));kobject_set_name (&new_efivar->kobj,"%s" , short_name); - new_efivar->kobj.kset = &vars_subsys; + new_efivar->kobj.kset = vars_kset; new_efivar->kobj.ktype = &efivar_ktype; i =kobject_register (&new_efivar->kobj);if (i) {
@@ -546,11 +546,9 @@ efivars_init(void) goto out_free; } - vars_subsys.kobj.kset = efi_kset; - - error =subsystem_register (&vars_subsys); - -if (error) { + vars_kset =kset_create_and_register ("vars" ,NULL ,NULL , efi_kset); +if (IS_ERR (vars_kset)) { + error =PTR_ERR (vars_kset);printk (KERN_ERR "efivars: Subsystem registration failed with error %d.\n" , error); goto out_firmware_unregister; }
@@ -589,7 +587,7 @@ efivars_init(void)else goto out_free; -subsystem_unregister (&vars_subsys); +kset_unregister (vars_kset); out_firmware_unregister:kset_unregister (efi_kset);
@@ -612,7 +610,7 @@ efivars_exit(void)efivar_unregister (entry); } -subsystem_unregister (&vars_subsys); +kset_unregister (vars_kset);kset_unregister (efi_kset); }
Signature · 1 line
1.5.3.4
PATCH 43/54 kobject: convert arm/mach-omap1/pm.c to kobj_attr interface
In reply to Greg KHThis makes the code a bit simpler and and gets us one step closer to deleting the deprecated subsys_attr code.
--- arch/arm/mach-omap1/pm.c | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-)
arch/arm/mach-omap1/pm.c +8 -14
@@ -69,14 +69,14 @@ static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];static unsigned short enable_dyn_sleep =1 ; -static ssize_t omap_pm_sleep_while_idle_show (struct kset *kset,char *buf) +static ssize_t idle_show (struct kobject *kobj,struct kobj_attribute *attr, +char *buf) {return sprintf (buf,"%hu\n" , enable_dyn_sleep); } -static ssize_t omap_pm_sleep_while_idle_store (struct kset *kset, -const char * buf, -size_t n) +static ssize_t idle_store (struct kobject *kobj,struct kobj_attribute *attr, +const char * buf,size_t n) {unsigned short value; if (sscanf(buf, "%hu", &value) != 1 ||
@@ -88,14 +88,8 @@ static ssize_t omap_pm_sleep_while_idle_store(struct kset *kset,return n; } -static struct subsys_attribute sleep_while_idle_attr = { - .attr = { - .name =__stringify (sleep_while_idle), - .mode =0644 , - }, - .show = omap_pm_sleep_while_idle_show, - .store = omap_pm_sleep_while_idle_store, -}; +static struct kobj_attribute sleep_while_idle_attr = +__ATTR (sleep_while_idle,0644 , idle_show, idle_store);static void (*omap_sram_idle)(void ) =NULL ;static void (*omap_sram_suspend)(unsigned long r0,unsigned long r1) =NULL ;
@@ -725,9 +719,9 @@ static int __init omap_pm_init(void)omap_pm_init_proc ();#endif - error =subsys_create_file (power_kset, &sleep_while_idle_attr); + error =sysfs_create_file (&power_kset->kobj, &sleep_while_idle_attr);if (error) -printk (KERN_ERR "subsys_create_file failed: %d\n" , error); +printk (KERN_ERR "sysfs_create_file failed: %d\n" , error);if (cpu_is_omap16xx ()) {/* configure LOW_PWR pin */
Signature · 1 line
1.5.3.4
PATCH 44/54 kobject: convert pseries/power.c to kobj_attr interface
In reply to Greg KHThis makes the code a bit simpler and and gets us one step closer to deleting the deprecated subsys_attr code.
--- arch/powerpc/platforms/pseries/power.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-)
arch/powerpc/platforms/pseries/power.c +8 -12
@@ -29,13 +29,15 @@unsigned long rtas_poweron_auto;/* default and normal state is 0 */ -static ssize_t auto_poweron_show (struct kset *kset,char *buf) +static ssize_t auto_poweron_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {return sprintf (buf,"%lu\n" , rtas_poweron_auto); } -static ssize_t -auto_poweron_store (struct kset *kset,const char *buf,size_t n) +static ssize_t auto_poweron_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t n) {int ret;unsigned long ups_restart;
@@ -48,14 +50,8 @@ auto_poweron_store(struct kset *kset, const char *buf, size_t n)return -EINVAL ; } -static struct subsys_attribute auto_poweron_attr = { - .attr = { - .name =__stringify (auto_poweron), - .mode =0644 , - }, - .show = auto_poweron_show, - .store = auto_poweron_store, -}; +static struct kobj_attribute auto_poweron_attr = +__ATTR (auto_poweron,0644 , auto_poweron_show, auto_poweron_store);#ifndef CONFIG_PM struct kset *power_kset;
@@ -80,7 +76,7 @@ core_initcall(pm_init);#else static int __init apo_pm_init (void ) { -return (subsys_create_file (power_kset, &auto_poweron_attr)); +return (sysfs_create_file (&power_kset->kobj, &auto_poweron_attr)); }__initcall (apo_pm_init);#endif
Signature · 1 line
1.5.3.4
PATCH 45/54 kobject: convert s390 ipl.c to kobj_attr interface
In reply to Greg KHThis makes the code a bit simpler and and gets us one step closer to deleting the deprecated subsys_attr code.
NOTE, this needs the next patch in the series in order to work properly. This will build, but the sysfs files will not properly operate.
--- arch/s390/kernel/ipl.c | 80 ++++++++++++++++++++++++++++------------------- 1 files changed, 48 insertions(+), 32 deletions(-)
arch/s390/kernel/ipl.c +48 -32
@@ -162,22 +162,25 @@ EXPORT_SYMBOL_GPL(diag308);/* SYSFS */ #define DEFINE_IPL_ATTR_RO (_prefix, _name, _format, _value) \ -static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ +static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ + struct kobj_attribute *attr, \ char *page) \ { \ return sprintf(page, _format, _value); \ } \ -static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ +static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);#define DEFINE_IPL_ATTR_RW (_prefix, _name, _fmt_out, _fmt_in, _value) \ -static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ +static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ + struct kobj_attribute *attr, \ char *page) \ { \ return sprintf(page, _fmt_out, \ (unsigned long long) _value); \ } \ -static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \ +static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \ + struct kobj_attribute *attr, \ const char *buf, size_t len) \ { \ unsigned long long value; \
@@ -186,25 +189,27 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \ _value = value; \return len; \ } \ -static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ +static struct kobj_attribute sys_##_prefix##_##_name##_attr = \__ATTR (_name,(S_IRUGO |S_IWUSR ), \ sys_##_prefix##_##_name##_show, \ sys_##_prefix##_##_name##_store);#define DEFINE_IPL_ATTR_STR_RW (_prefix, _name, _fmt_out, _fmt_in, _value)\ -static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ +static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ + struct kobj_attribute *attr, \ char *page) \ { \ return sprintf(page, _fmt_out, _value); \ } \ -static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \ +static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \ + struct kobj_attribute *attr, \ const char *buf, size_t len) \ { \ if (sscanf(buf, _fmt_in, _value) != 1) \ return -EINVAL; \ return len; \ } \ -static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ +static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ __ATTR(_name,(S_IRUGO | S_IWUSR), \ sys_##_prefix##_##_name##_show, \ sys_##_prefix##_##_name##_store);
@@ -270,14 +275,16 @@ void __init setup_ipl_info(void)struct ipl_info ipl_info;EXPORT_SYMBOL_GPL (ipl_info); -static ssize_t ipl_type_show (struct kset *kset,char *page) +static ssize_t ipl_type_show (struct kobject *kobj,struct kobj_attribute *attr, +char *page) {return sprintf (page,"%s\n" ,ipl_type_str (ipl_info.type)); } -static struct subsys_attribute sys_ipl_type_attr =__ATTR_RO (ipl_type); +static struct kobj_attribute sys_ipl_type_attr =__ATTR_RO (ipl_type); -static ssize_t sys_ipl_device_show (struct kset *kset,char *page) +static ssize_t sys_ipl_device_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {struct ipl_parameter_block *ipl =IPL_PARMBLOCK_START ;
@@ -292,7 +299,7 @@ static ssize_t sys_ipl_device_show(struct kset *kset, char *page) } } -static struct subsys_attribute sys_ipl_device_attr = +static struct kobj_attribute sys_ipl_device_attr =__ATTR (device,S_IRUGO , sys_ipl_device_show,NULL ); static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr,
@@ -367,7 +374,8 @@ static struct attribute_group ipl_fcp_attr_group = {/* CCW ipl device attributes */ -static ssize_t ipl_ccw_loadparm_show (struct kset *kset,char *page) +static ssize_t ipl_ccw_loadparm_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {char loadparm[LOADPARM_LEN +1 ] = {};
@@ -379,7 +387,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page)return sprintf (page,"%s\n" , loadparm); } -static struct subsys_attribute sys_ipl_ccw_loadparm_attr = +static struct kobj_attribute sys_ipl_ccw_loadparm_attr =__ATTR (loadparm,0444 , ipl_ccw_loadparm_show,NULL );static struct attribute *ipl_ccw_attrs[] = {
@@ -465,7 +473,8 @@ static void reipl_get_ascii_loadparm(char *loadparm)strstrip (loadparm); } -static ssize_t reipl_ccw_loadparm_show (struct kset *kset,char *page) +static ssize_t reipl_ccw_loadparm_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {char buf[LOADPARM_LEN +1 ];
@@ -473,7 +482,8 @@ static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page)return sprintf (page,"%s\n" , buf); } -static ssize_t reipl_ccw_loadparm_store (struct kset *kset, +static ssize_t reipl_ccw_loadparm_store (struct kobject *kobj, +struct kobj_attribute *attr,const char *buf,size_t len) {int i, lp_len;
@@ -500,7 +510,7 @@ static ssize_t reipl_ccw_loadparm_store(struct kset *kset,return len; } -static struct subsys_attribute sys_reipl_ccw_loadparm_attr = +static struct kobj_attribute sys_reipl_ccw_loadparm_attr =__ATTR (loadparm,0644 , reipl_ccw_loadparm_show, reipl_ccw_loadparm_store);
@@ -568,13 +578,15 @@ static int reipl_set_type(enum ipl_type type)return 0 ; } -static ssize_t reipl_type_show (struct kset *kset,char *page) +static ssize_t reipl_type_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {return sprintf (page,"%s\n" ,ipl_type_str (reipl_type)); } -static ssize_t reipl_type_store (struct kset *kset,const char *buf, -size_t len) +static ssize_t reipl_type_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t len) {int rc = -EINVAL ;
@@ -587,7 +599,7 @@ static ssize_t reipl_type_store(struct kset *kset, const char *buf,return (rc !=0 ) ? rc : len; } -static struct subsys_attribute reipl_type_attr = +static struct kobj_attribute reipl_type_attr =__ATTR (reipl_type,0644 , reipl_type_show, reipl_type_store); static decl_subsys(reipl, NULL);
@@ -663,13 +675,15 @@ static int dump_set_type(enum dump_type type)return 0 ; } -static ssize_t dump_type_show (struct kset *kset,char *page) +static ssize_t dump_type_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {return sprintf (page,"%s\n" ,dump_type_str (dump_type)); } -static ssize_t dump_type_store (struct kset *kset,const char *buf, -size_t len) +static ssize_t dump_type_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t len) {int rc = -EINVAL ;
@@ -682,7 +696,7 @@ static ssize_t dump_type_store(struct kset *kset, const char *buf,return (rc !=0 ) ? rc : len; } -static struct subsys_attribute dump_type_attr = +static struct kobj_attribute dump_type_attr =__ATTR (dump_type,0644 , dump_type_show, dump_type_store); static decl_subsys(dump, NULL);
@@ -695,13 +709,15 @@ static decl_subsys(shutdown_actions, NULL);/* on panic */ -static ssize_t on_panic_show (struct kset *kset,char *page) +static ssize_t on_panic_show (struct kobject *kobj, +struct kobj_attribute *attr,char *page) {return sprintf (page,"%s\n" ,shutdown_action_str (on_panic_action)); } -static ssize_t on_panic_store (struct kset *kset,const char *buf, -size_t len) +static ssize_t on_panic_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t len) {if (strncmp (buf,SHUTDOWN_REIPL_STR ,strlen (SHUTDOWN_REIPL_STR )) ==0 ) on_panic_action =SHUTDOWN_REIPL ;
@@ -717,7 +733,7 @@ static ssize_t on_panic_store(struct kset *kset, const char *buf,return len; } -static struct subsys_attribute on_panic_attr = +static struct kobj_attribute on_panic_attr =__ATTR (on_panic,0644 , on_panic_show, on_panic_store);void do_reipl (void )
@@ -961,7 +977,7 @@ static int __init reipl_init(void) rc =firmware_register (&reipl_subsys);if (rc)return rc; - rc =subsys_create_file (&reipl_subsys, &reipl_type_attr); + rc =sysfs_create_file (&reipl_subsys.kobj, &reipl_type_attr);if (rc) {firmware_unregister (&reipl_subsys);return rc;
@@ -1050,7 +1066,7 @@ static int __init dump_init(void) rc =firmware_register (&dump_subsys);if (rc)return rc; - rc =subsys_create_file (&dump_subsys, &dump_type_attr); + rc =sysfs_create_file (&dump_subsys.kobj, &dump_type_attr);if (rc) {firmware_unregister (&dump_subsys);return rc;
@@ -1072,7 +1088,7 @@ static int __init shutdown_actions_init(void) rc =firmware_register (&shutdown_actions_subsys);if (rc)return rc; - rc =subsys_create_file (&shutdown_actions_subsys, &on_panic_attr); + rc =sysfs_create_file (&shutdown_actions_subsys.kobj, &on_panic_attr);if (rc) {firmware_unregister (&shutdown_actions_subsys);return rc;
Signature · 1 line
1.5.3.4
PATCH 46/54 kset: convert s390 ipl.c to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.
--- arch/s390/kernel/ipl.c | 75 +++++++++++++++++++++++++----------------------- 1 files changed, 39 insertions(+), 36 deletions(-)
arch/s390/kernel/ipl.c +39 -36
@@ -14,6 +14,7 @@#include <linux/delay.h> #include <linux/reboot.h> #include <linux/ctype.h> +#include <linux/err.h> #include <asm/ipl.h> #include <asm/smp.h> #include <asm/setup.h>
@@ -426,7 +427,7 @@ static struct attribute_group ipl_unknown_attr_group = { .attrs = ipl_unknown_attrs, }; -static decl_subsys(ipl, NULL); +static struct kset *ipl_kset;/* * reipl section
@@ -602,7 +603,7 @@ static ssize_t reipl_type_store(struct kobject *kobj,static struct kobj_attribute reipl_type_attr =__ATTR (reipl_type,0644 , reipl_type_show, reipl_type_store); -static decl_subsys(reipl, NULL); +static struct kset *reipl_kset;/* * dump section
@@ -699,13 +700,13 @@ static ssize_t dump_type_store(struct kobject *kobj,static struct kobj_attribute dump_type_attr =__ATTR (dump_type,0644 , dump_type_show, dump_type_store); -static decl_subsys(dump, NULL); +static struct kset *dump_kset;/* * Shutdown actions section */ -static decl_subsys(shutdown_actions, NULL); +static struct kset *shutdown_actions_kset;/* on panic */
@@ -830,23 +831,23 @@ static int __init ipl_register_fcp_files(void) {int rc; - rc =sysfs_create_group (&ipl_subsys.kobj, + rc =sysfs_create_group (&ipl_kset->kobj, &ipl_fcp_attr_group);if (rc) goto out; - rc =sysfs_create_bin_file (&ipl_subsys.kobj, + rc =sysfs_create_bin_file (&ipl_kset->kobj, &ipl_parameter_attr);if (rc) goto out_ipl_parm; - rc =sysfs_create_bin_file (&ipl_subsys.kobj, + rc =sysfs_create_bin_file (&ipl_kset->kobj, &ipl_scp_data_attr);if (!rc) goto out; -sysfs_remove_bin_file (&ipl_subsys.kobj, &ipl_parameter_attr); +sysfs_remove_bin_file (&ipl_kset->kobj, &ipl_parameter_attr); out_ipl_parm: -sysfs_remove_group (&ipl_subsys.kobj, &ipl_fcp_attr_group); +sysfs_remove_group (&ipl_kset->kobj, &ipl_fcp_attr_group); out:return rc; }
@@ -855,12 +856,12 @@ static int __init ipl_init(void) {int rc; - rc =firmware_register (&ipl_subsys); -if (rc) -return rc; + ipl_kset =kset_create_and_register ("ipl" ,NULL ,NULL , firmware_kset); +if (IS_ERR (ipl_kset)) +return PTR_ERR (ipl_kset);switch (ipl_info.type) {case IPL_TYPE_CCW : - rc =sysfs_create_group (&ipl_subsys.kobj, + rc =sysfs_create_group (&ipl_kset->kobj, &ipl_ccw_attr_group);break ;case IPL_TYPE_FCP :
@@ -868,16 +869,16 @@ static int __init ipl_init(void) rc =ipl_register_fcp_files ();break ;case IPL_TYPE_NSS : - rc =sysfs_create_group (&ipl_subsys.kobj, + rc =sysfs_create_group (&ipl_kset->kobj, &ipl_nss_attr_group);break ;default : - rc =sysfs_create_group (&ipl_subsys.kobj, + rc =sysfs_create_group (&ipl_kset->kobj, &ipl_unknown_attr_group);break ; }if (rc) -firmware_unregister (&ipl_subsys); +kset_unregister (ipl_kset);return rc; }
@@ -899,7 +900,7 @@ static int __init reipl_nss_init(void)if (!MACHINE_IS_VM )return 0 ; - rc =sysfs_create_group (&reipl_subsys.kobj, &reipl_nss_attr_group); + rc =sysfs_create_group (&reipl_kset->kobj, &reipl_nss_attr_group);if (rc)return rc;strncpy (reipl_nss_name, kernel_nss_name,NSS_NAME_SIZE +1 );
@@ -914,7 +915,7 @@ static int __init reipl_ccw_init(void) reipl_block_ccw = (void *)get_zeroed_page (GFP_KERNEL );if (!reipl_block_ccw)return -ENOMEM ; - rc =sysfs_create_group (&reipl_subsys.kobj, &reipl_ccw_attr_group); + rc =sysfs_create_group (&reipl_kset->kobj, &reipl_ccw_attr_group);if (rc) {free_page ((unsigned long )reipl_block_ccw);return rc;
@@ -952,7 +953,7 @@ static int __init reipl_fcp_init(void) reipl_block_fcp = (void *)get_zeroed_page (GFP_KERNEL );if (!reipl_block_fcp)return -ENOMEM ; - rc =sysfs_create_group (&reipl_subsys.kobj, &reipl_fcp_attr_group); + rc =sysfs_create_group (&reipl_kset->kobj, &reipl_fcp_attr_group);if (rc) {free_page ((unsigned long )reipl_block_fcp);return rc;
@@ -974,12 +975,12 @@ static int __init reipl_init(void) {int rc; - rc =firmware_register (&reipl_subsys); -if (rc) -return rc; - rc =sysfs_create_file (&reipl_subsys.kobj, &reipl_type_attr); + reipl_kset =kset_create_and_register ("reipl" ,NULL ,NULL , firmware_kset); +if (IS_ERR (reipl_kset)) +return PTR_ERR (reipl_kset); + rc =sysfs_create_file (&reipl_kset->kobj, &reipl_type_attr);if (rc) { -firmware_unregister (&reipl_subsys); +kset_unregister (reipl_kset);return rc; } rc =reipl_ccw_init ();
@@ -1004,7 +1005,7 @@ static int __init dump_ccw_init(void) dump_block_ccw = (void *)get_zeroed_page (GFP_KERNEL );if (!dump_block_ccw)return -ENOMEM ; - rc =sysfs_create_group (&dump_subsys.kobj, &dump_ccw_attr_group); + rc =sysfs_create_group (&dump_kset->kobj, &dump_ccw_attr_group);if (rc) {free_page ((unsigned long )dump_block_ccw);return rc;
@@ -1028,7 +1029,7 @@ static int __init dump_fcp_init(void) dump_block_fcp = (void *)get_zeroed_page (GFP_KERNEL );if (!dump_block_fcp)return -ENOMEM ; - rc =sysfs_create_group (&dump_subsys.kobj, &dump_fcp_attr_group); + rc =sysfs_create_group (&dump_kset->kobj, &dump_fcp_attr_group);if (rc) {free_page ((unsigned long )dump_block_fcp);return rc;
@@ -1063,12 +1064,12 @@ static int __init dump_init(void) {int rc; - rc =firmware_register (&dump_subsys); -if (rc) -return rc; - rc =sysfs_create_file (&dump_subsys.kobj, &dump_type_attr); + dump_kset =kset_create_and_register ("dump" ,NULL ,NULL , firmware_kset); +if (IS_ERR (dump_kset)) +return PTR_ERR (dump_kset); + rc =sysfs_create_file (&dump_kset->kobj, &dump_type_attr);if (rc) { -firmware_unregister (&dump_subsys); +kset_unregister (dump_kset);return rc; } rc =dump_ccw_init ();
@@ -1085,12 +1086,14 @@ static int __init shutdown_actions_init(void) {int rc; - rc =firmware_register (&shutdown_actions_subsys); -if (rc) -return rc; - rc =sysfs_create_file (&shutdown_actions_subsys.kobj, &on_panic_attr); + shutdown_actions_kset =kset_create_and_register ("shutdown_actions" , +NULL ,NULL , + firmware_kset); +if (IS_ERR (shutdown_actions_kset)) +return PTR_ERR (shutdown_actions_kset); + rc =sysfs_create_file (&shutdown_actions_kset->kobj, &on_panic_attr);if (rc) { -firmware_unregister (&shutdown_actions_subsys); +kset_unregister (shutdown_actions_kset);return rc; } atomic_notifier_chain_register(&panic_notifier_list,
Signature · 1 line
1.5.3.4
PATCH 47/54 kobject: convert parisc/pdc_stable to kobj_attr interface
In reply to Greg KHThis makes the code a bit simpler and and gets us one step closer to deleting the deprecated subsys_attr code.
NOTE, this needs the next patch in the series in order to work properly. This will build, but the sysfs files will not properly operate.
--- drivers/parisc/pdc_stable.c | 147 ++++++++++++++++++++---------------------- 1 files changed, 70 insertions(+), 77 deletions(-)
drivers/parisc/pdc_stable.c +70 -77
@@ -120,7 +120,7 @@ struct pdcspath_entry pdcspath_entry_##_name = { \ };#define PDCS_ATTR (_name, _mode, _show, _store) \ -struct subsys_attribute pdcs_attr_##_name = { \ +struct kobj_attribute pdcs_attr_##_name = { \ .attr = {.name = __stringify(_name), .mode = _mode}, \ .show = _show, \ .store = _store, \
@@ -523,15 +523,15 @@ static struct pdcspath_entry *pdcspath_entries[] = {/** * pdcs_size_read - Stable Storage size output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. */ -static ssize_t -pdcs_size_read (struct kset *kset,char *buf) +static ssize_t pdcs_size_read (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) {char *out = buf; -if (!kset || !buf) +if (!buf)return -EINVAL ;/* show the size of the stable storage */
@@ -542,17 +542,17 @@ pdcs_size_read(struct kset *kset, char *buf)/** * pdcs_auto_read - Stable Storage autoboot/search flag output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag */ -static ssize_t -pdcs_auto_read (struct kset *kset,char *buf,int knob) +static ssize_t pdcs_auto_read (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf,int knob) {char *out = buf;struct pdcspath_entry *pathentry; -if (!kset || !buf) +if (!buf)return -EINVAL ;/* Current flags are stored in primary boot path entry */
@@ -568,40 +568,37 @@ pdcs_auto_read(struct kset *kset, char *buf, int knob)/** * pdcs_autoboot_read - Stable Storage autoboot flag output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. */ -static inline ssize_t -pdcs_autoboot_read (struct kset *kset,char *buf) +static ssize_t pdcs_autoboot_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return pdcs_auto_read (kset, buf,PF_AUTOBOOT ); +return pdcs_auto_read (kobj, attr, buf,PF_AUTOBOOT ); }/** * pdcs_autosearch_read - Stable Storage autoboot flag output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. */ -static inline ssize_t -pdcs_autosearch_read (struct kset *kset,char *buf) +static ssize_t pdcs_autosearch_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { -return pdcs_auto_read (kset, buf,PF_AUTOSEARCH ); +return pdcs_auto_read (kobj, attr, buf,PF_AUTOSEARCH ); }/** * pdcs_timer_read - Stable Storage timer count output (in seconds). -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * * The value of the timer field correponds to a number of seconds in powers of 2. */ -static ssize_t -pdcs_timer_read (struct kset *kset,char *buf) +static ssize_t pdcs_timer_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf;struct pdcspath_entry *pathentry; -if (!kset || !buf) +if (!buf)return -EINVAL ;/* Current flags are stored in primary boot path entry */
@@ -618,15 +615,14 @@ pdcs_timer_read(struct kset *kset, char *buf)/** * pdcs_osid_read - Stable Storage OS ID register output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. */ -static ssize_t -pdcs_osid_read (struct kset *kset,char *buf) +static ssize_t pdcs_osid_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf; -if (!kset || !buf) +if (!buf)return -EINVAL ; out += sprintf(out, "%s dependent data (0x%.4x)\n",
@@ -637,18 +633,17 @@ pdcs_osid_read(struct kset *kset, char *buf)/** * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * * This can hold 16 bytes of OS-Dependent data. */ -static ssize_t -pdcs_osdep1_read (struct kset *kset,char *buf) +static ssize_t pdcs_osdep1_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf;u32 result[4 ]; -if (!kset || !buf) +if (!buf)return -EINVAL ;if (pdc_stable_read (PDCS_ADDR_OSD1 , &result,sizeof (result)) !=PDC_OK )
@@ -664,18 +659,17 @@ pdcs_osdep1_read(struct kset *kset, char *buf)/** * pdcs_diagnostic_read - Stable Storage Diagnostic register output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * * I have NFC how to interpret the content of that register ;-). */ -static ssize_t -pdcs_diagnostic_read (struct kset *kset,char *buf) +static ssize_t pdcs_diagnostic_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf;u32 result; -if (!kset || !buf) +if (!buf)return -EINVAL ;/* get diagnostic */
@@ -689,18 +683,17 @@ pdcs_diagnostic_read(struct kset *kset, char *buf)/** * pdcs_fastsize_read - Stable Storage FastSize register output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * * This register holds the amount of system RAM to be tested during boot sequence. */ -static ssize_t -pdcs_fastsize_read (struct kset *kset,char *buf) +static ssize_t pdcs_fastsize_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf;u32 result; -if (!kset || !buf) +if (!buf)return -EINVAL ;/* get fast-size */
@@ -718,13 +711,12 @@ pdcs_fastsize_read(struct kset *kset, char *buf)/** * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The output buffer to write to. * * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. */ -static ssize_t -pdcs_osdep2_read (struct kset *kset,char *buf) +static ssize_t pdcs_osdep2_read (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) {char *out = buf;unsigned long size;
@@ -736,7 +728,7 @@ pdcs_osdep2_read(struct kset *kset, char *buf) size = pdcs_size -224 ; -if (!kset || !buf) +if (!buf)return -EINVAL ;for (i=0 ; i<size; i+=4 ) {
@@ -751,7 +743,6 @@ pdcs_osdep2_read(struct kset *kset, char *buf)/** * pdcs_auto_write - This function handles autoboot/search flag modifying. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The input buffer to read from. * @count: The number of bytes to be read. * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
@@ -760,8 +751,9 @@ pdcs_osdep2_read(struct kset *kset, char *buf)* We expect a precise syntax: * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On */ -static ssize_t -pdcs_auto_write (struct kset *kset,const char *buf,size_t count,int knob) +static ssize_t pdcs_auto_write (struct kobject *kobj, +struct kobj_attribute *attr,const char *buf, +size_t count,int knob) {struct pdcspath_entry *pathentry;unsigned char flags;
@@ -771,7 +763,7 @@ pdcs_auto_write(struct kset *kset, const char *buf, size_t count, int knob)if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -if (!kset || !buf || !count) +if (!buf || !count)return -EINVAL ;/* We'll use a local copy of buf */
@@ -826,7 +818,6 @@ parse_error:/** * pdcs_autoboot_write - This function handles autoboot flag modifying. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The input buffer to read from. * @count: The number of bytes to be read. *
@@ -834,15 +825,15 @@ parse_error:* We expect a precise syntax: * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On */ -static inline ssize_t -pdcs_autoboot_write (struct kset *kset,const char *buf,size_t count) +static ssize_t pdcs_autoboot_write (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t count) { -return pdcs_auto_write (kset, buf, count,PF_AUTOBOOT ); +return pdcs_auto_write (kset, attr, buf, count,PF_AUTOBOOT ); }/** * pdcs_autosearch_write - This function handles autosearch flag modifying. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The input buffer to read from. * @count: The number of bytes to be read. *
@@ -850,15 +841,15 @@ pdcs_autoboot_write(struct kset *kset, const char *buf, size_t count)* We expect a precise syntax: * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On */ -static inline ssize_t -pdcs_autosearch_write (struct kset *kset,const char *buf,size_t count) +static ssize_t pdcs_autosearch_write (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t count) { -return pdcs_auto_write (kset, buf, count,PF_AUTOSEARCH ); +return pdcs_auto_write (kset, attr, buf, count,PF_AUTOSEARCH ); }/** * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The input buffer to read from. * @count: The number of bytes to be read. *
@@ -866,15 +857,16 @@ pdcs_autosearch_write(struct kset *kset, const char *buf, size_t count)* write approach. It's up to userspace to deal with it when constructing * its input buffer. */ -static ssize_t -pdcs_osdep1_write (struct kset *kset,const char *buf,size_t count) +static ssize_t pdcs_osdep1_write (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t count) {u8 in[16 ];if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -if (!kset || !buf || !count) +if (!buf || !count)return -EINVAL ;if (unlikely (pdcs_osid !=OS_ID_LINUX ))
@@ -895,7 +887,6 @@ pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count)/** * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. -* @kset: An allocated and populated struct kset. We don't use it tho. * @buf: The input buffer to read from. * @count: The number of bytes to be read. *
@@ -903,8 +894,9 @@ pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count)* byte-by-byte write approach. It's up to userspace to deal with it when * constructing its input buffer. */ -static ssize_t -pdcs_osdep2_write (struct kset *kset,const char *buf,size_t count) +static ssize_t pdcs_osdep2_write (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t count) {unsigned long size;unsigned short i;
@@ -913,7 +905,7 @@ pdcs_osdep2_write(struct kset *kset, const char *buf, size_t count)if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -if (!kset || !buf || !count) +if (!buf || !count)return -EINVAL ;if (unlikely (pdcs_size <=224 ))
@@ -951,19 +943,23 @@ static PDCS_ATTR(diagnostic, 0400, pdcs_diagnostic_read, NULL); static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL); static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write); -static struct subsys_attribute *pdcs_subsys_attrs[] = { - &pdcs_attr_size, - &pdcs_attr_autoboot, - &pdcs_attr_autosearch, - &pdcs_attr_timer, - &pdcs_attr_osid, - &pdcs_attr_osdep1, - &pdcs_attr_diagnostic, - &pdcs_attr_fastsize, - &pdcs_attr_osdep2, +static struct attribute *pdcs_subsys_attrs[] = { + &pdcs_attr_size.attr, + &pdcs_attr_autoboot.attr, + &pdcs_attr_autosearch.attr, + &pdcs_attr_timer.attr, + &pdcs_attr_osid.attr, + &pdcs_attr_osdep1.attr, + &pdcs_attr_diagnostic.attr, + &pdcs_attr_fastsize.attr, + &pdcs_attr_osdep2.attr,NULL , }; +static struct attribute_group pdcs_attr_group = { + .attrs = pdcs_subsys_attrs, +}; + static decl_subsys(paths, NULL); static decl_subsys(stable, NULL);
@@ -1042,8 +1038,7 @@ pdcs_unregister_pathentries(void)static int __init pdc_stable_init (void ) { -struct subsys_attribute *attr; -int i, rc =0 , error =0 ; +int rc =0 , error =0 ;u32 result;/* find the size of the stable storage */
@@ -1068,10 +1063,8 @@ pdc_stable_init(void) goto fail_firmreg;/* Don't forget the root entries */ -for (i =0 ; (attr = pdcs_subsys_attrs[i]) && !error; i++) -if (attr->show) - error =subsys_create_file (&stable_subsys, attr); - + error =sysfs_create_group (&stable_subsys.kobj, pdcs_attr_group); +/* register the paths subsys as a subsystem of stable subsys */ paths_subsys.kobj.kset = &stable_subsys;if ((rc =subsystem_register (&paths_subsys)))
Signature · 1 line
1.5.3.4
PATCH 48/54 kset: convert parisc/pdc_stable.c to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.
--- drivers/parisc/pdc_stable.c | 42 ++++++++++++++++++++++++------------------ 1 files changed, 24 insertions(+), 18 deletions(-)
drivers/parisc/pdc_stable.c +24 -18
@@ -960,8 +960,8 @@ static struct attribute_group pdcs_attr_group = { .attrs = pdcs_subsys_attrs, }; -static decl_subsys(paths, NULL); -static decl_subsys(stable, NULL); +static struct kset *stable_kset; +static struct kset *paths_kset;/** * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage.
@@ -993,7 +993,7 @@ pdcs_register_pathentries(void)if ((err =kobject_set_name (&entry->kobj,"%s" , entry->name)))return err; - entry->kobj.kset = &paths_subsys; + entry->kobj.kset = paths_kset; entry->kobj.ktype = &ktype_pdcspath;if ((err =kobject_register (&entry->kobj)))return err;
@@ -1058,19 +1058,26 @@ pdc_stable_init(void)/* the actual result is 16 bits away */ pdcs_osid = (u16)(result >>16 ); -/* For now we'll register the stable subsys within this driver */ -if ((rc =firmware_register (&stable_subsys))) +/* For now we'll register the stable kset within this driver */ + stable_kset =kset_create_and_register ("stable" ,NULL ,NULL , + firmware_kset); +if (IS_ERR (stable_kset)) { + rc =PTR_ERR (stable_kset); goto fail_firmreg; + }/* Don't forget the root entries */ - error =sysfs_create_group (&stable_subsys.kobj, pdcs_attr_group); - -/* register the paths subsys as a subsystem of stable subsys */ - paths_subsys.kobj.kset = &stable_subsys; -if ((rc =subsystem_register (&paths_subsys))) - goto fail_subsysreg; + error =sysfs_create_group (&stable_kset->kobj, pdcs_attr_group); + +/* register the paths kset as a child of the stable kset */ + paths_kset =kset_create_and_register ("paths" ,NULL ,NULL , + stable_kset); +if (IS_ERR (paths_kset)) { + rc =PTR_ERR (paths_kset); + goto fail_ksetreg; + } -/* now we create all "files" for the paths subsys */ +/* now we create all "files" for the paths kset */ if ((rc =pdcs_register_pathentries ())) goto fail_pdcsreg;
@@ -1078,10 +1085,10 @@ pdc_stable_init(void) fail_pdcsreg:pdcs_unregister_pathentries (); -subsystem_unregister (&paths_subsys); +kset_unregister (paths_kset); -fail_subsysreg: -firmware_unregister (&stable_subsys); +fail_ksetreg: +kset_unregister (stable_kset); fail_firmreg: printk(KERN_INFO PDCS_PREFIX " bailing out\n");
@@ -1092,9 +1099,8 @@ static void __exitpdc_stable_exit (void) {pdcs_unregister_pathentries (); -subsystem_unregister (&paths_subsys); - -firmware_unregister (&stable_subsys); +kset_unregister (paths_kset); +kset_unregister (stable_kset); }
Signature · 1 line
1.5.3.4
PATCH 49/54 Driver Core: kill subsys_attribute and default sysfs ops
In reply to Greg KHFrom: Kay Sievers <[email protected]>
Remove the no longer needed subsys_attributes, they are all converted to the more sensical kobj_attributes.
There is no longer a magic fallback in sysfs attribute operations, all kobjects which create simple attributes need explicitely a ktype assigned, which tells the core what was intended here.
--- fs/sysfs/file.c | 63 +++++++--------------------------------------- include/linux/kobject.h | 9 ------ lib/kobject.c | 21 --------------- 3 files changed, 10 insertions(+), 83 deletions(-)
fs/sysfs/file.c +10 -53
@@ -20,43 +20,6 @@#include "sysfs.h" -#define to_sattr (a) container_of(a,struct subsys_attribute, attr) - -/* -* Subsystem file operations. -* These operations allow subsystems to have files that can be -* read/written. -*/ -static ssize_t -subsys_attr_show (struct kobject * kobj,struct attribute * attr,char * page) -{ -struct kset *kset =to_kset (kobj); -struct subsys_attribute * sattr =to_sattr (attr); -ssize_t ret = -EIO ; - -if (sattr->show) - ret = sattr->show (kset, page); -return ret; -} - -static ssize_t -subsys_attr_store (struct kobject * kobj,struct attribute * attr, -const char * page,size_t count) -{ -struct kset *kset =to_kset (kobj); -struct subsys_attribute * sattr =to_sattr (attr); -ssize_t ret = -EIO ; - -if (sattr->store) - ret = sattr->store (kset, page, count); -return ret; -} - -static struct sysfs_ops subsys_sysfs_ops = { - .show = subsys_attr_show, - .store = subsys_attr_store, -}; -/* * There's one sysfs_buffer for each open file and one * sysfs_open_dirent for each sysfs_dirent with one or more open
@@ -350,29 +313,23 @@ static int sysfs_open_file(struct inode *inode, struct file *file) {struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_buffer * buffer; -struct sysfs_ops * ops =NULL ; -int error; +struct sysfs_buffer *buffer; +struct sysfs_ops *ops; +int error = -EACCES ;/* need attr_sd for attr and ops, its parent for kobj */ if (!sysfs_get_active_two (attr_sd))return -ENODEV ; -/* if the kobject has no ktype, then we assume that it is a subsystem -* itself, and use ops for it. -*/ -if (kobj->ktype) +/* every kobject with an attribute needs a ktype assigned */ +if (kobj->ktype && kobj->ktype->sysfs_ops) ops = kobj->ktype->sysfs_ops; -else - ops = &subsys_sysfs_ops; - - error = -EACCES ; - -/* No sysfs operations, either from having no subsystem, -* or the subsystem have no operations. -*/ -if (!ops) +else { +printk (KERN_ERR "missing sysfs attribute operations for " +"kobject: %s\n" ,kobject_name (kobj)); +WARN_ON (1 ); goto err_out; + }/* File needs write support. * The inode's perms must say it's ok,
include/linux/kobject.h +0 -9
@@ -210,15 +210,6 @@ extern struct kset *firmware_kset;extern int __must_check subsystem_register (struct kset *);extern void subsystem_unregister (struct kset *); -struct subsys_attribute { -struct attribute attr; -ssize_t (*show)(struct kset *,char *); -ssize_t (*store)(struct kset *,const char *,size_t ); -}; - -extern int __must_check subsys_create_file (struct kset *, -struct subsys_attribute *); -#if defined(CONFIG_HOTPLUG )int kobject_uevent (struct kobject *kobj,enum kobject_action action); int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
lib/kobject.c +0 -21
@@ -671,26 +671,6 @@ void subsystem_unregister(struct kset *s)kset_unregister (s); } -/** -* subsystem_create_file - export sysfs attribute file. -* @s: subsystem. -* @a: subsystem attribute descriptor. -*/ - -int subsys_create_file (struct kset *s,struct subsys_attribute *a) -{ -int error =0 ; - -if (!s || !a) -return -EINVAL ; - -if (kset_get (s)) { - error =sysfs_create_file (&s->kobj, &a->attr); -kset_put (s); - } -return error; -} -static void kset_release (struct kobject *kobj) { struct kset *kset = container_of(kobj, struct kset, kobj);
@@ -795,4 +775,3 @@ EXPORT_SYMBOL(kset_unregister);EXPORT_SYMBOL (subsystem_register);EXPORT_SYMBOL (subsystem_unregister); -EXPORT_SYMBOL (subsys_create_file);
Signature · 1 line
1.5.3.4
PATCH 50/54 kset: convert edd to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/firmware/edd.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/firmware/edd.c +7 -7
@@ -631,7 +631,7 @@ static struct kobj_type edd_ktype = { .default_attrs = def_attrs, }; -static decl_subsys(edd, NULL); +static struct kset *edd_kset;/**
@@ -723,7 +723,7 @@ edd_device_register(struct edd_device *edev, int i)edd_dev_set_info (edev, i);kobject_set_name (&edev->kobj,"int13_dev%02x" ,0x80 + i); - edev->kobj.kset = &edd_subsys; + edev->kobj.kset = edd_kset; edev->kobj.ktype = &edd_ktype; error =kobject_register (&edev->kobj);if (!error)
@@ -756,9 +756,9 @@ edd_init(void)return 1 ; } - rc =firmware_register (&edd_subsys); -if (rc) -return rc; + edd_kset =kset_create_and_register ("edd" ,NULL ,NULL , firmware_kset); +if (IS_ERR (edd_kset)) +return PTR_ERR (edd_kset);for (i =0 ; i <edd_num_devices () && !rc; i++) { edev =kzalloc (sizeof (*edev),GFP_KERNEL );
@@ -774,7 +774,7 @@ edd_init(void) }if (rc) -firmware_unregister (&edd_subsys); +kset_unregister (edd_kset);return rc; }
@@ -788,7 +788,7 @@ edd_exit(void)if ((edev = edd_devices[i]))edd_device_unregister (edev); } -firmware_unregister (&edd_subsys); +kset_unregister (edd_kset); }late_initcall (edd_init);
Signature · 1 line
1.5.3.4
PATCH 51/54 kset: convert acpi to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
--- drivers/acpi/bus.c | 12 ++++++++---- drivers/acpi/system.c | 2 +- include/acpi/acpi_bus.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/acpi/bus.c +8 -4
@@ -744,7 +744,7 @@ static int __init acpi_bus_init(void)return -ENODEV ; } -decl_subsys (acpi,NULL ); +struct kset *acpi_kset;static int __init acpi_init (void ) {
@@ -756,10 +756,14 @@ static int __init acpi_init(void)return -ENODEV ; } - result =firmware_register (&acpi_subsys); -if (result <0 ) -printk (KERN_WARNING "%s: firmware_register error: %d\n" , + acpi_kset =kset_create_and_register ("acpi" ,NULL ,NULL , + firmware_kset); +if (IS_ERR (acpi_kset)) { + result =PTR_ERR (acpi_kset); +printk (KERN_WARNING "%s: kset create error: %d\n" , __FUNCTION__, result); + acpi_kset =NULL ; + } result =acpi_bus_init ();
drivers/acpi/system.c +1 -1
@@ -135,7 +135,7 @@ static int acpi_system_sysfs_init(void)int table_index =0 ;int result; - tables_kobj.parent = &acpi_subsys.kobj; + tables_kobj.parent = &acpi_kset->kobj;kobject_set_name (&tables_kobj,"tables" ); result =kobject_register (&tables_kobj);if (result)
include/acpi/acpi_bus.h +1 -1
@@ -318,7 +318,7 @@ struct acpi_bus_event {u32 data; }; -extern struct kset acpi_subsys; +extern struct kset *acpi_kset;extern int acpi_bus_generate_netlink_event (const char *,const char *,u8 ,int );/* * External Functions
Signature · 1 line
1.5.3.4
PATCH 52/54 firmware: remove firmware_(un)register()
In reply to Greg KHThese functions are no longer called or needed, so we can remove them.
As I rewrote the whole firmware.c file, add my copyright.
--- drivers/base/firmware.c | 19 ++----------------- include/linux/device.h | 5 ----- 2 files changed, 2 insertions(+), 22 deletions(-)
drivers/base/firmware.c +2 -17
@@ -3,11 +3,11 @@* * Copyright (c) 2002-3 Patrick Mochel * Copyright (c) 2002-3 Open Source Development Labs +* Copyright (c) 2007 Greg Kroah-Hartman <[email protected]> +* Copyright (c) 2007 Novell Inc. * * This file is released under the GPLv2 -* */ -#include <linux/kobject.h> #include <linux/module.h> #include <linux/init.h>
@@ -19,18 +19,6 @@struct kset *firmware_kset;EXPORT_SYMBOL_GPL (firmware_kset); -int firmware_register (struct kset *s) -{ - s->kobj.kset = firmware_kset; - s->kobj.ktype =NULL ; -return subsystem_register (s); -} - -void firmware_unregister (struct kset *s) -{ -subsystem_unregister (s); -} -int __init firmware_init (void ) { firmware_kset =kset_create_and_register ("firmware" ,NULL ,NULL ,NULL );
@@ -38,6 +26,3 @@ int __init firmware_init(void)return PTR_ERR (firmware_kset);return 0 ; } - -EXPORT_SYMBOL_GPL (firmware_register); -EXPORT_SYMBOL_GPL (firmware_unregister);
include/linux/device.h +0 -5
@@ -541,11 +541,6 @@ extern void device_shutdown(void);/* drivers/base/sys.c */ extern void sysdev_shutdown (void ); - -/* drivers/base/firmware.c */ -extern int __must_check firmware_register (struct kset *); -extern void firmware_unregister (struct kset *); -/* debugging and troubleshooting/diagnostic helpers. */ extern const char *dev_driver_string (struct device *dev); #define dev_printk(level, dev, format, arg...) \
Signature · 1 line
1.5.3.4
PATCH 53/54 kset: convert ocfs2 to use kset_create
In reply to Greg KHDynamically create the kset instead of declaring it statically.
Also use the new kobj_attribute which cleans up this file a _lot_.
--- fs/ocfs2/cluster/masklog.c | 4 +- fs/ocfs2/cluster/sys.c | 83 +++++++++++-------------------------------- 2 files changed, 23 insertions(+), 64 deletions(-)
fs/ocfs2/cluster/masklog.c +2 -2
@@ -146,7 +146,7 @@ static struct kset mlog_kset = { .kobj = {.ktype = &mlog_ktype}, }; -int mlog_sys_init (struct kset *o2cb_subsys) +int mlog_sys_init (struct kset *o2cb_kset) {int i =0 ;
@@ -157,7 +157,7 @@ int mlog_sys_init(struct kset *o2cb_subsys) mlog_attr_ptrs[i] =NULL ;kobject_set_name (&mlog_kset.kobj,"logmask" ); - mlog_kset.kobj.kset = o2cb_subsys; + mlog_kset.kobj.kset = o2cb_kset;return kset_register (&mlog_kset); }
fs/ocfs2/cluster/sys.c +21 -62
117 lines not on this page · raw message
Signature · 1 line
1.5.3.4
PATCH 54/54 kset: remove decl_subsys macro
In reply to Greg KHThis macro is no longer used. ksets should be created dynamically with a call to kset_create_and_register() not declared statically.
Yes, there are 5 remaining static struct kset usages in the kernel tree, but they will be fixed up soon.
--- drivers/base/class.c | 11 +++++++++-- include/linux/kobject.h | 6 ------ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/base/class.c +9 -2
@@ -453,8 +453,15 @@ static struct kset_uevent_ops class_uevent_ops = { .uevent = class_uevent, }; -static decl_subsys(class_obj, &class_uevent_ops); - +/* +* DO NOT copy how this is created, kset_create_and_register() should be +* called, but this is a hold-over from the old-way and will be deleted +* entirely soon. +*/ +static struct kset class_obj_subsys = { + .kobj = { .k_name ="class_obj" , }, + .uevent_ops = &class_uevent_ops, +};static int class_device_add_attrs (struct class_device * cd) {
include/linux/kobject.h +0 -6
@@ -192,12 +192,6 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);#define set_kset_name (str) .kset = { .kobj = { .k_name = str } } -#define decl_subsys (_name,_uevent_ops) \ -struct kset _name##_subsys = { \ - .kobj = { .k_name = __stringify(_name) }, \ - .uevent_ops =_uevent_ops, \ -} -/* The global /sys/kernel/ kset for people to chain off of */ extern struct kset *kernel_kset;/* The global /sys/hypervisor/ kset for people to chain off of */
Signature · 1 line
1.5.3.4
Re: [PATCH 46/54] kset: convert s390 ipl.c to use kset_create
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.
Cc Kay Sievers <[email protected]>Cc Michael Holzheu <[email protected]>Cc Heiko Carstens <[email protected]>Cc Volker Sameske <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 3 lines
--- arch/s390/kernel/ipl.c | 75 +++++++++++++++++++++++++----------------------- 1 files changed, 39 insertions(+), 36 deletions(-)
It seems you also need this (not yet booted):
Fix the following warnings:
arch/s390/kernel/ipl.c: In function 'reipl_init':arch/s390/kernel/ipl.c:981: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer type arch/s390/kernel/ipl.c: In function 'dump_init':arch/s390/kernel/ipl.c:1070: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer type arch/s390/kernel/ipl.c: In function 'shutdown_actions_init':arch/s390/kernel/ipl.c:1094: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer type
--- arch/s390/kernel/ipl.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +4 -3
@@ -978,7 +978,7 @@ static int __init reipl_init(void) reipl_kset =kset_create_and_register ("reipl" ,NULL ,NULL , firmware_kset);if (IS_ERR (reipl_kset))return PTR_ERR (reipl_kset); - rc =sysfs_create_file (&reipl_kset->kobj, &reipl_type_attr); + rc =sysfs_create_file (&reipl_kset->kobj, &reipl_type_attr.attr);if (rc) {kset_unregister (reipl_kset);return rc;
@@ -1067,7 +1067,7 @@ static int __init dump_init(void) dump_kset =kset_create_and_register ("dump" ,NULL ,NULL , firmware_kset);if (IS_ERR (dump_kset))return PTR_ERR (dump_kset); - rc =sysfs_create_file (&dump_kset->kobj, &dump_type_attr); + rc =sysfs_create_file (&dump_kset->kobj, &dump_type_attr.attr);if (rc) {kset_unregister (dump_kset);return rc;
@@ -1091,7 +1091,8 @@ static int __init shutdown_actions_init( firmware_kset);if (IS_ERR (shutdown_actions_kset))return PTR_ERR (shutdown_actions_kset); - rc =sysfs_create_file (&shutdown_actions_kset->kobj, &on_panic_attr); + rc =sysfs_create_file (&shutdown_actions_kset->kobj, + &on_panic_attr.attr);if (rc) {kset_unregister (shutdown_actions_kset);return rc;
Re: [PATCH 33/54] driver core: remove fields from struct bus_type
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
struct
bus_typeis static everywhere in the kernel. This moves the kobject in the structure out of it, and a bunch of other private only to the driver core fields are now moved to a private structure. This lets us dynamically create the backing kobject properly and gives us the chance to be able to document to users exactly how to use the structbus_typeas there are no fields they can improperly access.Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 10 lines
--- drivers/base/base.h | 30 +++++++++++- drivers/base/bus.c | 120 ++++++++++++++++++++++++++-------------------- drivers/base/core.c | 6 +- drivers/base/dd.c | 4 +- drivers/base/driver.c | 2 +- drivers/base/platform.c | 4 +- include/linux/device.h | 12 +---- 7 files changed, 107 insertions(+), 71 deletions(-)
drivers/base/bus.c: In function 'make_deprecated_bus_links':drivers/base/bus.c:428: error: 'struct bus_type' has no member named 'subsys'
--- drivers/base/bus.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/base/bus.c +1 -1
@@ -425,7 +425,7 @@ static void device_remove_attrs(struct bstatic int make_deprecated_bus_links (struct device *dev) {return sysfs_create_link (&dev->kobj, - &dev->bus->subsys.kobj,"bus" ); + &dev->bus->p->subsys.kobj,"bus" ); }static void remove_deprecated_bus_links (struct device *dev)
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
From: Kay Sievers <[email protected]>
Add
kobj_sysfs_opsto replacesubsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets.The whole concept of any default sysfs attribute operations will go away with the upcoming removal of
subsys_sysfs_ops.
Quoted 6 lines
Signed-off-by Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/kobject.h | 10 ++++++++++ lib/kobject.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)
How about adding some simple wrappers around the new kobj_attribute structure? This makes the layering clearer.
--- include/linux/kobject.h | 7 ++++++- lib/kobject.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-)
include/linux/kobject.h +6 -1
@@ -126,7 +126,12 @@ struct kobj_attribute {ssize_t (*store)(struct kobject *kobj,struct kobj_attribute *attr,const char *buf,size_t count); }; - +#define KOBJ_ATTR (_name,_mode,_show,_store) \ + struct kobj_attribute kobj_attr_##_name = \ + __ATTR(_name,_mode,_show,_store) +extern int __must_check kobject_create_file (struct kobject *, +struct kobj_attribute *); +extern void kobject_remove_file (struct kobject *,struct kobj_attribute *);extern struct sysfs_ops kobj_sysfs_ops;/**
lib/kobject.c +22 -0
@@ -577,6 +577,28 @@ struct sysfs_ops kobj_sysfs_ops = { .store = kobj_attr_store, }; +/** +* kobject_create_file() - create an attribute file for a kobject +* @kobj: kobject the attribute is created for +* @attr: attribute to be created +*/ +int kobject_create_file (struct kobject *kobj,struct kobj_attribute *attr) +{ +return sysfs_create_file (kobj, &attr->attr); +} +EXPORT_SYMBOL_GPL (kobject_create_file); + +/** +* kobject_remove_file() - remove an attribute file from a kobject +* @kobj: kobject the attribute is removed from +* @attr: attribute to be removed +*/ +void kobject_remove_file (struct kobject *kobj,struct kobj_attribute *attr) +{ +sysfs_remove_file (kobj, &attr->attr); +} +EXPORT_SYMBOL_GPL (kobject_remove_file); +static void dir_release (struct kobject *kobj) {kfree (kobj);
Re: [PATCH 27/54] kset: convert s390 hypervisor kset to use kset_create
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Cc Michael Holzheu <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/s390/hypfs/inode.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
arch/s390/hypfs/inode.c: In function 'hypfs_init':arch/s390/hypfs/inode.c:512: error: implicit declaration of function 'IS_PTR'
--- arch/s390/hypfs/inode.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
arch/s390/hypfs/inode.c +1 -1
@@ -509,7 +509,7 @@ static int __init hypfs_init(void) s390_kset =kset_create_and_register ("s390" ,NULL ,NULL , hypervisor_kset); -if (IS_PTR (s390_kset)) { +if (IS_ERR (s390_kset)) { rc =PTR_ERR (s390_kset); goto fail_sysfs; }
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Cornelia HuckQuoted 22 lines · Cornelia Huck
Quoted 9 lines · Greg Kroah-Hartman
From: Kay Sievers <[email protected]>
Add
kobj_sysfs_opsto replacesubsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets.The whole concept of any default sysfs attribute operations will go away with the upcoming removal of
subsys_sysfs_ops.Quoted 6 lines
Signed-off-by Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/kobject.h | 10 ++++++++++ lib/kobject.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)How about adding some simple wrappers around the new
kobj_attributestructure? This makes the layering clearer.
include/linux/kobject.h struct kobj_attribute { · line 131
Quoted 3 lines
include/linux/kobject.h +3
-0+#define KOBJ_ATTR (_name,_mode,_show,_store) \ + struct kobj_attribute kobj_attr_##_name = \ + __ATTR(_name,_mode,_show,_store)
That sounds fine.
Quoted 4 lines
+extern int
__must_checkkobject_create_file(struct kobject *,struct kobj_attribute *);+extern void
kobject_remove_file(struct kobject *,struct kobj_attribute *);
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
Kay
Re: [PATCH 46/54] kset: convert s390 ipl.c to use kset_create
In reply to Cornelia HuckQuoted 21 lines · Cornelia Huck
Quoted 10 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.
Cc Kay Sievers <[email protected]>Cc Michael Holzheu <[email protected]>Cc Heiko Carstens <[email protected]>Cc Volker Sameske <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/s390/kernel/ipl.c | 75 +++++++++++++++++++++++++----------------------- 1 files changed, 39 insertions(+), 36 deletions(-)It seems you also need this (not yet booted):
Fix the following warnings:
Quoted 8 lines
arch/s390/kernel/ipl.c: In function 'reipl_init':arch/s390/kernel/ipl.c:981: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer typearch/s390/kernel/ipl.c: In function 'dump_init':arch/s390/kernel/ipl.c:1070: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer typearch/s390/kernel/ipl.c: In function 'shutdown_actions_init':arch/s390/kernel/ipl.c:1094: warning: passing argument 2 of 'sysfs_create_file' from incompatible pointer typeSigned-off-by Cornelia Huck <[email protected]>
Thanks, but this should go with the previous kobject_attribute cleanup patch, not the kset patch. I've merged it in now.
thanks for the review and patch.
greg k-h
Re: [PATCH 33/54] driver core: remove fields from struct bus_type
In reply to Cornelia HuckQuoted 37 lines · Cornelia Huck
Quoted 9 lines · Greg Kroah-Hartman
struct
bus_typeis static everywhere in the kernel. This moves the kobject in the structure out of it, and a bunch of other private only to the driver core fields are now moved to a private structure. This lets us dynamically create the backing kobject properly and gives us the chance to be able to document to users exactly how to use the structbus_typeas there are no fields they can improperly access.Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 10 lines
--- drivers/base/base.h | 30 +++++++++++- drivers/base/bus.c | 120 ++++++++++++++++++++++++++-------------------- drivers/base/core.c | 6 +- drivers/base/dd.c | 4 +- drivers/base/driver.c | 2 +- drivers/base/platform.c | 4 +- include/linux/device.h | 12 +---- 7 files changed, 107 insertions(+), 71 deletions(-)
drivers/base/bus.c: In function 'make_deprecated_bus_links':drivers/base/bus.c:428: error: 'structbus_type' has no member named 'subsys'Signed-off-by Cornelia Huck <[email protected]>--- drivers/base/bus.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/drivers/base/bus.c
===================================================================
drivers/base/bus.c static void device_remove_attrs(struct b · line 431
Quoted 8 lines
drivers/base/bus.c +1
-1@@ -425,7 +425,7 @@ static void device_remove_attrs(struct bstatic int make_deprecated_bus_links (struct device *dev) {return sysfs_create_link (&dev->kobj, - &dev->bus->subsys.kobj,"bus" ); + &dev->bus->p->subsys.kobj,"bus" ); }static void remove_deprecated_bus_links (struct device *dev)
Thanks, Kay beat you to this by sending me a patch for it yesterday :)
greg
Re: [PATCH 27/54] kset: convert s390 hypervisor kset to use kset_create
In reply to Cornelia HuckQuoted 13 lines · Cornelia Huck
Quoted 9 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Cc Michael Holzheu <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/s390/hypfs/inode.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
Quoted 2 lines
arch/s390/hypfs/inode.c: In function 'hypfs_init':arch/s390/hypfs/inode.c:512: error: implicit declaration of function 'IS_PTR'
Argh, that's what I get when I can't build my code, stupid typos...
thanks for the patch, I've merged it in.
greg k-h
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Kay SieversQuoted 29 lines · Kay Sievers
Quoted 22 lines · Cornelia Huck
Quoted 9 lines · Greg Kroah-Hartman
From: Kay Sievers <[email protected]>
Add
kobj_sysfs_opsto replacesubsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets.The whole concept of any default sysfs attribute operations will go away with the upcoming removal of
subsys_sysfs_ops.Quoted 6 lines
Signed-off-by Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/kobject.h | 10 ++++++++++ lib/kobject.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)How about adding some simple wrappers around the new
kobj_attributestructure? This makes the layering clearer.include/linux/kobject.h struct kobj_attribute { · line 131
Quoted 3 lines
include/linux/kobject.h +3
-0+#define KOBJ_ATTR (_name,_mode,_show,_store) \ + struct kobj_attribute kobj_attr_##_name = \ + __ATTR(_name,_mode,_show,_store)That sounds fine.
Quoted 8 lines
Quoted 4 lines
+extern int
__must_checkkobject_create_file(struct kobject *,struct kobj_attribute *);+extern void
kobject_remove_file(struct kobject *,struct kobj_attribute *);That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use kobj_attributes :)
These look very useful, I'll go add them to the series unless Kay really objects.
thanks,
greg k-h
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
Quoted 39 lines · Greg KH
Quoted 29 lines · Kay Sievers
Quoted 22 lines · Cornelia Huck
Quoted 9 lines · Greg Kroah-Hartman
From: Kay Sievers <[email protected]>
Add
kobj_sysfs_opsto replacesubsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets.The whole concept of any default sysfs attribute operations will go away with the upcoming removal of
subsys_sysfs_ops.Quoted 6 lines
Signed-off-by Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/kobject.h | 10 ++++++++++ lib/kobject.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)How about adding some simple wrappers around the new
kobj_attributestructure? This makes the layering clearer.include/linux/kobject.h struct kobj_attribute { · line 131
Quoted 3 lines
include/linux/kobject.h +3
-0+#define KOBJ_ATTR (_name,_mode,_show,_store) \ + struct kobj_attribute kobj_attr_##_name = \ + __ATTR(_name,_mode,_show,_store)That sounds fine.
Quoted 8 lines
Quoted 4 lines
+extern int
__must_checkkobject_create_file(struct kobject *,struct kobj_attribute *);+extern void
kobject_remove_file(struct kobject *,struct kobj_attribute *);That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
Quoted 4 lines
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with kobject_register(), these attributes are not available at uevent time, which is really really bad.
Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
So I really object, unless we get a good example why it's needed. :)
Kay
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
Quoted 9 lines · Kay Sievers
Quoted 8 lines
Quoted 3 lines
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
Quoted 7 lines
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with
kobject_register(), these attributes are not available at uevent time, which is really really bad.Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
But where should I specify those default attributes? kset_create_and_register() sets the ktype to kset_ktype...
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
Quoted 16 lines · Cornelia Huck
Quoted 13 lines · Kay Sievers
Quoted 8 lines
Quoted 3 lines
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with
kobject_register(), these attributes are not available at uevent time, which is really really bad.
Quoted 6 lines
Quoted 3 lines
Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
But where should I specify those default attributes?
kset_create_and_register()sets the ktype tokset_ktype...
Do you need to create attributes at a kset itself, not the kobjects that belong to the kset?
Kay
Re: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/base/sys.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-)
Unfortunately, at that point in the patch series reipl breaks for me :(
I used the following silly debug patch:
--- drivers/base/power/shutdown.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/base/power/shutdown.c +3 -2
@@ -37,10 +37,11 @@ void device_shutdown(void)list_for_each_entry_safe_reverse (dev, devn, &devices_kset->list, kobj.entry) {if (dev->bus && dev->bus->shutdown) { -dev_dbg (dev,"shutdown\n" ); +dev_dbg (dev,"shutdown (bus %s)\n" , dev->bus->name); dev->bus->shutdown (dev); }else if (dev->driver && dev->driver->shutdown) { -dev_dbg (dev,"shutdown\n" ); +dev_dbg (dev,"shutdown (driver %s)\n" , + dev->driver->name); dev->driver->shutdown (dev); } }
and get as the kernel's last words:
<loads of sane shutdowns for the ccw and css busses>
<7>io_subchannel 0.0.095c: shutdown (bus css)
<7>io_subchannel 0.0.095b: shutdown (bus css)
<7>io_subchannel 0.0.095a: shutdown (bus css)
<7> : shutdown (bus )
<1>Unable to handle kernel pointer dereference at virtual kernel address 0000000500000000
<4>Oops: 003b [#1]
<4>Modules linked in: dm_multipath sunrpc qeth ccwgroup dm_mod
<4>CPU: 2 Not tainted
<4>Process reboot (pid: 2892, task: 0000000002cae048, ksp: 00000000045c39b8)
<4>Krnl PSW : 0704000180000000 0000000500000006 (0x500000006)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3
<4>Krnl GPRS: 0000000000019e75 0000000500000006 0000000002c42810 0000000002c429b0
<4> 00000000002a36ec 0000000000000000 000003ffffb76d48 0000000000000160
<4> 00000000001423a4 000002000015e390 00000000006e06b8 0000000000634638
<4> 0000000002c42810 000000000041f670 00000000002a36fe 00000000045c3d00
<4>Krnl Code: Bad PSW.
<4>Call Trace:
<4>([<00000000002a36ec>] device_shutdown+0x78/0x144)
<4> [<000000000013f18c>] kernel_restart_prepare+0x44/0x50
<4> [<000000000013f1be>] kernel_restart+0x26/0x6c
<4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4
<4> [<0000000000111038>] sysc_noemu+0x10/0x16
<4> [<00000200001048e0>] 0x200001048e0
<4>
<4> Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Kay SieversQuoted 21 lines · Kay Sievers
Quoted 20 lines · Cornelia Huck
Quoted 16 lines · Kay Sievers
Quoted 8 lines
Quoted 3 lines
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with
kobject_register(), these attributes are not available at uevent time, which is really really bad.Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
Quoted 5 lines
Quoted 2 lines
But where should I specify those default attributes?
kset_create_and_register()sets the ktype tokset_ktype...Do you need to create attributes at a kset itself, not the kobjects that belong to the kset?
Yes, see arch/s390/kernel/ipl.c (and I guess anything that uses subsys_create_file() before).
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
Quoted 24 lines · Cornelia Huck
Quoted 21 lines · Kay Sievers
Quoted 20 lines · Cornelia Huck
Quoted 16 lines · Kay Sievers
Quoted 8 lines
Quoted 3 lines
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with
kobject_register(), these attributes are not available at uevent time, which is really really bad.Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But where should I specify those default attributes?
kset_create_and_register()sets the ktype tokset_ktype...Do you need to create attributes at a kset itself, not the kobjects that belong to the kset?
Yes, see
arch/s390/kernel/ipl.c
Where are the objects that join this kset? A kset is a "collection of objects of a similar type", If there are no objects, you don't need a kset at all, I guess, but just a plain directory. :)
Anyway, seems we need an easy way to pass default attributes to ksets and plain directories. If userspace should set some values here when a subsystems creates the its sysfs representation, we must make sure, that the attributes exist at the time the event is sent, otherwise we will run into all sorts of timing problems.
Quoted 2 lines
(and I guess anything that uses
subsys_create_file()before).
Well, some users embedded ksets(subsystem) into objects, because it they confused kobjects and ksets. So there may be a only very few valid users left. :)
Kay
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
Quoted 37 lines · Kay Sievers
Quoted 24 lines · Cornelia Huck
Quoted 21 lines · Kay Sievers
Quoted 20 lines · Cornelia Huck
Quoted 16 lines · Kay Sievers
Quoted 8 lines
Quoted 3 lines
That should usually be done by default attributes assigned to the ktype. Do you have a good use case, where people need to create such attributes individually instead?
The s390 code that was converted to use
kobj_attributes:)These look very useful, I'll go add them to the series unless Kay really objects.
I just want to hear a good reason to create attributes individually. :) Especially in conjunction with
kobject_register(), these attributes are not available at uevent time, which is really really bad.Default attributes just work fine, and have the proper error handling built-in. Offering special functions for it, may just encourage people to continue this "broken" way of creating attributes.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But where should I specify those default attributes?
kset_create_and_register()sets the ktype tokset_ktype...Do you need to create attributes at a kset itself, not the kobjects that belong to the kset?
Yes, see
arch/s390/kernel/ipl.cWhere are the objects that join this kset? A kset is a "collection of objects of a similar type", If there are no objects, you don't need a kset at all, I guess, but just a plain directory. :)
Quoted 5 lines
Anyway, seems we need an easy way to pass default attributes to ksets and plain directories. If userspace should set some values here when a subsystems creates the its sysfs representation, we must make sure, that the attributes exist at the time the event is sent, otherwise we will run into all sorts of timing problems.
Kay is right, it should be simple to add the kobject attributes to the kobject itself when it is registered to this kset, right?
Quoted 6 lines
Quoted 2 lines
(and I guess anything that uses
subsys_create_file()before).Well, some users embedded ksets(subsystem) into objects, because it they confused kobjects and ksets. So there may be a only very few valid users left. :)
Hm, I don't think that anyone still does this anymore, as I think I fixed up all of these horrible use cases :)
thanks,
greg k-h
Re: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
In reply to Cornelia HuckQuoted 11 lines · Cornelia Huck
Quoted 7 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/base/sys.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-)
Quoted 3 lines
Unfortunately, at that point in the patch series reipl breaks for me :(
I used the following silly debug patch:
What does reipl have to do with shutdown?
Quoted 52 lines
--- drivers/base/power/shutdown.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)Index:
linux-2.6/drivers/base/power/shutdown.c
===================================================================drivers/base/power/shutdown.c +3
-2@@ -37,10 +37,11 @@ void device_shutdown(void)list_for_each_entry_safe_reverse (dev, devn, &devices_kset->list, kobj.entry) {if (dev->bus && dev->bus->shutdown) { -dev_dbg (dev,"shutdown\n" ); +dev_dbg (dev,"shutdown (bus %s)\n" , dev->bus->name); dev->bus->shutdown (dev); }else if (dev->driver && dev->driver->shutdown) { -dev_dbg (dev,"shutdown\n" ); +dev_dbg (dev,"shutdown (driver %s)\n" , + dev->driver->name); dev->driver->shutdown (dev); } }and get as the kernel's last words:
<loads of sane shutdowns for the ccw and css busses>
<7>io_subchannel 0.0.095c: shutdown (bus css) <7>io_subchannel 0.0.095b: shutdown (bus css) <7>io_subchannel 0.0.095a: shutdown (bus css) <7> : shutdown (bus ) <1>Unable to handle kernel pointer dereference at virtual kernel address 0000000500000000 <4>Oops: 003b [#1] <4>Modules linked in: dm_multipath sunrpc qeth ccwgroup dm_mod <4>CPU: 2 Not tainted <4>Process reboot (pid: 2892, task: 0000000002cae048, ksp: 00000000045c39b8) <4>Krnl PSW : 0704000180000000 0000000500000006 (0x500000006) <4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3 <4>Krnl GPRS: 0000000000019e75 0000000500000006 0000000002c42810 0000000002c429b0 <4> 00000000002a36ec 0000000000000000 000003ffffb76d48 0000000000000160 <4> 00000000001423a4 000002000015e390 00000000006e06b8 0000000000634638 <4> 0000000002c42810 000000000041f670 00000000002a36fe 00000000045c3d00 <4>Krnl Code: Bad PSW. <4>Call Trace: <4>([<00000000002a36ec>] device_shutdown+0x78/0x144) <4> [<000000000013f18c>] kernel_restart_prepare+0x44/0x50 <4> [<000000000013f1be>] kernel_restart+0x26/0x6c <4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>
Quoted 4 lines
Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
thanks,
greg k-h
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Kay SieversQuoted 3 lines · Kay Sievers
Where are the objects that join this kset? A kset is a "collection of objects of a similar type", If there are no objects, you don't need a kset at all, I guess, but just a plain directory. :)
Yes, ipl.c looks a lot like "we need a subdirectory under /sys/firmware/ and need to jump through hoops to get it there".
Quoted 5 lines
Anyway, seems we need an easy way to pass default attributes to ksets and plain directories. If userspace should set some values here when a subsystems creates the its sysfs representation, we must make sure, that the attributes exist at the time the event is sent, otherwise we will run into all sorts of timing problems.
Maybe they need something like device->uevent_suppress, but at the kobject level?
Re: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
In reply to Greg KHQuoted 12 lines · Greg KH
Quoted 11 lines · Cornelia Huck
Quoted 7 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/base/sys.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-)
Quoted 5 lines
Quoted 3 lines
Unfortunately, at that point in the patch series reipl breaks for me :(
I used the following silly debug patch:
What does reipl have to do with shutdown?
Before we reipl (reboot), device_shutdown() is called.
Quoted 27 lines
Quoted 27 lines
<loads of sane shutdowns for the ccw and css busses>
<7>io_subchannel 0.0.095c: shutdown (bus css) <7>io_subchannel 0.0.095b: shutdown (bus css) <7>io_subchannel 0.0.095a: shutdown (bus css) <7> : shutdown (bus ) <1>Unable to handle kernel pointer dereference at virtual kernel address 0000000500000000 <4>Oops: 003b [#1] <4>Modules linked in: dm_multipath sunrpc qeth ccwgroup dm_mod <4>CPU: 2 Not tainted <4>Process reboot (pid: 2892, task: 0000000002cae048, ksp: 00000000045c39b8) <4>Krnl PSW : 0704000180000000 0000000500000006 (0x500000006) <4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3 <4>Krnl GPRS: 0000000000019e75 0000000500000006 0000000002c42810 0000000002c429b0 <4> 00000000002a36ec 0000000000000000 000003ffffb76d48 0000000000000160 <4> 00000000001423a4 000002000015e390 00000000006e06b8 0000000000634638 <4> 0000000002c42810 000000000041f670 00000000002a36fe 00000000045c3d00 <4>Krnl Code: Bad PSW. <4>Call Trace: <4>([<00000000002a36ec>] device_shutdown+0x78/0x144) <4> [<000000000013f18c>] kernel_restart_prepare+0x44/0x50 <4> [<000000000013f1be>] kernel_restart+0x26/0x6c <4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>
Quoted 7 lines
Quoted 4 lines
Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of devices_kset seems to be broken.
Re: [PATCH 34/54] Driver Core: add kobj_attribute handling
In reply to Cornelia HuckQuoted 9 lines · Cornelia Huck
Quoted 3 lines · Kay Sievers
Where are the objects that join this kset? A kset is a "collection of objects of a similar type", If there are no objects, you don't need a kset at all, I guess, but just a plain directory. :)
Yes,
ipl.clooks a lot like "we need a subdirectory under/sys/firmware/and need to jump through hoops to get it there".
In looking at all of the users of the firmware subdirectory, that is what they are all needing that subdirectory for.
Ugh, I'll go change that up and delete that kset, and a few of the other ksets as they just need to be directories, not full-blown ksets.
Quoted 8 lines
Quoted 5 lines
Anyway, seems we need an easy way to pass default attributes to ksets and plain directories. If userspace should set some values here when a subsystems creates the its sysfs representation, we must make sure, that the attributes exist at the time the event is sent, otherwise we will run into all sorts of timing problems.
Maybe they need something like
device->uevent_suppress, but at the kobject level?
Ugh, I hope not :)
thanks,
greg k-h
Re: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
In reply to Cornelia HuckQuoted 15 lines · Cornelia Huck
Quoted 12 lines · Greg KH
Quoted 11 lines · Cornelia Huck
Quoted 7 lines · Greg Kroah-Hartman
Dynamically create the kset instead of declaring it statically.
Cc Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/base/sys.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Unfortunately, at that point in the patch series reipl breaks for me :(
I used the following silly debug patch:
What does reipl have to do with shutdown?
Before we reipl (reboot),
device_shutdown()is called.
Ah, ok.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
<loads of sane shutdowns for the ccw and css busses>
<7>io_subchannel 0.0.095c: shutdown (bus css) <7>io_subchannel 0.0.095b: shutdown (bus css) <7>io_subchannel 0.0.095a: shutdown (bus css) <7> : shutdown (bus ) <1>Unable to handle kernel pointer dereference at virtual kernel address 0000000500000000 <4>Oops: 003b [#1] <4>Modules linked in: dm_multipath sunrpc qeth ccwgroup dm_mod <4>CPU: 2 Not tainted <4>Process reboot (pid: 2892, task: 0000000002cae048, ksp: 00000000045c39b8) <4>Krnl PSW : 0704000180000000 0000000500000006 (0x500000006) <4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3 <4>Krnl GPRS: 0000000000019e75 0000000500000006 0000000002c42810 0000000002c429b0 <4> 00000000002a36ec 0000000000000000 000003ffffb76d48 0000000000000160 <4> 00000000001423a4 000002000015e390 00000000006e06b8 0000000000634638 <4> 0000000002c42810 000000000041f670 00000000002a36fe 00000000045c3d00 <4>Krnl Code: Bad PSW. <4>Call Trace: <4>([<00000000002a36ec>] device_shutdown+0x78/0x144) <4> [<000000000013f18c>] kernel_restart_prepare+0x44/0x50 <4> [<000000000013f1be>] kernel_restart+0x26/0x6c <4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of
devices_ksetseems to be broken.
Alright, I can reproduce something like this at shutdown time myself here, I'll try to figure it out...
thanks,
greg k-h
Andrew Morton
maintainerQuoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
Now I'm rather screwed. I still need to revert gregkh-driver-block-device.patch so that the G5 will boot, but doing that restores the decl_subsys(block, &block_uevent_ops) in genhd.c, and that no longer compiles.
Andrew Morton
maintainerQuoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
you killed perfmon.
perfmon/perfmon_sysfs.c: In function 'pfm_init_sysfs':perfmon/perfmon_sysfs.c:411: error: 'kernel_subsys' undeclared (first use in this function) perfmon/perfmon_sysfs.c:411: error: (Each undeclared identifier is reported only once perfmon/perfmon_sysfs.c:411: error: for each function it appears in.)
I'll drop the perfmon tree and shall soldier on.
Andrew Morton
maintainerQuoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
fs/ocfs2/stackglue.c:940: error: expected ')' before '(' token fs/ocfs2/stackglue.c: In function 'ocfs2_show':fs/ocfs2/stackglue.c:948: error: 'ocfs2_subsys' undeclared (first use in this function) fs/ocfs2/stackglue.c:948: error: (Each undeclared identifier is reported only once fs/ocfs2/stackglue.c:948: error: for each function it appears in.) fs/ocfs2/stackglue.c: In function 'ocfs2_store':fs/ocfs2/stackglue.c:962: error: 'ocfs2_subsys' undeclared (first use in this function) fs/ocfs2/stackglue.c: In function 'ocfs2_sys_shutdown':fs/ocfs2/stackglue.c:972: error: 'ocfs2_subsys' undeclared (first use in this function) fs/ocfs2/stackglue.c: In function 'ocfs2_sys_init':fs/ocfs2/stackglue.c:979: error: 'ocfs2_subsys' undeclared (first use in this function) fs/ocfs2/stackglue.c:980: error: implicit declaration of function 'kobj_set_kset_s' fs/ocfs2/stackglue.c:980: error: 'fs_subsys' undeclared (first use in this function)
wrecks the ocfs2 devel tree. I'll drop that too.
I wonder how much other out-of-tree code will be broken.
Andrew, Greg,
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
Quoted 8 lines
you killed perfmon.
perfmon/perfmon_sysfs.c: In function 'pfm_init_sysfs':perfmon/perfmon_sysfs.c:411: error: 'kernel_subsys' undeclared (first use in this function)perfmon/perfmon_sysfs.c:411: error: (Each undeclared identifier is reported only onceperfmon/perfmon_sysfs.c:411: error: for each function it appears in.)I'll drop the perfmon tree and shall soldier on.
I am sure we can fix this. I just need to get the kset patch from Greg.
Signature · 1 line
-Stephane
Quoted 12 lines · Stephane Eranian
Andrew, Greg,
Quoted 9 lines · Andrew Morton
Quoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
you killed perfmon.
Quoted 8 lines
Quoted 6 lines
perfmon/perfmon_sysfs.c: In function 'pfm_init_sysfs':perfmon/perfmon_sysfs.c:411: error: 'kernel_subsys' undeclared (first use in this function)perfmon/perfmon_sysfs.c:411: error: (Each undeclared identifier is reported only onceperfmon/perfmon_sysfs.c:411: error: for each function it appears in.)I'll drop the perfmon tree and shall soldier on.
I am sure we can fix this. I just need to get the kset patch from Greg.
What's the status on when perfmon will be sent to Linus? I'll be glad to send you a patch, I'm updating my tree right now, give me a few hours...
thanks,
greg k-h
Greg,
Quoted 18 lines · Greg KH
Quoted 17 lines · Stephane Eranian
Andrew, Greg,
Quoted 14 lines · Andrew Morton
Quoted 4 lines · On Fri, 2 Nov 2007 16:57:58 -0700 Greg KH <[email protected]> wrote:
So, I go on vacation for a week or so and come back to an overflowing inbox. Instead of trying to wade through all of that, I decide to finish up the work Kay and I had started on cleaning up the kset core code.
you killed perfmon.
perfmon/perfmon_sysfs.c: In function 'pfm_init_sysfs':perfmon/perfmon_sysfs.c:411: error: 'kernel_subsys' undeclared (first use in this function)perfmon/perfmon_sysfs.c:411: error: (Each undeclared identifier is reported only onceperfmon/perfmon_sysfs.c:411: error: for each function it appears in.)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
I'll drop the perfmon tree and shall soldier on.
I am sure we can fix this. I just need to get the kset patch from Greg.
What's the status on when perfmon will be sent to Linus? I'll be glad to send you a patch, I'm updating my tree right now, give me a few hours...
Trying to get into -mm first. Obvisouly there is a first problem with kobject/sysfs. But I am hoping it won't be that difficult to fix especially with your help ;->
Signature · 1 line
-Stephane
Andrew Morton
maintainerRe: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
In reply to Greg KHQuoted 14 lines · On Mon, 5 Nov 2007 12:03:34 -0800 Greg KH <[email protected]> wrote:
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
<4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Quoted 6 lines
Quoted 3 lines
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of
devices_ksetseems to be broken.Alright, I can reproduce something like this at shutdown time myself here, I'll try to figure it out...
<wishes he'd read this thread an hour ago>
The Vaio oopses during `reboot -f' and I bisected it down to this patch.
http://userweb.kernel.org/~akpm/dsc00034.jpg
http://userweb.kernel.org/~akpm/config-sony.txt
http://userweb.kernel.org/~akpm/dmesg-sony.txt
Andrew Morton
maintainerRe: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
Quoted 23 lines · On Tue, 13 Nov 2007 15:14:10 -0800 Andrew Morton <[email protected]>…
Quoted 14 lines · On Mon, 5 Nov 2007 12:03:34 -0800 Greg KH <[email protected]> wrote:
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
<4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Quoted 6 lines
Quoted 3 lines
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of
devices_ksetseems to be broken.Alright, I can reproduce something like this at shutdown time myself here, I'll try to figure it out...
Quoted 7 lines
<wishes he'd read this thread an hour ago>
The Vaio oopses during `reboot -f' and I bisected it down to this patch.
http://userweb.kernel.org/~akpm/dsc00034.jpg
http://userweb.kernel.org/~akpm/config-sony.txt
http://userweb.kernel.org/~akpm/dmesg-sony.txt
The G5 Mac oopses in the same place during `halt -pfn'.
Re: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
Quoted 27 lines · Andrew Morton
Quoted 25 lines · On Tue, 13 Nov 2007 15:14:10 -0800 Andrew Morton <[email protected]>…
Quoted 14 lines · On Mon, 5 Nov 2007 12:03:34 -0800 Greg KH <[email protected]> wrote:
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
<4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Quoted 6 lines
Quoted 3 lines
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of
devices_ksetseems to be broken.Alright, I can reproduce something like this at shutdown time myself here, I'll try to figure it out...
<wishes he'd read this thread an hour ago>
Quoted 7 lines
Quoted 5 lines
The Vaio oopses during `reboot -f' and I bisected it down to this patch.
http://userweb.kernel.org/~akpm/dsc00034.jpg
http://userweb.kernel.org/~akpm/config-sony.txt
http://userweb.kernel.org/~akpm/dmesg-sony.txtThe G5 Mac oopses in the same place during `halt -pfn'.
Crap, I can't duplicate this here anymore. I'll fire up the older boxes tonight and try to track this down...
thanks,
greg k-h
Andrew Morton
maintainerRe: [PATCH 22/54] kset: convert /sys/devices/system to use kset_create
Quoted 30 lines · On Tue, 13 Nov 2007 16:35:15 -0800 Greg KH <[email protected]> wrote:
Quoted 29 lines · Andrew Morton
Quoted 27 lines · On Tue, 13 Nov 2007 15:14:10 -0800 Andrew Morton <[email protected]>…
Quoted 14 lines · On Mon, 5 Nov 2007 12:03:34 -0800 Greg KH <[email protected]> wrote:
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
<4> [<0000000000142548>] sys_reboot+0x1a4/0x1f4 <4> [<0000000000111038>] sysc_noemu+0x10/0x16 <4> [<00000200001048e0>] 0x200001048e0 <4> <4>Huh? We want to shutdown an unknown device on a bus that wishes to stay anonymous?
Any hints would be appreciated...
I'll look into this, I wonder if we are walking off the end of an unterminated list...
Quoted 6 lines
Quoted 3 lines
Could well be. If I'm using lcrash's walk function correctly (which always manages to confuse me...), the list of
devices_ksetseems to be broken.Alright, I can reproduce something like this at shutdown time myself here, I'll try to figure it out...
<wishes he'd read this thread an hour ago>
The Vaio oopses during `reboot -f' and I bisected it down to this patch.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
http://userweb.kernel.org/~akpm/dsc00034.jpg
http://userweb.kernel.org/~akpm/config-sony.txt
http://userweb.kernel.org/~akpm/dmesg-sony.txtThe G5 Mac oopses in the same place during `halt -pfn'.
Crap, I can't duplicate this here anymore. I'll fire up the older boxes tonight and try to track this down...
Here's another machine hit the same thing
http://userweb.kernel.org/~akpm/config-vmm.txt
http://userweb.kernel.org/~akpm/dsc00035.jpg
(interesting EIP).
Thats'a crufty old pre-ACPI PIII running hacked-about FC1.
Re: [PATCH 38/54] efivars: remove new_var and del_var files from sysfs
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
WTF? Passing binary structures into a sysfs file, expecting it to be in the correct format/endianness? That's just wrong on so many levels.
So, these files are deleted. If you want to add them back, please do so in configfs, or in debugfs. Or use text strings, which is what sysfs is only for.
I have tested gregkh's patches tree, which includes this patch, the patch to put these back as binary blob interfaces, as well as other cleanups, on an Itanium2 system. The efibootmgr userspace application continues to work as it did before this patch series, which I claim is success. For the patches that touch drivers/firmware/efivars.c I can say:
Thanks,
Matt
Signature · 3 lines
Matt Domsch Linux Technology Strategist, Dell Office of the CTO linux.dell.com & www.dell.com/linux
Re: [PATCH 38/54] efivars: remove new_var and del_var files from sysfs
Quoted 9 lines · Matt Domsch
Quoted 6 lines · Greg Kroah-Hartman
WTF? Passing binary structures into a sysfs file, expecting it to be in the correct format/endianness? That's just wrong on so many levels.
So, these files are deleted. If you want to add them back, please do so in configfs, or in debugfs. Or use text strings, which is what sysfs is only for.
Quoted 8 lines
I have tested gregkh's patches tree, which includes this patch, the patch to put these back as binary blob interfaces, as well as other cleanups, on an Itanium2 system. The efibootmgr userspace application continues to work as it did before this patch series, which I claim is success. For the patches that touch
drivers/firmware/efivars.cI can say:Tested-by Matt Domsch <[email protected]>
Great, thanks for doing this, I appreciate it.
greg k-h