ls.c revision 9d2aefb3bc0a48b1540d06e1983aa96c56d39e17
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> 921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * 103839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * This file can be redistributed under the terms of the GNU Library General 113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Public License 123839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */ 133839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 141e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#include <stdio.h> 1550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#include <sys/types.h> 161e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#include <string.h> 17f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#include <grp.h> 18f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#include <pwd.h> 193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include <time.h> 203839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 213839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include "e2p.h" 223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 2353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_user (unsigned short uid, FILE *f) 24f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{ 25f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o struct passwd *pw; 26f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o 2753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "%u ", uid); 28f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o pw = getpwuid (uid); 29f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o if (pw == NULL) 3053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "(user unknown)\n"); 31f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o else 3253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "(user %s)\n", pw->pw_name); 33f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o} 34f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o 3553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_group (unsigned short gid, FILE *f) 36f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{ 37f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o struct group *gr; 38f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o 3953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "%u ", gid); 40f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o gr = getgrgid (gid); 41f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o if (gr == NULL) 4253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "(group unknown)\n"); 43f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o else 4453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "(group %s)\n", gr->gr_name); 45f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o} 46f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o 471e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define MONTH_INT (86400 * 30) 481e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define WEEK_INT (86400 * 7) 491e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define DAY_INT (86400) 501e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define HOUR_INT (60 * 60) 511e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#define MINUTE_INT (60) 521e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 5321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'ostatic const char *interval_string(unsigned int secs) 541e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{ 551e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o static char buf[256], tmp[80]; 561e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o int hr, min, num; 571e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 581e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o buf[0] = 0; 591e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 6021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o if (secs == 0) 6121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o return "<none>"; 6221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o 631e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (secs >= MONTH_INT) { 641e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o num = secs / MONTH_INT; 651e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o secs -= num*MONTH_INT; 661e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o sprintf(buf, "%d month%s", num, (num>1) ? "s" : ""); 671e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 681e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (secs >= WEEK_INT) { 691e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o num = secs / WEEK_INT; 701e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o secs -= num*WEEK_INT; 711e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o sprintf(tmp, "%s%d week%s", buf[0] ? ", " : "", 721e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o num, (num>1) ? "s" : ""); 731e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strcat(buf, tmp); 741e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 751e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (secs >= DAY_INT) { 761e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o num = secs / DAY_INT; 771e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o secs -= num*DAY_INT; 781e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o sprintf(tmp, "%s%d day%s", buf[0] ? ", " : "", 791e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o num, (num>1) ? "s" : ""); 801e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strcat(buf, tmp); 811e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 821e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (secs > 0) { 831e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o hr = secs / HOUR_INT; 841e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o secs -= hr*HOUR_INT; 851e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o min = secs / MINUTE_INT; 861e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o secs -= min*MINUTE_INT; 871e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o sprintf(tmp, "%s%d:%02d:%02d", buf[0] ? ", " : "", 881e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o hr, min, secs); 891e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strcat(buf, tmp); 901e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 911e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o return buf; 921e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o} 931e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 9453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ostatic void print_features(struct ext2_super_block * s, FILE *f) 95d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o{ 96d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#ifdef EXT2_DYNAMIC_REV 97d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o int i, j, printed=0; 98d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o __u32 *mask = &s->s_feature_compat, m; 99d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 10053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem features: "); 101d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o for (i=0; i <3; i++,mask++) { 102d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o for (j=0,m=1; j < 32; j++, m<<=1) { 103d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o if (*mask & m) { 10453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, " %s", e2p_feature2string(i, m)); 105d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o printed++; 106d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o } 107d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o } 108d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o } 109d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o if (printed == 0) 1106d21621c0ce194fd3c8474b8066a06c4781fb4bcTheodore Ts'o fprintf(f, " (none)"); 11153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 112d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#endif 113d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o} 114d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 115a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'ostatic void print_mntopts(struct ext2_super_block * s, FILE *f) 116a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o{ 117a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#ifdef EXT2_DYNAMIC_REV 118a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o int i, printed=0; 119a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o __u32 mask = s->s_default_mount_opts, m; 120a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o 121a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o fprintf(f, "Default mount options: "); 1224a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o if (mask & EXT3_DEFM_JMODE) { 1234a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o fprintf(f, " %s", e2p_mntopt2string(mask & EXT3_DEFM_JMODE)); 1244a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o printed++; 1254a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o } 126a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o for (i=0,m=1; i < 32; i++, m<<=1) { 1274a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o if (m & EXT3_DEFM_JMODE) 1284a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o continue; 129a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o if (mask & m) { 1304a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o fprintf(f, " %s", e2p_mntopt2string(m)); 131a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o printed++; 132a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o } 133a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o } 134a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o if (printed == 0) 135a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o fprintf(f, " (none)"); 136a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o fprintf(f, "\n"); 137a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#endif 138a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o} 139d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 1401e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 1417f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#ifndef EXT2_INODE_SIZE 1427f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) 1437f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#endif 1447f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o 145a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#ifndef EXT2_GOOD_OLD_REV 146a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#define EXT2_GOOD_OLD_REV 0 147a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#endif 148a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o 149379955feee57506fc1f1824c5223399690ea0465Theodore Ts'ovoid list_super2(struct ext2_super_block * sb, FILE *f) 1503839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{ 1517f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o int inode_blocks_per_group; 1521e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o char buf[80]; 1531e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o const char *os; 15421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o time_t tm; 1557f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o 156379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o inode_blocks_per_group = (((sb->s_inodes_per_group * 157379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_INODE_SIZE(sb)) + 158379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_BLOCK_SIZE(sb) - 1) / 159379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_BLOCK_SIZE(sb)); 1601e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (sb->s_volume_name[0]) { 1611e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o memset(buf, 0, sizeof(buf)); 1621e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name)); 16321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o } else 16421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o strcpy(buf, "<none>"); 16553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem volume name: %s\n", buf); 1661e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (sb->s_last_mounted[0]) { 1671e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o memset(buf, 0, sizeof(buf)); 1681e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted)); 16921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o } else 17021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o strcpy(buf, "<not available>"); 17153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last mounted on: %s\n", buf); 172f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o fprintf(f, "Filesystem UUID: %s\n", e2p_uuid2str(sb->s_uuid)); 173379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Filesystem magic number: 0x%04X\n", sb->s_magic); 174379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Filesystem revision #: %d", sb->s_rev_level); 175379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_rev_level == EXT2_GOOD_OLD_REV) { 17653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, " (original)\n"); 177521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#ifdef EXT2_DYNAMIC_REV 178379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o } else if (sb->s_rev_level == EXT2_DYNAMIC_REV) { 17953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, " (dynamic)\n"); 180521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#endif 181521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o } else 1826d21621c0ce194fd3c8474b8066a06c4781fb4bcTheodore Ts'o fprintf(f, " (unknown)\n"); 183379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_features(sb, f); 184a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o print_mntopts(sb, f); 18553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem state: "); 186379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_fs_state (f, sb->s_state); 18753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 18853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Errors behavior: "); 189379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_fs_errors(f, sb->s_errors); 19053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 191379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o switch (sb->s_creator_os) { 1921e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o case EXT2_OS_LINUX: os = "Linux"; break; 1934ea0a1109d761e9caaa53f6fa9e036321826c5faTheodore Ts'o case EXT2_OS_HURD: os = "GNU/Hurd"; break; 1941e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o case EXT2_OS_MASIX: os = "Masix"; break; 1951e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o default: os = "unknown"; break; 1961e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 19753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem OS type: %s\n", os); 198379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inode count: %u\n", sb->s_inodes_count); 199379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Block count: %u\n", sb->s_blocks_count); 200379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Reserved block count: %u\n", sb->s_r_blocks_count); 201379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Free blocks: %u\n", sb->s_free_blocks_count); 202379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Free inodes: %u\n", sb->s_free_inodes_count); 203379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First block: %u\n", sb->s_first_data_block); 204379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Block size: %u\n", EXT2_BLOCK_SIZE(sb)); 205379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Fragment size: %u\n", EXT2_FRAG_SIZE(sb)); 206379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Blocks per group: %u\n", sb->s_blocks_per_group); 207379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Fragments per group: %u\n", sb->s_frags_per_group); 208379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inodes per group: %u\n", sb->s_inodes_per_group); 20953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Inode blocks per group: %u\n", inode_blocks_per_group); 210c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o if (sb->s_first_meta_bg) 211c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o fprintf(f, "First meta block group: %u\n", 212c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o sb->s_first_meta_bg); 2139d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o if (sb->s_mkfs_time) { 2149d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o tm = sb->s_mkfs_time; 2159d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o fprintf(f, "Filesystem created: %s", ctime(&tm)); 2169d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o } 2179d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o tm = sb->s_mtime; 2189d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o fprintf(f, "Last mount time: %s", 2199d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o sb->s_mtime ? ctime(&tm) : "n/a\n"); 220379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o tm = sb->s_wtime; 22153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last write time: %s", ctime(&tm)); 222379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Mount count: %u\n", sb->s_mnt_count); 223379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Maximum mount count: %d\n", sb->s_max_mnt_count); 224379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o tm = sb->s_lastcheck; 22553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last checked: %s", ctime(&tm)); 226379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Check interval: %u (%s)\n", sb->s_checkinterval, 227379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o interval_string(sb->s_checkinterval)); 228379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_checkinterval) 2293839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o { 2303839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o time_t next; 2313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 232379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o next = sb->s_lastcheck + sb->s_checkinterval; 23353d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Next check after: %s", ctime(&next)); 2343839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o } 23553d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Reserved blocks uid: "); 236379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_user(sb->s_def_resuid, f); 23753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Reserved blocks gid: "); 238379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_group(sb->s_def_resgid, f); 239379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_rev_level >= EXT2_DYNAMIC_REV) { 240379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First inode: %d\n", sb->s_first_ino); 241379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inode size: %d\n", sb->s_inode_size); 2427f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o } 243379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) { 244f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o fprintf(f, "Journal UUID: %s\n", 245f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o e2p_uuid2str(sb->s_journal_uuid)); 246379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Journal inode: %u\n", sb->s_journal_inum); 247379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Journal device: 0x%04x\n", sb->s_journal_dev); 248379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First orphan inode: %u\n", sb->s_last_orphan); 24919c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o } 250f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o if (sb->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) { 251f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o fprintf(f, "Default directory hash: %s\n", 252f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o e2p_hash2string(sb->s_def_hash_version)); 253f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o fprintf(f, "Directory Hash Seed: %s\n", 254f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o e2p_uuid2str(sb->s_hash_seed)); 255f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o } 2563839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o} 2571e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 25853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ovoid list_super (struct ext2_super_block * s) 25953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o{ 26053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o list_super2(s, stdout); 26153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o} 2621e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 263