summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-07-13 08:10:27 -0400
committerJeff Darcy <jeff@pl.atyp.us>2017-07-14 02:42:23 +0000
commite648a291b02298d2f1063cedaad9a58614ebe0ad (patch)
tree48e9b1b66e47cb1855b4912bd940449f3fe6400b /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentd2650feb4bfadf3fb0cdb90236bc78c33b5ea451 (diff)
core: miscellaneous cleanup
clean up things that I tripped over doing other changes. 1) fix mishmash of random spacing in struct decls in glusterfs.h. Not technically a problem, just ugly to look at. 2) replace open-coded strings constants with existing #define constants. A disaster waiting to happen. 3) Use sys_access() instead of sys_stat() or sys_lstat() to test simple existence of file. Why copy dozens of bytes from kernel to user space that aren't going to be used by anything? There are probably more instances like these. Change-Id: I28089bef4cc93d5e4e4213045fb1a2649d110f82 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: https://review.gluster.org/17769 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6b12d603728..0ac64858c11 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -774,7 +774,6 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
char hook_script[PATH_MAX] = "";
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- struct stat stbuf = {0,};
this = THIS;
GF_VALIDATE_OR_GOTO ("glusterd", this, out);
@@ -806,7 +805,7 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (hook_script, sizeof(hook_script),
"%s"GLUSTERD_SHRD_STRG_HOOK_SCRIPT, conf->workdir);
- ret = sys_lstat (hook_script, &stbuf);
+ ret = sys_access (hook_script, R_OK|X_OK);
if (ret) {
snprintf (errstr, PATH_MAX,
"The hook-script (%s) required "
@@ -900,7 +899,6 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
gf_boolean_t check_op_version = _gf_true;
gf_boolean_t trash_enabled = _gf_false;
gf_boolean_t all_vol = _gf_false;
- struct stat stbuf = {0, };
GF_ASSERT (dict);
this = THIS;
@@ -1128,7 +1126,7 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
/* Check if the key is cluster.op-version and set
* local_new_op_version to the value given if possible.
*/
- if (strcmp (key, "cluster.op-version") == 0) {
+ if (strcmp (key, GLUSTERD_GLOBAL_OP_VERSION_KEY) == 0) {
if (!all_vol) {
ret = -1;
snprintf (errstr, sizeof (errstr), "Option \""
@@ -1292,7 +1290,7 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
/* Checks whether a directory with
given option exists or not */
- if (!sys_stat (trash_path, &stbuf)) {
+ if (!sys_access (trash_path, R_OK)) {
snprintf (errstr,
sizeof (errstr),
"Path %s exists",
@@ -2508,7 +2506,7 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
/* If the key is cluster.op-version, set conf->op_version to the value
* if needed and save it.
*/
- if (strcmp(key, "cluster.op-version") == 0) {
+ if (strcmp(key, GLUSTERD_GLOBAL_OP_VERSION_KEY) == 0) {
ret = 0;
ret = gf_string2uint (value, &op_version);