summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2017-07-18 15:23:12 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-07-18 17:10:26 +0000
commit63d46236592c9e3c2fef05fd60d1c39548e57a8d (patch)
tree4b5e7b13b8237190b8f29b03e4a6fd4f313d5213 /libglusterfs
parentf3b487a510965469963e860726059b28d67b3914 (diff)
common-utils: Remove fop_enum_to_string, get_fop_int
Implementation of these two functions becomes easier by using gf_fop_list[] array. So implemented that and removed usage of these functions. BUG: 1472250 Change-Id: I8a592913f9eeb02d965708bcf28a637588ed4988 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: https://review.gluster.org/17812 Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c77
-rw-r--r--libglusterfs/src/common-utils.h3
-rw-r--r--libglusterfs/src/glusterfs.h1
3 files changed, 15 insertions, 66 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index c93b3667ad9..1adb0bd5a81 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4650,71 +4650,6 @@ fop_enum_to_pri_string (glusterfs_fop_t fop)
}
const char *
-fop_enum_to_string (glusterfs_fop_t fop)
-{
- static const char *const str_map[] = {
- "NULL",
- "STAT",
- "READLINK",
- "MKNOD",
- "MKDIR",
- "UNLINK",
- "RMDIR",
- "SYMLINK",
- "RENAME",
- "LINK",
- "TRUNCATE",
- "OPEN",
- "READ",
- "WRITE",
- "STATFS",
- "FLUSH",
- "FSYNC",
- "SETXATTR",
- "GETXATTR",
- "REMOVEXATTR",
- "OPENDIR",
- "FSYNCDIR",
- "ACCESS",
- "CREATE",
- "FTRUNCATE",
- "FSTAT",
- "LK",
- "LOOKUP",
- "READDIR",
- "INODELK",
- "FINODELK",
- "ENTRYLK",
- "FENTRYLK",
- "XATTROP",
- "FXATTROP",
- "FGETXATTR",
- "FSETXATTR",
- "RCHECKSUM",
- "SETATTR",
- "FSETATTR",
- "READDIRP",
- "FORGET",
- "RELEASE",
- "RELEASEDIR",
- "GETSPEC",
- "FREMOVEXATTR",
- "FALLOCATE",
- "DISCARD",
- "ZEROFILL",
- "IPC",
- "SEEK",
- "COMPOUND",
- "GETACTIVELK",
- "SETACTIVELK",
- "MAXVALUE"};
- if (fop <= GF_FOP_MAXVALUE)
- return str_map[fop];
-
- return "UNKNOWNFOP";
-}
-
-const char *
gf_inode_type_to_str (ia_type_t type)
{
static const char *const str_ia_type[] = {
@@ -4820,6 +4755,18 @@ gf_fop_string (glusterfs_fop_t fop)
}
int
+gf_fop_int (char *fop)
+{
+ int i = 0;
+
+ for (i = GF_FOP_NULL + 1; i < GF_FOP_MAXVALUE; i++) {
+ if (strcasecmp (fop, gf_fop_list[i]) == 0)
+ return i;
+ }
+ return -1;
+}
+
+int
close_fds_except (int *fdv, size_t count)
{
int i = 0;
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 41cbb01440c..f1625e446cb 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -914,6 +914,9 @@ gf_bits_index (uint64_t n);
const char*
gf_fop_string (glusterfs_fop_t fop);
+int
+gf_fop_int (char *fop);
+
char *
get_ip_from_addrinfo (struct addrinfo *addr, char **ip);
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 19e4ee6ec16..a8c94837635 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -298,7 +298,6 @@
#define GF_LK_MANDATORY 1
const char *fop_enum_to_pri_string (glusterfs_fop_t fop);
-const char *fop_enum_to_string (glusterfs_fop_t fop);
#define GF_SET_IF_NOT_PRESENT 0x1 /* default behaviour */
#define GF_SET_OVERWRITE 0x2 /* Overwrite with the buf given */