Blame SOURCES/dump-glibc_xattr.patch

476b13
commit 3c7a1372a2ff3bd40d05cfca56af54cd1ae12321
476b13
Author: Vaclav Dolezal <vdolezal@redhat.com>
476b13
Date:   Wed Mar 6 11:37:50 2019 +0100
476b13
476b13
    Use xattr functions from libc
476b13
    
476b13
    Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
476b13
476b13
diff --git a/restore/xattr.c b/restore/xattr.c
476b13
index ddabfa2..a176e7e 100644
476b13
--- a/restore/xattr.c
476b13
+++ b/restore/xattr.c
476b13
@@ -36,6 +36,7 @@ static const char rcsid[] =
476b13
 #include <compatlfs.h>
476b13
 #include <compaterr.h>
476b13
 #include <sys/types.h>
476b13
+#include <sys/xattr.h>
476b13
 #include <stdio.h>
476b13
 #include <stdlib.h>
476b13
 #include <string.h>
476b13
@@ -124,82 +125,6 @@ struct ext2_xattr_entry {
476b13
 		(entry)->e_value_offs + sizeof(struct ext3_xattr_ibody_header) : \
476b13
 		(entry)->e_value_offs))
476b13
 	
476b13
-/*
476b13
- * xattr syscalls do not exist yet in libc, get our own copy here,
476b13
- * taken from libattr.
476b13
- */
476b13
-#if defined (__i386__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		227
476b13
-# define __NR_lgetxattr		230
476b13
-# define __NR_llistxattr	233
476b13
-#elif defined (__sparc__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		170
476b13
-# define __NR_lgetxattr		173
476b13
-# define __NR_llistxattr	179
476b13
-#elif defined (__ia64__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		1218
476b13
-# define __NR_lgetxattr		1221
476b13
-# define __NR_llistxattr	1224
476b13
-#elif defined (__powerpc__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		210
476b13
-# define __NR_lgetxattr		213
476b13
-# define __NR_llistxattr	216
476b13
-#elif defined (__x86_64__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		189
476b13
-# define __NR_lgetxattr		192
476b13
-# define __NR_llistxattr	195
476b13
-#elif defined (__s390__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		225
476b13
-# define __NR_lgetxattr		228
476b13
-# define __NR_llistxattr	231
476b13
-#elif defined (__arm__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_SYSCALL_BASE 0x900000
476b13
-# define __NR_lsetxattr		(__NR_SYSCALL_BASE+227)
476b13
-# define __NR_lgetxattr		(__NR_SYSCALL_BASE+230)
476b13
-# define __NR_llistxattr	(__NR_SYSCALL_BASE+233)
476b13
-#elif defined (__mips64__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_Linux 5000
476b13
-# define __NR_lsetxattr		(__NR_Linux + 218)
476b13
-# define __NR_lgetxattr		(__NR_Linux + 221)
476b13
-# define __NR_llistxattr	(__NR_Linux + 224)
476b13
-#elif defined (__mips__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_Linux 4000
476b13
-# define __NR_lsetxattr		(__NR_Linux + 225)
476b13
-# define __NR_lgetxattr		(__NR_Linux + 228)
476b13
-# define __NR_llistxattr	(__NR_Linux + 231)
476b13
-#elif defined (__alpha__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		383
476b13
-# define __NR_lgetxattr		386
476b13
-# define __NR_llistxattr	389
476b13
-#elif defined (__mc68000__)
476b13
-# define HAVE_XATTR_SYSCALLS 1
476b13
-# define __NR_lsetxattr		224
476b13
-# define __NR_lgetxattr		227
476b13
-# define __NR_llistxattr	230
476b13
-#else
476b13
-# warning "Extended attribute syscalls undefined for this architecture"
476b13
-# define HAVE_XATTR_SYSCALLS 0
476b13
-#endif
476b13
-
476b13
-#if HAVE_XATTR_SYSCALLS
476b13
-# define SYSCALL(args...)	syscall(args)
476b13
-#else
476b13
-# define SYSCALL(args...)	( errno = ENOSYS, -1 )
476b13
-#endif
476b13
-
476b13
-static int lsetxattr __P((const char *, const char *, void *, size_t, int));
476b13
-static ssize_t lgetxattr __P((const char *, const char *, void *, size_t));
476b13
-static ssize_t llistxattr __P((const char *, char *, size_t));
476b13
 static int xattr_cb_list __P((char *, char *, int, int, void *));
476b13
 static int xattr_cb_set __P((char *, char *, int, int, void *));
476b13
 static int xattr_cb_compare __P((char *, char *, int, int, void *));
476b13
@@ -207,24 +132,6 @@ static int xattr_verify __P((char *));
476b13
 static int xattr_count __P((char *, int *));
476b13
 static int xattr_walk __P((char *, int (*)(char *, char *, int, int, void *), void *));
476b13
 
476b13
-static int
476b13
-lsetxattr(const char *path, const char *name, void *value, size_t size, int flags)
476b13
-{
476b13
-	return SYSCALL(__NR_lsetxattr, path, name, value, size, flags);
476b13
-}
476b13
-
476b13
-static ssize_t
476b13
-lgetxattr(const char *path, const char *name, void *value, size_t size)
476b13
-{
476b13
-	return SYSCALL(__NR_lgetxattr, path, name, value, size);
476b13
-}
476b13
-
476b13
-static ssize_t
476b13
-llistxattr(const char *path, char *list, size_t size)
476b13
-{
476b13
-	return SYSCALL(__NR_llistxattr, path, list, size);
476b13
-}
476b13
-
476b13
 #define POSIX_ACL_XATTR_VERSION 0x0002
476b13
 
476b13
 #define ACL_UNDEFINED_ID        (-1)