lkml.org 
[lkml]   [2009]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 23/26] 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 97ca5bf..7da42fb 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -686,7 +686,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;
@@ -732,12 +732,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-29 22:29    [W:0.308 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site