dm-sysfs.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) dm-sysfs.c (be35f486108227e10fe5d96fd42fb2b344c59983)
1/*
2 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3 *
4 * This file is released under the GPL.
5 */
6
7#include <linux/sysfs.h>
8#include <linux/dm-ioctl.h>

--- 65 unchanged lines hidden (view full) ---

74 &dm_attr_suspended.attr,
75 NULL,
76};
77
78static const struct sysfs_ops dm_sysfs_ops = {
79 .show = dm_attr_show,
80};
81
1/*
2 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3 *
4 * This file is released under the GPL.
5 */
6
7#include <linux/sysfs.h>
8#include <linux/dm-ioctl.h>

--- 65 unchanged lines hidden (view full) ---

74 &dm_attr_suspended.attr,
75 NULL,
76};
77
78static const struct sysfs_ops dm_sysfs_ops = {
79 .show = dm_attr_show,
80};
81
82static void dm_kobject_release(struct kobject *kobj)
83{
84 complete(dm_get_completion_from_kobject(kobj));
85}
86
82/*
83 * dm kobject is embedded in mapped_device structure
84 * no need to define release function here
85 */
86static struct kobj_type dm_ktype = {
87 .sysfs_ops = &dm_sysfs_ops,
88 .default_attrs = dm_attrs,
87/*
88 * dm kobject is embedded in mapped_device structure
89 * no need to define release function here
90 */
91static struct kobj_type dm_ktype = {
92 .sysfs_ops = &dm_sysfs_ops,
93 .default_attrs = dm_attrs,
94 .release = dm_kobject_release,
89};
90
91/*
92 * Initialize kobj
93 * because nobody using md yet, no need to call explicit dm_get/put
94 */
95int dm_sysfs_init(struct mapped_device *md)
96{
97 return kobject_init_and_add(dm_kobject(md), &dm_ktype,
98 &disk_to_dev(dm_disk(md))->kobj,
99 "%s", "dm");
100}
101
102/*
103 * Remove kobj, called after all references removed
104 */
105void dm_sysfs_exit(struct mapped_device *md)
106{
95};
96
97/*
98 * Initialize kobj
99 * because nobody using md yet, no need to call explicit dm_get/put
100 */
101int dm_sysfs_init(struct mapped_device *md)
102{
103 return kobject_init_and_add(dm_kobject(md), &dm_ktype,
104 &disk_to_dev(dm_disk(md))->kobj,
105 "%s", "dm");
106}
107
108/*
109 * Remove kobj, called after all references removed
110 */
111void dm_sysfs_exit(struct mapped_device *md)
112{
107 kobject_put(dm_kobject(md));
113 struct kobject *kobj = dm_kobject(md);
114 kobject_put(kobj);
115 wait_for_completion(dm_get_completion_from_kobject(kobj));
108}
116}