diff options
Diffstat (limited to 'api/src/glfs-handleops.c')
| -rw-r--r-- | api/src/glfs-handleops.c | 199 | 
1 files changed, 131 insertions, 68 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 0538ac6f349..35cb0c807b4 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -58,7 +58,7 @@ 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, +pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,  		 const char *path, struct stat *stat)  {  	int                      ret = 0; @@ -77,7 +77,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; @@ -93,7 +93,7 @@ glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,  	}  	/* fop/op */ -	ret = glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt, +	ret = priv_glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt,  			       0 /*TODO: links? */, 0);  	/* populate out args */ @@ -110,13 +110,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; @@ -133,7 +136,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; @@ -163,13 +166,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_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; @@ -185,7 +191,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; @@ -211,14 +217,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; @@ -235,7 +244,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; @@ -265,14 +274,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_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; @@ -290,7 +302,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; @@ -318,14 +330,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_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; @@ -343,7 +358,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; @@ -379,13 +394,16 @@ 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; @@ -401,7 +419,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; @@ -427,13 +445,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; @@ -450,7 +471,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; @@ -510,14 +531,17 @@ out:  		glfs_fd_bind (glfd);  	} -	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; @@ -538,7 +562,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; @@ -621,13 +645,16 @@ 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, +pub_glfs_h_mkdir (struct glfs *fs, struct glfs_object *parent, const char *path,  	      mode_t mode, struct stat *stat)  {  	int                 ret = -1; @@ -648,7 +675,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; @@ -709,13 +736,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_mkdir, 3.4.2); + +  struct glfs_object * -glfs_h_mknod (struct glfs *fs, struct glfs_object *parent, const char *path, +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; @@ -736,7 +766,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; @@ -796,13 +826,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; @@ -818,7 +851,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; @@ -832,7 +865,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;  	} @@ -858,13 +891,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; @@ -881,7 +917,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; @@ -933,13 +969,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); + +  ssize_t -glfs_h_extract_handle (struct glfs_object *object, unsigned char *handle, +pub_glfs_h_extract_handle (struct glfs_object *object, unsigned char *handle,  		       int len)  {  	ssize_t ret = -1; @@ -969,8 +1008,11 @@ 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, +pub_glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len,  			   struct stat *stat)  {  	loc_t               loc = {0, }; @@ -989,7 +1031,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; @@ -1047,13 +1089,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); @@ -1062,8 +1107,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; @@ -1079,7 +1127,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; @@ -1108,13 +1156,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_truncate, 3.4.2); + +  struct glfs_object * -glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, const char *name, +pub_glfs_h_symlink (struct glfs *fs, struct glfs_object *parent, const char *name,  		const char *data, struct stat *stat)  {  	int                 ret = -1; @@ -1136,7 +1187,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; @@ -1202,13 +1253,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_symlink, 3.4.2); + +  int -glfs_h_readlink (struct glfs *fs, struct glfs_object *object, char *buf, +pub_glfs_h_readlink (struct glfs *fs, struct glfs_object *object, char *buf,  		 size_t bufsiz)  {  	loc_t               loc = {0, }; @@ -1226,7 +1280,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; @@ -1258,13 +1312,16 @@ 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); + +  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; @@ -1284,7 +1341,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; @@ -1316,7 +1373,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; @@ -1343,13 +1400,16 @@ 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, +pub_glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,  	       struct glfs_object *newdir, const char *newname)  {  	int                 ret = -1; @@ -1371,7 +1431,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; @@ -1385,7 +1445,7 @@ glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,  		goto out;  	} -	ret = glfs_resolve_at (fs, subvol, oldpinode, oldname, &oldloc, +	ret = priv_glfs_resolve_at (fs, subvol, oldpinode, oldname, &oldloc,  			       &oldiatt, 0 , 0);  	if (ret != 0) {  		goto out; @@ -1398,7 +1458,7 @@ glfs_h_rename (struct glfs *fs, struct glfs_object *olddir, const char *oldname,  		goto out;  	} -	ret = glfs_resolve_at (fs, subvol, newpinode, newname, &newloc, +	ret = priv_glfs_resolve_at (fs, subvol, newpinode, newname, &newloc,  			       &newiatt, 0, 0);  	if (ret && errno != ENOENT && newloc.parent) @@ -1435,7 +1495,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); +  | 
