ls.c revision 379955feee57506fc1f1824c5223399690ea0465
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) 11053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "(none)"); 11153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 112d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#endif 113d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o} 114d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 115d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 1161e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 1177f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#ifndef EXT2_INODE_SIZE 1187f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) 1197f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o#endif 1207f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o 121a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#ifndef EXT2_GOOD_OLD_REV 122a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#define EXT2_GOOD_OLD_REV 0 123a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o#endif 124a29f4d30f24d68f1f1c75548e020689ede532c05Theodore Ts'o 125379955feee57506fc1f1824c5223399690ea0465Theodore Ts'ovoid list_super2(struct ext2_super_block * sb, FILE *f) 1263839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{ 1277f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o int inode_blocks_per_group; 1281e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o char buf[80]; 1291e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o const char *os; 13021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o time_t tm; 1317f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o 132379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o inode_blocks_per_group = (((sb->s_inodes_per_group * 133379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_INODE_SIZE(sb)) + 134379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_BLOCK_SIZE(sb) - 1) / 135379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o EXT2_BLOCK_SIZE(sb)); 1361e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (sb->s_volume_name[0]) { 1371e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o memset(buf, 0, sizeof(buf)); 1381e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name)); 13921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o } else 14021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o strcpy(buf, "<none>"); 14153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem volume name: %s\n", buf); 1421e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (sb->s_last_mounted[0]) { 1431e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o memset(buf, 0, sizeof(buf)); 1441e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted)); 14521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o } else 14621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o strcpy(buf, "<not available>"); 14753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last mounted on: %s\n", buf); 1481e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o if (!e2p_is_null_uuid(sb->s_uuid)) { 1491e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o e2p_uuid_to_str(sb->s_uuid, buf); 15021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o } else 15121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o strcpy(buf, "<none>"); 15253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem UUID: %s\n", buf); 153379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Filesystem magic number: 0x%04X\n", sb->s_magic); 154379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Filesystem revision #: %d", sb->s_rev_level); 155379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_rev_level == EXT2_GOOD_OLD_REV) { 15653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, " (original)\n"); 157521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#ifdef EXT2_DYNAMIC_REV 158379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o } else if (sb->s_rev_level == EXT2_DYNAMIC_REV) { 15953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, " (dynamic)\n"); 160521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o#endif 161521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o } else 16253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 163379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_features(sb, f); 16453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem state: "); 165379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_fs_state (f, sb->s_state); 16653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 16753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Errors behavior: "); 168379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_fs_errors(f, sb->s_errors); 16953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "\n"); 170379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o switch (sb->s_creator_os) { 1711e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o case EXT2_OS_LINUX: os = "Linux"; break; 1724ea0a1109d761e9caaa53f6fa9e036321826c5faTheodore Ts'o case EXT2_OS_HURD: os = "GNU/Hurd"; break; 1731e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o case EXT2_OS_MASIX: os = "Masix"; break; 1741e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o default: os = "unknown"; break; 1751e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o } 17653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Filesystem OS type: %s\n", os); 177379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inode count: %u\n", sb->s_inodes_count); 178379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Block count: %u\n", sb->s_blocks_count); 179379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Reserved block count: %u\n", sb->s_r_blocks_count); 180379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Free blocks: %u\n", sb->s_free_blocks_count); 181379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Free inodes: %u\n", sb->s_free_inodes_count); 182379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First block: %u\n", sb->s_first_data_block); 183379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Block size: %u\n", EXT2_BLOCK_SIZE(sb)); 184379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Fragment size: %u\n", EXT2_FRAG_SIZE(sb)); 185379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Blocks per group: %u\n", sb->s_blocks_per_group); 186379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Fragments per group: %u\n", sb->s_frags_per_group); 187379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inodes per group: %u\n", sb->s_inodes_per_group); 18853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Inode blocks per group: %u\n", inode_blocks_per_group); 189379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o tm = sb->s_mtime; 19053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last mount time: %s", ctime(&tm)); 191379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o tm = sb->s_wtime; 19253d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last write time: %s", ctime(&tm)); 193379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Mount count: %u\n", sb->s_mnt_count); 194379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Maximum mount count: %d\n", sb->s_max_mnt_count); 195379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o tm = sb->s_lastcheck; 19653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Last checked: %s", ctime(&tm)); 197379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Check interval: %u (%s)\n", sb->s_checkinterval, 198379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o interval_string(sb->s_checkinterval)); 199379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_checkinterval) 2003839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o { 2013839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o time_t next; 2023839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 203379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o next = sb->s_lastcheck + sb->s_checkinterval; 20453d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Next check after: %s", ctime(&next)); 2053839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o } 20653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Reserved blocks uid: "); 207379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_user(sb->s_def_resuid, f); 20853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Reserved blocks gid: "); 209379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o print_group(sb->s_def_resgid, f); 210379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_rev_level >= EXT2_DYNAMIC_REV) { 211379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First inode: %d\n", sb->s_first_ino); 212379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Inode size: %d\n", sb->s_inode_size); 2137f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o } 214379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o if (sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) { 21519c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o if (e2p_is_null_uuid(sb->s_journal_uuid)) { 21619c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o strcpy(buf, "<none>"); 21719c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o } else 21819c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o e2p_uuid_to_str(sb->s_uuid, buf); 21953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o fprintf(f, "Journal UUID: %s\n", buf); 220379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Journal inode: %u\n", sb->s_journal_inum); 221379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "Journal device: 0x%04x\n", sb->s_journal_dev); 222379955feee57506fc1f1824c5223399690ea0465Theodore Ts'o fprintf(f, "First orphan inode: %u\n", sb->s_last_orphan); 22319c689196bcd90510070b50cd08d0e962fe8311cTheodore Ts'o } 2243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o} 2251e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 22653d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ovoid list_super (struct ext2_super_block * s) 22753d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o{ 22853d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o list_super2(s, stdout); 22953d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'o} 2301e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 231