All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] src/multi_open_unlink: Stop using attr_set
@ 2020-12-08  6:40 Xiao Yang
  2020-12-08  6:40 ` [PATCH 2/2] src/dmiperf: Stop using attr_setf Xiao Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-12-08  6:40 UTC (permalink / raw)
  To: darrick.wong, guaneryu; +Cc: fstests, Xiao Yang

Avoid the following warning by replacing deprecated
attr_set with setxattr:
---------------------------------------------------
warning: 'attr_set' is deprecated: Use setxattr or lsetxattr instead [-Wdeprecated-declarations]
---------------------------------------------------

Also remove unneeded flags and <attr/attributes.h>.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 src/multi_open_unlink.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/multi_open_unlink.c b/src/multi_open_unlink.c
index d697e5f1..c221d39e 100644
--- a/src/multi_open_unlink.c
+++ b/src/multi_open_unlink.c
@@ -12,9 +12,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <attr/attributes.h>
+#include <sys/xattr.h>
 
 #define MAX_EA_NAME 30
+#define MAX_VALUELEN	(64*1024)
 
 /*
  * multi_open_unlink path_prefix num_files sleep_time
@@ -40,7 +41,7 @@ main(int argc, char *argv[])
 	int sleep_time = 60;
 	int num_files = 100;
 	int num_eas = 0;
-	int value_size = ATTR_MAX_VALUELEN;
+	int value_size = MAX_VALUELEN;
 	int fd = -1;
 	int i,j,c;
 
@@ -87,7 +88,6 @@ main(int argc, char *argv[])
 			int sts;
 			char *attrvalue;
 			char attrname[MAX_EA_NAME];
-			int flags = 0;
 
 			snprintf(attrname, MAX_EA_NAME, "user.name.%d", j);
 
@@ -98,7 +98,7 @@ main(int argc, char *argv[])
 				return 1;
 			}
 
-			sts = attr_set(path, attrname, attrvalue, value_size, flags);
+			sts = setxattr(path, attrname, attrvalue, value_size, 0);
 			if (sts == -1) {
 				fprintf(stderr, "%s: failed to create EA \"%s\" of size %d on path \"%s\": %s\n",
 					prog, attrname, value_size, path, strerror(errno));
-- 
2.23.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] src/dmiperf: Stop using attr_setf
  2020-12-08  6:40 [PATCH 1/2] src/multi_open_unlink: Stop using attr_set Xiao Yang
@ 2020-12-08  6:40 ` Xiao Yang
  2020-12-08 18:24   ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-12-08  6:40 UTC (permalink / raw)
  To: darrick.wong, guaneryu; +Cc: fstests, Xiao Yang

Avoid the following warning by replacing deprecated
attr_setf with fsetxattr:
---------------------------------------------------
dmiperf.c:192:2: warning: 'attr_setf' is deprecated: Use fsetxattr instead [-Wdeprecated-declarations]
---------------------------------------------------

Also remove unneeded <attr/attributes.h> and $(LIBATTR).

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 src/Makefile  | 2 +-
 src/dmiperf.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 32940142..c0688520 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -33,7 +33,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 
 SUBDIRS = log-writes perf
 
-LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL) -lpthread -lrt
+LLDLIBS = $(LIBHANDLE) $(LIBACL) -lpthread -lrt
 
 ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
 LINUX_TARGETS += loggen
diff --git a/src/dmiperf.c b/src/dmiperf.c
index 4026dcfb..f9415953 100644
--- a/src/dmiperf.c
+++ b/src/dmiperf.c
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <attr/attributes.h>
+#include <sys/xattr.h>
 
 typedef unsigned int uint_t;
 
@@ -189,8 +189,8 @@ mkfile(char *name, char *attr)
 		perror("open");
 		exit(1);
 	}
-	if (attr_setf(fd, DMFATTRNAME, attr, DMFATTRLEN, ATTR_ROOT) < 0) {
-		perror("attr_setf");
+	if (fsetxattr(fd, DMFATTRNAME, attr, DMFATTRLEN, 0) < 0) {
+		perror("fsetxattr");
 		exit(1);
 	}
 	while (bytes > 0) {
-- 
2.23.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] src/dmiperf: Stop using attr_setf
  2020-12-08  6:40 ` [PATCH 2/2] src/dmiperf: Stop using attr_setf Xiao Yang
@ 2020-12-08 18:24   ` Darrick J. Wong
  2020-12-09  1:12     ` Xiao Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2020-12-08 18:24 UTC (permalink / raw)
  To: Xiao Yang; +Cc: guaneryu, fstests

On Tue, Dec 08, 2020 at 02:40:05PM +0800, Xiao Yang wrote:
> Avoid the following warning by replacing deprecated
> attr_setf with fsetxattr:
> ---------------------------------------------------
> dmiperf.c:192:2: warning: 'attr_setf' is deprecated: Use fsetxattr instead [-Wdeprecated-declarations]
> ---------------------------------------------------

I frankly wonder if it's time to kill the DMI tests since I've never
seen it and none of the functionality is upstream.

--D

> 
> Also remove unneeded <attr/attributes.h> and $(LIBATTR).
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  src/Makefile  | 2 +-
>  src/dmiperf.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/Makefile b/src/Makefile
> index 32940142..c0688520 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -33,7 +33,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
>  
>  SUBDIRS = log-writes perf
>  
> -LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL) -lpthread -lrt
> +LLDLIBS = $(LIBHANDLE) $(LIBACL) -lpthread -lrt
>  
>  ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
>  LINUX_TARGETS += loggen
> diff --git a/src/dmiperf.c b/src/dmiperf.c
> index 4026dcfb..f9415953 100644
> --- a/src/dmiperf.c
> +++ b/src/dmiperf.c
> @@ -17,7 +17,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> -#include <attr/attributes.h>
> +#include <sys/xattr.h>
>  
>  typedef unsigned int uint_t;
>  
> @@ -189,8 +189,8 @@ mkfile(char *name, char *attr)
>  		perror("open");
>  		exit(1);
>  	}
> -	if (attr_setf(fd, DMFATTRNAME, attr, DMFATTRLEN, ATTR_ROOT) < 0) {
> -		perror("attr_setf");
> +	if (fsetxattr(fd, DMFATTRNAME, attr, DMFATTRLEN, 0) < 0) {
> +		perror("fsetxattr");
>  		exit(1);
>  	}
>  	while (bytes > 0) {
> -- 
> 2.23.0
> 
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] src/dmiperf: Stop using attr_setf
  2020-12-08 18:24   ` Darrick J. Wong
@ 2020-12-09  1:12     ` Xiao Yang
  2020-12-09  4:22       ` Eryu Guan
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-12-09  1:12 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, fstests

On 2020/12/9 2:24, Darrick J. Wong wrote:
> On Tue, Dec 08, 2020 at 02:40:05PM +0800, Xiao Yang wrote:
>> Avoid the following warning by replacing deprecated
>> attr_setf with fsetxattr:
>> ---------------------------------------------------
>> dmiperf.c:192:2: warning: 'attr_setf' is deprecated: Use fsetxattr instead [-Wdeprecated-declarations]
>> ---------------------------------------------------
> I frankly wonder if it's time to kill the DMI tests since I've never
> seen it and none of the functionality is upstream.
Hi Darrick,

Agreed.  I wanted to remove it yesterday but I am not sure if it will be 
used in future.

I will remove it directly in v2 patch if Eryu or anyone also approves it.

Best Regards,
Xiao Yang
> --D
>
>> Also remove unneeded<attr/attributes.h>  and $(LIBATTR).
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   src/Makefile  | 2 +-
>>   src/dmiperf.c | 6 +++---
>>   2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/Makefile b/src/Makefile
>> index 32940142..c0688520 100644
>> --- a/src/Makefile
>> +++ b/src/Makefile
>> @@ -33,7 +33,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
>>
>>   SUBDIRS = log-writes perf
>>
>> -LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL) -lpthread -lrt
>> +LLDLIBS = $(LIBHANDLE) $(LIBACL) -lpthread -lrt
>>
>>   ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
>>   LINUX_TARGETS += loggen
>> diff --git a/src/dmiperf.c b/src/dmiperf.c
>> index 4026dcfb..f9415953 100644
>> --- a/src/dmiperf.c
>> +++ b/src/dmiperf.c
>> @@ -17,7 +17,7 @@
>>   #include<stdlib.h>
>>   #include<string.h>
>>   #include<unistd.h>
>> -#include<attr/attributes.h>
>> +#include<sys/xattr.h>
>>
>>   typedef unsigned int uint_t;
>>
>> @@ -189,8 +189,8 @@ mkfile(char *name, char *attr)
>>   		perror("open");
>>   		exit(1);
>>   	}
>> -	if (attr_setf(fd, DMFATTRNAME, attr, DMFATTRLEN, ATTR_ROOT)<  0) {
>> -		perror("attr_setf");
>> +	if (fsetxattr(fd, DMFATTRNAME, attr, DMFATTRLEN, 0)<  0) {
>> +		perror("fsetxattr");
>>   		exit(1);
>>   	}
>>   	while (bytes>  0) {
>> -- 
>> 2.23.0
>>
>>
>>
>
> .
>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] src/dmiperf: Stop using attr_setf
  2020-12-09  1:12     ` Xiao Yang
@ 2020-12-09  4:22       ` Eryu Guan
  0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2020-12-09  4:22 UTC (permalink / raw)
  To: Xiao Yang; +Cc: Darrick J. Wong, guaneryu, fstests

On Wed, Dec 09, 2020 at 09:12:22AM +0800, Xiao Yang wrote:
> On 2020/12/9 2:24, Darrick J. Wong wrote:
> >On Tue, Dec 08, 2020 at 02:40:05PM +0800, Xiao Yang wrote:
> >>Avoid the following warning by replacing deprecated
> >>attr_setf with fsetxattr:
> >>---------------------------------------------------
> >>dmiperf.c:192:2: warning: 'attr_setf' is deprecated: Use fsetxattr instead [-Wdeprecated-declarations]
> >>---------------------------------------------------
> >I frankly wonder if it's time to kill the DMI tests since I've never
> >seen it and none of the functionality is upstream.
> Hi Darrick,
> 
> Agreed.  I wanted to remove it yesterday but I am not sure if it
> will be used in future.
> 
> I will remove it directly in v2 patch if Eryu or anyone also approves it.

I agree to kill the dmi tests, because even xfs maintain wants to kill
them :)

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-09  4:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  6:40 [PATCH 1/2] src/multi_open_unlink: Stop using attr_set Xiao Yang
2020-12-08  6:40 ` [PATCH 2/2] src/dmiperf: Stop using attr_setf Xiao Yang
2020-12-08 18:24   ` Darrick J. Wong
2020-12-09  1:12     ` Xiao Yang
2020-12-09  4:22       ` Eryu Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.