lkml.org 
[lkml]   [2009]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 21/20] sysfs: Rename sysfs_mv_dir sysfs_rename
From: Eric W. Biederman <ebiederm@xmission.com>

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@aristanetworks.com>
---
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 7aa8890..4da20a3 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -660,7 +660,7 @@ void sysfs_remove_dir(struct kobject * kobj)
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;
@@ -706,12 +706,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


\
 
 \ /
  Last update: 2009-05-23 22:17    [from the cache]
©2003-2011 Jasper Spaans