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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-10-01 15:10:26 +02:00
parent 42e7b7e617
commit ad4d5b163b
1 changed files with 21 additions and 0 deletions

View File

@ -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");