update
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
This commit is contained in:
parent
c4dd3f468a
commit
1e969fa88f
|
|
@ -35,6 +35,21 @@ static ssize_t is_zero_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|||
}
|
||||
static struct kobj_attribute is_zero_attribute = __ATTR_RO(is_zero);
|
||||
|
||||
static ssize_t is_atomic_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
unsigned long percpu_ptr = READ_ONCE(global_ref.percpu_count_ptr);
|
||||
return sysfs_emit(buf, "%d\n", percpu_ptr & __PERCPU_REF_ATOMIC);
|
||||
}
|
||||
static struct kobj_attribute is_atomic_attribute = __ATTR_RO(is_atomic);
|
||||
|
||||
static ssize_t force_atomic_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return sysfs_emit(buf, "%d\n", global_ref.data->force_atomic);
|
||||
}
|
||||
static struct kobj_attribute force_atomic_attribute = __ATTR_RO(force_atomic);
|
||||
|
||||
static ssize_t kill_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
|
|
@ -51,12 +66,23 @@ static ssize_t resurrect_store(struct kobject *kobj, struct kobj_attribute *attr
|
|||
}
|
||||
static struct kobj_attribute resurrect_attribute = __ATTR_WO(resurrect);
|
||||
|
||||
static ssize_t switch_to_percpu_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
percpu_ref_switch_to_percpu(&global_ref);
|
||||
return count;
|
||||
}
|
||||
static struct kobj_attribute switch_to_percpu_attribute = __ATTR_WO(switch_to_percpu);
|
||||
|
||||
static struct attribute *attrs[] = {
|
||||
&is_dying_attribute.attr,
|
||||
&is_zero_attribute.attr,
|
||||
&is_percpu_attribute.attr,
|
||||
&is_atomic_attribute.attr,
|
||||
&force_atomic_attribute.attr,
|
||||
&kill_attribute.attr,
|
||||
&resurrect_attribute.attr,
|
||||
&switch_to_percpu_attribute.attr,
|
||||
NULL,
|
||||
};
|
||||
static struct attribute_group attr_group = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue