diff options
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 236 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-protocol.h | 40 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 48 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.h | 2 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 212 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-protocol.h | 2 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-resolve.c | 4 |
7 files changed, 272 insertions, 272 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 3adfbd79b..f50182a6b 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -3437,27 +3437,27 @@ client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, while (trav) { int32_t this_len = 0; char *tmp_buf = NULL; - struct stat *stbuf = &trav->buf; + struct iatt *stbuf = &trav->buf; { /* Convert the stat buf to string */ - uint64_t dev = stbuf->st_dev; - uint64_t ino = stbuf->st_ino; - uint32_t mode = stbuf->st_mode; - uint32_t nlink = stbuf->st_nlink; - uint32_t uid = stbuf->st_uid; - uint32_t gid = stbuf->st_gid; - uint64_t rdev = stbuf->st_rdev; - uint64_t size = stbuf->st_size; - uint32_t blksize = stbuf->st_blksize; - uint64_t blocks = stbuf->st_blocks; - - uint32_t atime = stbuf->st_atime; - uint32_t mtime = stbuf->st_mtime; - uint32_t ctime = stbuf->st_ctime; - - uint32_t atime_nsec = ST_ATIM_NSEC(stbuf); - uint32_t mtime_nsec = ST_MTIM_NSEC(stbuf); - uint32_t ctime_nsec = ST_CTIM_NSEC(stbuf); + uint64_t dev = stbuf->ia_gen; + uint64_t ino = stbuf->ia_ino; + uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + uint32_t nlink = stbuf->ia_nlink; + uint32_t uid = stbuf->ia_uid; + uint32_t gid = stbuf->ia_gid; + uint64_t rdev = stbuf->ia_rdev; + uint64_t size = stbuf->ia_size; + uint32_t blksize = stbuf->ia_blksize; + uint64_t blocks = stbuf->ia_blocks; + + uint32_t atime = stbuf->ia_atime; + uint32_t mtime = stbuf->ia_mtime; + uint32_t ctime = stbuf->ia_ctime; + + uint32_t atime_nsec = stbuf->ia_atime_nsec; + uint32_t mtime_nsec = stbuf->ia_mtime_nsec; + uint32_t ctime_nsec = stbuf->ia_ctime_nsec; ret = asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR, dev, ino, mode, nlink, uid, gid, @@ -3520,7 +3520,7 @@ unwind: int client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { gf_hdr_common_t *hdr = NULL; gf_fop_setattr_req_t *req = NULL; @@ -3553,7 +3553,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, req->gen = hton64 (gen); strcpy (req->path, loc->path); - gf_stat_from_stat (&req->stbuf, stbuf); + gf_stat_from_iatt (&req->stbuf, stbuf); req->valid = hton32 (valid); ret = protocol_client_xfer (frame, this, @@ -3570,7 +3570,7 @@ unwind: int client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { gf_hdr_common_t *hdr = NULL; gf_fop_fsetattr_req_t *req = NULL; @@ -3616,7 +3616,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, req->fd = hton64 (remote_fd); - gf_stat_from_stat (&req->stbuf, stbuf); + gf_stat_from_iatt (&req->stbuf, stbuf); req->valid = hton32 (valid); ret = protocol_client_xfer (frame, this, @@ -3940,9 +3940,9 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_errno = 0; fd_t *fd = NULL; inode_t *inode = NULL; - struct stat stbuf = {0, }; - struct stat preparent = {0, }; - struct stat postparent = {0, }; + struct iatt stbuf = {0, }; + struct iatt preparent = {0, }; + struct iatt postparent = {0, }; int64_t remote_fd = 0; int32_t ret = -1; client_local_t *local = NULL; @@ -3963,13 +3963,13 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret >= 0) { remote_fd = ntoh64 (rsp->fd); - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); - ino = stbuf.st_ino; - gen = stbuf.st_dev; + ino = stbuf.ia_ino; + gen = stbuf.ia_gen; } if (op_ret >= 0) { @@ -4106,7 +4106,7 @@ int client_stat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_stat_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4117,7 +4117,7 @@ client_stat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4141,12 +4141,12 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_mknod_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; frame->local = NULL; @@ -4158,10 +4158,10 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_put2 (local->loc.inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "MKNOD %"PRId64"/%s (%s): failed to set remote" @@ -4170,8 +4170,8 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4197,9 +4197,9 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_symlink_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt stbuf = {0, }; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; @@ -4214,10 +4214,10 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_put2 (inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "SYMLINK %"PRId64"/%s (%s): failed to set " @@ -4225,8 +4225,8 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.parent->ino, local->loc.name, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4252,11 +4252,11 @@ client_link_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_link_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; frame->local = NULL; @@ -4268,10 +4268,10 @@ client_link_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4297,8 +4297,8 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_truncate_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4306,8 +4306,8 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4326,7 +4326,7 @@ int client_fstat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_fstat_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4337,7 +4337,7 @@ client_fstat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); } @@ -4360,8 +4360,8 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_ftruncate_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4369,8 +4369,8 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4394,7 +4394,7 @@ client_readv_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_ret = 0; int32_t op_errno = 0; struct iovec vector = {0, }; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; struct iobref *iobref = NULL; rsp = gf_param (hdr); @@ -4404,7 +4404,7 @@ client_readv_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret != -1) { iobref = iobref_new (); - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); vector.iov_len = op_ret; if (op_ret > 0) { @@ -4439,8 +4439,8 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_write_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4448,8 +4448,8 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4528,8 +4528,8 @@ int client_fsync_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat prestat = {0, }; - struct stat poststat = {0,}; + struct iatt prestat = {0, }; + struct iatt poststat = {0,}; gf_fop_fsync_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4540,8 +4540,8 @@ client_fsync_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4564,8 +4564,8 @@ client_unlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_unlink_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; rsp = gf_param (hdr); @@ -4573,8 +4573,8 @@ client_unlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, &preparent, &postparent); @@ -4594,14 +4594,14 @@ int client_rename_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_rename_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preoldparent = {0, }; - struct stat postoldparent = {0, }; - struct stat prenewparent = {0, }; - struct stat postnewparent = {0, }; + struct iatt preoldparent = {0, }; + struct iatt postoldparent = {0, }; + struct iatt prenewparent = {0, }; + struct iatt postnewparent = {0, }; rsp = gf_param (hdr); @@ -4609,11 +4609,11 @@ client_rename_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preoldparent, &preoldparent); - gf_stat_to_stat (&rsp->postoldparent, &postoldparent); - gf_stat_to_stat (&rsp->prenewparent, &prenewparent); - gf_stat_to_stat (&rsp->postnewparent, &postnewparent); + gf_stat_to_iatt (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->preoldparent, &preoldparent); + gf_stat_to_iatt (&rsp->postoldparent, &postoldparent); + gf_stat_to_iatt (&rsp->prenewparent, &prenewparent); + gf_stat_to_iatt (&rsp->postnewparent, &postnewparent); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf, &preoldparent, @@ -4639,7 +4639,7 @@ client_readlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_ret = 0; int32_t op_errno = 0; char *link = NULL; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; rsp = gf_param (hdr); @@ -4648,7 +4648,7 @@ client_readlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret > 0) { link = rsp->path; - gf_stat_to_stat (&rsp->buf, &stbuf); + gf_stat_to_iatt (&rsp->buf, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, link, &stbuf); @@ -4670,12 +4670,12 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_mkdir_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; inode = local->loc.inode; @@ -4687,10 +4687,10 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - ret = inode_ctx_put2 (inode, frame->this, stbuf.st_ino, - stbuf.st_dev); + ret = inode_ctx_put2 (inode, frame->this, stbuf.ia_ino, + stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "MKDIR %"PRId64"/%s (%s): failed to set " @@ -4699,8 +4699,8 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4829,8 +4829,8 @@ client_rmdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_rmdir_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; rsp = gf_param (hdr); @@ -4838,8 +4838,8 @@ client_rmdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, &preparent, &postparent); @@ -4886,8 +4886,8 @@ int client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; - struct stat postparent = {0, }; + struct iatt stbuf = {0, }; + struct iatt postparent = {0, }; inode_t *inode = NULL; dict_t *xattr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -4909,14 +4909,14 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_ret = ntoh32 (hdr->rsp.op_ret); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); if (op_ret == 0) { op_ret = -1; - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_get2 (inode, frame->this, &oldino, &oldgen); - if (oldino != stbuf.st_ino || oldgen != stbuf.st_dev) { + if (oldino != stbuf.ia_ino || oldgen != stbuf.ia_gen) { if (oldino) { gf_log (frame->this->name, GF_LOG_DEBUG, "LOOKUP %"PRId64"/%s (%s): " @@ -4926,13 +4926,13 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.parent->ino : (uint64_t) 0, local->loc.name, local->loc.path, - oldgen, oldino, stbuf.st_dev, stbuf.st_ino); + oldgen, oldino, stbuf.ia_gen, stbuf.ia_ino); op_errno = ESTALE; goto fail; } ret = inode_ctx_put2 (inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "LOOKUP %"PRId64"/%s (%s) : " @@ -4990,8 +4990,8 @@ static int32_t client_setattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat statpre = {0, }; - struct stat statpost = {0, }; + struct iatt statpre = {0, }; + struct iatt statpost = {0, }; gf_fop_setattr_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -5002,8 +5002,8 @@ client_setattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->statpre, &statpre); - gf_stat_to_stat (&rsp->statpost, &statpost); + gf_stat_to_iatt (&rsp->statpre, &statpre); + gf_stat_to_iatt (&rsp->statpost, &statpost); } STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost); @@ -5015,8 +5015,8 @@ static int32_t client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat statpre = {0, }; - struct stat statpost = {0, }; + struct iatt statpre = {0, }; + struct iatt statpost = {0, }; gf_fop_setattr_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -5027,8 +5027,8 @@ client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->statpre, &statpre); - gf_stat_to_stat (&rsp->statpost, &statpost); + gf_stat_to_iatt (&rsp->statpre, &statpre); + gf_stat_to_iatt (&rsp->statpost, &statpost); } STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost); @@ -5087,7 +5087,7 @@ gf_bin_to_direntry (char *buf, size_t count) break; rcount = ender - buffer; *ender = '\0'; - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) trav->link = strdup (buffer); else trav->link = ""; @@ -5118,7 +5118,7 @@ gf_free_direntry (dir_entry_t *head) while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; diff --git a/xlators/protocol/client/src/client-protocol.h b/xlators/protocol/client/src/client-protocol.h index 273486902..ae65fb5fe 100644 --- a/xlators/protocol/client/src/client-protocol.h +++ b/xlators/protocol/client/src/client-protocol.h @@ -117,7 +117,7 @@ typedef struct { static inline void -gf_string_to_stat(char *string, struct stat *stbuf) +gf_string_to_stat(char *string, struct iatt *stbuf) { uint64_t dev = 0; uint64_t ino = 0; @@ -154,25 +154,25 @@ gf_string_to_stat(char *string, struct stat *stbuf) &ctime, &ctime_nsec); - stbuf->st_dev = dev; - stbuf->st_ino = ino; - stbuf->st_mode = mode; - stbuf->st_nlink = nlink; - stbuf->st_uid = uid; - stbuf->st_gid = gid; - stbuf->st_rdev = rdev; - stbuf->st_size = size; - stbuf->st_blksize = blksize; - stbuf->st_blocks = blocks; - - stbuf->st_atime = atime; - stbuf->st_mtime = mtime; - stbuf->st_ctime = ctime; - - ST_ATIM_NSEC_SET(stbuf, atime_nsec); - ST_MTIM_NSEC_SET(stbuf, mtime_nsec); - ST_CTIM_NSEC_SET(stbuf, ctime_nsec); - + stbuf->ia_gen = dev; + stbuf->ia_ino = ino; + stbuf->ia_prot = ia_prot_from_st_mode (mode); + stbuf->ia_type = ia_type_from_st_mode (mode); + stbuf->ia_nlink = nlink; + stbuf->ia_uid = uid; + stbuf->ia_gid = gid; + stbuf->ia_rdev = rdev; + stbuf->ia_size = size; + stbuf->ia_blksize = blksize; + stbuf->ia_blocks = blocks; + + stbuf->ia_atime = atime; + stbuf->ia_mtime = mtime; + stbuf->ia_ctime = ctime; + + stbuf->ia_atime_nsec = atime_nsec; + stbuf->ia_mtime_nsec = mtime_nsec; + stbuf->ia_ctime_nsec = ctime_nsec; } #endif diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index f627b6b53..dc2620c90 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -112,34 +112,34 @@ out: } /* - * stat_to_str - convert struct stat to a ASCII string - * @stbuf: struct stat pointer + * stat_to_str - convert struct iatt to a ASCII string + * @stbuf: struct iatt pointer * * not for external reference */ char * -stat_to_str (struct stat *stbuf) +stat_to_str (struct iatt *stbuf) { int ret = 0; char *tmp_buf = NULL; - uint64_t dev = stbuf->st_dev; - uint64_t ino = stbuf->st_ino; - uint32_t mode = stbuf->st_mode; - uint32_t nlink = stbuf->st_nlink; - uint32_t uid = stbuf->st_uid; - uint32_t gid = stbuf->st_gid; - uint64_t rdev = stbuf->st_rdev; - uint64_t size = stbuf->st_size; - uint32_t blksize = stbuf->st_blksize; - uint64_t blocks = stbuf->st_blocks; - uint32_t atime = stbuf->st_atime; - uint32_t mtime = stbuf->st_mtime; - uint32_t ctime = stbuf->st_ctime; - - uint32_t atime_nsec = ST_ATIM_NSEC(stbuf); - uint32_t mtime_nsec = ST_MTIM_NSEC(stbuf); - uint32_t ctime_nsec = ST_CTIM_NSEC(stbuf); + uint64_t dev = stbuf->ia_gen; + uint64_t ino = stbuf->ia_ino; + uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + uint32_t nlink = stbuf->ia_nlink; + uint32_t uid = stbuf->ia_uid; + uint32_t gid = stbuf->ia_gid; + uint64_t rdev = stbuf->ia_rdev; + uint64_t size = stbuf->ia_size; + uint32_t blksize = stbuf->ia_blksize; + uint64_t blocks = stbuf->ia_blocks; + uint32_t atime = stbuf->ia_atime; + uint32_t mtime = stbuf->ia_mtime; + uint32_t ctime = stbuf->ia_ctime; + + uint32_t atime_nsec = stbuf->ia_atime_nsec; + uint32_t mtime_nsec = stbuf->ia_mtime_nsec; + uint32_t ctime_nsec = stbuf->ia_ctime_nsec; ret = asprintf (&tmp_buf, @@ -307,10 +307,10 @@ gf_add_locker (struct _lock_table *table, const char *volume, if (fd == NULL) { loc_copy (&new->loc, loc); - dir = S_ISDIR (new->loc.inode->st_mode); + dir = IA_ISDIR (new->loc.inode->ia_type); } else { new->fd = fd_ref (fd); - dir = S_ISDIR (fd->inode->st_mode); + dir = IA_ISDIR (fd->inode->ia_type); } new->pid = pid; @@ -342,9 +342,9 @@ gf_del_locker (struct _lock_table *table, const char *volume, INIT_LIST_HEAD (&del); if (fd) { - dir = S_ISDIR (fd->inode->st_mode); + dir = IA_ISDIR (fd->inode->ia_type); } else { - dir = S_ISDIR (loc->inode->st_mode); + dir = IA_ISDIR (loc->inode->ia_type); } LOCK (&table->lock); diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index 867035d33..cbf57ae44 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -42,7 +42,7 @@ #define IS_NOT_ROOT(pathlen) ((pathlen > 2)? 1 : 0) char * -stat_to_str (struct stat *stbuf); +stat_to_str (struct iatt *stbuf); call_frame_t * server_copy_frame (call_frame_t *frame); diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 4562eaea3..57e320393 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -668,8 +668,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rmdir_rsp_t *rsp = NULL; @@ -705,8 +705,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RMDIR, @@ -729,8 +729,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mkdir_rsp_t *rsp = NULL; @@ -750,9 +750,9 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -785,8 +785,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mknod_rsp_t *rsp = NULL; @@ -806,9 +806,9 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -1383,9 +1383,9 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rename_rsp_t *rsp = NULL; @@ -1404,8 +1404,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - stbuf->st_ino = state->loc.inode->ino; - stbuf->st_mode = state->loc.inode->st_mode; + stbuf->ia_ino = state->loc.inode->ino; + stbuf->ia_type = state->loc.inode->ia_type; gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": RENAME_CBK (%"PRId64") %"PRId64"/%s " @@ -1418,13 +1418,13 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.parent, state->loc.name, state->loc2.parent, state->loc2.name, state->loc.inode, stbuf); - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preoldparent, preoldparent); - gf_stat_from_stat (&rsp->postoldparent, postoldparent); + gf_stat_from_iatt (&rsp->preoldparent, preoldparent); + gf_stat_from_iatt (&rsp->postoldparent, postoldparent); - gf_stat_from_stat (&rsp->prenewparent, prenewparent); - gf_stat_from_stat (&rsp->postnewparent, postnewparent); + gf_stat_from_iatt (&rsp->prenewparent, prenewparent); + gf_stat_from_iatt (&rsp->postnewparent, postnewparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RENAME, @@ -1446,8 +1446,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_unlink_rsp_t *rsp = NULL; @@ -1489,8 +1489,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UNLINK, @@ -1512,8 +1512,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_symlink_rsp_t *rsp = NULL; @@ -1533,9 +1533,9 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -1569,8 +1569,8 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_link_rsp_t *rsp = NULL; @@ -1590,11 +1590,11 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - stbuf->st_ino = state->loc.inode->ino; + stbuf->ia_ino = state->loc.inode->ino; - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": LINK (%"PRId64") %"PRId64"/%s ==> %"PRId64"/%s", @@ -1637,8 +1637,8 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_truncate_rsp_t *rsp = NULL; @@ -1657,8 +1657,8 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": TRUNCATE %s (%"PRId64") ==> %"PRId32" (%s)", @@ -1686,7 +1686,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_fstat_rsp_t *rsp = NULL; @@ -1703,7 +1703,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { state = CALL_STATE(frame); @@ -1733,8 +1733,8 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_ftruncate_rsp_t *rsp = NULL; @@ -1751,8 +1751,8 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { state = CALL_STATE (frame); @@ -1825,8 +1825,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_fsync_rsp_t *rsp = NULL; @@ -1853,8 +1853,8 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&(rsp->prestat), prebuf); - gf_stat_from_stat (&(rsp->poststat), postbuf); + gf_stat_from_iatt (&(rsp->prestat), prebuf); + gf_stat_from_iatt (&(rsp->poststat), postbuf); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSYNC, @@ -1909,8 +1909,8 @@ server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_write_rsp_t *rsp = NULL; @@ -1927,8 +1927,8 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { state = CALL_STATE(frame); @@ -1962,7 +1962,7 @@ int server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf, struct iobref *iobref) + struct iatt *stbuf, struct iobref *iobref) { gf_hdr_common_t *hdr = NULL; gf_fop_read_rsp_t *rsp = NULL; @@ -1979,7 +1979,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { state = CALL_STATE(frame); @@ -2062,15 +2062,15 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * @op_errno: * @fd: file descriptor * @inode: inode structure - * @stbuf: struct stat of created file + * @stbuf: struct iatt of created file * * not for external reference */ int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + fd_t *fd, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { server_connection_t *conn = NULL; gf_hdr_common_t *hdr = NULL; @@ -2089,7 +2089,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": CREATE %"PRId64"/%s (%"PRId64")", frame->root->unique, state->loc.parent->ino, - state->loc.name, stbuf->st_ino); + state->loc.name, stbuf->ia_ino); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -2142,9 +2142,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp->fd = hton64 (fd_no); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CREATE, @@ -2167,7 +2167,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *buf, - struct stat *sbuf) + struct iatt *sbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_readlink_rsp_t *rsp = NULL; @@ -2197,7 +2197,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&(rsp->buf), sbuf); + gf_stat_from_iatt (&(rsp->buf), sbuf); strcpy (rsp->path, buf); } @@ -2220,7 +2220,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_stat_rsp_t *rsp = NULL; @@ -2239,7 +2239,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": STAT %s (%"PRId64") ==> %"PRId32" (%s)", @@ -2269,7 +2269,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, struct stat *statpost) + struct iatt *statpre, struct iatt *statpost) { gf_hdr_common_t *hdr = NULL; gf_fop_setattr_rsp_t *rsp = NULL; @@ -2288,8 +2288,8 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->statpre, statpre); - gf_stat_from_stat (&rsp->statpost, statpost); + gf_stat_from_iatt (&rsp->statpre, statpre); + gf_stat_from_iatt (&rsp->statpost, statpost); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": SETATTR %s (%"PRId64") ==> %"PRId32" (%s)", @@ -2318,7 +2318,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, struct stat *statpost) + struct iatt *statpre, struct iatt *statpost) { gf_hdr_common_t *hdr = NULL; gf_fop_fsetattr_rsp_t *rsp = NULL; @@ -2337,8 +2337,8 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->statpre, statpre); - gf_stat_from_stat (&rsp->statpost, statpost); + gf_stat_from_iatt (&rsp->statpre, statpre); + gf_stat_from_iatt (&rsp->statpost, statpost); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": FSETATTR %"PRId64" (%"PRId64") ==> " @@ -2370,8 +2370,8 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, dict_t *dict, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *dict, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -2435,18 +2435,18 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (postparent) - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->postparent, postparent); if (op_ret == 0) { root_inode = BOUND_XL(frame)->itable->root; if (inode == root_inode) { /* we just looked up root ("/") */ - stbuf->st_ino = 1; - if (inode->st_mode == 0) - inode->st_mode = stbuf->st_mode; + stbuf->ia_ino = 1; + if (inode->ia_type == 0) + inode->ia_type = stbuf->ia_type; } - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); if (inode->ino != 1) { link_inode = inode_link (inode, state->loc.parent, @@ -2802,7 +2802,7 @@ server_setattr (call_frame_t *frame, xlator_t *bound_xl, state->resolve.gen = ntoh64 (req->gen); state->resolve.path = strdup (req->path); - gf_stat_to_stat (&req->stbuf, &state->stbuf); + gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); resolve_and_resume (frame, server_setattr_resume); @@ -2848,7 +2848,7 @@ server_fsetattr (call_frame_t *frame, xlator_t *bound_xl, state->resolve.type = RESOLVE_MUST; state->resolve.fd_no = ntoh64 (req->fd); - gf_stat_to_stat (&req->stbuf, &state->stbuf); + gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); resolve_and_resume (frame, server_fsetattr_resume); @@ -5084,25 +5084,25 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, &size, &blksize, &blocks, &atime, &atime_nsec, &mtime, &mtime_nsec, &ctime, &ctime_nsec); - trav->buf.st_dev = dev; - trav->buf.st_ino = ino; - trav->buf.st_mode = mode; - trav->buf.st_nlink = nlink; - trav->buf.st_uid = uid; - trav->buf.st_gid = gid; - trav->buf.st_rdev = rdev; - trav->buf.st_size = size; - trav->buf.st_blksize = blksize; - trav->buf.st_blocks = blocks; - - trav->buf.st_atime = atime; - trav->buf.st_mtime = mtime; - trav->buf.st_ctime = ctime; - - ST_ATIM_NSEC_SET(&trav->buf, atime_nsec); - ST_MTIM_NSEC_SET(&trav->buf, mtime_nsec); - ST_CTIM_NSEC_SET(&trav->buf, ctime_nsec); - + trav->buf.ia_gen = dev; + trav->buf.ia_ino = ino; + trav->buf.ia_prot = ia_prot_from_st_mode (mode); + trav->buf.ia_type = ia_type_from_st_mode (mode); + trav->buf.ia_nlink = nlink; + trav->buf.ia_uid = uid; + trav->buf.ia_gid = gid; + trav->buf.ia_rdev = rdev; + trav->buf.ia_size = size; + trav->buf.ia_blksize = blksize; + trav->buf.ia_blocks = blocks; + + trav->buf.ia_atime = atime; + trav->buf.ia_mtime = mtime; + trav->buf.ia_ctime = ctime; + + trav->buf.ia_atime_nsec = atime_nsec; + trav->buf.ia_mtime_nsec = mtime_nsec; + trav->buf.ia_ctime_nsec = ctime_nsec; } ender = strchr (buffer_ptr, '\n'); @@ -5110,7 +5110,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, break; count = ender - buffer_ptr; *ender = '\0'; - if (S_ISLNK (trav->buf.st_mode)) { + if (IA_ISLNK (trav->buf.ia_type)) { trav->link = strdup (buffer_ptr); } else trav->link = ""; @@ -5131,7 +5131,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; diff --git a/xlators/protocol/server/src/server-protocol.h b/xlators/protocol/server/src/server-protocol.h index 78bc13827..61fcb877e 100644 --- a/xlators/protocol/server/src/server-protocol.h +++ b/xlators/protocol/server/src/server-protocol.h @@ -165,7 +165,7 @@ struct _server_state { loc_t *loc_now; server_resolve_t *resolve_now; - struct stat stbuf; + struct iatt stbuf; int valid; fd_t *fd; diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c index 2eb95e6a4..f4c9ebad7 100644 --- a/xlators/protocol/server/src/server-resolve.c +++ b/xlators/protocol/server/src/server-resolve.c @@ -165,8 +165,8 @@ resolve_deep_continue (call_frame_t *frame) int resolve_deep_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr, struct stat *postparent) + int op_ret, int op_errno, inode_t *inode, struct iatt *buf, + dict_t *xattr, struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; |