diff options
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/compress/src/cdc-helper.c | 7 | ||||
-rw-r--r-- | xlators/features/index/src/index.c | 39 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.c | 7 | ||||
-rw-r--r-- | xlators/features/trash/src/trash.c | 3 |
4 files changed, 30 insertions, 26 deletions
diff --git a/xlators/features/compress/src/cdc-helper.c b/xlators/features/compress/src/cdc-helper.c index 21f529c2652..0a9a0e3d29c 100644 --- a/xlators/features/compress/src/cdc-helper.c +++ b/xlators/features/compress/src/cdc-helper.c @@ -10,6 +10,7 @@ #include "glusterfs.h" #include "logging.h" +#include "syscall.h" #include "cdc.h" #include "cdc-mem-types.h" @@ -166,17 +167,17 @@ cdc_dump_iovec_to_disk (xlator_t *this, cdc_info_t *ci, const char *file) return; } - written = write (fd, (char *) gzip_header, 10); + written = sys_write (fd, (char *) gzip_header, 10); total_written += written; for (i = 0; i < ci->ncount; i++) { - written = write (fd, (char *) ci->vec[i].iov_base, ci->vec[i].iov_len); + written = sys_write (fd, (char *) ci->vec[i].iov_base, ci->vec[i].iov_len); total_written += written; } gf_log (this->name, GF_LOG_DEBUG, "dump'd %zu bytes to %s", total_written, GF_CDC_DEBUG_DUMP_FILE ); - close (fd); + sys_close (fd); } static int32_t diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 2bba6630bde..5de8d9b4668 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -144,7 +144,7 @@ index_dir_create (xlator_t *this, const char *subdir) priv = this->private; make_index_dir_path (priv->index_basepath, subdir, fullpath, sizeof (fullpath)); - ret = stat (fullpath, &st); + ret = sys_stat (fullpath, &st); if (!ret) { if (!S_ISDIR (st.st_mode)) ret = -2; @@ -163,7 +163,7 @@ index_dir_create (xlator_t *this, const char *subdir) len = pathlen; strncpy (path, fullpath, len); path[len] = '\0'; - ret = mkdir (path, 0600); + ret = sys_mkdir (path, 0600); if (ret && (errno != EEXIST)) goto out; } @@ -236,9 +236,10 @@ make_file_path (char *base, const char *subdir, const char *filename, static int is_index_file_current (char *filename, uuid_t priv_index) { - char *current_index = alloca (strlen ("xattrop-") + GF_UUID_BUF_SIZE); + char current_index[GF_UUID_BUF_SIZE + 16] = {0, }; - sprintf (current_index, "xattrop-%s", uuid_utoa(priv_index)); + snprintf (current_index, sizeof current_index, + "xattrop-%s", uuid_utoa(priv_index)); return (!strcmp(filename, current_index)); } @@ -257,9 +258,9 @@ check_delete_stale_index_file (xlator_t *this, char *filename) make_file_path (priv->index_basepath, XATTROP_SUBDIR, filename, filepath, sizeof (filepath)); - ret = stat (filepath, &st); + ret = sys_stat (filepath, &st); if (!ret && st.st_nlink == 1) - unlink (filepath); + sys_unlink (filepath); } static int @@ -370,7 +371,7 @@ index_fill_readdir (fd_t *fd, index_fd_ctx_t *fctx, DIR *dir, off_t off, count ++; } - if ((!readdir (dir) && (errno == 0))) { + if ((!sys_readdir (dir) && (errno == 0))) { /* Indicate EOF */ errno = ENOENT; /* Remember EOF offset for later detection */ @@ -399,7 +400,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) make_gfid_path (priv->index_basepath, subdir, gfid, gfid_path, sizeof (gfid_path)); - ret = stat (gfid_path, &st); + ret = sys_stat (gfid_path, &st); if (!ret) goto out; index_get_index (priv, index); @@ -424,7 +425,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) goto out; } - fd = creat (index_path, 0); + fd = sys_creat (index_path, 0); if ((fd < 0) && (errno != EEXIST)) { ret = -1; gf_log (this->name, GF_LOG_ERROR, "%s: Not able to " @@ -434,7 +435,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) } if (fd >= 0) - close (fd); + sys_close (fd); ret = sys_link (index_path, gfid_path); if (ret && (errno != EEXIST)) { @@ -462,7 +463,7 @@ index_del (xlator_t *this, uuid_t gfid, const char *subdir) out, op_errno, EINVAL); make_gfid_path (priv->index_basepath, subdir, gfid, gfid_path, sizeof (gfid_path)); - ret = unlink (gfid_path); + ret = sys_unlink (gfid_path); if (ret && (errno != ENOENT)) { gf_log (this->name, GF_LOG_ERROR, "%s: failed to delete from index (%s)", @@ -590,7 +591,7 @@ __index_fd_ctx_get (fd_t *fd, xlator_t *this, index_fd_ctx_t **ctx) make_index_dir_path (priv->index_basepath, XATTROP_SUBDIR, index_dir, sizeof (index_dir)); - fctx->dir = opendir (index_dir); + fctx->dir = sys_opendir (index_dir); if (!fctx->dir) { ret = -errno; GF_FREE (fctx); @@ -601,7 +602,7 @@ __index_fd_ctx_get (fd_t *fd, xlator_t *this, index_fd_ctx_t **ctx) ret = __fd_ctx_set (fd, this, (uint64_t)(long)fctx); if (ret) { - closedir (fctx->dir); + sys_closedir (fctx->dir); GF_FREE (fctx); fctx = NULL; ret = -EINVAL; @@ -822,7 +823,7 @@ index_entry_count (xlator_t *this, char *subdir) make_index_dir_path (priv->index_basepath, subdir, index_dir, sizeof (index_dir)); - dirp = opendir (index_dir); + dirp = sys_opendir (index_dir); if (!dirp) return 0; @@ -836,7 +837,7 @@ index_entry_count (xlator_t *this, char *subdir) continue; count++; } - closedir (dirp); + sys_closedir (dirp); return count; } @@ -918,7 +919,7 @@ index_lookup_wrapper (call_frame_t *frame, xlator_t *this, loc->name, path, sizeof (path)); } - ret = lstat (path, &lstatbuf); + ret = sys_lstat (path, &lstatbuf); if (ret) { gf_log (this->name, GF_LOG_DEBUG, "Stat failed on index dir " "(%s)", strerror (errno)); @@ -1010,7 +1011,7 @@ index_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag, priv = this->private; make_index_dir_path (priv->index_basepath, XATTROP_SUBDIR, index_dir, sizeof (index_dir)); - ret = lstat (index_dir, &lstatbuf); + ret = sys_lstat (index_dir, &lstatbuf); if (ret < 0) { op_ret = -1; op_errno = errno; @@ -1028,7 +1029,7 @@ index_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag, goto done; } memset (&lstatbuf, 0, sizeof (lstatbuf)); - ret = lstat (index_dir, &lstatbuf); + ret = sys_lstat (index_dir, &lstatbuf); if (ret < 0) { op_ret = -1; op_errno = errno; @@ -1380,7 +1381,7 @@ index_releasedir (xlator_t *this, fd_t *fd) fctx = (index_fd_ctx_t*) (long) ctx; if (fctx->dir) { - ret = closedir (fctx->dir); + ret = sys_closedir (fctx->dir); if (ret) gf_log (this->name, GF_LOG_ERROR, "closedir error: %s", strerror (errno)); } diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 4e4a280ba31..e579417810f 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -17,6 +17,7 @@ #include "marker-common.h" #include "byte-order.h" #include "syncop.h" +#include "syscall.h" #include <fnmatch.h> @@ -178,7 +179,7 @@ marker_error_handler (xlator_t *this, marker_local_t *local, int32_t op_errno) "Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path, strerror (op_errno)); - unlink (priv->timestamp_file); + sys_unlink (priv->timestamp_file); return 0; } @@ -235,7 +236,7 @@ stat_stampfile (xlator_t *this, marker_conf_t *priv, GF_ASSERT (sizeof (priv->volume_uuid_bin) == 16); memcpy (vol_mark->uuid, priv->volume_uuid_bin, 16); - if (stat (priv->timestamp_file, &buf) != -1) { + if (sys_stat (priv->timestamp_file, &buf) != -1) { vol_mark->retval = 0; vol_mark->sec = htonl (buf.st_mtime); vol_mark->usec = htonl (ST_MTIM_NSEC (&buf)/1000); @@ -2101,7 +2102,7 @@ call_from_sp_client_to_reset_tmfile (call_frame_t *frame, /* TODO check whether the O_TRUNC would update the * timestamps on a zero length file on all machies. */ - close (fd); + sys_close (fd); } if (fd != -1 || errno == ENOENT) { diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index 18e36e7d6d9..35712f98aff 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -9,6 +9,7 @@ */ #include "trash.h" #include "trash-mem-types.h" +#include "syscall.h" #define root_gfid (uuid_t){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} #define trash_gfid (uuid_t){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5} @@ -48,7 +49,7 @@ get_permission (char *path) struct iatt ibuf = {0,}; int ret = 0; - ret = stat (path, &sbuf); + ret = sys_stat (path, &sbuf); if (!ret) { iatt_from_stat (&ibuf, &sbuf); mode = st_mode_from_ia (ibuf.ia_prot, ibuf.ia_type); |