]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - lib/e2p/pf.c
libe2p/libext2fs: add EXT4_INLINE_DATA_FL flag
[thirdparty/e2fsprogs.git] / lib / e2p / pf.c
CommitLineData
3839e657
TT
1/*
2 * pf.c - Print file attributes on an ext2 file system
3 *
4 * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr>
5 * Laboratoire MASI, Institut Blaise Pascal
6 * Universite Pierre et Marie Curie (Paris VI)
7 *
543547a5
TT
8 * %Begin-Header%
9 * This file may be redistributed under the terms of the GNU Library
10 * General Public License, version 2.
11 * %End-Header%
3839e657
TT
12 */
13
14/*
15 * History:
16 * 93/10/30 - Creation
17 */
18
d1154eb4 19#include "config.h"
3839e657 20#include <stdio.h>
3839e657
TT
21
22#include "e2p.h"
23
dede39bb
TT
24struct flags_name {
25 unsigned long flag;
4ea7bd04
TT
26 const char *short_name;
27 const char *long_name;
dede39bb 28};
f3db3566 29
dede39bb
TT
30static struct flags_name flags_array[] = {
31 { EXT2_SECRM_FL, "s", "Secure_Deletion" },
32 { EXT2_UNRM_FL, "u" , "Undelete" },
33 { EXT2_SYNC_FL, "S", "Synchronous_Updates" },
88372d5c 34 { EXT2_DIRSYNC_FL, "D", "Synchronous_Directory_Updates" },
dede39bb
TT
35 { EXT2_IMMUTABLE_FL, "i", "Immutable" },
36 { EXT2_APPEND_FL, "a", "Append_Only" },
37 { EXT2_NODUMP_FL, "d", "No_Dump" },
38 { EXT2_NOATIME_FL, "A", "No_Atime" },
bda15095 39 { EXT2_COMPR_FL, "c", "Compression_Requested" },
c4e5e36a 40#ifdef ENABLE_COMPRESSION
bda15095 41 { EXT2_COMPRBLK_FL, "B", "Compressed_File" },
88372d5c 42 { EXT2_DIRTY_FL, "Z", "Compressed_Dirty_File" },
c8199c47 43 { EXT2_NOCOMPR_FL, "X", "Compression_Raw_Access" },
dede39bb 44 { EXT2_ECOMPR_FL, "E", "Compression_Error" },
c4e5e36a 45#endif
c8199c47 46 { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
312c2a40 47 { EXT2_INDEX_FL, "I", "Indexed_directory" },
b3f5b4c2 48 { EXT2_NOTAIL_FL, "t", "No_Tailmerging" },
15f9011a 49 { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
8fe81a3d 50 { EXT4_EXTENTS_FL, "e", "Extents" },
1ca1059f 51 { EXT4_HUGE_FILE_FL, "h", "Huge_file" },
0796e660 52 { FS_NOCOW_FL, "C", "No_COW" },
bf5dd0ae 53 { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
dede39bb
TT
54 { 0, NULL, NULL }
55};
f3db3566 56
dede39bb 57void print_flags (FILE * f, unsigned long flags, unsigned options)
3839e657 58{
dede39bb
TT
59 int long_opt = (options & PFOPT_LONG);
60 struct flags_name *fp;
61 int first = 1;
f3db3566 62
dede39bb
TT
63 for (fp = flags_array; fp->flag != 0; fp++) {
64 if (flags & fp->flag) {
65 if (long_opt) {
66 if (first)
67 first = 0;
68 else
69 fputs(", ", f);
70 fputs(fp->long_name, f);
71 } else
72 fputs(fp->short_name, f);
73 } else {
74 if (!long_opt)
75 fputs("-", f);
76 }
f3db3566 77 }
dede39bb
TT
78 if (long_opt && first)
79 fputs("---", f);
3839e657 80}
dede39bb 81