[PATCH 21/24] sysfs: Rename sysfs_mv_dir sysfs_rename

From: Eric W. Biederman
Date: Thu May 28 2009 - 19:06:22 EST


From: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>

It turns out that sysfs_mv_dir actually makes no assumptions that what
is being renamed is a directory. So rename sysfs_mv_dir to sysfs_rename to
reflect the functions general utility. Later we will use it rename symlinks
in sysfs.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>
---
fs/sysfs/dir.c | 6 +++---
fs/sysfs/sysfs.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 39c6944..96f95f5 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -688,7 +688,7 @@ void sysfs_remove_dir(struct kobject * kobj)
__sysfs_remove_dir(sd);
}

-static int sysfs_mv_dir(struct sysfs_dirent *sd,
+int sysfs_rename(struct sysfs_dirent *sd,
struct sysfs_dirent *new_parent_sd, const char *new_name)
{
const char *dup_name = NULL;
@@ -734,12 +734,12 @@ static int sysfs_mv_dir(struct sysfs_dirent *sd,

int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
{
- return sysfs_mv_dir(kobj->sd, kobj->sd->s_parent, new_name);
+ return sysfs_rename(kobj->sd, kobj->sd->s_parent, new_name);
}

int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
{
- return sysfs_mv_dir(kobj->sd, new_parent_kobj->sd, kobj->sd->s_name);
+ return sysfs_rename(kobj->sd, new_parent_kobj->sd, kobj->sd->s_name);
}

/* Relationship between s_mode and the DT_xxx types */
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 5dd8168..be1d932 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -109,6 +109,9 @@ int sysfs_create_subdir(struct kobject *kobj, const char *name,
struct sysfs_dirent **p_sd);
void sysfs_remove_subdir(struct sysfs_dirent *sd);

+int sysfs_rename(struct sysfs_dirent *sd,
+ struct sysfs_dirent *new_parent_sd, const char *new_name);
+
static inline struct sysfs_dirent *__sysfs_get(struct sysfs_dirent *sd)
{
if (sd) {
--
1.6.3.1.54.g99dd.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/