From ad4d5b163bcc2eba82adbd439b94d4bd02188610 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 1 Oct 2021 15:10:26 +0200 Subject: [PATCH] btrfs-progs: subvol show: print send and receive generation and timestamp There are some send/receive related data not printed in subvol show, while they're exported by the ioctls. Print them for convenience: $ btrfs subvol show test test Name: test UUID: dc16dd1b-825f-3245-94a8-557672d6cf85 Parent UUID: - Received UUID: - Creation time: 2021-05-17 16:17:14 +0200 Subvolume ID: 19112 Generation: 7730702 Gen at creation: 7730701 Parent ID: 5 Top level ID: 5 Flags: - Send transid: 0 Send time: 2021-05-17 16:17:14 +0200 Receive transid: 0 Receive time: - Snapshot(s): test-snap Signed-off-by: David Sterba --- cmds/subvolume.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmds/subvolume.c b/cmds/subvolume.c index f5a1230b..10672bab 100644 --- a/cmds/subvolume.c +++ b/cmds/subvolume.c @@ -1209,6 +1209,27 @@ static int cmd_subvol_show(const struct cmd_struct *cmd, int argc, char **argv) else printf("\tFlags: \t\t\t-\n"); + printf("\tSend transid: \t\t%" PRIu64 "\n", subvol.stransid); + printf("\tSend time: \t\t%s\n", tstr); + if (subvol.stime.tv_sec) { + struct tm tm; + + localtime_r(&subvol.stime.tv_sec, &tm); + strftime(tstr, 256, "%Y-%m-%d %X %z", &tm); + } else { + strcpy(tstr, "-"); + } + printf("\tReceive transid: \t%" PRIu64 "\n", subvol.rtransid); + if (subvol.rtime.tv_sec) { + struct tm tm; + + localtime_r(&subvol.rtime.tv_sec, &tm); + strftime(tstr, 256, "%Y-%m-%d %X %z", &tm); + } else { + strcpy(tstr, "-"); + } + printf("\tReceive time: \t\t%s\n", tstr); + /* print the snapshots of the given subvol if any*/ printf("\tSnapshot(s):\n");