[PATCH 14/22] sysfs: s/symlink/link/g

Tejun Heo
2007-09-20T08:10:26Z

Currently, sysfs symlinks are either called symlinks or links. Rename
everything to link and drop attr and _sd postfix as new interface
won't be bound to kobj.

This patch doesn't introduce any logic change.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
fs/sysfs/dir.c | 6 +++---
fs/sysfs/inode.c | 4 ++--
fs/sysfs/symlink.c | 9 ++++-----
fs/sysfs/sysfs.h | 16 ++++++++--------
4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 263d346..a20beff 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -277,8 +277,8 @@ void release_sysfs_dirent(struct sysfs_dirent * sd)
*/
parent_sd = sd->s_parent;

- if (sysfs_type(sd) == SYSFS_KOBJ_LINK)
- sysfs_put(sd->s_symlink.target_sd);
+ if (sysfs_type(sd) == SYSFS_LINK)
+ sysfs_put(sd->s_link.target);
if (sd->s_flags & SYSFS_FLAG_NAME_COPIED)
kfree(sd->s_name);
kfree(sd->s_iattr);
@@ -345,7 +345,7 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
case SYSFS_BIN:
mode |= S_IFREG;
break;
- case SYSFS_KOBJ_LINK:
+ case SYSFS_LINK:
mode |= S_IFLNK;
break;
}
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index d303e62..8df357e 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -168,8 +168,8 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
inode->i_size = sd->s_bin.size;
inode->i_fop = &sysfs_bin_file_operations;
break;
- case SYSFS_KOBJ_LINK:
- inode->i_op = &sysfs_symlink_inode_operations;
+ case SYSFS_LINK:
+ inode->i_op = &sysfs_link_inode_operations;
break;
default:
BUG();
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 9c15a32..2c3e4f7 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -82,12 +82,11 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char
goto out_put;

error = -ENOMEM;
- sd = sysfs_new_dirent(name, S_IRWXUGO | SYSFS_COPY_NAME,
- SYSFS_KOBJ_LINK);
+ sd = sysfs_new_dirent(name, S_IRWXUGO | SYSFS_COPY_NAME, SYSFS_LINK);
if (!sd)
goto out_put;

- sd->s_symlink.target_sd = target_sd;
+ sd->s_link.target = target_sd;
target_sd = NULL; /* reference is now owned by the symlink */

sysfs_addrm_start(&acxt);
@@ -131,7 +130,7 @@ static int sysfs_getlink(struct dentry *dentry, char * path)
{
struct sysfs_dirent *sd = dentry->d_fsdata;
struct sysfs_dirent *parent_sd = sd->s_parent;
- struct sysfs_dirent *target_sd = sd->s_symlink.target_sd;
+ struct sysfs_dirent *target_sd = sd->s_link.target;
int error;

mutex_lock(&sysfs_mutex);
@@ -158,7 +157,7 @@ static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd, void *co
free_page((unsigned long)page);
}

-const struct inode_operations sysfs_symlink_inode_operations = {
+const struct inode_operations sysfs_link_inode_operations = {
.readlink = generic_readlink,
.follow_link = sysfs_follow_link,
.put_link = sysfs_put_link,
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index d8c61c5..c5593f9 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -7,8 +7,8 @@ struct sysfs_elem_dir {
struct sysfs_dirent *children;
};

-struct sysfs_elem_symlink {
- struct sysfs_dirent *target_sd;
+struct sysfs_elem_link {
+ struct sysfs_dirent *target;
};

struct sysfs_elem_file {
@@ -39,10 +39,10 @@ struct sysfs_dirent {
const char *s_name;

union {
- struct sysfs_elem_dir s_dir;
- struct sysfs_elem_symlink s_symlink;
- struct sysfs_elem_file s_file;
- struct sysfs_elem_bin s_bin;
+ struct sysfs_elem_dir s_dir;
+ struct sysfs_elem_link s_link;
+ struct sysfs_elem_file s_file;
+ struct sysfs_elem_bin s_bin;
};

unsigned int s_flags;
@@ -57,7 +57,7 @@ struct sysfs_dirent {
#define SYSFS_DIR 0x0001
#define SYSFS_FILE 0x0002
#define SYSFS_BIN 0x0004
-#define SYSFS_KOBJ_LINK 0x0008
+#define SYSFS_LINK 0x0008

#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
#define SYSFS_FLAG_REMOVED 0x0200
@@ -156,4 +156,4 @@ extern const struct file_operations sysfs_bin_file_operations;
/*
* symlink.c
*/
-extern const struct inode_operations sysfs_symlink_inode_operations;
+extern const struct inode_operations sysfs_link_inode_operations;
--
1.5.0.3