Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266869
b: refs/heads/master
c: 672d82c
h: refs/heads/master
i:
  266867: 7c77f54
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Oct 19, 2011
1 parent 9473f62 commit 932cf77
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 487505c257021fc06a7d05753cf27b011487f1dc
refs/heads/master: 672d82c18d222e51b40ff47e660fc54ec3e3e0a9
17 changes: 15 additions & 2 deletions trunk/drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr,
return ret;
}

static const void *class_attr_namespace(struct kobject *kobj,
const struct attribute *attr)
{
struct class_attribute *class_attr = to_class_attr(attr);
struct subsys_private *cp = to_subsys_private(kobj);
const void *ns = NULL;

if (class_attr->namespace)
ns = class_attr->namespace(cp->class, class_attr);
return ns;
}

static void class_release(struct kobject *kobj)
{
struct subsys_private *cp = to_subsys_private(kobj);
Expand All @@ -72,8 +84,9 @@ static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject
}

static const struct sysfs_ops class_sysfs_ops = {
.show = class_attr_show,
.store = class_attr_store,
.show = class_attr_show,
.store = class_attr_store,
.namespace = class_attr_namespace,
};

static struct kobj_type class_ktype = {
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ struct class_attribute {
char *buf);
ssize_t (*store)(struct class *class, struct class_attribute *attr,
const char *buf, size_t count);
const void *(*namespace)(struct class *class,
const struct class_attribute *attr);
};

#define CLASS_ATTR(_name, _mode, _show, _store) \
Expand Down

0 comments on commit 932cf77

Please sign in to comment.