]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
discover-image: pick up subvol ctime, too 38230/head
authorLennart Poettering <lennart@poettering.net>
Tue, 15 Jul 2025 15:21:03 +0000 (17:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 15 Jul 2025 15:24:18 +0000 (17:24 +0200)
The btrfs subvol ctime is conceptually what we call the images "mtime",
hence expose it like that, since we get it anyway these days.

src/shared/btrfs-util.c
src/shared/btrfs-util.h
src/shared/discover-image.c

index 869eb490f8ec84686fa4fc3121fc44f99b0e2025..349a1691071910e81f41226c15d9ff2bd1c009e5 100644 (file)
@@ -323,6 +323,7 @@ int btrfs_subvol_get_info_fd(int fd, uint64_t subvol_id, BtrfsSubvolInfo *ret) {
         *ret = (BtrfsSubvolInfo) {
                 .subvol_id = info.treeid,
                 .otime = info.otime.sec * USEC_PER_SEC + (info.otime.nsec / NSEC_PER_USEC),
+                .ctime = info.ctime.sec * USEC_PER_SEC + (info.ctime.nsec / NSEC_PER_USEC),
                 .read_only = FLAGS_SET(info.flags, BTRFS_SUBVOL_RDONLY),
         };
 
index 63fc1d0b32d5050982ace446942b816e9d5004f3..d002618bd80fd7c04a7a1571750f42d031d112ea 100644 (file)
@@ -8,7 +8,8 @@
 
 typedef struct BtrfsSubvolInfo {
         uint64_t subvol_id;
-        usec_t otime;
+        usec_t otime; /* creation time */
+        usec_t ctime; /* change time */
 
         sd_id128_t uuid;
         sd_id128_t parent_uuid;
index d39c3a13563422c112dca6846a3f6efb66ca3ac7..58777c683b2f90c04282a96e357678323c78d1ab 100644 (file)
@@ -430,7 +430,7 @@ static int image_make(
                                               filename,
                                               info.read_only || read_only,
                                               info.otime,
-                                              0,
+                                              info.ctime,
                                               ret);
                                 if (r < 0)
                                         return r;