Enabled recording and restoring of extattr on NetBSD

This commit is contained in:
Thomas Schmitt 2014-06-20 09:07:51 +02:00
parent 1b5caac764
commit e26d07ee77
3 changed files with 44 additions and 5 deletions

View File

@ -5,9 +5,9 @@
Arbitrary Attribute Interchange Protocol , system adapter for getting and
setting of ACLs and xattr.
To be included by aaip_0_2.c
To be included by aaip_0_2.c for FreeBSD and NetBSD
Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2014 Thomas Schmitt, libburnia project, GPLv2+
*/
@ -32,6 +32,8 @@
#include <sys/extattr.h>
#endif
#include <sys/statvfs.h>
/* <<< Use old ACL adapter code that is unable to deal with extattr */
/* # define Libisofs_old_freebsd_acl_adapteR */
@ -70,6 +72,32 @@ int aaip_local_attr_support(int flag)
}
#ifdef Libisofs_with_freebsd_extattR
static int aaip_extattr_path_supp(char *path, int flag)
{
#ifdef MNT_EXTATTR
int ret;
struct statvfs statvfs_buf;
ret = statvfs(path, &statvfs_buf);
if(ret == -1)
return(1);
return(!!(statvfs_buf.f_flag & MNT_EXTATTR));
#else /* MNT_EXTATTR */
return(1);
#endif /* ! MNT_EXTATTR */
}
#endif /* Libisofs_with_freebsd_extattR */
/* ------------------------------ Getters --------------------------------- */
/* Obtain the ACL of the given file in long text form.
@ -195,8 +223,13 @@ static int aaip_extattr_make_list(char *path, int attrnamespace,
*list_size= extattr_list_file(path, attrnamespace, NULL, (size_t) 0);
else
*list_size= extattr_list_link(path, attrnamespace, NULL, (size_t) 0);
if(*list_size == -1)
if(*list_size == -1) {
if(! aaip_extattr_path_supp(path, 0)) {
*list_size = 0;
return(2);
}
return(0);
}
if(*list_size == 0)
return(2);
*list= calloc(*list_size, 1);

View File

@ -5,7 +5,7 @@
Arbitrary Attribute Interchange Protocol , system adapter for getting and
setting of ACLs and xattr.
To be included by aaip_0_2.c
To be included by aaip_0_2.c for Linux
Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+

View File

@ -7,7 +7,7 @@
See libisofs/aaip_0_2.h
http://libburnia-project.org/wiki/AAIP
Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2014 Thomas Schmitt, libburnia project, GPLv2+
*/
@ -2181,6 +2181,11 @@ ex:;
#include "aaip-os-freebsd.c"
#else
#ifdef __NetBSD__
#include "aaip-os-freebsd.c"
#else
#ifdef __linux
@ -2198,5 +2203,6 @@ ex:;
#include "aaip-os-dummy.c"
#endif /* ! __linux */
#endif /* ! __NetBSD__ */
#endif /* ! __FreeBSD__ */