diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2015-10-01 16:31:19 -0400 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2015-10-28 13:38:42 -0700 |
commit | 3066a21caafab6305527991de11c8eb43ec0044c (patch) | |
tree | 5efc91272ac76ff1613cee1e8a41aeb32aa92d73 /xlators/storage/bd/src/bd-helper.c | |
parent | 063d4ead61ee47433793de81a1c77e0ba69e6e07 (diff) |
core: use syscall wrappers instead of direct syscalls - miscellaneous
various xlators and other components are invoking system calls
directly instead of using the libglusterfs/syscall.[ch] wrappers.
If not using the system call wrappers there should be a comment
in the source explaining why the wrapper isn't used.
Change-Id: I1f47820534c890a00b452fa61f7438eb2b3f667c
BUG: 1267967
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/12276
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/storage/bd/src/bd-helper.c')
-rw-r--r-- | xlators/storage/bd/src/bd-helper.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c index 9532ad3cfd2..520ddd86c06 100644 --- a/xlators/storage/bd/src/bd-helper.c +++ b/xlators/storage/bd/src/bd-helper.c @@ -8,6 +8,7 @@ #include "bd-mem-types.h" #include "run.h" #include "lvm-defaults.h" +#include "syscall.h" int bd_inode_ctx_set (inode_t *inode, xlator_t *this, bd_attr_t *ctx) @@ -269,7 +270,7 @@ out: GF_FREE (devpath); if (ret) { if (_fd >= 0) - close (_fd); + sys_close (_fd); GF_FREE (bdfd); } return ret; @@ -338,7 +339,7 @@ bd_validate_bd_xattr (xlator_t *this, char *bd, char **type, } /* Destination file does not exist */ - if (stat (path, &stbuf)) { + if (sys_stat (path, &stbuf)) { gf_log (this->name, GF_LOG_WARNING, "lstat failed for path %s", path); return -1; @@ -400,7 +401,7 @@ create_thin_lv (char *vg, char *pool, char *lv, uint64_t extent) ret = ENOMEM; goto out; } - if (lstat (path, &stat) < 0) + if (sys_lstat (path, &stat) < 0) ret = EAGAIN; else ret = 0; @@ -612,7 +613,7 @@ bd_snapshot_create (bd_local_t *local, bd_priv_t *priv) runner_start (&runner); runner_end (&runner); - if (lstat (path, &stat) < 0) + if (sys_lstat (path, &stat) < 0) ret = EIO; GF_FREE (path); @@ -672,7 +673,7 @@ bd_clone (bd_local_t *local, bd_priv_t *priv) } while (1) { - bytes = readv (fd1, vec, IOV_NR); + bytes = sys_readv (fd1, vec, IOV_NR); if (bytes < 0) { ret = errno; gf_log (THIS->name, GF_LOG_WARNING, "read failed: %s", @@ -681,7 +682,7 @@ bd_clone (bd_local_t *local, bd_priv_t *priv) } if (!bytes) break; - bytes = writev (fd2, vec, IOV_NR); + bytes = sys_writev (fd2, vec, IOV_NR); if (bytes < 0) { ret = errno; gf_log (THIS->name, GF_LOG_WARNING, @@ -697,9 +698,9 @@ out: GF_FREE (vec); if (fd1 != -1) - close (fd1); + sys_close (fd1); if (fd2 != -1) - close (fd2); + sys_close (fd2); GF_FREE (spath); GF_FREE (dpath); @@ -729,7 +730,7 @@ bd_merge (bd_priv_t *priv, uuid_t gfid) runner_start (&runner); runner_end (&runner); - if (!lstat (path, &stat)) + if (!sys_lstat (path, &stat)) ret = EIO; GF_FREE (path); @@ -847,18 +848,18 @@ bd_do_manual_zerofill (int fd, off_t offset, off_t len, int o_direct) } for (idx = 0; idx < num_loop; idx++) { - op_ret = writev (fd, vector, num_vect); + op_ret = sys_writev (fd, vector, num_vect); if (op_ret < 0) goto err; } if (extra) { - op_ret = writev (fd, vector, extra); + op_ret = sys_writev (fd, vector, extra); if (op_ret < 0) goto err; } if (remain) { vector[0].iov_len = remain; - op_ret = writev (fd, vector , 1); + op_ret = sys_writev (fd, vector , 1); if (op_ret < 0) goto err; } @@ -902,7 +903,7 @@ bd_do_ioctl_zerofill (bd_priv_t *priv, bd_attr_t *bdatt, int fd, char *vg, uuid_utoa_r (bdatt->iatt.ia_gfid, uuid); sprintf (lvname, "/dev/%s/%s", vg, uuid); - readlink (lvname, dmname, sizeof (dmname) - 1); + sys_readlink (lvname, dmname, sizeof (dmname) - 1); p = strrchr (dmname, '/'); if (p) @@ -918,8 +919,8 @@ bd_do_ioctl_zerofill (bd_priv_t *priv, bd_attr_t *bdatt, int fd, char *vg, goto skip; } - read (sysfd, buff, sizeof (buff)); - close (sysfd); + sys_read (sysfd, buff, sizeof (buff)); + sys_close (sysfd); max_bytes = atoll (buff); @@ -1000,7 +1001,7 @@ bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, } if (bd_fd->flag & (O_SYNC|O_DSYNC)) { - ret = fsync (bd_fd->fd); + ret = sys_fsync (bd_fd->fd); if (ret) { gf_log (this->name, GF_LOG_ERROR, "fsync() in writev on fd %d failed: %s", |