summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorZhou Zhengping <johnzzpcrystal@gmail.com>2016-07-16 21:43:58 -0400
committerJeff Darcy <jdarcy@redhat.com>2016-07-18 04:59:05 -0700
commit73b9ede7e115fab245b0f59d18e4d6cc4d297cec (patch)
tree88b9b003486c7b98241d93069e7fa773508b1284 /libglusterfs
parent939184c6709db1391d38c892e098c20519d746cc (diff)
core: add a basis function to reduce verbose code
Change-Id: Icebe1b865edb317685e93f3ef11d98fd9b2c2e9a BUG: 1357226 Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com> Reviewed-on: http://review.gluster.org/14936 Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c14
-rw-r--r--libglusterfs/src/common-utils.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index b9062c159c7..b2d5a279dc8 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4538,3 +4538,17 @@ is_virtual_xattr (const char *k)
return ret;
}
+
+ino_t
+gfid_to_ino (uuid_t gfid)
+{
+ ino_t ino = 0;
+ int32_t i;
+
+ for (i = 8; i < 16; i++) {
+ ino <<= 8;
+ ino += (uint8_t)gfid[i];
+ }
+
+ return ino;
+}
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index e2b3f3ea032..d7277e6e834 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -652,6 +652,12 @@ gf_time_fmt (char *dst, size_t sz_dst, time_t utime, unsigned int fmt)
return dst;
}
+/* This function helps us use gfid (unique identity) to generate inode's unique
+ * number in glusterfs.
+ */
+ino_t
+gfid_to_ino (uuid_t gfid);
+
int
mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks);
/*