diff mbox series

[2/2] src/dmiperf: Stop using attr_setf

Message ID 20201208064005.1187031-2-yangx.jy@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series [1/2] src/multi_open_unlink: Stop using attr_set | expand

Commit Message

Xiao Yang Dec. 8, 2020, 6:40 a.m. UTC
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(-)

Comments

Darrick J. Wong Dec. 8, 2020, 6:24 p.m. UTC | #1
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
> 
> 
>
Xiao Yang Dec. 9, 2020, 1:12 a.m. UTC | #2
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
>>
>>
>>
>
> .
>
Eryu Guan Dec. 9, 2020, 4:22 a.m. UTC | #3
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
diff mbox series

Patch

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) {