Module: wine Branch: master Commit: 71afae901f3c627331bf544e52a5b0e825391b66 URL: https://gitlab.winehq.org/wine/wine/-/commit/71afae901f3c627331bf544e52a5b0e...
Author: Erich E. Hoover erich.e.hoover@gmail.com Date: Mon Oct 6 14:21:11 2014 -0600
ntdll: Add support for FreeBSD style extended attributes.
Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk
---
configure | 6 ++++++ configure.ac | 1 + dlls/ntdll/unix/file.c | 24 +++++++++++++++++++++++- include/config.h.in | 3 +++ 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/configure b/configure index b21cc96dec0..aaebcc553f5 100755 --- a/configure +++ b/configure @@ -8194,6 +8194,12 @@ if test "x$ac_cv_header_sys_event_h" = xyes then : printf "%s\n" "#define HAVE_SYS_EVENT_H 1" >>confdefs.h
+fi +ac_fn_c_check_header_compile "$LINENO" "sys/extattr.h" "ac_cv_header_sys_extattr_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_extattr_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_EXTATTR_H 1" >>confdefs.h + fi ac_fn_c_check_header_compile "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes diff --git a/configure.ac b/configure.ac index 51a02d3e876..fe6a773d1c3 100644 --- a/configure.ac +++ b/configure.ac @@ -467,6 +467,7 @@ AC_CHECK_HEADERS(\ sys/cdio.h \ sys/epoll.h \ sys/event.h \ + sys/extattr.h \ sys/filio.h \ sys/ipc.h \ sys/link.h \ diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 44ff136c423..e80eb368e8a 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -102,6 +102,10 @@ #ifdef HAVE_SYS_XATTR_H #include <sys/xattr.h> #endif +#ifdef HAVE_SYS_EXTATTR_H +#undef XATTR_ADDITIONAL_OPTIONS +#include <sys/extattr.h> +#endif #include <time.h> #include <unistd.h>
@@ -171,7 +175,14 @@ typedef struct
#define MAX_IGNORED_FILES 4
-#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +#ifndef XATTR_USER_PREFIX +# define XATTR_USER_PREFIX "user." +#endif +#ifndef XATTR_USER_PREFIX_LEN +# define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1) +#endif + +#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB" #define XATTR_ATTRIBS_MASK (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)
struct file_identity @@ -371,6 +382,8 @@ static int xattr_fremove( int filedes, const char *name ) # else return fremovexattr( filedes, name ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_delete_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] ); #else errno = ENOSYS; return -1; @@ -386,6 +399,9 @@ static int xattr_fset( int filedes, const char *name, const void *value, size_t # else return fsetxattr( filedes, name, value, size, 0 ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -401,6 +417,9 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si # else return getxattr( path, name, value, size ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_get_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -416,6 +435,9 @@ static int xattr_fget( int filedes, const char *name, void *value, size_t size ) # else return fgetxattr( filedes, name, value, size ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; diff --git a/include/config.h.in b/include/config.h.in index 1cea698f585..3a06d36bd02 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -568,6 +568,9 @@ /* Define to 1 if you have the <sys/event.h> header file. */ #undef HAVE_SYS_EVENT_H
+/* Define to 1 if you have the <sys/extattr.h> header file. */ +#undef HAVE_SYS_EXTATTR_H + /* Define to 1 if you have the <sys/filio.h> header file. */ #undef HAVE_SYS_FILIO_H