acl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Acl-devel] [PATCH] Switch to sys/xattr.h


From: Cristian Rodríguez
Subject: [Acl-devel] [PATCH] Switch to sys/xattr.h
Date: Wed, 28 May 2014 17:28:13 -0400

Since a very long time (over ten years) the xattrs functions
that libacl uses have been provided by libc.
This commit switches the code to use libc and leave libxattr
behind.
---
 configure.ac                        |  5 ++--
 libacl/Makemodule.am                |  4 +--
 libacl/__acl_extended_file.c        |  7 ++++-
 libacl/acl_delete_def_file.c        |  9 ++++---
 libacl/acl_extended_fd.c            |  6 ++++-
 libacl/acl_extended_file.c          |  6 ++++-
 libacl/acl_extended_file_nofollow.c |  6 ++++-
 libacl/acl_get_fd.c                 |  6 ++++-
 libacl/acl_get_file.c               |  6 ++++-
 libacl/acl_set_fd.c                 |  6 ++++-
 libacl/acl_set_file.c               |  6 ++++-
 libacl/error_context.h              | 53 +++++++++++++++++++++++++++++++++++++
 libacl/libobj.h                     |  5 +++-
 libacl/perm_copy_fd.c               |  7 ++---
 libacl/perm_copy_file.c             |  7 ++---
 15 files changed, 112 insertions(+), 27 deletions(-)
 create mode 100644 libacl/error_context.h

diff --git a/configure.ac b/configure.ac
index 2182e81..0342857 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,9 +44,8 @@ dnl Automatically increment the revision for every release.
 LT_REVISION=$(echo "${PACKAGE_VERSION}" | tr -d .)
 AC_SUBST(LT_REVISION)
 
-AC_PACKAGE_NEED_ATTR_XATTR_H
-AC_PACKAGE_NEED_ATTR_ERROR_H
-AC_PACKAGE_NEED_GETXATTR_LIBATTR
+AC_CHECK_HEADERS([sys/xattr.h],,
+                 [AC_MSG_ERROR([sys/xattr.h header not found])])
 
 AC_CONFIG_COMMANDS([include/acl],
        [dnl
diff --git a/libacl/Makemodule.am b/libacl/Makemodule.am
index c35214c..64b70b4 100644
--- a/libacl/Makemodule.am
+++ b/libacl/Makemodule.am
@@ -74,8 +74,8 @@ INTERNAL_CFILES = \
 
 libacl_la_DEPENDENCIES = exports libmisc.la
 libacl_la_SOURCES = $(CFILES) $(HFILES)
-libacl_la_LIBADD = -lattr libmisc.la
+libacl_la_LIBADD = libmisc.la
 libacl_la_CFLAGS = $(AM_CFLAGS) -include $(srcdir)/libacl/perm_copy.h
-libacl_la_LDFLAGS = \
+libacl_la_LDFLAGS = -no-undefined \
        -Wl,--version-script,$(top_srcdir)/exports \
        -version-info $(LTVERSION)
diff --git a/libacl/__acl_extended_file.c b/libacl/__acl_extended_file.c
index 3e45abd..c18c852 100644
--- a/libacl/__acl_extended_file.c
+++ b/libacl/__acl_extended_file.c
@@ -19,8 +19,13 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 
 #include "byteorder.h"
diff --git a/libacl/acl_delete_def_file.c b/libacl/acl_delete_def_file.c
index fae4460..c5d956d 100644
--- a/libacl/acl_delete_def_file.c
+++ b/libacl/acl_delete_def_file.c
@@ -19,12 +19,15 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "byteorder.h"
 #include "acl_ea.h"
-#include "config.h"
-
+#include "libobj.h"
 
 /* 23.4.8 */
 int
diff --git a/libacl/acl_extended_fd.c b/libacl/acl_extended_fd.c
index f19ad7b..60e963a 100644
--- a/libacl/acl_extended_fd.c
+++ b/libacl/acl_extended_fd.c
@@ -19,8 +19,12 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 
 #include "byteorder.h"
diff --git a/libacl/acl_extended_file.c b/libacl/acl_extended_file.c
index f417784..f180fe9 100644
--- a/libacl/acl_extended_file.c
+++ b/libacl/acl_extended_file.c
@@ -19,8 +19,12 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 
 #include "__acl_extended_file.h"
diff --git a/libacl/acl_extended_file_nofollow.c 
b/libacl/acl_extended_file_nofollow.c
index c253e4d..9087c5d 100644
--- a/libacl/acl_extended_file_nofollow.c
+++ b/libacl/acl_extended_file_nofollow.c
@@ -19,8 +19,12 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 
 #include "__acl_extended_file.h"
diff --git a/libacl/acl_get_fd.c b/libacl/acl_get_fd.c
index f2525ef..eb5dad1 100644
--- a/libacl/acl_get_fd.c
+++ b/libacl/acl_get_fd.c
@@ -19,11 +19,15 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include <acl/libacl.h>
 #include "libacl.h"
 #include "__acl_from_xattr.h"
diff --git a/libacl/acl_get_file.c b/libacl/acl_get_file.c
index 110ef2e..0cfb51e 100644
--- a/libacl/acl_get_file.c
+++ b/libacl/acl_get_file.c
@@ -19,11 +19,15 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include <acl/libacl.h>
 #include "libacl.h"
 #include "__acl_from_xattr.h"
diff --git a/libacl/acl_set_fd.c b/libacl/acl_set_fd.c
index e6413ad..c5c1c0a 100644
--- a/libacl/acl_set_fd.c
+++ b/libacl/acl_set_fd.c
@@ -19,8 +19,12 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 #include "__acl_to_xattr.h"
 
diff --git a/libacl/acl_set_file.c b/libacl/acl_set_file.c
index 6821851..371d04f 100644
--- a/libacl/acl_set_file.c
+++ b/libacl/acl_set_file.c
@@ -19,10 +19,14 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include "libacl.h"
 #include "__acl_to_xattr.h"
 
diff --git a/libacl/error_context.h b/libacl/error_context.h
new file mode 100644
index 0000000..9b56944
--- /dev/null
+++ b/libacl/error_context.h
@@ -0,0 +1,53 @@
+/*
+  Copyright (C) 2009  Andreas Gruenbacher <address@hidden>
+
+  This program is free software: you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation, either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __ERROR_CONTEXT_T
+#define __ERROR_CONTEXT_T
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct error_context {
+       /* Process an error message */
+       void (*error) (struct error_context *, const char *, ...);
+
+       /* Quote a file name for including in an error message */
+       const char *(*quote) (struct error_context *, const char *);
+
+       /* Free a quoted name */
+       void (*quote_free) (struct error_context *, const char *);
+};
+
+#ifdef ERROR_CONTEXT_MACROS
+# define error(ctx, args...) do { \
+       if ((ctx) && (ctx)->error) \
+               (ctx)->error((ctx), args); \
+       } while(0)
+# define quote(ctx, name) \
+       ( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) )
+# define quote_free(ctx, name) do { \
+       if ((ctx) && (ctx)->quote_free) \
+               (ctx)->quote_free((ctx), (name)); \
+       } while(0)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __ERROR_CONTEXT_T */
diff --git a/libacl/libobj.h b/libacl/libobj.h
index 5480a0e..2bc90dd 100644
--- a/libacl/libobj.h
+++ b/libacl/libobj.h
@@ -19,8 +19,11 @@
 #define __LIBOBJ_H
 
 #include <stdlib.h>
+#include <errno.h>
 
-#include "config.h"
+#ifndef ENOATTR
+# define ENOATTR ENODATA        /* No such attribute */
+#endif
 
 /* Mark library internal functions as hidden */
 #if defined(HAVE_VISIBILITY_ATTRIBUTE)
diff --git a/libacl/perm_copy_fd.c b/libacl/perm_copy_fd.c
index f9ae690..ca91e61 100644
--- a/libacl/perm_copy_fd.c
+++ b/libacl/perm_copy_fd.c
@@ -17,9 +17,10 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
-#if defined (HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #if defined(HAVE_LIBACL_LIBACL_H)
 # include "libacl.h"
 #endif
@@ -39,11 +40,7 @@
 #endif
 
 #define ERROR_CONTEXT_MACROS
-#ifdef HAVE_ATTR_ERROR_CONTEXT_H
-#include <attr/error_context.h>
-#else
 #include "error_context.h"
-#endif
 
 #if !defined(ENOTSUP)
 # define ENOTSUP (-1)
diff --git a/libacl/perm_copy_file.c b/libacl/perm_copy_file.c
index 023294d..129c1ea 100644
--- a/libacl/perm_copy_file.c
+++ b/libacl/perm_copy_file.c
@@ -17,9 +17,10 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
-#if defined (HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #if defined(HAVE_LIBACL_LIBACL_H)
 # include "libacl.h"
 #endif
@@ -39,11 +40,7 @@
 #endif
 
 #define ERROR_CONTEXT_MACROS
-#ifdef HAVE_ATTR_ERROR_CONTEXT_H
-#include <attr/error_context.h>
-#else
 #include "error_context.h"
-#endif
 
 #if !defined(ENOTSUP)
 # define ENOTSUP (-1)
-- 
1.8.4.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]