diff options
| author | Kay Sievers <kay@vrfy.org> | 2014-05-28 17:36:40 +0800 |
|---|---|---|
| committer | Kay Sievers <kay@vrfy.org> | 2014-05-28 17:36:40 +0800 |
| commit | d2edfae0f9bdbecf6a8518e2a5bcf06f470e0d9e (patch) | |
| tree | 10cddc44db05b62c3d57b9b741eef95eef001aae | |
| parent | c9679c652b3c31f2510e8805d81630680ebc7e95 (diff) | |
build-sys: use glibc's xattr support instead of requiring libattr
| -rw-r--r-- | configure.ac | 53 | ||||
| -rw-r--r-- | src/core/mount-setup.c | 2 | ||||
| -rw-r--r-- | src/core/socket.c | 4 | ||||
| -rw-r--r-- | src/journal/journal-file.c | 7 | ||||
| -rw-r--r-- | src/journal/journal-vacuum.c | 10 | ||||
| -rw-r--r-- | src/shared/label.c | 2 | ||||
| -rw-r--r-- | src/shared/smack-util.c | 4 |
7 files changed, 7 insertions, 75 deletions
diff --git a/configure.ac b/configure.ac index 5133c12..e5883e7 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -535,44 +535,6 @@ AC_SUBST(ACL_LIBS) | |||
| 535 | AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno]) | 535 | AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno]) |
| 536 | 536 | ||
| 537 | # ------------------------------------------------------------------------------ | 537 | # ------------------------------------------------------------------------------ |
| 538 | AC_ARG_ENABLE([xattr], | ||
| 539 | AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]), | ||
| 540 | [case "${enableval}" in | ||
| 541 | yes) have_xattr=yes ;; | ||
| 542 | no) have_xattr=no ;; | ||
| 543 | *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;; | ||
| 544 | esac], | ||
| 545 | [have_xattr=auto]) | ||
| 546 | |||
| 547 | if test "x${have_xattr}" != xno ; then | ||
| 548 | AC_CHECK_HEADERS( | ||
| 549 | [attr/xattr.h], | ||
| 550 | [have_xattr=yes], | ||
| 551 | [if test "x$have_xattr" = xyes ; then | ||
| 552 | AC_MSG_ERROR([*** XATTR headers not found.]) | ||
| 553 | fi]) | ||
| 554 | |||
| 555 | AC_CHECK_LIB( | ||
| 556 | [attr], | ||
| 557 | [fsetxattr], | ||
| 558 | [have_xattr=yes], | ||
| 559 | [if test "x$have_xattr" = xyes ; then | ||
| 560 | AC_MSG_ERROR([*** libattr not found.]) | ||
| 561 | fi]) | ||
| 562 | |||
| 563 | if test "x$have_xattr" = xyes ; then | ||
| 564 | XATTR_LIBS="-lattr" | ||
| 565 | AC_DEFINE(HAVE_XATTR, 1, [XATTR available]) | ||
| 566 | else | ||
| 567 | have_xattr=no | ||
| 568 | fi | ||
| 569 | else | ||
| 570 | XATTR_LIBS= | ||
| 571 | fi | ||
| 572 | AC_SUBST(XATTR_LIBS) | ||
| 573 | AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno]) | ||
| 574 | |||
| 575 | # ------------------------------------------------------------------------------ | ||
| 576 | AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]), | 538 | AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]), |
| 577 | [case "${enableval}" in | 539 | [case "${enableval}" in |
| 578 | yes) have_smack=yes ;; | 540 | yes) have_smack=yes ;; |
| @@ -581,17 +543,9 @@ AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK | |||
| 581 | esac], | 543 | esac], |
| 582 | [have_smack=auto]) | 544 | [have_smack=auto]) |
| 583 | 545 | ||
| 584 | if test "x${have_xattr}" = xno; then | 546 | if test "x${have_smack}" = xauto; then |
| 585 | if test "x${have_smack}" = xyes; then | 547 | M4_DEFINES="$M4_DEFINES -DHAVE_SMACK" |
| 586 | AC_MSG_ERROR(SMACK requires xattr support) | 548 | have_smack=yes |
| 587 | else | ||
| 588 | have_smack=no | ||
| 589 | fi | ||
| 590 | else | ||
| 591 | if test "x${have_smack}" = xauto; then | ||
| 592 | M4_DEFINES="$M4_DEFINES -DHAVE_SMACK" | ||
| 593 | have_smack=yes | ||
| 594 | fi | ||
| 595 | fi | 549 | fi |
| 596 | 550 | ||
| 597 | AC_ARG_WITH(smack-run-label, | 551 | AC_ARG_WITH(smack-run-label, |
| @@ -1205,7 +1159,6 @@ AC_MSG_RESULT([ | |||
| 1205 | SMACK: ${have_smack} | 1159 | SMACK: ${have_smack} |
| 1206 | XZ: ${have_xz} | 1160 | XZ: ${have_xz} |
| 1207 | ACL: ${have_acl} | 1161 | ACL: ${have_acl} |
| 1208 | XATTR: ${have_xattr} | ||
| 1209 | GCRYPT: ${have_gcrypt} | 1162 | GCRYPT: ${have_gcrypt} |
| 1210 | QRENCODE: ${have_qrencode} | 1163 | QRENCODE: ${have_qrencode} |
| 1211 | MICROHTTPD: ${have_microhttpd} | 1164 | MICROHTTPD: ${have_microhttpd} |
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index 34d71e5..ae8447c 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c | |||
| @@ -93,10 +93,8 @@ static const MountPoint mount_table[] = { | |||
| 93 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, | 93 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, |
| 94 | { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME, | 94 | { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME, |
| 95 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, | 95 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, |
| 96 | #ifdef HAVE_XATTR | ||
| 97 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV, | 96 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV, |
| 98 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, | 97 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, |
| 99 | #endif | ||
| 100 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, | 98 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, |
| 101 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, | 99 | NULL, MNT_FATAL|MNT_IN_CONTAINER }, |
| 102 | { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, | 100 | { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, |
diff --git a/src/core/socket.c b/src/core/socket.c index aca20fd..60dc9d0 100644 --- a/src/core/socket.c +++ b/src/core/socket.c | |||
| @@ -29,9 +29,7 @@ | |||
| 29 | #include <arpa/inet.h> | 29 | #include <arpa/inet.h> |
| 30 | #include <netinet/tcp.h> | 30 | #include <netinet/tcp.h> |
| 31 | #include <mqueue.h> | 31 | #include <mqueue.h> |
| 32 | #ifdef HAVE_XATTR | 32 | #include <sys/xattr.h> |
| 33 | #include <attr/xattr.h> | ||
| 34 | #endif | ||
| 35 | 33 | ||
| 36 | #include "sd-event.h" | 34 | #include "sd-event.h" |
| 37 | #include "log.h" | 35 | #include "log.h" |
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index f2f1f35..b3b1ffc 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c | |||
| @@ -26,10 +26,7 @@ | |||
| 26 | #include <sys/statvfs.h> | 26 | #include <sys/statvfs.h> |
| 27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
| 28 | #include <stddef.h> | 28 | #include <stddef.h> |
| 29 | 29 | #include <sys/xattr.h> | |
| 30 | #ifdef HAVE_XATTR | ||
| 31 | #include <attr/xattr.h> | ||
| 32 | #endif | ||
| 33 | 30 | ||
| 34 | #include "journal-def.h" | 31 | #include "journal-def.h" |
| 35 | #include "journal-file.h" | 32 | #include "journal-file.h" |
| @@ -2511,7 +2508,6 @@ int journal_file_open( | |||
| 2511 | } | 2508 | } |
| 2512 | 2509 | ||
| 2513 | if (f->last_stat.st_size == 0 && f->writable) { | 2510 | if (f->last_stat.st_size == 0 && f->writable) { |
| 2514 | #ifdef HAVE_XATTR | ||
| 2515 | uint64_t crtime; | 2511 | uint64_t crtime; |
| 2516 | 2512 | ||
| 2517 | /* Let's attach the creation time to the journal file, | 2513 | /* Let's attach the creation time to the journal file, |
| @@ -2526,7 +2522,6 @@ int journal_file_open( | |||
| 2526 | 2522 | ||
| 2527 | crtime = htole64((uint64_t) now(CLOCK_REALTIME)); | 2523 | crtime = htole64((uint64_t) now(CLOCK_REALTIME)); |
| 2528 | fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE); | 2524 | fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE); |
| 2529 | #endif | ||
| 2530 | 2525 | ||
| 2531 | #ifdef HAVE_GCRYPT | 2526 | #ifdef HAVE_GCRYPT |
| 2532 | /* Try to load the FSPRG state, and if we can't, then | 2527 | /* Try to load the FSPRG state, and if we can't, then |
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index ebe5e42..086b40f 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c | |||
| @@ -24,10 +24,7 @@ | |||
| 24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
| 25 | #include <sys/statvfs.h> | 25 | #include <sys/statvfs.h> |
| 26 | #include <unistd.h> | 26 | #include <unistd.h> |
| 27 | 27 | #include <sys/xattr.h> | |
| 28 | #ifdef HAVE_XATTR | ||
| 29 | #include <attr/xattr.h> | ||
| 30 | #endif | ||
| 31 | 28 | ||
| 32 | #include "journal-def.h" | 29 | #include "journal-def.h" |
| 33 | #include "journal-file.h" | 30 | #include "journal-file.h" |
| @@ -79,11 +76,8 @@ static void patch_realtime( | |||
| 79 | unsigned long long *realtime) { | 76 | unsigned long long *realtime) { |
| 80 | 77 | ||
| 81 | usec_t x; | 78 | usec_t x; |
| 82 | |||
| 83 | #ifdef HAVE_XATTR | ||
| 84 | uint64_t crtime; | 79 | uint64_t crtime; |
| 85 | _cleanup_free_ const char *path = NULL; | 80 | _cleanup_free_ const char *path = NULL; |
| 86 | #endif | ||
| 87 | 81 | ||
| 88 | /* The timestamp was determined by the file name, but let's | 82 | /* The timestamp was determined by the file name, but let's |
| 89 | * see if the file might actually be older than the file name | 83 | * see if the file might actually be older than the file name |
| @@ -106,7 +100,6 @@ static void patch_realtime( | |||
| 106 | if (x > 0 && x != (usec_t) -1 && x < *realtime) | 100 | if (x > 0 && x != (usec_t) -1 && x < *realtime) |
| 107 | *realtime = x; | 101 | *realtime = x; |
| 108 | 102 | ||
| 109 | #ifdef HAVE_XATTR | ||
| 110 | /* Let's read the original creation time, if possible. Ideally | 103 | /* Let's read the original creation time, if possible. Ideally |
| 111 | * we'd just query the creation time the FS might provide, but | 104 | * we'd just query the creation time the FS might provide, but |
| 112 | * unfortunately there's currently no sane API to query | 105 | * unfortunately there's currently no sane API to query |
| @@ -125,7 +118,6 @@ static void patch_realtime( | |||
| 125 | if (crtime > 0 && crtime != (uint64_t) -1 && crtime < *realtime) | 118 | if (crtime > 0 && crtime != (uint64_t) -1 && crtime < *realtime) |
| 126 | *realtime = crtime; | 119 | *realtime = crtime; |
| 127 | } | 120 | } |
| 128 | #endif | ||
| 129 | } | 121 | } |
| 130 | 122 | ||
| 131 | static int journal_file_empty(int dir_fd, const char *name) { | 123 | static int journal_file_empty(int dir_fd, const char *name) { |
diff --git a/src/shared/label.c b/src/shared/label.c index 3b7b86e..e46d532 100644 --- a/src/shared/label.c +++ b/src/shared/label.c | |||
| @@ -27,9 +27,7 @@ | |||
| 27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| 30 | #ifdef HAVE_XATTR | ||
| 31 | #include <sys/xattr.h> | 30 | #include <sys/xattr.h> |
| 32 | #endif | ||
| 33 | #ifdef HAVE_SELINUX | 31 | #ifdef HAVE_SELINUX |
| 34 | #include <selinux/selinux.h> | 32 | #include <selinux/selinux.h> |
| 35 | #include <selinux/label.h> | 33 | #include <selinux/label.h> |
diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c index df194e0..8f83562 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c | |||
| @@ -23,9 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <unistd.h> | 24 | #include <unistd.h> |
| 25 | #include <string.h> | 25 | #include <string.h> |
| 26 | #ifdef HAVE_XATTR | 26 | #include <sys/xattr.h> |
| 27 | #include <attr/xattr.h> | ||
| 28 | #endif | ||
| 29 | 27 | ||
| 30 | #include "smack-util.h" | 28 | #include "smack-util.h" |
| 31 | 29 | ||
