summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-05-16 18:22:35 +0530
committerAnand Avati <avati@redhat.com>2012-05-21 13:46:18 -0700
commita2b7f11f279b9acc74c1a3b6d893fda7c160683d (patch)
tree756adc0753d6e6947a4e825068a5866aa91b406c /libglusterfs
parentcfcc252514f3c3e99a3f40ca3415f77c2295a8e0 (diff)
common-utils: Simplified mkdir_p interface and put it to use.
- Simplified mkdir_p interface. - Removed mkdir_if_missing from codebase - Modified glusterd consumers of mkdir_if_missing to use mkdir_p with allow_symlinks=_gf_true. This implicitly assumes that glusterd is in 'control' of the brick path and glusterd's working dir in the sense that the symlinks (if any) in any of the above mentioned paths are under the 'storage administrator's control. Change-Id: I7383ad5cff11b123e1e0d2fe6da0c81e03c52ed2 BUG: 823132 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/3378 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c10
-rw-r--r--libglusterfs/src/common-utils.h2
2 files changed, 2 insertions, 10 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 4b8807be1eb..737487d1d72 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -59,17 +59,14 @@ struct dnscache6 {
/* works similar to mkdir(1) -p.
- * @start returns the point in path from which components were created
- * @start is -1 if the entire path existed before.
*/
int
-mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks, int *start)
+mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks)
{
int i = 0;
int ret = -1;
char dir[PATH_MAX] = {0,};
struct stat stbuf = {0,};
- int created = -1;
strcpy (dir, path);
i = (dir[0] == '/')? 1: 0;
@@ -85,9 +82,6 @@ mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks, int *start)
goto out;
}
- if (ret && errno == EEXIST)
- created = i;
-
if (ret && errno == EEXIST && !allow_symlinks) {
ret = lstat (dir, &stbuf);
if (ret)
@@ -113,8 +107,6 @@ mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks, int *start)
}
ret = 0;
- if (start)
- *start = created;
out:
return ret;
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 69d57c8d431..b2533ae175d 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -393,7 +393,7 @@ memdup (const void *ptr, size_t size)
}
int
-mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks, int *start);
+mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks);
/*
* rounds up nr to power of two. If nr is already a power of two, just returns
* nr