diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-25 03:19:19 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-25 03:19:19 +0100 |
commit | 10f9c75519671e7c7ab8993b54fe22da7c2d0c38 (patch) | |
tree | 78777a123c0261f892af164581884f8a07756203 /src/test/test-btrfs.c | |
parent | 5fa89b2cb366d533e56a9b7a9ce548480776f973 (diff) |
machined: beef up machined image listing with creation/modification times of subvolumes
We make use of the btrfs subvol crtime for this, and for gpt images of a
manually managed xattr, if we can.
Diffstat (limited to 'src/test/test-btrfs.c')
-rw-r--r-- | src/test/test-btrfs.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c index 7c4cc55442..4a08c72fbb 100644 --- a/src/test/test-btrfs.c +++ b/src/test/test-btrfs.c @@ -20,13 +20,36 @@ ***/ #include <stdlib.h> +#include <fcntl.h> #include "log.h" -#include "btrfs-util.h" #include "fileio.h" +#include "util.h" +#include "btrfs-util.h" int main(int argc, char *argv[]) { int r; + BtrfsSubvolInfo info; + char ts[FORMAT_TIMESTAMP_MAX]; + int fd; + + fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY); + if (fd < 0) + log_error_errno(errno, "Failed to open root directory: %m"); + else { + r = btrfs_subvol_get_info_fd(fd, &info); + if (r < 0) + log_error_errno(r, "Failed to get subvolume info: %m"); + else { + log_info("otime: %s", format_timestamp(ts, sizeof(ts), info.otime)); + log_info("read-only: %s", yes_no(info.read_only)); + } + + r = btrfs_subvol_get_read_only_fd(fd); + assert_se(r >= 0); + + log_info("read-only: %s", yes_no(r)); + } r = btrfs_subvol_make("/xxxtest"); if (r < 0) |