>From b00fff657574e7ca98336af9a35d672d349dc9be Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 6 Aug 2012 13:15:16 +0200 Subject: [PATCH 1/2] adding module 'xattr' --- lib/attr-xattr.in.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/attr-xattr-h.m4 | 28 +++++++++++++++++++++++ modules/xattr-h | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 lib/attr-xattr.in.h create mode 100644 m4/attr-xattr-h.m4 create mode 100644 modules/xattr-h diff --git a/lib/attr-xattr.in.h b/lib/attr-xattr.in.h new file mode 100644 index 0000000..ae3e28f --- /dev/null +++ b/lib/attr-xattr.in.h @@ -0,0 +1,65 @@ +#ifndef address@hidden@_ATTR_XATTR_H +#define address@hidden@_ATTR_XATTR_H + +/* Replacement for platforms that lack it. + Copyright (C) 2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#if HAVE_ATTR_XATTR_H + +#include +#include_next + +#else +# include + +/* setting */ +static inline int setxattr (const char *path, const char *name, const void + *value, size_t size, int flags) +{ errno = ENOTSUP; return -1; } + +static inline int lsetxattr (const char *path, const char *name, const void + *value, size_t size, int flags) +{ errno = ENOTSUP; return -1; } + +static inline int fsetxattr (int filedes, const char *name, const void *value, + size_t size, int flags) +{ errno = ENOTSUP; return -1; } + + +/* getting */ +static inline ssize_t getxattr (const char *path, const char *name, void *value, + size_t size) +{ errno = ENOTSUP; return -1; } +static inline ssize_t lgetxattr (const char *path, const char *name, void + *value, size_t size) +{ errno = ENOTSUP; return -1; } +static inline ssize_t fgetxattr (int filedes, const char *name, void *value, + size_t size) +{ errno = ENOTSUP; return -1; } + + +/* listing */ +static inline ssize_t listxattr (const char *path, char *list, size_t size) +{ errno = ENOTSUP; return -1; } + +static inline ssize_t llistxattr (const char *path, char *list, size_t size) +{ errno = ENOTSUP; return -1; } + +static inline ssize_t flistxattr (int filedes, char *list, size_t size) +{ errno = ENOTSUP; return -1; } + +#endif /* if HAVE_ATTR_XATTR_H */ +#endif /* address@hidden@_ATTR_XATTR_H */ diff --git a/m4/attr-xattr-h.m4 b/m4/attr-xattr-h.m4 new file mode 100644 index 0000000..271834b --- /dev/null +++ b/m4/attr-xattr-h.m4 @@ -0,0 +1,28 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Provide , if necessary + +AC_DEFUN([gl_HEADERS_ATTR_XATTR_H], +[ + AC_ARG_WITH([xattrs], + AS_HELP_STRING([--without-xattrs], [don't use linux exteneded atttributes]), + [], [with_xattrs=maybe] + ) + + AC_CHECK_HEADERS([attr/xattr.h]) + if test "$ac_cv_header_attr_xattr_h" = yes; then + AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \ + setxattr fsetxattr lsetxattr \ + listxattr flistxattr llistxattr, + # only when functions are present + AC_DEFINE([HAVE_ATTR_XATTR_H], [1], + [define to 1 if we have header]) + if test "$with_xattrs" != no; then + AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) + fi + ) + fi +]) diff --git a/modules/xattr-h b/modules/xattr-h new file mode 100644 index 0000000..691e7fe --- /dev/null +++ b/modules/xattr-h @@ -0,0 +1,44 @@ +Description: +xattr headers for systems that lack them + +Files: +lib/attr-xattr.in.h +m4/attr-xattr-h.m4 + +Depends-on: +errno +sys_types +include_next + +configure.ac: +gl_HEADERS_ATTR_XATTR_H + +Makefile.am: +lib_SOURCES += attr-xattr.in.h +BUILT_SOURCES += attr/xattr.h +attr/xattr.h: attr-xattr.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) attr + $(AM_V_GEN)rm -f address@hidden $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ + < $(srcdir)/attr-xattr.in.h; \ + } > address@hidden && \ + chmod a-x address@hidden && \ + mv address@hidden $@ +MOSTLYCLEANFILES += attr/xattr.h attr/xattr.h-t + +Include: + + + +Link: + +License: +LGPLv2+ + +Maintainer: +all -- 1.7.11.2