kset-example.c (552c69b36ebd966186573b9c7a286b390935cce1) | kset-example.c (c484a6783d2b800ebbb110b28b0d96444f8b81ca) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Sample kset and ktype implementation 4 * 5 * Copyright (C) 2004-2007 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (C) 2007 Novell Inc. 7 */ 8#include <linux/kobject.h> --- 164 unchanged lines hidden (view full) --- 173 * at once. 174 */ 175static struct attribute *foo_default_attrs[] = { 176 &foo_attribute.attr, 177 &baz_attribute.attr, 178 &bar_attribute.attr, 179 NULL, /* need to NULL terminate the list of attributes */ 180}; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Sample kset and ktype implementation 4 * 5 * Copyright (C) 2004-2007 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (C) 2007 Novell Inc. 7 */ 8#include <linux/kobject.h> --- 164 unchanged lines hidden (view full) --- 173 * at once. 174 */ 175static struct attribute *foo_default_attrs[] = { 176 &foo_attribute.attr, 177 &baz_attribute.attr, 178 &bar_attribute.attr, 179 NULL, /* need to NULL terminate the list of attributes */ 180}; |
181ATTRIBUTE_GROUPS(foo_default); |
|
181 182/* 183 * Our own ktype for our kobjects. Here we specify our sysfs ops, the 184 * release function, and the set of default attributes we want created 185 * whenever a kobject of this type is registered with the kernel. 186 */ 187static struct kobj_type foo_ktype = { 188 .sysfs_ops = &foo_sysfs_ops, 189 .release = foo_release, | 182 183/* 184 * Our own ktype for our kobjects. Here we specify our sysfs ops, the 185 * release function, and the set of default attributes we want created 186 * whenever a kobject of this type is registered with the kernel. 187 */ 188static struct kobj_type foo_ktype = { 189 .sysfs_ops = &foo_sysfs_ops, 190 .release = foo_release, |
190 .default_attrs = foo_default_attrs, | 191 .default_groups = foo_default_groups, |
191}; 192 193static struct kset *example_kset; 194static struct foo_obj *foo_obj; 195static struct foo_obj *bar_obj; 196static struct foo_obj *baz_obj; 197 198static struct foo_obj *create_foo_obj(const char *name) --- 89 unchanged lines hidden --- | 192}; 193 194static struct kset *example_kset; 195static struct foo_obj *foo_obj; 196static struct foo_obj *bar_obj; 197static struct foo_obj *baz_obj; 198 199static struct foo_obj *create_foo_obj(const char *name) --- 89 unchanged lines hidden --- |