3 # Create Adobe-PostScript file that graphically displays the output of
4 # dumpe2fs(8). Use "dumpe2fs | dconf" to create a PostScript file on stdout.
5 # Developed and tested for Linux 1.0.
8 # ALte Regensburger Strasse 11a
9 # D-93149 Nittenau, Germany
10 # <Ulrich.Windl@rz.uni-regensburg.de>
12 AWKFILE
=/tmp
/${SELF}.
awk
13 TEMPFILE
=/tmp
/${SELF}.tmp
30 /^Blocks per group:/ {
32 printf("BC %d\n", bpg)
33 printf("GC %d\n", (bc + bpg - 1) / bpg)
36 /^Inodes per group:/ {
40 lwtime=$0; gsub("Last write time:[ ]+", "", lwtime)
41 printf("T %s\n", lwtime)
45 group=$2; gsub(":", "", group)
47 group_start=group*bpg+fb
48 group_end=group_start+bpg
49 printf("G %d : %d - %d\n", group, group_start, group_end)
52 /^[ ]+Free blocks: / {
53 for ( i=3; i < NF; ++i ) {
54 block=$i; gsub(",", "", block)
55 if ( index(block, "-") == 0 ) block=block "-" block
58 substr(block, 0, pos) - group_start,
59 substr(block, pos + 1) - group_start)
61 if ( block == "" ) printf("Group %d is full\n", group)
66 printf("E %s\n", lwtime)
68 awk -f $AWKFILE $
* >$TEMPFILE
71 printf("%%!PS-Adobe\n")
72 printf("%%%%BoundingBox: 0 0 1 1\n")
73 printf("/rect {/y2 exch def /x2 exch def /y1 exch def /x1 exch def\n")
74 printf(" newpath x1 y1 moveto x2 y1 lineto x2 y2 lineto\n")
75 printf(" x1 y2 lineto closepath} def\n")
76 printf("/fb {rect gsave 1.0 setgray fill grestore} def\n")
77 printf("/dg {rect gsave gsave 0.0 setgray fill grestore\n")
78 printf(" 0.5 setgray stroke grestore} def\n")
79 printf("/textxy {moveto show} bind def\n")
80 printf("0.0001 setlinewidth\n")
82 $1 == "GC" && NF == 2 {
84 printf("/Times-Roman findfont %g scalefont setfont\n",
85 1.0 / number_of_groups)
88 $1 == "BC" && NF == 2 {
89 blocks_per_group=$2; next
92 printf("(%s) %g %g textxy\n",
93 substr($0, 2), 0, 1.02)
96 $1 == "G" && NF == 6 && $3 == ":" && $5 == "-" {
100 height=1.0 / number_of_groups
101 vstart=group_index * height
102 printf("%% group %d of %d:\n0 %g 1 %g dg\n",
103 group_index, number_of_groups, vstart, vstart + height)
104 printf("(Group %s) 1.02 %g textxy\n", group_index, vstart)
107 $1 == "FB" && NF == 2 {
109 printf("%% hole %s\n%g %g %g %g fb\n",
110 $2, substr($2, 0, pos) / blocks_per_group, vstart,
111 (substr($2, pos + 1) + 1) / blocks_per_group, vstart + height)
118 awk -f $AWKFILE $TEMPFILE