13839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
23839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * ls.c			- List the contents of an ext2fs superblock
33839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
43839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Copyright (C) 1992, 1993, 1994  Remy Card <card@masi.ibp.fr>
53839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *                                 Laboratoire MASI, Institut Blaise Pascal
63839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *                                 Universite Pierre et Marie Curie (Paris VI)
73839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * Copyright (C) 1995, 1996, 1997  Theodore Ts'o <tytso@mit.edu>
9efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
10543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * %Begin-Header%
11543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * This file may be redistributed under the terms of the GNU Library
12543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * General Public License, version 2.
13543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * %End-Header%
143839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
161e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#include <stdio.h>
17b7e4eef304d20fabbe2dd6bfeb1bc217db280e48Theodore Ts'o#include <stdlib.h>
1850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#include <sys/types.h>
191e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#include <string.h>
20f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#include <grp.h>
21f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#include <pwd.h>
223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include <time.h>
233839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include "e2p.h"
253839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
2653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_user (unsigned short uid, FILE *f)
27f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
28f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	struct passwd *pw;
29f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
3053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "%u ", uid);
31f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	pw = getpwuid (uid);
32f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	if (pw == NULL)
3353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, "(user unknown)\n");
34f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	else
3553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, "(user %s)\n", pw->pw_name);
36f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
37f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
3853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_group (unsigned short gid, FILE *f)
39f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
40f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	struct group *gr;
41f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
4253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "%u ", gid);
43f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	gr = getgrgid (gid);
44f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	if (gr == NULL)
4553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, "(group unknown)\n");
46f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	else
4753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, "(group %s)\n", gr->gr_name);
48f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
49f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
501e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define MONTH_INT (86400 * 30)
511e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define WEEK_INT (86400 * 7)
521e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define DAY_INT	(86400)
531e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define HOUR_INT (60 * 60)
541e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define MINUTE_INT (60)
551e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
5621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'ostatic const char *interval_string(unsigned int secs)
571e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
581e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	static char buf[256], tmp[80];
591e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int		hr, min, num;
601e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
611e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	buf[0] = 0;
621e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
6321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if (secs == 0)
6421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return "<none>";
6521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
661e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (secs >= MONTH_INT) {
671e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		num = secs / MONTH_INT;
681e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		secs -= num*MONTH_INT;
691e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		sprintf(buf, "%d month%s", num, (num>1) ? "s" : "");
701e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	}
711e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (secs >= WEEK_INT) {
721e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		num = secs / WEEK_INT;
731e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		secs -= num*WEEK_INT;
741e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		sprintf(tmp, "%s%d week%s", buf[0] ? ", " : "",
751e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			num, (num>1) ? "s" : "");
761e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		strcat(buf, tmp);
771e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	}
781e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (secs >= DAY_INT) {
791e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		num = secs / DAY_INT;
801e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		secs -= num*DAY_INT;
811e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		sprintf(tmp, "%s%d day%s", buf[0] ? ", " : "",
821e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			num, (num>1) ? "s" : "");
831e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		strcat(buf, tmp);
841e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	}
851e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (secs > 0) {
861e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		hr = secs / HOUR_INT;
871e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		secs -= hr*HOUR_INT;
881e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		min = secs / MINUTE_INT;
891e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		secs -= min*MINUTE_INT;
901e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		sprintf(tmp, "%s%d:%02d:%02d", buf[0] ? ", " : "",
911e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			hr, min, secs);
921e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		strcat(buf, tmp);
931e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	}
941e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return buf;
951e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
961e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
9753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_features(struct ext2_super_block * s, FILE *f)
98d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o{
99d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#ifdef EXT2_DYNAMIC_REV
100d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o	int	i, j, printed=0;
101d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o	__u32	*mask = &s->s_feature_compat, m;
102d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o
10353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Filesystem features:     ");
104d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o	for (i=0; i <3; i++,mask++) {
105d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o		for (j=0,m=1; j < 32; j++, m<<=1) {
106d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o			if (*mask & m) {
10753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o				fprintf(f, " %s", e2p_feature2string(i, m));
108d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o				printed++;
109d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o			}
110d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o		}
111d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o	}
112d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o	if (printed == 0)
1136d21621c0ce194fd3c8474b8066a06c4781fb4bcTheodore Ts'o		fprintf(f, " (none)");
11453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "\n");
115d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#endif
116d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o}
117d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o
118a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'ostatic void print_mntopts(struct ext2_super_block * s, FILE *f)
119a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o{
120a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#ifdef EXT2_DYNAMIC_REV
121a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	int	i, printed=0;
122a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	__u32	mask = s->s_default_mount_opts, m;
123a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o
124a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	fprintf(f, "Default mount options:   ");
1254a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o	if (mask & EXT3_DEFM_JMODE) {
1264a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o		fprintf(f, " %s", e2p_mntopt2string(mask & EXT3_DEFM_JMODE));
1274a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o		printed++;
1284a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o	}
129a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	for (i=0,m=1; i < 32; i++, m<<=1) {
1304a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o		if (m & EXT3_DEFM_JMODE)
1314a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o			continue;
132a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o		if (mask & m) {
1334a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o			fprintf(f, " %s", e2p_mntopt2string(m));
134a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o			printed++;
135a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o		}
136a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	}
137a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	if (printed == 0)
138a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o		fprintf(f, " (none)");
139a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	fprintf(f, "\n");
140a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#endif
141a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o}
142d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o
143f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'ostatic void print_super_flags(struct ext2_super_block * s, FILE *f)
144f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o{
145f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	int	flags_found = 0;
146f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o
147f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	if (s->s_flags == 0)
148f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o		return;
149f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o
150f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	fputs("Filesystem flags:         ", f);
151f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	if (s->s_flags & EXT2_FLAGS_SIGNED_HASH) {
1526cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o		fputs("signed_directory_hash ", f);
153f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o		flags_found++;
154f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	}
155f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	if (s->s_flags & EXT2_FLAGS_UNSIGNED_HASH) {
1566cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o		fputs("unsigned_directory_hash ", f);
1576cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o		flags_found++;
1586cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o	}
1596cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o	if (s->s_flags & EXT2_FLAGS_TEST_FILESYS) {
1606cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o		fputs("test_filesystem ", f);
161f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o		flags_found++;
162f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	}
163f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	if (flags_found)
164f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o		fputs("\n", f);
165f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	else
166f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o		fputs("(none)\n", f);
167f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o}
168f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o
169e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstatic __u64 e2p_blocks_count(struct ext2_super_block *super)
170e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
171e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return super->s_blocks_count |
172e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
173e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(__u64) super->s_blocks_count_hi << 32 : 0);
174e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
175e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
176e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstatic __u64 e2p_r_blocks_count(struct ext2_super_block *super)
177e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
178e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return super->s_r_blocks_count |
179e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
180e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(__u64) super->s_r_blocks_count_hi << 32 : 0);
181e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
182e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
183e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstatic __u64 e2p_free_blocks_count(struct ext2_super_block *super)
184e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
185e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return super->s_free_blocks_count |
186e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
187e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		(__u64) super->s_free_blocks_hi << 32 : 0);
188e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
1891e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
1907f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#ifndef EXT2_INODE_SIZE
1917f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode)
1927f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#endif
1937f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o
194a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#ifndef EXT2_GOOD_OLD_REV
195a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#define EXT2_GOOD_OLD_REV 0
196a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#endif
197a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o
198379955feee57506fc1f1824c5223399690ea0465Theodore Ts'ovoid list_super2(struct ext2_super_block * sb, FILE *f)
1993839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
2007f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	int inode_blocks_per_group;
20163253946309651c1015947d522e2ba4b35a807a5Theodore Ts'o	char buf[80], *str;
20221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	time_t	tm;
2037f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o
204379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	inode_blocks_per_group = (((sb->s_inodes_per_group *
205379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o				    EXT2_INODE_SIZE(sb)) +
206379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o				   EXT2_BLOCK_SIZE(sb) - 1) /
207379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o				  EXT2_BLOCK_SIZE(sb));
2081e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (sb->s_volume_name[0]) {
2091e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		memset(buf, 0, sizeof(buf));
2101e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name));
21121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	} else
21221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		strcpy(buf, "<none>");
21353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Filesystem volume name:   %s\n", buf);
2141e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if (sb->s_last_mounted[0]) {
2151e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		memset(buf, 0, sizeof(buf));
2161e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted));
21721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	} else
21821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		strcpy(buf, "<not available>");
21953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Last mounted on:          %s\n", buf);
220f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o	fprintf(f, "Filesystem UUID:          %s\n", e2p_uuid2str(sb->s_uuid));
221379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Filesystem magic number:  0x%04X\n", sb->s_magic);
222379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Filesystem revision #:    %d", sb->s_rev_level);
223379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	if (sb->s_rev_level == EXT2_GOOD_OLD_REV) {
22453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, " (original)\n");
225521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#ifdef EXT2_DYNAMIC_REV
226379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	} else if (sb->s_rev_level == EXT2_DYNAMIC_REV) {
22753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, " (dynamic)\n");
228521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#endif
229521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	} else
2306d21621c0ce194fd3c8474b8066a06c4781fb4bcTheodore Ts'o		fprintf(f, " (unknown)\n");
231379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	print_features(sb, f);
232f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o	print_super_flags(sb, f);
233a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o	print_mntopts(sb, f);
2349345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o	if (sb->s_mount_opts[0])
2359345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o		fprintf(f, "Mount options:            %s\n", sb->s_mount_opts);
23653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Filesystem state:        ");
237379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	print_fs_state (f, sb->s_state);
23853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "\n");
23953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Errors behavior:          ");
240379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	print_fs_errors(f, sb->s_errors);
24153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "\n");
24263253946309651c1015947d522e2ba4b35a807a5Theodore Ts'o	str = e2p_os2string(sb->s_creator_os);
24363253946309651c1015947d522e2ba4b35a807a5Theodore Ts'o	fprintf(f, "Filesystem OS type:       %s\n", str);
24463253946309651c1015947d522e2ba4b35a807a5Theodore Ts'o	free(str);
245379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Inode count:              %u\n", sb->s_inodes_count);
246e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	fprintf(f, "Block count:              %llu\n", e2p_blocks_count(sb));
247e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	fprintf(f, "Reserved block count:     %llu\n", e2p_r_blocks_count(sb));
248e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_overhead_blocks)
249e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Overhead blocks:          %u\n",
250e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_overhead_blocks);
251e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	fprintf(f, "Free blocks:              %llu\n", e2p_free_blocks_count(sb));
252379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Free inodes:              %u\n", sb->s_free_inodes_count);
253379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "First block:              %u\n", sb->s_first_data_block);
254379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Block size:               %u\n", EXT2_BLOCK_SIZE(sb));
255e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
256e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Cluster size:             %u\n",
257e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			EXT2_CLUSTER_SIZE(sb));
258e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	else
259e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Fragment size:            %u\n",
260e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			EXT2_CLUSTER_SIZE(sb));
261e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
262e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Group descriptor size:    %u\n", sb->s_desc_size);
263faeaf937523f452d9ad579445b88b8949a76d57aTheodore Ts'o	if (sb->s_reserved_gdt_blocks)
264efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o		fprintf(f, "Reserved GDT blocks:      %u\n",
265faeaf937523f452d9ad579445b88b8949a76d57aTheodore Ts'o			sb->s_reserved_gdt_blocks);
266379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Blocks per group:         %u\n", sb->s_blocks_per_group);
267e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
268e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Clusters per group:       %u\n",
269e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_clusters_per_group);
270e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	else
271e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Fragments per group:      %u\n",
272e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_clusters_per_group);
273379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Inodes per group:         %u\n", sb->s_inodes_per_group);
27453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Inode blocks per group:   %u\n", inode_blocks_per_group);
2756b226c3de2aea0ae3a44a56d0322ba3a7f561886Theodore Ts'o	if (sb->s_raid_stride)
276395529bb4676856a026f5f0c92d494491c3ebb75Theodore Ts'o		fprintf(f, "RAID stride:              %u\n",
2776b226c3de2aea0ae3a44a56d0322ba3a7f561886Theodore Ts'o			sb->s_raid_stride);
2786b226c3de2aea0ae3a44a56d0322ba3a7f561886Theodore Ts'o	if (sb->s_raid_stripe_width)
279395529bb4676856a026f5f0c92d494491c3ebb75Theodore Ts'o		fprintf(f, "RAID stripe width:        %u\n",
2806b226c3de2aea0ae3a44a56d0322ba3a7f561886Theodore Ts'o			sb->s_raid_stripe_width);
281c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o	if (sb->s_first_meta_bg)
282c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o		fprintf(f, "First meta block group:   %u\n",
283c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o			sb->s_first_meta_bg);
284494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o	if (sb->s_log_groups_per_flex)
285494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o		fprintf(f, "Flex block group size:    %u\n",
286494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o			1 << sb->s_log_groups_per_flex);
2879d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o	if (sb->s_mkfs_time) {
2889d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o		tm = sb->s_mkfs_time;
2899d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o		fprintf(f, "Filesystem created:       %s", ctime(&tm));
2909d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o	}
2919d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o	tm = sb->s_mtime;
2929d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o	fprintf(f, "Last mount time:          %s",
2939d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o		sb->s_mtime ? ctime(&tm) : "n/a\n");
294379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	tm = sb->s_wtime;
29553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Last write time:          %s", ctime(&tm));
296379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Mount count:              %u\n", sb->s_mnt_count);
297379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Maximum mount count:      %d\n", sb->s_max_mnt_count);
298379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	tm = sb->s_lastcheck;
29953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Last checked:             %s", ctime(&tm));
300379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	fprintf(f, "Check interval:           %u (%s)\n", sb->s_checkinterval,
301379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	       interval_string(sb->s_checkinterval));
302379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	if (sb->s_checkinterval)
3033839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	{
3043839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		time_t next;
3053839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
306379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o		next = sb->s_lastcheck + sb->s_checkinterval;
30753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o		fprintf(f, "Next check after:         %s", ctime(&next));
3083839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	}
309b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o#define POW2(x) ((__u64) 1 << (x))
310b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o	if (sb->s_kbytes_written) {
311b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		fprintf(f, "Lifetime writes:          ");
312b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		if (sb->s_kbytes_written < POW2(13))
313b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o			fprintf(f, "%llu kB\n", sb->s_kbytes_written);
314b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		else if (sb->s_kbytes_written < POW2(23))
315b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o			fprintf(f, "%llu MB\n",
316b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o				(sb->s_kbytes_written + POW2(9)) >> 10);
317b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		else if (sb->s_kbytes_written < POW2(33))
318b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o			fprintf(f, "%llu GB\n",
319b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o				(sb->s_kbytes_written + POW2(19)) >> 20);
320b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		else if (sb->s_kbytes_written < POW2(43))
321b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o			fprintf(f, "%llu TB\n",
322b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o				(sb->s_kbytes_written + POW2(29)) >> 30);
323b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o		else
324b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o			fprintf(f, "%llu PB\n",
325b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o				(sb->s_kbytes_written + POW2(39)) >> 40);
326b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o	}
32753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Reserved blocks uid:      ");
328379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	print_user(sb->s_def_resuid, f);
32953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	fprintf(f, "Reserved blocks gid:      ");
330379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	print_group(sb->s_def_resgid, f);
331379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o	if (sb->s_rev_level >= EXT2_DYNAMIC_REV) {
332379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o		fprintf(f, "First inode:              %d\n", sb->s_first_ino);
33341a5afa87b0408bc213d72712a0f6fa9177680c4Theodore Ts'o		fprintf(f, "Inode size:	          %d\n", sb->s_inode_size);
33441a5afa87b0408bc213d72712a0f6fa9177680c4Theodore Ts'o		if (sb->s_min_extra_isize)
335efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o			fprintf(f, "Required extra isize:     %d\n",
33641a5afa87b0408bc213d72712a0f6fa9177680c4Theodore Ts'o				sb->s_min_extra_isize);
33741a5afa87b0408bc213d72712a0f6fa9177680c4Theodore Ts'o		if (sb->s_want_extra_isize)
338efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o			fprintf(f, "Desired extra isize:      %d\n",
33941a5afa87b0408bc213d72712a0f6fa9177680c4Theodore Ts'o				sb->s_want_extra_isize);
3407f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	}
3419522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if (!e2p_is_null_uuid(sb->s_journal_uuid))
342f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o		fprintf(f, "Journal UUID:             %s\n",
343f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o			e2p_uuid2str(sb->s_journal_uuid));
3449522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if (sb->s_journal_inum)
3459522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o		fprintf(f, "Journal inode:            %u\n",
3469522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o			sb->s_journal_inum);
3479522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if (sb->s_journal_dev)
3489522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o		fprintf(f, "Journal device:	          0x%04x\n",
3499522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o			sb->s_journal_dev);
3509522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if (sb->s_last_orphan)
3519522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o		fprintf(f, "First orphan inode:       %u\n",
3529522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o			sb->s_last_orphan);
3539522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if ((sb->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) ||
3549522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	    sb->s_def_hash_version)
355f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o		fprintf(f, "Default directory hash:   %s\n",
356f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o			e2p_hash2string(sb->s_def_hash_version));
3579522e0aa0408a541423992f747ce49219fea97ffTheodore Ts'o	if (!e2p_is_null_uuid(sb->s_hash_seed))
358f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o		fprintf(f, "Directory Hash Seed:      %s\n",
359f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o			e2p_uuid2str(sb->s_hash_seed));
360a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o	if (sb->s_jnl_backup_type) {
361a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o		fprintf(f, "Journal backup:           ");
362a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o		switch (sb->s_jnl_backup_type) {
363a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o		case 1:
364a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o			fprintf(f, "inode blocks\n");
365a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o			break;
366a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o		default:
367a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o			fprintf(f, "type %u\n", sb->s_jnl_backup_type);
368a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o		}
369a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o	}
370f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o	if (sb->s_snapshot_inum) {
371f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o		fprintf(f, "Snapshot inode:           %u\n",
372f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o			sb->s_snapshot_inum);
373f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o		fprintf(f, "Snapshot ID:              %u\n",
374f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o			sb->s_snapshot_id);
375f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o		fprintf(f, "Snapshot reserved blocks: %llu\n",
376f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o			sb->s_snapshot_r_blocks_count);
377f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o	}
378f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o	if (sb->s_snapshot_list)
379f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o		fprintf(f, "Snapshot list head:       %u\n",
380f5448c19acda0bae0673d17e97b8a0590c99c944Theodore Ts'o			sb->s_snapshot_list);
381993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o	if (sb->s_error_count)
382993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "FS Error count:           %u\n",
383993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_error_count);
384993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o	if (sb->s_first_error_time) {
385993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		tm = sb->s_first_error_time;
386993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "First error time:         %s", ctime(&tm));
387993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		memset(buf, 0, sizeof(buf));
388e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		strncpy(buf, (char *)sb->s_first_error_func,
389993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sizeof(sb->s_first_error_func));
390993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "First error function:     %s\n", buf);
391993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "First error line #:       %u\n",
392993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_first_error_line);
393993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "First error inode #:      %u\n",
394993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_first_error_ino);
395993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "First error block #:      %llu\n",
396993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_first_error_block);
397993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o	}
398993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o	if (sb->s_last_error_time) {
399993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		tm = sb->s_last_error_time;
400993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "Last error time:          %s", ctime(&tm));
401993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		memset(buf, 0, sizeof(buf));
402e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		strncpy(buf, (char *)sb->s_last_error_func,
403993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sizeof(sb->s_last_error_func));
404993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "Last error function:      %s\n", buf);
405993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "Last error line #:        %u\n",
406993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_last_error_line);
407993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "Last error inode #:       %u\n",
408993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_last_error_ino);
409993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o		fprintf(f, "Last error block #:       %llu\n",
410993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o			sb->s_last_error_block);
411993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o	}
412e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) {
413e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "MMP block number:         %llu\n",
414e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			(long long)sb->s_mmp_block);
415e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "MMP update interval:      %u\n",
416e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_mmp_update_interval);
417e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	}
418e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_usr_quota_inum)
419e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "User quota inode:         %u\n",
420e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_usr_quota_inum);
421e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_grp_quota_inum)
422e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Group quota inode:        %u\n",
423e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_grp_quota_inum);
424e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
425e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
426e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		fprintf(f, "Checksum:                 0x%08x\n",
427e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			sb->s_checksum);
4283839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4291e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
43053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ovoid list_super (struct ext2_super_block * s)
43153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o{
43253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o	list_super2(s, stdout);
43353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o}
4341e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
435