diff mbox series

[2/4] fsstress: stop using attr_set

Message ID 160505548994.1389938.10129281247073522665.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series xfstests: fix compiler warnings with fsx/fsstress | expand

Commit Message

Darrick J. Wong Nov. 11, 2020, 12:44 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

attr_set is deprecated, so replace it with lsetxattr.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 ltp/fsstress.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig Nov. 14, 2020, 10:45 a.m. UTC | #1
On Tue, Nov 10, 2020 at 04:44:49PM -0800, Darrick J. Wong wrote:
>  	aval = malloc(len);
>  	memset(aval, nameseq & 0xff, len);
> -	e = attr_set_path(&f, aname, aval, len, ATTR_DONTFOLLOW) < 0 ?
> +	e = attr_set_path(&f, aname, aval, len) < 0 ?
>  		errno : 0;

Nipick, but I'd spell this out in a normal if while you touch it:

	if (attr_set_path(&f, aname, aval, len) < 0)
		e = errno;
	else	
		e = 0;

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 1238fcf5..41b31060 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -395,7 +395,7 @@  void	add_to_flist(int, int, int, int);
 void	append_pathname(pathname_t *, char *);
 int	attr_list_path(pathname_t *, char *, const int, int, attrlist_cursor_t *);
 int	attr_remove_path(pathname_t *, const char *, int);
-int	attr_set_path(pathname_t *, const char *, const char *, const int, int);
+int	attr_set_path(pathname_t *, const char *, const char *, const int);
 void	check_cwd(void);
 void	cleanup_flist(void);
 int	creat_path(pathname_t *, mode_t);
@@ -909,19 +909,19 @@  attr_remove_path(pathname_t *name, const char *attrname, int flags)
 
 int
 attr_set_path(pathname_t *name, const char *attrname, const char *attrvalue,
-	      const int valuelength, int flags)
+	      const int valuelength)
 {
 	char		buf[NAME_MAX + 1];
 	pathname_t	newname;
 	int		rval;
 
-	rval = attr_set(name->path, attrname, attrvalue, valuelength, flags);
+	rval = lsetxattr(name->path, attrname, attrvalue, valuelength, 0);
 	if (rval >= 0 || errno != ENAMETOOLONG)
 		return rval;
 	separate_pathname(name, buf, &newname);
 	if (chdir(buf) == 0) {
-		rval = attr_set_path(&newname, attrname, attrvalue, valuelength,
-			flags);
+		rval = attr_set_path(&newname, attrname, attrvalue,
+				     valuelength);
 		assert(chdir("..") == 0);
 	}
 	free_pathname(&newname);
@@ -2392,7 +2392,7 @@  attr_set_f(int opno, long r)
 		len = 1;
 	aval = malloc(len);
 	memset(aval, nameseq & 0xff, len);
-	e = attr_set_path(&f, aname, aval, len, ATTR_DONTFOLLOW) < 0 ?
+	e = attr_set_path(&f, aname, aval, len) < 0 ?
 		errno : 0;
 	check_cwd();
 	free(aval);