diff options
author | Tejun Heo <htejun@gmail.com> | 2007-09-20 03:05:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:10 -0400 |
commit | b1fc3d6144d56360d1373b01c7881826f558b6cd (patch) | |
tree | 3bac4c3df21dc74c6373c3e4a22c3ea6b01b1832 /fs/sysfs | |
parent | 078ce6409ca54d5fc6eb7d2147cd6efc3eb09078 (diff) |
sysfs: make s_elem an anonymous union
Make s_elem an anonymous union. Prefixing with s_elem makes things
needlessly longer without any advantage.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/bin.c | 14 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 4 | ||||
-rw-r--r-- | fs/sysfs/file.c | 14 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 2 | ||||
-rw-r--r-- | fs/sysfs/symlink.c | 4 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 10 |
6 files changed, 24 insertions, 24 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 9c8f8824e660..247ea19721c3 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -30,8 +30,8 @@ static int | |||
30 | fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | 30 | fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) |
31 | { | 31 | { |
32 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 32 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
33 | struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr; | 33 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
34 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 34 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
35 | int rc; | 35 | int rc; |
36 | 36 | ||
37 | /* need attr_sd for attr, its parent for kobj */ | 37 | /* need attr_sd for attr, its parent for kobj */ |
@@ -87,8 +87,8 @@ static int | |||
87 | flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | 87 | flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) |
88 | { | 88 | { |
89 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 89 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
90 | struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr; | 90 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
91 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 91 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
92 | int rc; | 92 | int rc; |
93 | 93 | ||
94 | /* need attr_sd for attr, its parent for kobj */ | 94 | /* need attr_sd for attr, its parent for kobj */ |
@@ -140,8 +140,8 @@ static int mmap(struct file *file, struct vm_area_struct *vma) | |||
140 | { | 140 | { |
141 | struct bin_buffer *bb = file->private_data; | 141 | struct bin_buffer *bb = file->private_data; |
142 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | 142 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
143 | struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr; | 143 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
144 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 144 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
145 | int rc; | 145 | int rc; |
146 | 146 | ||
147 | mutex_lock(&bb->mutex); | 147 | mutex_lock(&bb->mutex); |
@@ -167,7 +167,7 @@ static int mmap(struct file *file, struct vm_area_struct *vma) | |||
167 | static int open(struct inode * inode, struct file * file) | 167 | static int open(struct inode * inode, struct file * file) |
168 | { | 168 | { |
169 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | 169 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
170 | struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr; | 170 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
171 | struct bin_buffer *bb = NULL; | 171 | struct bin_buffer *bb = NULL; |
172 | int error; | 172 | int error; |
173 | 173 | ||
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index fc615eed67dc..6ee76a82eb38 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -273,7 +273,7 @@ void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
273 | parent_sd = sd->s_parent; | 273 | parent_sd = sd->s_parent; |
274 | 274 | ||
275 | if (sysfs_type(sd) == SYSFS_KOBJ_LINK) | 275 | if (sysfs_type(sd) == SYSFS_KOBJ_LINK) |
276 | sysfs_put(sd->s_elem.symlink.target_sd); | 276 | sysfs_put(sd->s_symlink.target_sd); |
277 | if (sysfs_type(sd) & SYSFS_COPY_NAME) | 277 | if (sysfs_type(sd) & SYSFS_COPY_NAME) |
278 | kfree(sd->s_name); | 278 | kfree(sd->s_name); |
279 | kfree(sd->s_iattr); | 279 | kfree(sd->s_iattr); |
@@ -630,7 +630,7 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, | |||
630 | sd = sysfs_new_dirent(name, mode, SYSFS_DIR); | 630 | sd = sysfs_new_dirent(name, mode, SYSFS_DIR); |
631 | if (!sd) | 631 | if (!sd) |
632 | return -ENOMEM; | 632 | return -ENOMEM; |
633 | sd->s_elem.dir.kobj = kobj; | 633 | sd->s_dir.kobj = kobj; |
634 | 634 | ||
635 | /* link in */ | 635 | /* link in */ |
636 | sysfs_addrm_start(&acxt, parent_sd); | 636 | sysfs_addrm_start(&acxt, parent_sd); |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 8f1ebd88b9ce..3c91a57a1ed2 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -73,7 +73,7 @@ struct sysfs_buffer { | |||
73 | static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) | 73 | static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) |
74 | { | 74 | { |
75 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 75 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
76 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 76 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
77 | struct sysfs_ops * ops = buffer->ops; | 77 | struct sysfs_ops * ops = buffer->ops; |
78 | int ret = 0; | 78 | int ret = 0; |
79 | ssize_t count; | 79 | ssize_t count; |
@@ -88,7 +88,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer | |||
88 | return -ENODEV; | 88 | return -ENODEV; |
89 | 89 | ||
90 | buffer->event = atomic_read(&attr_sd->s_event); | 90 | buffer->event = atomic_read(&attr_sd->s_event); |
91 | count = ops->show(kobj, attr_sd->s_elem.attr.attr, buffer->page); | 91 | count = ops->show(kobj, attr_sd->s_attr.attr, buffer->page); |
92 | 92 | ||
93 | sysfs_put_active_two(attr_sd); | 93 | sysfs_put_active_two(attr_sd); |
94 | 94 | ||
@@ -188,7 +188,7 @@ static int | |||
188 | flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t count) | 188 | flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t count) |
189 | { | 189 | { |
190 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 190 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
191 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 191 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
192 | struct sysfs_ops * ops = buffer->ops; | 192 | struct sysfs_ops * ops = buffer->ops; |
193 | int rc; | 193 | int rc; |
194 | 194 | ||
@@ -196,7 +196,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t | |||
196 | if (!sysfs_get_active_two(attr_sd)) | 196 | if (!sysfs_get_active_two(attr_sd)) |
197 | return -ENODEV; | 197 | return -ENODEV; |
198 | 198 | ||
199 | rc = ops->store(kobj, attr_sd->s_elem.attr.attr, buffer->page, count); | 199 | rc = ops->store(kobj, attr_sd->s_attr.attr, buffer->page, count); |
200 | 200 | ||
201 | sysfs_put_active_two(attr_sd); | 201 | sysfs_put_active_two(attr_sd); |
202 | 202 | ||
@@ -240,7 +240,7 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t | |||
240 | static int sysfs_open_file(struct inode *inode, struct file *file) | 240 | static int sysfs_open_file(struct inode *inode, struct file *file) |
241 | { | 241 | { |
242 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | 242 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
243 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 243 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
244 | struct sysfs_buffer * buffer; | 244 | struct sysfs_buffer * buffer; |
245 | struct sysfs_ops * ops = NULL; | 245 | struct sysfs_ops * ops = NULL; |
246 | int error; | 246 | int error; |
@@ -336,7 +336,7 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait) | |||
336 | { | 336 | { |
337 | struct sysfs_buffer * buffer = filp->private_data; | 337 | struct sysfs_buffer * buffer = filp->private_data; |
338 | struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata; | 338 | struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata; |
339 | struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; | 339 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
340 | 340 | ||
341 | /* need parent for the kobj, grab both */ | 341 | /* need parent for the kobj, grab both */ |
342 | if (!sysfs_get_active_two(attr_sd)) | 342 | if (!sysfs_get_active_two(attr_sd)) |
@@ -396,7 +396,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr, | |||
396 | sd = sysfs_new_dirent(attr->name, mode, type); | 396 | sd = sysfs_new_dirent(attr->name, mode, type); |
397 | if (!sd) | 397 | if (!sd) |
398 | return -ENOMEM; | 398 | return -ENOMEM; |
399 | sd->s_elem.attr.attr = (void *)attr; | 399 | sd->s_attr.attr = (void *)attr; |
400 | 400 | ||
401 | sysfs_addrm_start(&acxt, dir_sd); | 401 | sysfs_addrm_start(&acxt, dir_sd); |
402 | rc = sysfs_add_one(&acxt, sd); | 402 | rc = sysfs_add_one(&acxt, sd); |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 0d706a86d2c7..b6ac4e6d6e79 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -172,7 +172,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) | |||
172 | inode->i_fop = &sysfs_file_operations; | 172 | inode->i_fop = &sysfs_file_operations; |
173 | break; | 173 | break; |
174 | case SYSFS_KOBJ_BIN_ATTR: | 174 | case SYSFS_KOBJ_BIN_ATTR: |
175 | bin_attr = sd->s_elem.bin_attr.bin_attr; | 175 | bin_attr = sd->s_bin_attr.bin_attr; |
176 | inode->i_size = bin_attr->size; | 176 | inode->i_size = bin_attr->size; |
177 | inode->i_fop = &bin_fops; | 177 | inode->i_fop = &bin_fops; |
178 | break; | 178 | break; |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 8ad38bccc0e4..ffa82e9802ad 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -86,7 +86,7 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
86 | if (!sd) | 86 | if (!sd) |
87 | goto out_put; | 87 | goto out_put; |
88 | 88 | ||
89 | sd->s_elem.symlink.target_sd = target_sd; | 89 | sd->s_symlink.target_sd = target_sd; |
90 | target_sd = NULL; /* reference is now owned by the symlink */ | 90 | target_sd = NULL; /* reference is now owned by the symlink */ |
91 | 91 | ||
92 | sysfs_addrm_start(&acxt, parent_sd); | 92 | sysfs_addrm_start(&acxt, parent_sd); |
@@ -142,7 +142,7 @@ static int sysfs_getlink(struct dentry *dentry, char * path) | |||
142 | { | 142 | { |
143 | struct sysfs_dirent *sd = dentry->d_fsdata; | 143 | struct sysfs_dirent *sd = dentry->d_fsdata; |
144 | struct sysfs_dirent *parent_sd = sd->s_parent; | 144 | struct sysfs_dirent *parent_sd = sd->s_parent; |
145 | struct sysfs_dirent *target_sd = sd->s_elem.symlink.target_sd; | 145 | struct sysfs_dirent *target_sd = sd->s_symlink.target_sd; |
146 | int error; | 146 | int error; |
147 | 147 | ||
148 | mutex_lock(&sysfs_mutex); | 148 | mutex_lock(&sysfs_mutex); |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 6cf61c882baa..2a68bfa46e43 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -32,11 +32,11 @@ struct sysfs_dirent { | |||
32 | const char *s_name; | 32 | const char *s_name; |
33 | 33 | ||
34 | union { | 34 | union { |
35 | struct sysfs_elem_dir dir; | 35 | struct sysfs_elem_dir s_dir; |
36 | struct sysfs_elem_symlink symlink; | 36 | struct sysfs_elem_symlink s_symlink; |
37 | struct sysfs_elem_attr attr; | 37 | struct sysfs_elem_attr s_attr; |
38 | struct sysfs_elem_bin_attr bin_attr; | 38 | struct sysfs_elem_bin_attr s_bin_attr; |
39 | } s_elem; | 39 | }; |
40 | 40 | ||
41 | unsigned int s_flags; | 41 | unsigned int s_flags; |
42 | ino_t s_ino; | 42 | ino_t s_ino; |