diff options
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r-- | api/src/glfs-fops.c | 389 |
1 files changed, 290 insertions, 99 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 4bf33b859..37e8d22d8 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -146,7 +146,7 @@ out: int -glfs_close (struct glfs_fd *glfd) +glfs_close_with_xdata (struct glfs_fd *glfd, dict_t *dict) { xlator_t *subvol = NULL; int ret = -1; @@ -169,7 +169,7 @@ glfs_close (struct glfs_fd *glfd) goto out; } - ret = syncop_flush (subvol, fd); + ret = syncop_flush_with_xdata (subvol, fd, dict); DECODE_SYNCOP_ERR (ret); out: fs = glfd->fs; @@ -183,6 +183,11 @@ out: return ret; } +int +glfs_close (struct glfs_fd *glfd) +{ + return(glfs_close_with_xdata(glfd, NULL)); +} int glfs_lstat (struct glfs *fs, const char *path, struct stat *stat) @@ -251,7 +256,7 @@ out: int -glfs_fstat (struct glfs_fd *glfd, struct stat *stat) +glfs_fstat_with_xdata (struct glfs_fd *glfd, struct stat *stat, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -274,7 +279,7 @@ glfs_fstat (struct glfs_fd *glfd, struct stat *stat) goto out; } - ret = syncop_fstat (subvol, fd, &iatt); + ret = syncop_fstat_with_xdata (subvol, fd, &iatt, dict); DECODE_SYNCOP_ERR (ret); if (ret == 0 && stat) @@ -288,17 +293,21 @@ out: return ret; } +int +glfs_fstat (struct glfs_fd *glfd, struct stat *stat) +{ + return(glfs_fstat_with_xdata(glfd, stat, NULL)); +} + struct glfs_fd * -glfs_creat (struct glfs *fs, const char *path, int flags, mode_t mode) +glfs_creat_with_xdata (struct glfs *fs, const char *path, int flags, mode_t mode, uuid_t gfid, dict_t *xattr_req) { int ret = -1; struct glfs_fd *glfd = NULL; xlator_t *subvol = NULL; loc_t loc = {0, }; struct iatt iatt = {0, }; - uuid_t gfid; - dict_t *xattr_req = NULL; int reval = 0; __glfs_entry_fs (fs); @@ -310,14 +319,6 @@ glfs_creat (struct glfs *fs, const char *path, int flags, mode_t mode) goto out; } - xattr_req = dict_new (); - if (!xattr_req) { - ret = -1; - errno = ENOMEM; - goto out; - } - - uuid_generate (gfid); ret = dict_set_static_bin (xattr_req, "gfid-req", gfid, 16); if (ret) { ret = -1; @@ -409,8 +410,6 @@ retry: out: loc_wipe (&loc); - if (xattr_req) - dict_unref (xattr_req); if (ret && glfd) { glfs_fd_destroy (glfd); @@ -426,9 +425,28 @@ out: return glfd; } +struct glfs_fd * +glfs_creat (struct glfs *fs, const char *path, int flags, mode_t mode) +{ + dict_t *xattr_req = NULL; + uuid_t gfid; + struct glfs_fd *fd = NULL; + + + xattr_req = dict_new (); + if (!xattr_req) { + errno = ENOMEM; + return NULL; + } + uuid_generate (gfid); + fd = glfs_creat_with_xdata (fs, path, flags, mode, gfid, xattr_req); + if (xattr_req) + dict_unref (xattr_req); + return (fd); +} off_t -glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence) +glfs_lseek_with_xdata (struct glfs_fd *glfd, off_t offset, int whence, dict_t *dict) { struct stat sb = {0, }; int ret = -1; @@ -443,7 +461,7 @@ glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence) glfd->offset += offset; break; case SEEK_END: - ret = glfs_fstat (glfd, &sb); + ret = glfs_fstat_with_xdata (glfd, &sb, dict); if (ret) { /* seek cannot fail :O */ break; @@ -455,12 +473,17 @@ glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence) return glfd->offset; } +off_t +glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence) +{ + return(glfs_lseek_with_xdata(glfd, offset, whence, NULL)); +} ////////////// ssize_t -glfs_preadv (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, - off_t offset, int flags) +glfs_preadv_with_xdata (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, + off_t offset, int flags, dict_t *dict) { xlator_t *subvol = NULL; ssize_t ret = -1; @@ -488,7 +511,7 @@ glfs_preadv (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, size = iov_length (iovec, iovcnt); - ret = syncop_readv (subvol, fd, size, offset, 0, &iov, &cnt, &iobref); + ret = syncop_readv_with_xdata (subvol, fd, size, offset, 0, &iov, &cnt, &iobref, dict); DECODE_SYNCOP_ERR (ret); if (ret <= 0) goto out; @@ -512,6 +535,12 @@ out: return ret; } +ssize_t +glfs_preadv (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, + off_t offset, int flags) +{ + return(glfs_preadv_with_xdata(glfd, iovec, iovcnt, offset, flags, NULL)); +} ssize_t glfs_read (struct glfs_fd *glfd, void *buf, size_t count, int flags) @@ -527,6 +556,19 @@ glfs_read (struct glfs_fd *glfd, void *buf, size_t count, int flags) return ret; } +ssize_t +glfs_read_with_xdata (struct glfs_fd *glfd, void *buf, size_t count, int flags, dict_t *dict) +{ + struct iovec iov = {0, }; + ssize_t ret = 0; + + iov.iov_base = buf; + iov.iov_len = count; + + ret = glfs_preadv_with_xdata (glfd, &iov, 1, glfd->offset, flags, dict); + + return ret; +} ssize_t glfs_pread (struct glfs_fd *glfd, void *buf, size_t count, off_t offset, @@ -783,6 +825,12 @@ ssize_t glfs_pwritev (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, off_t offset, int flags) { + return(glfs_pwritev_with_xdata(glfd, iovec, iovcnt, offset, flags, NULL)); +} +ssize_t +glfs_pwritev_with_xdata (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, + off_t offset, int flags, dict_t *dict) +{ xlator_t *subvol = NULL; int ret = -1; size_t size = -1; @@ -838,7 +886,7 @@ glfs_pwritev (struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, iov.iov_base = iobuf_ptr (iobuf); iov.iov_len = size; - ret = syncop_writev (subvol, fd, &iov, 1, offset, iobref, flags); + ret = syncop_writev_with_xdata (subvol, fd, &iov, 1, offset, iobref, flags, dict); DECODE_SYNCOP_ERR (ret); iobuf_unref (iobuf); @@ -873,6 +921,20 @@ glfs_write (struct glfs_fd *glfd, const void *buf, size_t count, int flags) return ret; } +ssize_t +glfs_write_with_xdata (struct glfs_fd *glfd, const void *buf, size_t count, int flags, dict_t *dict) +{ + struct iovec iov = {0, }; + ssize_t ret = 0; + + iov.iov_base = (void *) buf; + iov.iov_len = count; + + ret = glfs_pwritev_with_xdata (glfd, &iov, 1, glfd->offset, flags, dict); + + return ret; +} + ssize_t @@ -886,6 +948,16 @@ glfs_writev (struct glfs_fd *glfd, const struct iovec *iov, int count, return ret; } +ssize_t +glfs_writev_with_xdata (struct glfs_fd *glfd, const struct iovec *iov, int count, + int flags, dict_t *dict) +{ + ssize_t ret = 0; + + ret = glfs_pwritev_with_xdata (glfd, iov, count, glfd->offset, flags, dict); + + return ret; +} ssize_t glfs_pwrite (struct glfs_fd *glfd, const void *buf, size_t count, off_t offset, @@ -989,7 +1061,7 @@ glfs_writev_async (struct glfs_fd *glfd, const struct iovec *iov, int count, int -glfs_fsync (struct glfs_fd *glfd) +glfs_fsync_with_xdata (struct glfs_fd *glfd, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1011,7 +1083,7 @@ glfs_fsync (struct glfs_fd *glfd) goto out; } - ret = syncop_fsync (subvol, fd, 0); + ret = syncop_fsync_with_xdata (subvol, fd, 0, dict); DECODE_SYNCOP_ERR (ret); out: if (fd) @@ -1022,6 +1094,11 @@ out: return ret; } +int +glfs_fsync (struct glfs_fd *glfd) +{ + return(glfs_fsync_with_xdata(glfd, NULL)); +} static int glfs_fsync_async_common (struct glfs_fd *glfd, glfs_io_cbk fn, void *data, @@ -1106,7 +1183,7 @@ glfs_fdatasync_async (struct glfs_fd *glfd, glfs_io_cbk fn, void *data) int -glfs_ftruncate (struct glfs_fd *glfd, off_t offset) +glfs_ftruncate_with_xdata (struct glfs_fd *glfd, off_t offset, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1128,7 +1205,7 @@ glfs_ftruncate (struct glfs_fd *glfd, off_t offset) goto out; } - ret = syncop_ftruncate (subvol, fd, offset); + ret = syncop_ftruncate_with_xdata (subvol, fd, offset, dict); DECODE_SYNCOP_ERR (ret); out: if (fd) @@ -1139,6 +1216,11 @@ out: return ret; } +int +glfs_ftruncate (struct glfs_fd *glfd, off_t offset) +{ + return(glfs_ftruncate_with_xdata(glfd, offset, NULL)); +} int glfs_ftruncate_async (struct glfs_fd *glfd, off_t offset, @@ -1211,14 +1293,12 @@ out: int -glfs_symlink (struct glfs *fs, const char *data, const char *path) +glfs_symlink_with_xdata (struct glfs *fs, const char *data, const char *path, uuid_t gfid, dict_t *xattr_req) { int ret = -1; xlator_t *subvol = NULL; loc_t loc = {0, }; struct iatt iatt = {0, }; - uuid_t gfid; - dict_t *xattr_req = NULL; int reval = 0; __glfs_entry_fs (fs); @@ -1230,14 +1310,6 @@ glfs_symlink (struct glfs *fs, const char *data, const char *path) goto out; } - xattr_req = dict_new (); - if (!xattr_req) { - ret = -1; - errno = ENOMEM; - goto out; - } - - uuid_generate (gfid); ret = dict_set_static_bin (xattr_req, "gfid-req", gfid, 16); if (ret) { ret = -1; @@ -1283,14 +1355,30 @@ retry: out: loc_wipe (&loc); - if (xattr_req) - dict_unref (xattr_req); - glfs_subvol_done (fs, subvol); return ret; } +int +glfs_symlink (struct glfs *fs, const char *data, const char *path) +{ + uuid_t gfid; + dict_t *xattr_req = NULL; + int ret = -1; + + xattr_req = dict_new (); + if (!xattr_req) { + errno = ENOMEM; + return -1 ; + } + + uuid_generate (gfid); + ret = glfs_symlink_with_xdata(fs, data, path, gfid, xattr_req); + + dict_unref (xattr_req); + return ret; +} int glfs_readlink (struct glfs *fs, const char *path, char *buf, size_t bufsiz) @@ -1342,14 +1430,12 @@ out: int -glfs_mknod (struct glfs *fs, const char *path, mode_t mode, dev_t dev) +glfs_mknod_with_xdata (struct glfs *fs, const char *path, mode_t mode, dev_t dev, uuid_t gfid, dict_t *xattr_req) { int ret = -1; xlator_t *subvol = NULL; loc_t loc = {0, }; struct iatt iatt = {0, }; - uuid_t gfid; - dict_t *xattr_req = NULL; int reval = 0; __glfs_entry_fs (fs); @@ -1361,14 +1447,7 @@ glfs_mknod (struct glfs *fs, const char *path, mode_t mode, dev_t dev) goto out; } - xattr_req = dict_new (); - if (!xattr_req) { - ret = -1; - errno = ENOMEM; - goto out; - } - uuid_generate (gfid); ret = dict_set_static_bin (xattr_req, "gfid-req", gfid, 16); if (ret) { ret = -1; @@ -1414,24 +1493,38 @@ retry: out: loc_wipe (&loc); - if (xattr_req) - dict_unref (xattr_req); - glfs_subvol_done (fs, subvol); return ret; } +int +glfs_mknod (struct glfs *fs, const char *path, mode_t mode, dev_t dev) +{ + dict_t *xattr_req = NULL; + uuid_t gfid; + int ret; + + xattr_req = dict_new (); + if (!xattr_req) { + errno = ENOMEM; + return -1; + } + + uuid_generate (gfid); + ret = glfs_mknod_with_xdata(fs, path, mode, dev, gfid, xattr_req); + + dict_unref (xattr_req); + return (ret); +} int -glfs_mkdir (struct glfs *fs, const char *path, mode_t mode) +glfs_mkdir_with_xdata (struct glfs *fs, const char *path, mode_t mode, uuid_t gfid, dict_t *xattr_req) { int ret = -1; xlator_t *subvol = NULL; loc_t loc = {0, }; struct iatt iatt = {0, }; - uuid_t gfid; - dict_t *xattr_req = NULL; int reval = 0; __glfs_entry_fs (fs); @@ -1443,14 +1536,6 @@ glfs_mkdir (struct glfs *fs, const char *path, mode_t mode) goto out; } - xattr_req = dict_new (); - if (!xattr_req) { - ret = -1; - errno = ENOMEM; - goto out; - } - - uuid_generate (gfid); ret = dict_set_static_bin (xattr_req, "gfid-req", gfid, 16); if (ret) { ret = -1; @@ -1496,17 +1581,33 @@ retry: out: loc_wipe (&loc); - if (xattr_req) - dict_unref (xattr_req); glfs_subvol_done (fs, subvol); return ret; } +int +glfs_mkdir (struct glfs *fs, const char *path, mode_t mode) +{ + uuid_t gfid; + dict_t *xattr_req = NULL; + int ret; + + xattr_req = dict_new (); + if (!xattr_req) { + errno = ENOMEM; + return -1; + } + + uuid_generate (gfid); + ret = glfs_mkdir_with_xdata(fs, path, mode, gfid, xattr_req); + dict_unref (xattr_req); + return ret; +} int -glfs_unlink (struct glfs *fs, const char *path) +glfs_unlink_with_xdata (struct glfs *fs, const char *path, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1536,7 +1637,7 @@ retry: goto out; } - ret = syncop_unlink (subvol, &loc); + ret = syncop_unlink_with_xdata (subvol, &loc, dict); DECODE_SYNCOP_ERR (ret); ESTALE_RETRY (ret, errno, reval, &loc, retry); @@ -1551,9 +1652,14 @@ out: return ret; } +int +glfs_unlink (struct glfs *fs, const char *path) +{ + return(glfs_unlink_with_xdata(fs, path, NULL)); +} int -glfs_rmdir (struct glfs *fs, const char *path) +glfs_rmdir_with_xdata (struct glfs *fs, const char *path, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1583,7 +1689,7 @@ retry: goto out; } - ret = syncop_rmdir (subvol, &loc, 0); + ret = syncop_rmdir_with_xdata (subvol, &loc, 0, dict); DECODE_SYNCOP_ERR (ret); ESTALE_RETRY (ret, errno, reval, &loc, retry); @@ -1598,9 +1704,14 @@ out: return ret; } +int +glfs_rmdir (struct glfs *fs, const char *path) +{ + return (glfs_rmdir_with_xdata(fs, path, NULL)); +} int -glfs_rename (struct glfs *fs, const char *oldpath, const char *newpath) +glfs_rename_with_xdata (struct glfs *fs, const char *oldpath, const char *newpath, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1647,7 +1758,7 @@ retrynew: /* TODO: check if new or old is a prefix of the other, and fail EINVAL */ - ret = syncop_rename (subvol, &oldloc, &newloc); + ret = syncop_rename_with_xdata (subvol, &oldloc, &newloc, dict); DECODE_SYNCOP_ERR (ret); if (ret == -1 && errno == ESTALE) { @@ -1674,7 +1785,13 @@ out: int -glfs_link (struct glfs *fs, const char *oldpath, const char *newpath) +glfs_rename (struct glfs *fs, const char *oldpath, const char *newpath) +{ + return(glfs_rename_with_xdata(fs, oldpath, newpath, NULL)); +} + +int +glfs_link_with_xdata (struct glfs *fs, const char *oldpath, const char *newpath, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -1725,7 +1842,7 @@ retrynew: } newloc.inode = inode_ref (oldloc.inode); - ret = syncop_link (subvol, &oldloc, &newloc); + ret = syncop_link_with_xdata (subvol, &oldloc, &newloc, dict); DECODE_SYNCOP_ERR (ret); if (ret == -1 && errno == ESTALE) { @@ -1746,6 +1863,11 @@ out: return ret; } +int +glfs_link (struct glfs *fs, const char *oldpath, const char *newpath) +{ + return(glfs_link_with_xdata(fs, oldpath, newpath, NULL)); +} struct glfs_fd * glfs_opendir (struct glfs *fs, const char *path) @@ -2184,8 +2306,8 @@ out: int -glfs_setattr (struct glfs *fs, const char *path, struct iatt *iatt, - int valid, int follow) +glfs_setattr_with_xdata (struct glfs *fs, const char *path, struct iatt *iatt, + int valid, int follow, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2212,7 +2334,7 @@ retry: if (ret) goto out; - ret = syncop_setattr (subvol, &loc, iatt, valid, 0, 0); + ret = syncop_setattr_with_xdata (subvol, &loc, iatt, valid, 0, 0, dict); DECODE_SYNCOP_ERR (ret); ESTALE_RETRY (ret, errno, reval, &loc, retry); @@ -2224,9 +2346,15 @@ out: return ret; } +int +glfs_setattr (struct glfs *fs, const char *path, struct iatt *iatt, + int valid, int follow) +{ + return(glfs_setattr_with_xdata(fs, path, iatt, valid, follow, NULL)); +} int -glfs_fsetattr (struct glfs_fd *glfd, struct iatt *iatt, int valid) +glfs_fsetattr_with_xdata (struct glfs_fd *glfd, struct iatt *iatt, int valid, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2248,7 +2376,7 @@ glfs_fsetattr (struct glfs_fd *glfd, struct iatt *iatt, int valid) goto out; } - ret = syncop_fsetattr (subvol, fd, iatt, valid, 0, 0); + ret = syncop_fsetattr_with_xdata (subvol, fd, iatt, valid, 0, 0, dict); DECODE_SYNCOP_ERR (ret); out: if (fd) @@ -2259,6 +2387,11 @@ out: return ret; } +int +glfs_fsetattr (struct glfs_fd *glfd, struct iatt *iatt, int valid) +{ + return(glfs_fsetattr_with_xdata(glfd, iatt, valid, NULL)); +} int glfs_chmod (struct glfs *fs, const char *path, mode_t mode) @@ -2500,8 +2633,8 @@ glfs_lgetxattr (struct glfs *fs, const char *path, const char *name, ssize_t -glfs_fgetxattr (struct glfs_fd *glfd, const char *name, void *value, - size_t size) +glfs_fgetxattr_with_xdata (struct glfs_fd *glfd, const char *name, void *value, + size_t size, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2524,7 +2657,7 @@ glfs_fgetxattr (struct glfs_fd *glfd, const char *name, void *value, goto out; } - ret = syncop_fgetxattr (subvol, fd, &xattr, name); + ret = syncop_fgetxattr_with_xdata (subvol, fd, &xattr, name, dict); DECODE_SYNCOP_ERR (ret); if (ret) goto out; @@ -2539,6 +2672,12 @@ out: return ret; } +ssize_t +glfs_fgetxattr (struct glfs_fd *glfd, const char *name, void *value, + size_t size) +{ + return(glfs_fgetxattr_with_xdata(glfd, name, value, size, NULL)); +} int glfs_listxattr_process (void *value, size_t size, dict_t *xattr) @@ -2628,7 +2767,8 @@ glfs_llistxattr (struct glfs *fs, const char *path, void *value, size_t size) ssize_t -glfs_flistxattr (struct glfs_fd *glfd, void *value, size_t size) +glfs_flistxattr_with_xdata (struct glfs_fd *glfd, void *value, size_t size, + dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2651,7 +2791,7 @@ glfs_flistxattr (struct glfs_fd *glfd, void *value, size_t size) goto out; } - ret = syncop_fgetxattr (subvol, fd, &xattr, NULL); + ret = syncop_fgetxattr_with_xdata (subvol, fd, &xattr, NULL, dict); DECODE_SYNCOP_ERR (ret); if (ret) goto out; @@ -2667,6 +2807,12 @@ out: } +ssize_t +glfs_flistxattr (struct glfs_fd *glfd, void *value, size_t size) +{ + return(glfs_flistxattr_with_xdata(glfd, value, size, NULL)); +} + dict_t * dict_for_key_value (const char *name, const char *value, size_t size) { @@ -2689,7 +2835,7 @@ dict_for_key_value (const char *name, const char *value, size_t size) int glfs_setxattr_common (struct glfs *fs, const char *path, const char *name, - const void *value, size_t size, int flags, int follow) + const void *value, size_t size, int flags, int follow, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2724,7 +2870,7 @@ retry: goto out; } - ret = syncop_setxattr (subvol, &loc, xattr, flags); + ret = syncop_setxattr_with_xdata (subvol, &loc, xattr, flags, dict); DECODE_SYNCOP_ERR (ret); ESTALE_RETRY (ret, errno, reval, &loc, retry); @@ -2744,21 +2890,27 @@ int glfs_setxattr (struct glfs *fs, const char *path, const char *name, const void *value, size_t size, int flags) { - return glfs_setxattr_common (fs, path, name, value, size, flags, 1); + return glfs_setxattr_common (fs, path, name, value, size, flags, 1, NULL); } +int +glfs_setxattr_with_xdata (struct glfs *fs, const char *path, const char *name, + const void *value, size_t size, int flags, dict_t * dict) +{ + return glfs_setxattr_common (fs, path, name, value, size, flags, 1, dict); +} int glfs_lsetxattr (struct glfs *fs, const char *path, const char *name, const void *value, size_t size, int flags) { - return glfs_setxattr_common (fs, path, name, value, size, flags, 0); + return glfs_setxattr_common (fs, path, name, value, size, flags, 0, NULL); } int -glfs_fsetxattr (struct glfs_fd *glfd, const char *name, const void *value, - size_t size, int flags) +glfs_fsetxattr_with_xdata (struct glfs_fd *glfd, const char *name, const void *value, + size_t size, int flags, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2788,7 +2940,7 @@ glfs_fsetxattr (struct glfs_fd *glfd, const char *name, const void *value, goto out; } - ret = syncop_fsetxattr (subvol, fd, xattr, flags); + ret = syncop_fsetxattr_with_xdata (subvol, fd, xattr, flags, dict); DECODE_SYNCOP_ERR (ret); out: if (xattr) @@ -2802,10 +2954,16 @@ out: return ret; } +int +glfs_fsetxattr (struct glfs_fd *glfd, const char *name, const void *value, + size_t size, int flags) +{ + return(glfs_fsetxattr_with_xdata(glfd, name, value, size, flags, NULL)); +} int glfs_removexattr_common (struct glfs *fs, const char *path, const char *name, - int follow) + int follow, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2832,7 +2990,7 @@ retry: if (ret) goto out; - ret = syncop_removexattr (subvol, &loc, name, 0); + ret = syncop_removexattr_with_xdata (subvol, &loc, name, dict); DECODE_SYNCOP_ERR (ret); ESTALE_RETRY (ret, errno, reval, &loc, retry); @@ -2849,19 +3007,25 @@ out: int glfs_removexattr (struct glfs *fs, const char *path, const char *name) { - return glfs_removexattr_common (fs, path, name, 1); + return glfs_removexattr_common (fs, path, name, 1, NULL); } int glfs_lremovexattr (struct glfs *fs, const char *path, const char *name) { - return glfs_removexattr_common (fs, path, name, 0); + return glfs_removexattr_common (fs, path, name, 0, NULL); +} + +int +glfs_removexattr_with_xdata (struct glfs *fs, const char *path, const char *name, dict_t *dict) +{ + return glfs_removexattr_common (fs, path, name, 1, dict); } int -glfs_fremovexattr (struct glfs_fd *glfd, const char *name) +glfs_fremovexattr_with_xdata (struct glfs_fd *glfd, const char *name, dict_t *dict) { int ret = -1; xlator_t *subvol = NULL; @@ -2883,7 +3047,7 @@ glfs_fremovexattr (struct glfs_fd *glfd, const char *name) goto out; } - ret = syncop_fremovexattr (subvol, fd, name, 0); + ret = syncop_fremovexattr_with_xdata (subvol, fd, name, dict); DECODE_SYNCOP_ERR (ret); out: if (fd) @@ -2894,6 +3058,11 @@ out: return ret; } +int +glfs_fremovexattr (struct glfs_fd *glfd, const char *name) +{ + return(glfs_fremovexattr_with_xdata(glfd, name, NULL)); +} int glfs_fallocate (struct glfs_fd *glfd, int keep_size, off_t offset, size_t len) @@ -2997,6 +3166,29 @@ out: } int +glfs_ipc (struct glfs *fs, int32_t op) +{ + int ret = -1; + xlator_t *subvol = NULL; + + __glfs_entry_fs (fs); + + subvol = glfs_active_subvol (fs); + if (!subvol) { + ret = -1; + errno = EIO; + goto out; + } + + ret = syncop_ipc (subvol, op); + DECODE_SYNCOP_ERR (ret); + +out: + glfs_subvol_done (fs, subvol); + return ret; +} + +int glfs_chdir (struct glfs *fs, const char *path) { int ret = -1; @@ -3139,7 +3331,6 @@ out: return retpath; } - char * glfs_getcwd (struct glfs *fs, char *buf, size_t n) { |