aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--driver/kobject-change-sys-kernel-uids-to-not-use-a-kset.patch49
-rw-r--r--f1.patch48
-rw-r--r--f2.patch26
-rw-r--r--kobject-add-kobject_init_ng-function.patch75
-rw-r--r--series5
5 files changed, 153 insertions, 50 deletions
diff --git a/driver/kobject-change-sys-kernel-uids-to-not-use-a-kset.patch b/driver/kobject-change-sys-kernel-uids-to-not-use-a-kset.patch
new file mode 100644
index 00000000000000..8d01f1bc6d4c7c
--- /dev/null
+++ b/driver/kobject-change-sys-kernel-uids-to-not-use-a-kset.patch
@@ -0,0 +1,49 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Thu, 29 Nov 2007 22:38:12 -0800
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: kobject: change /sys/kernel/uids to not use a kset
+
+A kset is not needed for the uids kobjects, so switch to using a
+kobject instead.
+
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ kernel/user.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/kernel/user.c
++++ b/kernel/user.c
+@@ -115,7 +115,9 @@ static void sched_switch_user(struct tas
+
+ #if defined(CONFIG_FAIR_USER_SCHED) && defined(CONFIG_SYSFS)
+
+-static struct kset *uids_kset; /* represents the /sys/kernel/uids/ directory */
++/* represents the /sys/kernel/uids/ directory */
++static struct kobject *uids_kobj;
++
+ static DEFINE_MUTEX(uids_mutex);
+
+ static inline void uids_mutex_lock(void)
+@@ -182,7 +184,7 @@ static int uids_user_create(struct user_
+
+ memset(kobj, 0, sizeof(struct kobject));
+ kobj->ktype = &uids_ktype;
+- kobj->kset = uids_kset;
++ kobj->parent = uids_kobj;
+ kobject_init(kobj);
+ kobject_set_name(&up->kobj, "%d", up->uid);
+ error = kobject_add(kobj);
+@@ -201,8 +203,8 @@ done:
+ */
+ int __init uids_sysfs_init(void)
+ {
+- uids_kset = kset_create_and_register("uids", NULL, kernel_kobj);
+- if (!uids_kset)
++ uids_kobj = kobject_create_and_register("uids", kernel_kobj);
++ if (!uids_kobj)
+ return -ENOMEM;
+
+ return uids_user_create(&root_user);
diff --git a/f1.patch b/f1.patch
deleted file mode 100644
index b5b190d736b3b9..00000000000000
--- a/f1.patch
+++ /dev/null
@@ -1,48 +0,0 @@
----
- lib/kobject.c | 35 +++++++++++++++++++++++++++++++++++
- 1 file changed, 35 insertions(+)
-
---- a/lib/kobject.c
-+++ b/lib/kobject.c
-@@ -191,6 +191,41 @@ void kobject_init(struct kobject * kobj)
- INIT_LIST_HEAD(&kobj->entry);
- }
-
-+/**
-+ * kobject_init - initialize a kobject structure
-+ * @kobj: pointer to the kobject to initialize
-+ * @ktype: pointer to the ktype for this kobject.
-+ * @fmt: the name of the kobject
-+ *
-+ * This function will properly initialize a kobject such that it can then
-+ * be passed to the kobject_add() call.
-+ *
-+ * If the function returns an error, the memory allocated by the kobject
-+ * can be safely freed, no other functions need to be called.
-+ */
-+int kobject_i(struct kobject *kobj, struct kobj_type *ktype, const char *fmt, ...)
-+{
-+ va_list args;
-+ int retval;
-+
-+ if (!kobj)
-+ return -EINVAL;
-+
-+ if (!ktype)
-+ return -EINVAL;
-+
-+ WARN_ON(atomic_read(&kobj->kref.refcount));
-+ kref_init(&kobj->kref);
-+ INIT_LIST_HEAD(&kobj->entry);
-+ kobj->ktype = ktype;
-+
-+ va_start(args, fmt);
-+ retval = kobject_set_name_vargs(kobj, fmt, args);
-+ va_end(args);
-+
-+ return retval;
-+}
-+
-
- /**
- * unlink - remove kobject from kset list.
diff --git a/f2.patch b/f2.patch
new file mode 100644
index 00000000000000..e778a7de3659d2
--- /dev/null
+++ b/f2.patch
@@ -0,0 +1,26 @@
+---
+ kernel/user.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/kernel/user.c
++++ b/kernel/user.c
+@@ -183,13 +183,15 @@ static int uids_user_create(struct user_
+ int error;
+
+ memset(kobj, 0, sizeof(struct kobject));
+- kobj->ktype = &uids_ktype;
+ kobj->parent = uids_kobj;
+- kobject_init(kobj);
+- kobject_set_name(&up->kobj, "%d", up->uid);
+- error = kobject_add(kobj);
++ error = kobject_init_name(kobj, &uids_ktype, "%d", up->uid);
+ if (error)
+ goto done;
++ error = kobject_add(kobj);
++ if (error) {
++ kobject_put(kobj);
++ goto done;
++ }
+
+ kobject_uevent(kobj, KOBJ_ADD);
+ done:
diff --git a/kobject-add-kobject_init_ng-function.patch b/kobject-add-kobject_init_ng-function.patch
new file mode 100644
index 00000000000000..8d59506c6a90d2
--- /dev/null
+++ b/kobject-add-kobject_init_ng-function.patch
@@ -0,0 +1,75 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Thu, 29 Nov 2007 22:38:12 -0800
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: kobject: add kobject_init_ng function
+
+This is what the kobject_init function is going to become. Add it to
+the kernel and then we can convert over the current kobject_init() users
+before renaming it.
+
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/kobject.h | 2 ++
+ lib/kobject.c | 37 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 39 insertions(+)
+
+--- a/include/linux/kobject.h
++++ b/include/linux/kobject.h
+@@ -79,6 +79,8 @@ static inline const char * kobject_name(
+ }
+
+ extern void kobject_init(struct kobject *);
++extern int kobject_init_name(struct kobject *kobj, struct kobj_type *ktype,
++ const char *fmt, ...);
+ extern void kobject_cleanup(struct kobject *);
+
+ extern int __must_check kobject_add(struct kobject *);
+--- a/lib/kobject.c
++++ b/lib/kobject.c
+@@ -348,6 +348,43 @@ int kobject_set_name(struct kobject *kob
+ EXPORT_SYMBOL(kobject_set_name);
+
+ /**
++ * kobject_init_name - initialize a kobject structure
++ * @kobj: pointer to the kobject to initialize
++ * @ktype: pointer to the ktype for this kobject.
++ * @fmt: the name of the kobject
++ *
++ * This function will properly initialize a kobject such that it can then
++ * be passed to the kobject_add() call.
++ *
++ * If the function returns an error, the memory allocated by the kobject
++ * can be safely freed, no other functions need to be called.
++ */
++int kobject_init_name(struct kobject *kobj, struct kobj_type *ktype,
++ const char *fmt, ...)
++{
++ va_list args;
++ int retval;
++
++ if (!kobj)
++ return -EINVAL;
++
++ if (!ktype)
++ return -EINVAL;
++
++ WARN_ON(atomic_read(&kobj->kref.refcount));
++ kref_init(&kobj->kref);
++ INIT_LIST_HEAD(&kobj->entry);
++ kobj->ktype = ktype;
++
++ va_start(args, fmt);
++ retval = kobject_set_name_vargs(kobj, fmt, args);
++ va_end(args);
++
++ return retval;
++}
++EXPORT_SYMBOL(kobject_init_name);
++
++/**
+ * kobject_rename - change the name of an object
+ * @kobj: object in question.
+ * @new_name: object's new name
diff --git a/series b/series
index c31db0beefceea..dcfd81be4bf310 100644
--- a/series
+++ b/series
@@ -243,6 +243,7 @@ usb/usb-gotemp.patch
# work in progress goes here...
#
-f1.patch
-
+kobject-change-sys-kernel-uids-to-not-use-a-kset.patch
+kobject-add-kobject_init_ng-function.patch
+f2.patch