diff options
Diffstat (limited to 'api/src/glfs-handleops.c')
| -rw-r--r-- | api/src/glfs-handleops.c | 238 | 
1 files changed, 155 insertions, 83 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index cefe6e3157b..dadbda3675f 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -61,8 +61,8 @@ glfs_iatt_from_stat (struct stat *stat, int valid, struct iatt *iatt,  }  struct glfs_object * -glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent, -                 const char *path, struct stat *stat) +pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent, +                     const char *path, struct stat *stat)  {          int                      ret = 0;          xlator_t                *subvol = NULL; @@ -80,7 +80,7 @@ glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  errno = EIO;                  goto out; @@ -96,8 +96,8 @@ glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,          }          /* fop/op */ -        ret = glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt, -                               0 /*TODO: links? */, 0); +        ret = priv_glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt, +                                    0 /*TODO: links? */, 0);          /* populate out args */          if (!ret) { @@ -113,13 +113,16 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_lookupat, 3.4.2); + +  int -glfs_h_stat (struct glfs *fs, struct glfs_object *object, struct stat *stat) +pub_glfs_h_stat (struct glfs *fs, struct glfs_object *object, struct stat *stat)  {          int              ret = -1;          xlator_t        *subvol = NULL; @@ -136,7 +139,7 @@ glfs_h_stat (struct glfs *fs, struct glfs_object *object, struct stat *stat)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -167,13 +170,17 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_stat, 3.4.2); + +  int -glfs_h_getattrs (struct glfs *fs, struct glfs_object *object, struct stat *stat) +pub_glfs_h_getattrs (struct glfs *fs, struct glfs_object *object, +                     struct stat *stat)  {          int                      ret = 0;          xlator_t                *subvol = NULL; @@ -189,7 +196,7 @@ glfs_h_getattrs (struct glfs *fs, struct glfs_object *object, struct stat *stat)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -215,14 +222,17 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_getattrs, 3.4.2); + +  int -glfs_h_getxattrs (struct glfs *fs, struct glfs_object *object, const char *name, -                  void *value, size_t size) +pub_glfs_h_getxattrs (struct glfs *fs, struct glfs_object *object, +                      const char *name, void *value, size_t size)  {          int                 ret = 0;          xlator_t        *subvol = NULL; @@ -239,7 +249,7 @@ glfs_h_getxattrs (struct glfs *fs, struct glfs_object *object, const char *name,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -274,14 +284,16 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_getxattrs, 3.5.1); +  int -glfs_h_setattrs (struct glfs *fs, struct glfs_object *object, struct stat *stat, -                 int valid) +pub_glfs_h_setattrs (struct glfs *fs, struct glfs_object *object, +                     struct stat *stat, int valid)  {          int              ret = -1;          xlator_t        *subvol = NULL; @@ -299,7 +311,7 @@ glfs_h_setattrs (struct glfs *fs, struct glfs_object *object, struct stat *stat,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -328,14 +340,18 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_setattrs, 3.4.2); + +  int -glfs_h_setxattrs (struct glfs *fs, struct glfs_object *object, const char *name, -                 const void *value, size_t size, int flags) +pub_glfs_h_setxattrs (struct glfs *fs, struct glfs_object *object, +                      const char *name, const void *value, size_t size, +                      int flags)  {          int              ret = -1;          xlator_t        *subvol = NULL; @@ -353,7 +369,7 @@ glfs_h_setxattrs (struct glfs *fs, struct glfs_object *object, const char *name,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -390,13 +406,17 @@ out:          if (xattr)                  dict_unref (xattr); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_setxattrs, 3.5.0); + +  int -glfs_h_removexattrs (struct glfs *fs, struct glfs_object *object, const char *name) +pub_glfs_h_removexattrs (struct glfs *fs, struct glfs_object *object, +                         const char *name)  {          int              ret = -1;          xlator_t        *subvol = NULL; @@ -412,7 +432,7 @@ glfs_h_removexattrs (struct glfs *fs, struct glfs_object *object, const char *na          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -439,13 +459,16 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_removexattrs, 3.5.1); + +  struct glfs_fd * -glfs_h_open (struct glfs *fs, struct glfs_object *object, int flags) +pub_glfs_h_open (struct glfs *fs, struct glfs_object *object, int flags)  {          int              ret = -1;          struct glfs_fd  *glfd = NULL; @@ -462,7 +485,7 @@ glfs_h_open (struct glfs *fs, struct glfs_object *object, int flags)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  errno = EIO;                  goto out; @@ -525,14 +548,17 @@ out:                  glfd = NULL;          } -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return glfd;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_open, 3.4.2); + +  struct glfs_object * -glfs_h_creat (struct glfs *fs, struct glfs_object *parent, const char *path, -              int flags, mode_t mode, struct stat *stat) +pub_glfs_h_creat (struct glfs *fs, struct glfs_object *parent, const char *path, +                  int flags, mode_t mode, struct stat *stat)  {          int                 ret = -1;          struct glfs_fd     *glfd = NULL; @@ -553,7 +579,7 @@ glfs_h_creat (struct glfs *fs, struct glfs_object *parent, const char *path,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -645,14 +671,17 @@ out:                  glfd = NULL;          } -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_creat, 3.4.2); + +  struct glfs_object * -glfs_h_mkdir (struct glfs *fs, struct glfs_object *parent, const char *path, -              mode_t mode, struct stat *stat) +pub_glfs_h_mkdir (struct glfs *fs, struct glfs_object *parent, const char *path, +                  mode_t mode, struct stat *stat)  {          int                 ret = -1;          xlator_t           *subvol = NULL; @@ -672,7 +701,7 @@ glfs_h_mkdir (struct glfs *fs, struct glfs_object *parent, const char *path,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -734,14 +763,17 @@ out:          if (xattr_req)                  dict_unref (xattr_req); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_mkdir, 3.4.2); + +  struct glfs_object * -glfs_h_mknod (struct glfs *fs, struct glfs_object *parent, const char *path, -              mode_t mode, dev_t dev, struct stat *stat) +pub_glfs_h_mknod (struct glfs *fs, struct glfs_object *parent, const char *path, +                  mode_t mode, dev_t dev, struct stat *stat)  {          int                 ret = -1;          xlator_t           *subvol = NULL; @@ -761,7 +793,7 @@ glfs_h_mknod (struct glfs *fs, struct glfs_object *parent, const char *path,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -822,13 +854,16 @@ out:          if (xattr_req)                  dict_unref (xattr_req); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_mknod, 3.4.2); + +  int -glfs_h_unlink (struct glfs *fs, struct glfs_object *parent, const char *path) +pub_glfs_h_unlink (struct glfs *fs, struct glfs_object *parent, const char *path)  {          int                 ret = -1;          xlator_t           *subvol = NULL; @@ -844,7 +879,7 @@ glfs_h_unlink (struct glfs *fs, struct glfs_object *parent, const char *path)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if ( !subvol ) {                  ret = -1;                  errno = EIO; @@ -858,7 +893,7 @@ glfs_h_unlink (struct glfs *fs, struct glfs_object *parent, const char *path)                  goto out;          } -        ret = glfs_resolve_at (fs, subvol, inode, path, &loc, NULL, 0 , 0); +        ret = priv_glfs_resolve_at (fs, subvol, inode, path, &loc, NULL, 0 , 0);          if (ret != 0) {                  goto out;          } @@ -886,13 +921,16 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_unlink, 3.4.2); + +  struct glfs_fd * -glfs_h_opendir (struct glfs *fs, struct glfs_object *object) +pub_glfs_h_opendir (struct glfs *fs, struct glfs_object *object)  {          int              ret = -1;          struct glfs_fd  *glfd = NULL; @@ -909,7 +947,7 @@ glfs_h_opendir (struct glfs *fs, struct glfs_object *object)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -962,13 +1000,16 @@ out:                  glfs_fd_bind (glfd);          } -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return glfd;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_opendir, 3.4.2); + +  int -glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask) +pub_glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask)  {  	int              ret = -1;  	xlator_t        *subvol = NULL; @@ -984,7 +1025,7 @@ glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask)  	__glfs_entry_fs (fs);  	/* get the active volume */ -	subvol = glfs_active_subvol (fs); +	subvol = priv_glfs_active_subvol (fs);  	if (!subvol) {  		ret = -1;  		errno = EIO; @@ -1013,14 +1054,17 @@ out:  		inode_unref (inode); -	glfs_subvol_done (fs, subvol); +	priv_glfs_subvol_done (fs, subvol);  	return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_access, 3.6.0); + +  ssize_t -glfs_h_extract_handle (struct glfs_object *object, unsigned char *handle, -                       int len) +pub_glfs_h_extract_handle (struct glfs_object *object, unsigned char *handle, +                           int len)  {          ssize_t ret = -1; @@ -1049,9 +1093,12 @@ out:          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_extract_handle, 3.4.2); + +  struct glfs_object * -glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len, -                           struct stat *stat) +pub_glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len, +                               struct stat *stat)  {          loc_t               loc = {0, };          int                 ret = -1; @@ -1069,7 +1116,7 @@ glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  errno = EIO;                  goto out; @@ -1128,13 +1175,16 @@ out:          /* TODO: Check where the inode ref is being held? */          loc_wipe (&loc); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_create_from_handle, 3.4.2); + +  int -glfs_h_close (struct glfs_object *object) +pub_glfs_h_close (struct glfs_object *object)  {          /* Release the held reference */          inode_unref (object->inode); @@ -1143,8 +1193,11 @@ glfs_h_close (struct glfs_object *object)          return 0;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_close, 3.4.2); + +  int -glfs_h_truncate (struct glfs *fs, struct glfs_object *object, off_t offset) +pub_glfs_h_truncate (struct glfs *fs, struct glfs_object *object, off_t offset)  {          loc_t               loc = {0, };          int                 ret = -1; @@ -1160,7 +1213,7 @@ glfs_h_truncate (struct glfs *fs, struct glfs_object *object, off_t offset)          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -1190,14 +1243,17 @@ out:          if (inode)                  inode_unref (inode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_truncate, 3.4.2); + +  struct glfs_object * -glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, const char *name, -                const char *data, struct stat *stat) +pub_glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, +                    const char *name, const char *data, struct stat *stat)  {          int                 ret = -1;          xlator_t           *subvol = NULL; @@ -1218,7 +1274,7 @@ glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, const char *name,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -1273,7 +1329,7 @@ glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, const char *name,  out:          if (ret && object != NULL) { -                glfs_h_close (object); +                pub_glfs_h_close (object);                  object = NULL;          } @@ -1285,14 +1341,17 @@ out:          if (xattr_req)                  dict_unref (xattr_req); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return object;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_symlink, 3.4.2); + +  int -glfs_h_readlink (struct glfs *fs, struct glfs_object *object, char *buf, -                 size_t bufsiz) +pub_glfs_h_readlink (struct glfs *fs, struct glfs_object *object, char *buf, +                     size_t bufsiz)  {          loc_t               loc = {0, };          int                 ret = -1; @@ -1309,7 +1368,7 @@ glfs_h_readlink (struct glfs *fs, struct glfs_object *object, char *buf,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -1342,13 +1401,19 @@ out:          if (linkval)                  GF_FREE (linkval); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_readlink, 3.4.2); + + +extern int +priv_glfs_loc_touchup (loc_t *); +  int -glfs_h_link (struct glfs *fs, struct glfs_object *linksrc, +pub_glfs_h_link (struct glfs *fs, struct glfs_object *linksrc,               struct glfs_object *parent, const char *name)  {          int                 ret = -1; @@ -1368,7 +1433,7 @@ glfs_h_link (struct glfs *fs, struct glfs_object *linksrc,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if (!subvol) {                  ret = -1;                  errno = EIO; @@ -1400,7 +1465,7 @@ glfs_h_link (struct glfs *fs, struct glfs_object *linksrc,          /* setup newloc based on parent */          newloc.parent = inode_ref (pinode);          newloc.name = name; -        ret = glfs_loc_touchup (&newloc); +        ret = priv_glfs_loc_touchup (&newloc);          if (ret != 0) {                  errno = EINVAL;                  goto out; @@ -1428,14 +1493,18 @@ out:          if (pinode)                  inode_unref (pinode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_link, 3.4.2); + +  int -glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname, -               struct glfs_object *newdir, const char *newname) +pub_glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, +                   const char *oldname, struct glfs_object *newdir, +                   const char *newname)  {          int                 ret = -1;          xlator_t           *subvol = NULL; @@ -1456,7 +1525,7 @@ glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,          __glfs_entry_fs (fs);          /* get the active volume */ -        subvol = glfs_active_subvol (fs); +        subvol = priv_glfs_active_subvol (fs);          if ( !subvol ) {                  ret = -1;                  errno = EIO; @@ -1470,8 +1539,8 @@ glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,                  goto out;          } -        ret = glfs_resolve_at (fs, subvol, oldpinode, oldname, &oldloc, -                               &oldiatt, 0 , 0); +        ret = priv_glfs_resolve_at (fs, subvol, oldpinode, oldname, &oldloc, +                                    &oldiatt, 0 , 0);          if (ret != 0) {                  goto out;          } @@ -1483,8 +1552,8 @@ glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,                  goto out;          } -        ret = glfs_resolve_at (fs, subvol, newpinode, newname, &newloc, -                               &newiatt, 0, 0); +        ret = priv_glfs_resolve_at (fs, subvol, newpinode, newname, &newloc, +                                    &newiatt, 0, 0);          if (ret && errno != ENOENT && newloc.parent)                  goto out; @@ -1521,7 +1590,10 @@ out:          if (newpinode)                  inode_unref (newpinode); -        glfs_subvol_done (fs, subvol); +        priv_glfs_subvol_done (fs, subvol);          return ret;  } + +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_rename, 3.4.2); +  | 
