home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: sysfsana.lys
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 20 6d 69 70 | 6f 73 33 21 69 6e 74 65 |From mip|os3!inte|
|00000010| 6c 63 61 21 6f 6c 69 76 | 65 62 21 61 6d 65 73 21 |lca!oliv|eb!ames!|
|00000020| 6e 65 63 6e 74 63 21 6e | 63 6f 61 73 74 21 61 6c |necntc!n|coast!al|
|00000030| 6c 62 65 72 79 20 53 61 | 74 20 4a 61 6e 20 32 33 |lbery Sa|t Jan 23|
|00000040| 20 31 39 3a 33 36 3a 35 | 36 20 50 53 54 20 31 39 | 19:36:5|6 PST 19|
|00000050| 38 38 0a 41 72 74 69 63 | 6c 65 20 32 35 34 20 6f |88.Artic|le 254 o|
|00000060| 66 20 63 6f 6d 70 2e 73 | 6f 75 72 63 65 73 2e 6d |f comp.s|ources.m|
|00000070| 69 73 63 3a 0a 50 61 74 | 68 3a 20 74 64 32 63 61 |isc:.Pat|h: td2ca|
|00000080| 64 21 6d 69 70 6f 73 33 | 21 69 6e 74 65 6c 63 61 |d!mipos3|!intelca|
|00000090| 21 6f 6c 69 76 65 62 21 | 61 6d 65 73 21 6e 65 63 |!oliveb!|ames!nec|
|000000a0| 6e 74 63 21 6e 63 6f 61 | 73 74 21 61 6c 6c 62 65 |ntc!ncoa|st!allbe|
|000000b0| 72 79 0a 46 72 6f 6d 3a | 20 6d 6a 79 40 73 64 74 |ry.From:| mjy@sdt|
|000000c0| 69 2e 55 55 43 50 20 28 | 4d 69 63 68 61 65 6c 20 |i.UUCP (|Michael |
|000000d0| 4a 2e 20 59 6f 75 6e 67 | 29 0a 4e 65 77 73 67 72 |J. Young|).Newsgr|
|000000e0| 6f 75 70 73 3a 20 63 6f | 6d 70 2e 73 6f 75 72 63 |oups: co|mp.sourc|
|000000f0| 65 73 2e 6d 69 73 63 0a | 53 75 62 6a 65 63 74 3a |es.misc.|Subject:|
|00000100| 20 76 30 32 69 30 30 35 | 3a 20 46 69 6c 65 20 53 | v02i005|: File S|
|00000110| 79 73 74 65 6d 20 41 6e | 61 6c 79 7a 65 72 20 54 |ystem An|alyzer T|
|00000120| 6f 6f 6c 0a 4d 65 73 73 | 61 67 65 2d 49 44 3a 20 |ool.Mess|age-ID: |
|00000130| 3c 37 30 37 39 40 6e 63 | 6f 61 73 74 2e 55 55 43 |<7079@nc|oast.UUC|
|00000140| 50 3e 0a 44 61 74 65 3a | 20 31 35 20 4a 61 6e 20 |P>.Date:| 15 Jan |
|00000150| 38 38 20 30 30 3a 33 31 | 3a 33 36 20 47 4d 54 0a |88 00:31|:36 GMT.|
|00000160| 53 65 6e 64 65 72 3a 20 | 61 6c 6c 62 65 72 79 40 |Sender: |allbery@|
|00000170| 6e 63 6f 61 73 74 2e 55 | 55 43 50 0a 4c 69 6e 65 |ncoast.U|UCP.Line|
|00000180| 73 3a 20 31 32 33 31 0a | 41 70 70 72 6f 76 65 64 |s: 1231.|Approved|
|00000190| 3a 20 61 6c 6c 62 65 72 | 79 40 6e 63 6f 61 73 74 |: allber|y@ncoast|
|000001a0| 2e 55 55 43 50 0a 58 2d | 41 72 63 68 69 76 65 3a |.UUCP.X-|Archive:|
|000001b0| 20 63 6f 6d 70 2e 73 6f | 75 72 63 65 73 2e 6d 69 | comp.so|urces.mi|
|000001c0| 73 63 2f 38 38 30 31 2f | 35 0a 43 6f 6d 70 2e 53 |sc/8801/|5.Comp.S|
|000001d0| 6f 75 72 63 65 73 2e 4d | 69 73 63 3a 20 56 6f 6c |ources.M|isc: Vol|
|000001e0| 75 6d 65 20 32 2c 20 49 | 73 73 75 65 20 35 0a 53 |ume 2, I|ssue 5.S|
|000001f0| 75 62 6d 69 74 74 65 64 | 2d 42 79 3a 20 4d 69 63 |ubmitted|-By: Mic|
|00000200| 68 61 65 6c 20 4a 2e 20 | 59 6f 75 6e 67 20 3c 6d |hael J. |Young <m|
|00000210| 6a 79 40 73 64 74 69 2e | 55 55 43 50 3e 0a 41 72 |jy@sdti.|UUCP>.Ar|
|00000220| 63 68 69 76 65 2d 4e 61 | 6d 65 3a 20 73 79 73 35 |chive-Na|me: sys5|
|00000230| 2d 66 73 2d 61 6e 61 6c | 79 73 69 73 0a 0a 43 6f |-fs-anal|ysis..Co|
|00000240| 6d 70 2e 53 6f 75 72 63 | 65 73 2e 4d 69 73 63 3a |mp.Sourc|es.Misc:|
|00000250| 20 56 6f 6c 75 6d 65 20 | 32 2c 20 49 73 73 75 65 | Volume |2, Issue|
|00000260| 20 35 0a 53 75 62 6d 69 | 74 74 65 64 2d 42 79 3a | 5.Submi|tted-By:|
|00000270| 20 4d 69 63 68 61 65 6c | 20 4a 2e 20 59 6f 75 6e | Michael| J. Youn|
|00000280| 67 20 3c 6d 6a 79 40 73 | 64 74 69 2e 55 55 43 50 |g <mjy@s|dti.UUCP|
|00000290| 3e 0a 41 72 63 68 69 76 | 65 2d 4e 61 6d 65 3a 20 |>.Archiv|e-Name: |
|000002a0| 73 79 73 35 2d 66 73 2d | 61 6e 61 6c 79 73 69 73 |sys5-fs-|analysis|
|000002b0| 0a 0a 49 27 76 65 20 74 | 72 69 65 64 20 70 6f 73 |..I've t|ried pos|
|000002c0| 74 69 6e 67 20 74 68 69 | 73 20 74 6f 20 63 6f 6d |ting thi|s to com|
|000002d0| 70 2e 73 6f 75 72 63 65 | 73 2e 75 6e 69 78 20 61 |p.source|s.unix a|
|000002e0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 74 69 6d 65 73 | number |of times|
|000002f0| 20 28 73 69 6e 63 65 0a | 4f 63 74 6f 62 65 72 21 | (since.|October!|
|00000300| 29 2c 20 62 75 74 20 49 | 20 73 65 65 6d 20 74 6f |), but I| seem to|
|00000310| 20 68 61 76 65 20 64 69 | 73 63 6f 76 65 72 65 64 | have di|scovered|
|00000320| 20 61 20 62 6c 61 63 6b | 20 68 6f 6c 65 20 62 65 | a black| hole be|
|00000330| 74 77 65 65 6e 20 68 65 | 72 65 20 61 6e 64 20 74 |tween he|re and t|
|00000340| 68 61 74 0a 6e 65 77 73 | 67 72 6f 75 70 2e 20 20 |hat.news|group. |
|00000350| 53 69 6e 63 65 20 49 27 | 6d 20 73 74 61 72 74 69 |Since I'|m starti|
|00000360| 6e 67 20 74 6f 20 67 65 | 74 20 67 65 6e 74 6c 65 |ng to ge|t gentle|
|00000370| 20 72 65 6d 69 6e 64 65 | 72 73 20 74 68 61 74 20 | reminde|rs that |
|00000380| 49 27 64 20 70 72 6f 6d | 69 73 65 64 0a 74 68 69 |I'd prom|ised.thi|
|00000390| 73 20 61 77 68 69 6c 65 | 20 61 67 6f 2c 20 49 20 |s awhile| ago, I |
|000003a0| 64 65 63 69 64 65 64 20 | 74 6f 20 70 75 6e 74 20 |decided |to punt |
|000003b0| 61 6e 64 20 74 72 79 20 | 70 6f 73 74 69 6e 67 20 |and try |posting |
|000003c0| 68 65 72 65 2e 0a 0a 54 | 68 69 73 20 69 73 20 61 |here...T|his is a|
|000003d0| 20 74 6f 6f 6c 20 74 68 | 61 74 20 49 20 77 72 6f | tool th|at I wro|
|000003e0| 74 65 20 74 6f 20 64 65 | 74 65 72 6d 69 6e 65 20 |te to de|termine |
|000003f0| 66 69 6c 65 20 73 79 73 | 74 65 6d 20 66 72 61 67 |file sys|tem frag|
|00000400| 6d 65 6e 74 61 74 69 6f | 6e 20 6f 6e 20 6d 79 0a |mentatio|n on my.|
|00000410| 4d 69 63 72 6f 70 6f 72 | 74 20 62 6f 78 2e 20 20 |Micropor|t box. |
|00000420| 49 20 6d 65 6e 74 69 6f | 6e 65 64 20 69 74 20 61 |I mentio|ned it a|
|00000430| 20 66 65 77 20 6d 6f 6e | 74 68 73 20 61 67 6f 20 | few mon|ths ago |
|00000440| 69 6e 20 63 6f 6d 70 2e | 75 6e 69 78 2e 77 69 7a |in comp.|unix.wiz|
|00000450| 61 72 64 73 2c 20 61 6e | 64 0a 67 6f 74 20 61 20 |ards, an|d.got a |
|00000460| 6c 6f 74 20 6f 66 20 72 | 65 71 75 65 73 74 73 20 |lot of r|equests |
|00000470| 66 6f 72 20 74 68 65 20 | 73 6f 75 72 63 65 2e 20 |for the |source. |
|00000480| 20 49 74 27 73 20 6e 6f | 74 20 76 65 72 79 20 65 | It's no|t very e|
|00000490| 6c 65 67 61 6e 74 2c 20 | 61 6e 64 20 69 74 27 73 |legant, |and it's|
|000004a0| 0a 73 70 65 63 69 66 69 | 63 20 74 6f 20 53 79 73 |.specifi|c to Sys|
|000004b0| 74 65 6d 20 56 2c 20 62 | 75 74 20 69 74 27 73 20 |tem V, b|ut it's |
|000004c0| 66 75 6e 63 74 69 6f 6e | 61 6c 2e 0a 0a 49 27 64 |function|al...I'd|
|000004d0| 20 72 65 61 6c 6c 79 20 | 6c 69 6b 65 20 74 6f 20 | really |like to |
|000004e0| 73 65 65 20 69 74 20 70 | 6f 72 74 65 64 20 74 6f |see it p|orted to|
|000004f0| 20 6f 74 68 65 72 20 73 | 79 73 74 65 6d 73 20 28 | other s|ystems (|
|00000500| 49 20 6f 6e 6c 79 20 68 | 61 76 65 20 61 63 63 65 |I only h|ave acce|
|00000510| 73 73 20 74 6f 0a 53 79 | 73 74 65 6d 20 56 29 2e |ss to.Sy|stem V).|
|00000520| 20 20 49 66 20 61 6e 79 | 6f 6e 65 20 68 61 73 20 | If any|one has |
|00000530| 6c 6f 74 73 20 6f 66 20 | 73 70 61 72 65 20 74 69 |lots of |spare ti|
|00000540| 6d 65 28 21 29 20 20 61 | 6e 64 20 77 61 6e 74 73 |me(!) a|nd wants|
|00000550| 20 74 6f 20 70 6f 72 74 | 20 69 74 2c 20 74 68 65 | to port| it, the|
|00000560| 72 65 0a 61 72 65 20 73 | 6f 6d 65 20 6e 6f 74 65 |re.are s|ome note|
|00000570| 73 20 69 6e 20 74 68 65 | 20 52 45 41 44 4d 45 20 |s in the| README |
|00000580| 66 69 6c 65 20 66 6f 72 | 20 74 68 69 6e 67 73 20 |file for| things |
|00000590| 74 6f 20 77 61 74 63 68 | 20 6f 75 74 20 66 6f 72 |to watch| out for|
|000005a0| 2e 20 20 50 6c 65 61 73 | 65 20 73 65 6e 64 0a 6d |. Pleas|e send.m|
|000005b0| 65 20 79 6f 75 72 20 63 | 68 61 6e 67 65 73 20 73 |e your c|hanges s|
|000005c0| 6f 20 49 20 63 61 6e 20 | 69 6e 63 6f 72 70 6f 72 |o I can |incorpor|
|000005d0| 61 74 65 20 74 68 65 6d | 20 69 6e 74 6f 20 6d 79 |ate them| into my|
|000005e0| 20 76 65 72 73 69 6f 6e | 2e 20 20 49 66 20 79 6f | version|. If yo|
|000005f0| 75 20 61 72 65 0a 72 65 | 61 6c 6c 79 20 62 6f 72 |u are.re|ally bor|
|00000600| 65 64 2c 20 66 65 65 6c | 20 66 72 65 65 20 74 6f |ed, feel| free to|
|00000610| 20 61 64 64 20 61 6e 20 | 69 6e 2d 70 6c 61 63 65 | add an |in-place|
|00000620| 20 64 69 73 6b 2d 63 6f | 6d 70 72 65 73 73 69 6f | disk-co|mpressio|
|00000630| 6e 20 63 61 70 61 62 69 | 6c 69 74 79 21 20 3a 2d |n capabi|lity! :-|
|00000640| 29 0a 0a 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |)..-----|--------|
|00000650| 2d 2d 2d 2d 2d 2d 2d 2d | 20 63 75 74 20 68 65 72 |--------| cut her|
|00000660| 65 20 2d 2d 2d 2d 2d 2d | 2d 2d 20 63 75 74 20 68 |e ------|-- cut h|
|00000670| 65 72 65 20 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |ere ----|--------|
|00000680| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0a 23 |--------|------.#|
|00000690| 21 20 2f 62 69 6e 2f 73 | 68 0a 23 20 54 68 69 73 |! /bin/s|h.# This|
|000006a0| 20 69 73 20 61 20 73 68 | 65 6c 6c 20 61 72 63 68 | is a sh|ell arch|
|000006b0| 69 76 65 2e 20 20 52 65 | 6d 6f 76 65 20 61 6e 79 |ive. Re|move any|
|000006c0| 74 68 69 6e 67 20 62 65 | 66 6f 72 65 20 74 68 69 |thing be|fore thi|
|000006d0| 73 20 6c 69 6e 65 2c 20 | 74 68 65 6e 20 75 6e 70 |s line, |then unp|
|000006e0| 61 63 6b 0a 23 20 69 74 | 20 62 79 20 73 61 76 69 |ack.# it| by savi|
|000006f0| 6e 67 20 69 74 20 69 6e | 74 6f 20 61 20 66 69 6c |ng it in|to a fil|
|00000700| 65 20 61 6e 64 20 74 79 | 70 69 6e 67 20 22 73 68 |e and ty|ping "sh|
|00000710| 20 66 69 6c 65 22 2e 20 | 20 54 6f 20 6f 76 65 72 | file". | To over|
|00000720| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 0a 23 |write ex|isting.#|
|00000730| 20 66 69 6c 65 73 2c 20 | 74 79 70 65 20 22 73 68 | files, |type "sh|
|00000740| 20 66 69 6c 65 20 2d 63 | 22 2e 20 20 59 6f 75 20 | file -c|". You |
|00000750| 63 61 6e 20 61 6c 73 6f | 20 66 65 65 64 20 74 68 |can also| feed th|
|00000760| 69 73 20 61 73 20 73 74 | 61 6e 64 61 72 64 20 69 |is as st|andard i|
|00000770| 6e 70 75 74 20 76 69 61 | 0a 23 20 75 6e 73 68 61 |nput via|.# unsha|
|00000780| 72 2c 20 6f 72 20 62 79 | 20 74 79 70 69 6e 67 20 |r, or by| typing |
|00000790| 22 73 68 20 3c 66 69 6c | 65 22 2c 20 65 2e 67 2e |"sh <fil|e", e.g.|
|000007a0| 2e 20 20 49 66 20 74 68 | 69 73 20 61 72 63 68 69 |. If th|is archi|
|000007b0| 76 65 20 69 73 20 63 6f | 6d 70 6c 65 74 65 2c 20 |ve is co|mplete, |
|000007c0| 79 6f 75 0a 23 20 77 69 | 6c 6c 20 73 65 65 20 74 |you.# wi|ll see t|
|000007d0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6d 65 73 |he follo|wing mes|
|000007e0| 73 61 67 65 20 61 74 20 | 74 68 65 20 65 6e 64 3a |sage at |the end:|
|000007f0| 0a 23 09 09 22 45 6e 64 | 20 6f 66 20 61 72 63 68 |.#.."End| of arch|
|00000800| 69 76 65 20 31 20 28 6f | 66 20 31 29 2e 22 0a 23 |ive 1 (o|f 1).".#|
|00000810| 20 43 6f 6e 74 65 6e 74 | 73 3a 20 20 52 45 41 44 | Content|s: READ|
|00000820| 4d 45 20 66 73 61 6e 61 | 6c 79 7a 65 2e 38 20 66 |ME fsana|lyze.8 f|
|00000830| 73 61 6e 61 6c 79 7a 65 | 2e 63 0a 23 20 57 72 61 |sanalyze|.c.# Wra|
|00000840| 70 70 65 64 20 62 79 20 | 6d 6a 79 40 73 64 74 69 |pped by |mjy@sdti|
|00000850| 20 6f 6e 20 54 68 75 20 | 4a 61 6e 20 20 37 20 31 | on Thu |Jan 7 1|
|00000860| 35 3a 34 36 3a 30 31 20 | 31 39 38 38 0a 50 41 54 |5:46:01 |1988.PAT|
|00000870| 48 3d 2f 62 69 6e 3a 2f | 75 73 72 2f 62 69 6e 3a |H=/bin:/|usr/bin:|
|00000880| 2f 75 73 72 2f 75 63 62 | 20 3b 20 65 78 70 6f 72 |/usr/ucb| ; expor|
|00000890| 74 20 50 41 54 48 0a 69 | 66 20 74 65 73 74 20 2d |t PATH.i|f test -|
|000008a0| 66 20 52 45 41 44 4d 45 | 20 2d 61 20 22 24 7b 31 |f README| -a "${1|
|000008b0| 7d 22 20 21 3d 20 22 2d | 63 22 20 3b 20 74 68 65 |}" != "-|c" ; the|
|000008c0| 6e 20 0a 20 20 65 63 68 | 6f 20 73 68 61 72 3a 20 |n . ech|o shar: |
|000008d0| 57 69 6c 6c 20 6e 6f 74 | 20 6f 76 65 72 2d 77 72 |Will not| over-wr|
|000008e0| 69 74 65 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ite exis|ting fil|
|000008f0| 65 20 5c 22 52 45 41 44 | 4d 45 5c 22 0a 65 6c 73 |e \"READ|ME\".els|
|00000900| 65 0a 65 63 68 6f 20 73 | 68 61 72 3a 20 45 78 74 |e.echo s|har: Ext|
|00000910| 72 61 63 74 69 6e 67 20 | 5c 22 52 45 41 44 4d 45 |racting |\"README|
|00000920| 5c 22 20 5c 28 37 39 31 | 35 20 63 68 61 72 61 63 |\" \(791|5 charac|
|00000930| 74 65 72 73 5c 29 0a 73 | 65 64 20 22 73 2f 5e 58 |ters\).s|ed "s/^X|
|00000940| 2f 2f 22 20 3e 52 45 41 | 44 4d 45 20 3c 3c 27 45 |//" >REA|DME <<'E|
|00000950| 4e 44 5f 4f 46 5f 52 45 | 41 44 4d 45 27 0a 58 46 |ND_OF_RE|ADME'.XF|
|00000960| 53 41 4e 41 4c 59 5a 45 | 20 2d 20 53 79 73 74 65 |SANALYZE| - Syste|
|00000970| 6d 20 56 20 46 69 6c 65 | 20 53 79 73 74 65 6d 20 |m V File| System |
|00000980| 41 6e 61 6c 79 7a 65 72 | 20 74 6f 6f 6c 20 2d 20 |Analyzer| tool - |
|00000990| 76 32 2e 30 34 2c 20 37 | 20 4a 61 6e 75 61 72 61 |v2.04, 7| Januara|
|000009a0| 79 20 31 39 38 38 0a 58 | 0a 58 41 75 74 68 6f 72 |y 1988.X|.XAuthor|
|000009b0| 20 20 20 3a 20 4d 69 63 | 68 61 65 6c 20 4a 2e 20 | : Mic|hael J. |
|000009c0| 59 6f 75 6e 67 0a 58 55 | 53 6d 61 69 6c 20 20 20 |Young.XU|Smail |
|000009d0| 3a 20 53 6f 66 74 77 61 | 72 65 20 44 65 76 65 6c |: Softwa|re Devel|
|000009e0| 6f 70 6d 65 6e 74 20 54 | 65 63 68 6e 6f 6c 6f 67 |opment T|echnolog|
|000009f0| 69 65 73 2c 20 49 6e 63 | 2e 0a 58 20 20 20 20 20 |ies, Inc|..X |
|00000a00| 20 20 20 20 20 20 33 37 | 35 20 44 75 74 74 6f 6e | 37|5 Dutton|
|00000a10| 20 52 64 0a 58 20 20 20 | 20 20 20 20 20 20 20 20 | Rd.X | |
|00000a20| 53 75 64 62 75 72 79 20 | 4d 41 20 20 30 31 37 37 |Sudbury |MA 0177|
|00000a30| 36 0a 58 55 55 43 50 20 | 20 20 20 20 3a 20 7b 64 |6.XUUCP | : {d|
|00000a40| 65 63 76 61 78 7c 68 61 | 72 76 61 72 64 7c 6c 69 |ecvax|ha|rvard|li|
|00000a50| 6e 75 73 7c 6d 69 74 2d | 65 64 64 69 65 7d 21 6e |nus|mit-|eddie}!n|
|00000a60| 65 63 6e 74 63 21 6e 65 | 63 69 73 21 6d 72 73 74 |ecntc!ne|cis!mrst|
|00000a70| 21 73 64 74 69 21 6d 6a | 79 0a 58 49 6e 74 65 72 |!sdti!mj|y.XInter|
|00000a80| 6e 65 74 20 3a 20 6d 6a | 79 25 73 64 74 69 2e 75 |net : mj|y%sdti.u|
|00000a90| 75 63 70 40 68 61 72 76 | 61 72 64 2e 68 61 72 76 |ucp@harv|ard.harv|
|00000aa0| 61 72 64 2e 65 64 75 0a | 58 0a 58 20 20 20 3d 3d |ard.edu.|X.X ==|
|00000ab0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000ac0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000ad0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000ae0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000af0| 3d 3d 3d 3d 3d 3d 3d 0a | 58 20 20 20 4e 6f 74 65 |=======.|X Note|
|00000b00| 20 3a 20 54 68 69 73 20 | 70 72 6f 67 72 61 6d 20 | : This |program |
|00000b10| 68 61 73 20 62 65 65 6e | 20 70 6c 61 63 65 64 20 |has been| placed |
|00000b20| 69 6e 20 74 68 65 20 70 | 75 62 6c 69 63 20 64 6f |in the p|ublic do|
|00000b30| 6d 61 69 6e 20 74 6f 20 | 70 65 72 6d 69 74 0a 58 |main to |permit.X|
|00000b40| 20 20 20 75 6e 72 65 73 | 74 72 69 63 74 65 64 20 | unres|tricted |
|00000b50| 64 69 73 74 72 69 62 75 | 74 69 6f 6e 20 61 6e 64 |distribu|tion and|
|00000b60| 20 75 73 65 2e 20 20 49 | 20 68 61 76 65 20 70 6c | use. I| have pl|
|00000b70| 61 63 65 64 20 6e 6f 20 | 63 6f 70 79 72 69 67 68 |aced no |copyrigh|
|00000b80| 74 20 6f 6e 20 69 74 2c | 20 62 75 74 0a 58 20 20 |t on it,| but.X |
|00000b90| 20 49 20 72 65 71 75 65 | 73 74 20 74 68 61 74 20 | I reque|st that |
|00000ba0| 79 6f 75 20 6b 65 65 70 | 20 6d 65 20 69 6e 66 6f |you keep| me info|
|00000bb0| 72 6d 65 64 20 61 62 6f | 75 74 20 61 6e 79 20 65 |rmed abo|ut any e|
|00000bc0| 6e 68 61 6e 63 65 6d 65 | 6e 74 73 20 61 6e 64 20 |nhanceme|nts and |
|00000bd0| 62 75 67 20 66 69 78 65 | 73 0a 58 20 20 20 79 6f |bug fixe|s.X yo|
|00000be0| 75 20 6d 61 6b 65 20 73 | 6f 20 49 20 63 61 6e 20 |u make s|o I can |
|00000bf0| 6b 65 65 70 20 61 6e 20 | 75 70 2d 74 6f 2d 64 61 |keep an |up-to-da|
|00000c00| 74 65 20 63 6f 70 79 20 | 66 6f 72 20 66 75 72 74 |te copy |for furt|
|00000c10| 68 65 72 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e |her dist|ribution|
|00000c20| 2e 0a 58 20 20 20 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |..X ==|========|
|00000c30| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c40| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c50| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c60| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 0a |========|=======.|
|00000c70| 58 0a 58 20 20 20 46 73 | 61 6e 61 6c 79 7a 65 20 |X.X Fs|analyze |
|00000c80| 69 73 20 61 20 73 69 6d | 70 6c 65 20 74 6f 6f 6c |is a sim|ple tool|
|00000c90| 20 74 68 61 74 20 65 73 | 74 69 6d 61 74 65 73 20 | that es|timates |
|00000ca0| 66 69 6c 65 20 73 79 73 | 74 65 6d 20 66 72 61 67 |file sys|tem frag|
|00000cb0| 6d 65 6e 74 61 74 69 6f | 6e 2e 20 20 49 74 0a 58 |mentatio|n. It.X|
|00000cc0| 20 20 20 61 63 63 6f 6d | 70 6c 69 73 68 65 73 20 | accom|plishes |
|00000cd0| 74 68 69 73 20 62 79 20 | 73 63 61 6e 6e 69 6e 67 |this by |scanning|
|00000ce0| 20 74 68 65 20 64 61 74 | 61 20 62 6c 6f 63 6b 73 | the dat|a blocks|
|00000cf0| 20 66 6f 72 20 65 61 63 | 68 20 69 2d 6e 6f 64 65 | for eac|h i-node|
|00000d00| 20 69 6e 20 74 68 65 20 | 0a 58 20 20 20 66 69 6c | in the |.X fil|
|00000d10| 65 20 73 79 73 74 65 6d | 2c 20 6c 6f 6f 6b 69 6e |e system|, lookin|
|00000d20| 67 20 66 6f 72 20 62 6c | 6f 63 6b 20 6e 75 6d 62 |g for bl|ock numb|
|00000d30| 65 72 73 20 74 68 61 74 | 20 61 72 65 20 6f 75 74 |ers that| are out|
|00000d40| 20 6f 66 20 73 65 71 75 | 65 6e 63 65 2e 20 20 49 | of sequ|ence. I|
|00000d50| 6e 0a 58 20 20 20 65 66 | 66 65 63 74 2c 20 69 74 |n.X ef|fect, it|
|00000d60| 20 69 73 20 63 6f 75 6e | 74 69 6e 67 20 74 68 65 | is coun|ting the|
|00000d70| 20 6e 75 6d 62 65 72 20 | 6f 66 20 64 69 73 6b 20 | number |of disk |
|00000d80| 73 65 65 6b 73 20 72 65 | 71 75 69 72 65 64 20 74 |seeks re|quired t|
|00000d90| 6f 20 72 65 61 64 20 74 | 68 65 0a 58 20 20 20 65 |o read t|he.X e|
|00000da0| 6e 74 69 72 65 20 66 69 | 6c 65 20 69 6e 20 73 65 |ntire fi|le in se|
|00000db0| 71 75 65 6e 63 65 2e 20 | 20 46 72 61 67 6d 65 6e |quence. | Fragmen|
|00000dc0| 74 61 74 69 6f 6e 20 69 | 73 20 74 68 65 6e 20 63 |tation i|s then c|
|00000dd0| 6f 6d 70 75 74 65 64 20 | 61 73 20 74 68 65 20 72 |omputed |as the r|
|00000de0| 61 74 69 6f 0a 58 20 20 | 20 6f 66 20 61 63 74 75 |atio.X | of actu|
|00000df0| 61 6c 20 22 73 65 65 6b | 73 22 20 74 6f 20 74 68 |al "seek|s" to th|
|00000e00| 65 20 70 6f 74 65 6e 74 | 69 61 6c 20 6e 75 6d 62 |e potent|ial numb|
|00000e10| 65 72 20 6f 66 20 22 73 | 65 65 6b 73 22 20 69 66 |er of "s|eeks" if|
|00000e20| 20 74 68 65 20 66 69 6c | 65 20 77 65 72 65 0a 58 | the fil|e were.X|
|00000e30| 20 20 20 63 6f 6d 70 6c | 65 74 65 6c 79 20 66 72 | compl|etely fr|
|00000e40| 61 67 6d 65 6e 74 65 64 | 2e 0a 58 0a 58 20 20 20 |agmented|..X.X |
|00000e50| 46 73 61 6e 61 6c 79 7a | 65 20 61 6c 73 6f 20 70 |Fsanalyz|e also p|
|00000e60| 72 6f 76 69 64 65 73 20 | 73 74 61 74 69 73 74 69 |rovides |statisti|
|00000e70| 63 73 20 72 65 67 61 72 | 64 69 6e 67 20 74 68 65 |cs regar|ding the|
|00000e80| 20 6e 75 6d 62 65 72 20 | 28 61 6e 64 20 69 64 65 | number |(and ide|
|00000e90| 6e 74 69 74 79 29 20 6f | 66 0a 58 20 20 20 66 69 |ntity) o|f.X fi|
|00000ea0| 6c 65 73 20 74 68 61 74 | 20 61 72 65 20 76 65 72 |les that| are ver|
|00000eb0| 79 20 6c 61 72 67 65 2c | 20 61 6e 64 20 65 78 63 |y large,| and exc|
|00000ec0| 65 73 73 69 76 65 6c 79 | 20 6c 61 72 67 65 20 64 |essively| large d|
|00000ed0| 69 72 65 63 74 6f 72 69 | 65 73 2e 0a 58 20 20 20 |irectori|es..X |
|00000ee0| 0a 58 20 20 20 45 78 63 | 65 73 73 69 76 65 6c 79 |.X Exc|essively|
|00000ef0| 20 6c 61 72 67 65 20 64 | 69 72 65 63 74 6f 72 69 | large d|irectori|
|00000f00| 65 73 20 61 72 65 20 64 | 69 72 65 63 74 6f 72 69 |es are d|irectori|
|00000f10| 65 73 20 74 68 61 74 20 | 61 72 65 20 6f 76 65 72 |es that |are over|
|00000f20| 20 35 31 32 30 20 62 79 | 74 65 73 0a 58 20 20 20 | 5120 by|tes.X |
|00000f30| 6c 6f 6e 67 20 28 33 32 | 30 20 65 6e 74 72 69 65 |long (32|0 entrie|
|00000f40| 73 29 2e 20 20 44 69 72 | 65 63 74 6f 72 69 65 73 |s). Dir|ectories|
|00000f50| 20 6c 61 72 67 65 72 20 | 74 68 61 6e 20 74 68 69 | larger |than thi|
|00000f60| 73 20 72 65 71 75 69 72 | 65 20 64 61 74 61 20 62 |s requir|e data b|
|00000f70| 6c 6f 63 6b 0a 58 20 20 | 20 69 6e 64 69 72 65 63 |lock.X | indirec|
|00000f80| 74 69 6f 6e 2c 20 6d 61 | 6b 69 6e 67 20 66 69 6c |tion, ma|king fil|
|00000f90| 65 20 73 65 61 72 63 68 | 65 73 20 76 65 72 79 20 |e search|es very |
|00000fa0| 69 6e 65 66 66 69 63 69 | 65 6e 74 2e 0a 58 0a 58 |ineffici|ent..X.X|
|00000fb0| 20 20 20 41 66 74 65 72 | 20 74 68 65 20 67 65 6e | After| the gen|
|00000fc0| 65 72 61 6c 20 66 69 6c | 65 20 73 79 73 74 65 6d |eral fil|e system|
|00000fd0| 20 73 74 61 74 69 73 74 | 69 63 73 20 61 72 65 20 | statist|ics are |
|00000fe0| 64 69 73 70 6c 61 79 65 | 64 2c 20 66 73 61 6e 61 |displaye|d, fsana|
|00000ff0| 6c 79 7a 65 20 6c 69 73 | 74 73 0a 58 20 20 20 74 |lyze lis|ts.X t|
|00001000| 68 65 20 31 30 20 6d 6f | 73 74 20 66 72 61 67 6d |he 10 mo|st fragm|
|00001010| 65 6e 74 65 64 20 69 2d | 6e 6f 64 65 73 20 69 6e |ented i-|nodes in|
|00001020| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00001030| 2e 20 20 0a 58 20 20 20 | 54 68 65 20 31 30 20 6d |. .X |The 10 m|
|00001040| 6f 73 74 20 66 72 61 67 | 6d 65 6e 74 65 64 20 66 |ost frag|mented f|
|00001050| 69 6c 65 73 20 61 72 65 | 20 6c 69 73 74 65 64 20 |iles are| listed |
|00001060| 69 6e 20 64 65 63 72 65 | 61 73 69 6e 67 20 6f 72 |in decre|asing or|
|00001070| 64 65 72 20 6f 66 20 0a | 58 20 20 20 66 72 61 67 |der of .|X frag|
|00001080| 6d 65 6e 74 61 74 69 6f | 6e 20 62 61 73 65 64 20 |mentatio|n based |
|00001090| 6f 6e 20 74 68 65 20 61 | 62 73 6f 6c 75 74 65 20 |on the a|bsolute |
|000010a0| 6e 75 6d 62 65 72 20 6f | 66 20 66 72 61 67 6d 65 |number o|f fragme|
|000010b0| 6e 74 73 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |nts. Fo|r exampl|
|000010c0| 65 2c 0a 58 20 20 20 61 | 20 31 30 30 2d 62 6c 6f |e,.X a| 100-blo|
|000010d0| 63 6b 20 66 69 6c 65 20 | 74 68 61 74 20 63 6f 6e |ck file |that con|
|000010e0| 74 61 69 6e 73 20 34 30 | 20 69 6e 64 69 76 69 64 |tains 40| individ|
|000010f0| 75 61 6c 20 66 72 61 67 | 6d 65 6e 74 73 20 69 73 |ual frag|ments is|
|00001100| 20 33 39 2e 33 39 25 0a | 58 20 20 20 66 72 61 67 | 39.39%.|X frag|
|00001110| 6d 65 6e 74 65 64 20 28 | 33 39 20 73 65 65 6b 73 |mented (|39 seeks|
|00001120| 20 2f 20 39 39 20 70 6f | 74 65 6e 74 69 61 6c 20 | / 99 po|tential |
|00001130| 73 65 65 6b 73 29 2c 20 | 62 75 74 20 69 73 20 6c |seeks), |but is l|
|00001140| 69 73 74 65 64 20 62 65 | 66 6f 72 65 0a 58 20 20 |isted be|fore.X |
|00001150| 20 61 20 32 2d 62 6c 6f | 63 6b 20 66 69 6c 65 20 | a 2-blo|ck file |
|00001160| 74 68 61 74 20 63 6f 6e | 74 61 69 6e 73 20 32 20 |that con|tains 2 |
|00001170| 66 72 61 67 6d 65 6e 74 | 73 20 28 31 30 30 25 20 |fragment|s (100% |
|00001180| 66 72 61 67 6d 65 6e 74 | 65 64 29 2e 20 20 54 68 |fragment|ed). Th|
|00001190| 75 73 2c 20 6c 61 72 67 | 65 72 0a 58 20 20 20 66 |us, larg|er.X f|
|000011a0| 72 61 67 6d 65 6e 74 65 | 64 20 66 69 6c 65 73 20 |ragmente|d files |
|000011b0| 28 77 68 69 63 68 20 68 | 61 76 65 20 61 20 67 72 |(which h|ave a gr|
|000011c0| 65 61 74 65 72 20 65 66 | 66 65 63 74 20 6f 6e 20 |eater ef|fect on |
|000011d0| 66 69 6c 65 20 73 79 73 | 74 65 6d 20 70 65 72 66 |file sys|tem perf|
|000011e0| 6f 72 6d 61 6e 63 65 29 | 0a 58 20 20 20 61 72 65 |ormance)|.X are|
|000011f0| 20 6c 69 73 74 65 64 20 | 62 65 66 6f 72 65 20 73 | listed |before s|
|00001200| 6d 61 6c 6c 20 66 69 6c | 65 73 2e 0a 58 0a 58 52 |mall fil|es..X.XR|
|00001210| 65 76 69 73 69 6f 6e 20 | 48 69 73 74 6f 72 79 3a |evision |History:|
|00001220| 0a 58 0a 58 20 20 20 56 | 65 72 73 69 6f 6e 20 32 |.X.X V|ersion 2|
|00001230| 2e 30 20 69 73 20 61 20 | 6d 61 6a 6f 72 20 72 65 |.0 is a |major re|
|00001240| 77 72 69 74 65 20 6f 66 | 20 66 73 61 6e 61 6c 79 |write of| fsanaly|
|00001250| 7a 65 20 74 68 61 74 20 | 61 64 64 73 20 74 68 65 |ze that |adds the|
|00001260| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6e 65 77 0a 58 | followi|ng new.X|
|00001270| 20 20 20 66 65 61 74 75 | 72 65 73 3a 0a 58 20 20 | featu|res:.X |
|00001280| 20 20 20 20 20 2d 20 54 | 68 65 20 61 62 69 6c 69 | - T|he abili|
|00001290| 74 79 20 74 6f 20 61 6e | 61 6c 79 7a 65 20 69 6e |ty to an|alyze in|
|000012a0| 64 69 76 69 64 75 61 6c | 20 66 69 6c 65 73 0a 58 |dividual| files.X|
|000012b0| 20 20 20 20 20 20 20 2d | 20 44 69 73 70 6c 61 79 | -| Display|
|000012c0| 20 6f 66 20 74 68 65 20 | 31 30 20 6d 6f 73 74 20 | of the |10 most |
|000012d0| 66 72 61 67 6d 65 6e 74 | 65 64 20 66 69 6c 65 73 |fragment|ed files|
|000012e0| 20 69 6e 20 61 20 66 69 | 6c 65 20 73 79 73 74 65 | in a fi|le syste|
|000012f0| 6d 0a 58 20 20 20 20 20 | 20 20 2d 20 45 6e 68 61 |m.X | - Enha|
|00001300| 6e 63 65 64 20 65 72 72 | 6f 72 20 63 68 65 63 6b |nced err|or check|
|00001310| 69 6e 67 20 6f 6e 20 74 | 68 65 20 66 69 6c 65 20 |ing on t|he file |
|00001320| 73 79 73 74 65 6d 20 61 | 72 67 75 6d 65 6e 74 0a |system a|rgument.|
|00001330| 58 0a 58 20 20 20 56 65 | 72 73 69 6f 6e 20 32 2e |X.X Ve|rsion 2.|
|00001340| 30 31 20 63 6f 6e 74 61 | 69 6e 73 20 61 20 6d 69 |01 conta|ins a mi|
|00001350| 6e 6f 72 20 6d 6f 64 69 | 66 69 63 61 74 69 6f 6e |nor modi|fication|
|00001360| 20 69 6e 20 77 68 69 63 | 68 20 66 73 61 6e 61 6c | in whic|h fsanal|
|00001370| 79 7a 65 20 65 78 65 63 | 75 74 65 73 0a 58 20 20 |yze exec|utes.X |
|00001380| 20 2f 65 74 63 2f 66 73 | 73 74 61 74 20 74 6f 20 | /etc/fs|stat to |
|00001390| 64 65 74 65 72 6d 69 6e | 65 20 74 68 65 20 68 65 |determin|e the he|
|000013a0| 61 6c 74 68 20 6f 66 20 | 74 68 65 20 66 69 6c 65 |alth of |the file|
|000013b0| 20 73 79 73 74 65 6d 20 | 62 65 66 6f 72 65 20 61 | system |before a|
|000013c0| 6e 61 6c 79 7a 69 6e 67 | 0a 58 20 20 20 69 74 2e |nalyzing|.X it.|
|000013d0| 0a 58 0a 58 20 20 20 56 | 65 72 73 69 6f 6e 20 32 |.X.X V|ersion 2|
|000013e0| 2e 30 32 20 63 6f 6e 74 | 61 69 6e 73 20 61 20 6d |.02 cont|ains a m|
|000013f0| 69 6e 6f 72 20 6d 6f 64 | 69 66 69 63 61 74 69 6f |inor mod|ificatio|
|00001400| 6e 20 74 6f 20 70 72 69 | 6e 74 20 6f 75 74 20 61 |n to pri|nt out a|
|00001410| 20 77 61 72 6e 69 6e 67 | 20 6d 65 73 73 61 67 65 | warning| message|
|00001420| 0a 58 20 20 20 69 66 20 | 74 68 65 20 66 69 6c 65 |.X if |the file|
|00001430| 20 73 79 73 74 65 6d 20 | 62 65 69 6e 67 20 61 6e | system |being an|
|00001440| 61 6c 79 7a 65 64 20 69 | 73 20 63 75 72 72 65 6e |alyzed i|s curren|
|00001450| 74 6c 79 20 6d 6f 75 6e | 74 65 64 2e 0a 58 0a 58 |tly moun|ted..X.X|
|00001460| 20 20 20 56 65 72 73 69 | 6f 6e 20 32 2e 30 33 20 | Versi|on 2.03 |
|00001470| 63 6f 6e 74 61 69 6e 73 | 20 61 20 66 69 78 20 66 |contains| a fix f|
|00001480| 6f 72 20 61 20 6d 69 6e | 6f 72 20 62 75 67 20 69 |or a min|or bug i|
|00001490| 6e 20 77 68 69 63 68 20 | 74 68 65 20 73 69 7a 65 |n which |the size|
|000014a0| 20 6f 66 20 74 68 65 0a | 58 20 20 20 76 6f 6c 75 | of the.|X volu|
|000014b0| 6d 65 20 64 61 74 61 20 | 62 6c 6f 63 6b 20 73 69 |me data |block si|
|000014c0| 7a 65 20 77 6f 75 6c 64 | 20 62 65 20 70 72 69 6e |ze would| be prin|
|000014d0| 74 65 64 20 6f 75 74 20 | 69 6e 63 6f 72 72 65 63 |ted out |incorrec|
|000014e0| 74 6c 79 20 66 6f 72 20 | 6c 61 72 67 65 0a 58 20 |tly for |large.X |
|000014f0| 20 20 66 69 6c 65 20 73 | 79 73 74 65 6d 73 2e 0a | file s|ystems..|
|00001500| 58 0a 58 20 20 20 56 65 | 72 73 69 6f 6e 20 32 2e |X.X Ve|rsion 2.|
|00001510| 30 34 20 69 6e 63 6f 72 | 70 6f 72 61 74 65 73 20 |04 incor|porates |
|00001520| 74 68 65 20 6c 69 62 72 | 61 72 79 20 66 75 6e 63 |the libr|ary func|
|00001530| 74 69 6f 6e 20 6c 33 74 | 6f 6c 20 74 6f 20 61 63 |tion l3t|ol to ac|
|00001540| 63 65 73 73 20 69 6e 6f | 64 65 0a 58 20 20 20 62 |cess ino|de.X b|
|00001550| 6c 6f 63 6b 20 6e 75 6d | 62 65 72 73 2e 0a 58 0a |lock num|bers..X.|
|00001560| 58 49 6e 73 74 61 6c 6c | 61 74 69 6f 6e 3a 0a 58 |XInstall|ation:.X|
|00001570| 0a 58 20 20 20 54 68 69 | 73 20 70 72 6f 67 72 61 |.X Thi|s progra|
|00001580| 6d 20 69 73 20 73 6f 20 | 73 69 6d 70 6c 65 20 74 |m is so |simple t|
|00001590| 68 61 74 20 49 20 64 69 | 64 6e 27 74 20 62 6f 74 |hat I di|dn't bot|
|000015a0| 68 65 72 20 74 6f 20 63 | 72 65 61 74 65 20 61 20 |her to c|reate a |
|000015b0| 4d 61 6b 65 66 69 6c 65 | 2e 20 20 54 6f 0a 58 20 |Makefile|. To.X |
|000015c0| 20 20 62 75 69 6c 64 20 | 66 73 61 6e 61 6c 79 7a | build |fsanalyz|
|000015d0| 65 20 74 68 65 20 73 74 | 65 70 73 20 61 72 65 3a |e the st|eps are:|
|000015e0| 0a 58 20 20 20 20 20 20 | 63 63 20 2d 4f 20 2d 6f |.X |cc -O -o|
|000015f0| 20 66 73 61 6e 61 6c 79 | 7a 65 20 66 73 61 6e 61 | fsanaly|ze fsana|
|00001600| 6c 79 7a 65 2e 63 0a 58 | 20 20 20 20 20 20 6d 76 |lyze.c.X| mv|
|00001610| 20 66 73 61 6e 61 6c 79 | 7a 65 20 2f 62 69 6e 0a | fsanaly|ze /bin.|
|00001620| 58 20 20 20 57 68 65 72 | 65 20 66 73 61 6e 61 6c |X Wher|e fsanal|
|00001630| 79 7a 65 20 69 73 20 69 | 6e 73 74 61 6c 6c 65 64 |yze is i|nstalled|
|00001640| 20 64 6f 65 73 6e 27 74 | 20 72 65 61 6c 6c 79 20 | doesn't| really |
|00001650| 6d 61 74 74 65 72 2c 20 | 62 75 74 20 49 20 77 6f |matter, |but I wo|
|00001660| 75 6c 64 20 72 65 63 6f | 6d 6d 65 6e 64 0a 58 20 |uld reco|mmend.X |
|00001670| 20 20 70 6c 61 63 69 6e | 67 20 69 74 20 73 6f 6d | placin|g it som|
|00001680| 65 77 68 65 72 65 20 69 | 6e 20 74 68 65 20 72 6f |ewhere i|n the ro|
|00001690| 6f 74 20 66 69 6c 65 73 | 79 73 74 65 6d 2c 20 77 |ot files|ystem, w|
|000016a0| 68 69 63 68 20 69 73 20 | 61 6c 77 61 79 73 20 6d |hich is |always m|
|000016b0| 6f 75 6e 74 65 64 2e 20 | 20 49 0a 58 20 20 20 74 |ounted. | I.X t|
|000016c0| 79 70 69 63 61 6c 6c 79 | 20 72 75 6e 20 66 73 61 |ypically| run fsa|
|000016d0| 6e 61 6c 79 7a 65 20 64 | 75 72 69 6e 67 20 6d 79 |nalyze d|uring my|
|000016e0| 20 62 61 63 6b 75 70 20 | 70 72 6f 63 65 64 75 72 | backup |procedur|
|000016f0| 65 2c 20 77 68 69 6c 65 | 20 6d 79 20 6f 74 68 65 |e, while| my othe|
|00001700| 72 0a 58 20 20 20 66 69 | 6c 65 73 79 73 74 65 6d |r.X fi|lesystem|
|00001710| 73 20 61 72 65 20 75 6e | 6d 6f 75 6e 74 65 64 2e |s are un|mounted.|
|00001720| 0a 58 0a 58 55 73 61 67 | 65 3a 0a 58 20 20 20 66 |.X.XUsag|e:.X f|
|00001730| 73 61 6e 61 6c 79 7a 65 | 20 5b 2d 66 6c 61 67 73 |sanalyze| [-flags|
|00001740| 5d 20 73 70 65 63 69 61 | 6c 20 5b 66 69 6c 65 20 |] specia|l [file |
|00001750| 5b 2e 2e 2e 5d 5d 0a 58 | 0a 58 20 20 20 49 66 20 |[...]].X|.X If |
|00001760| 74 68 65 20 6f 70 74 69 | 6f 6e 61 6c 20 66 69 6c |the opti|onal fil|
|00001770| 65 6e 61 6d 65 20 61 72 | 67 75 6d 65 6e 74 73 20 |ename ar|guments |
|00001780| 61 72 65 20 6d 69 73 73 | 69 6e 67 2c 20 74 68 65 |are miss|ing, the|
|00001790| 20 65 6e 74 69 72 65 20 | 66 69 6c 65 20 73 79 73 | entire |file sys|
|000017a0| 74 65 6d 0a 58 20 20 20 | 69 73 20 61 6e 61 6c 79 |tem.X |is analy|
|000017b0| 7a 65 64 2e 20 20 49 66 | 20 70 72 65 73 65 6e 74 |zed. If| present|
|000017c0| 2c 20 74 68 65 20 73 70 | 65 63 69 66 69 65 64 20 |, the sp|ecified |
|000017d0| 66 69 6c 65 73 20 61 72 | 65 20 61 6e 61 6c 79 7a |files ar|e analyz|
|000017e0| 65 64 20 61 6e 64 20 72 | 65 70 6f 72 74 65 64 0a |ed and r|eported.|
|000017f0| 58 20 20 20 69 6e 64 69 | 76 69 64 75 61 6c 6c 79 |X indi|vidually|
|00001800| 2e 0a 58 0a 58 20 20 20 | 5b 66 6c 61 67 73 5d 20 |..X.X |[flags] |
|00001810| 69 6e 63 6c 75 64 65 20 | 74 68 65 20 66 6f 6c 6c |include |the foll|
|00001820| 6f 77 69 6e 67 3a 0a 58 | 20 20 20 20 20 64 20 20 |owing:.X| d |
|00001830| 20 64 69 73 70 6c 61 79 | 20 69 2d 6e 6f 64 65 20 | display| i-node |
|00001840| 6e 75 6d 62 65 72 73 20 | 61 73 20 74 68 65 79 20 |numbers |as they |
|00001850| 61 72 65 20 65 78 61 6d | 69 6e 65 64 0a 58 20 20 |are exam|ined.X |
|00001860| 20 20 20 65 20 20 20 72 | 65 70 6f 72 74 20 66 69 | e r|eport fi|
|00001870| 6c 65 20 73 69 7a 65 20 | 69 6e 63 6f 6e 73 69 73 |le size |inconsis|
|00001880| 74 65 6e 63 69 65 73 20 | 2d 20 74 68 65 20 69 6e |tencies |- the in|
|00001890| 6f 64 65 20 6e 75 6d 62 | 65 72 73 20 61 72 65 20 |ode numb|ers are |
|000018a0| 72 65 70 6f 72 74 65 64 | 0a 58 20 20 20 20 20 20 |reported|.X |
|000018b0| 20 20 20 66 6f 72 20 66 | 69 6c 65 73 20 77 68 65 | for f|iles whe|
|000018c0| 72 65 20 74 68 65 20 66 | 69 6c 65 20 73 69 7a 65 |re the f|ile size|
|000018d0| 20 61 6e 64 20 6e 75 6d | 62 65 72 20 6f 66 20 64 | and num|ber of d|
|000018e0| 61 74 61 20 62 6c 6f 63 | 6b 73 20 61 72 65 0a 58 |ata bloc|ks are.X|
|000018f0| 20 20 20 20 20 20 20 20 | 20 69 6e 63 6f 6e 73 69 | | inconsi|
|00001900| 73 74 65 6e 74 2e 0a 58 | 20 20 20 20 20 69 20 20 |stent..X| i |
|00001910| 20 72 65 70 6f 72 74 20 | 64 6f 75 62 6c 65 20 61 | report |double a|
|00001920| 6e 64 20 74 72 69 70 6c | 65 20 69 6e 64 69 72 65 |nd tripl|e indire|
|00001930| 63 74 69 6f 6e 20 2d 20 | 74 68 65 20 69 6e 6f 64 |ction - |the inod|
|00001940| 65 20 6e 75 6d 62 65 72 | 73 20 61 72 65 0a 58 20 |e number|s are.X |
|00001950| 20 20 20 20 20 20 20 20 | 72 65 70 6f 72 74 65 64 | |reported|
|00001960| 20 66 6f 72 20 66 69 6c | 65 73 20 74 68 61 74 20 | for fil|es that |
|00001970| 63 6f 6e 74 61 69 6e 20 | 64 6f 75 62 6c 65 20 61 |contain |double a|
|00001980| 6e 64 2f 6f 72 20 74 72 | 69 70 6c 65 20 69 6e 64 |nd/or tr|iple ind|
|00001990| 69 72 65 63 74 69 6f 6e | 2e 0a 58 20 20 20 20 20 |irection|..X |
|000019a0| 6f 20 20 20 6f 76 65 72 | 72 69 64 65 73 20 65 72 |o over|rides er|
|000019b0| 72 6f 72 20 63 68 65 63 | 6b 69 6e 67 20 6f 6e 20 |ror chec|king on |
|000019c0| 66 69 6c 65 20 73 79 73 | 74 65 6d 2e 20 20 55 73 |file sys|tem. Us|
|000019d0| 65 20 74 68 69 73 20 66 | 6c 61 67 20 69 66 20 74 |e this f|lag if t|
|000019e0| 68 65 0a 58 20 20 20 20 | 20 20 20 20 20 66 69 6c |he.X | fil|
|000019f0| 65 20 73 79 73 74 65 6d | 20 79 6f 75 20 61 72 65 |e system| you are|
|00001a00| 20 61 6e 61 6c 79 7a 69 | 6e 67 20 69 73 20 64 61 | analyzi|ng is da|
|00001a10| 6d 61 67 65 64 2e 20 20 | 4e 6f 74 65 20 74 68 61 |maged. |Note tha|
|00001a20| 74 20 66 73 61 6e 61 6c | 79 7a 65 0a 58 20 20 20 |t fsanal|yze.X |
|00001a30| 20 20 20 20 20 20 6d 61 | 79 20 67 69 76 65 20 65 | ma|y give e|
|00001a40| 72 72 6f 6e 65 6f 75 73 | 20 72 65 73 75 6c 74 73 |rroneous| results|
|00001a50| 20 69 66 20 75 73 65 64 | 20 6f 6e 20 61 20 64 61 | if used| on a da|
|00001a60| 6d 61 67 65 64 20 66 69 | 6c 65 20 73 79 73 74 65 |maged fi|le syste|
|00001a70| 6d 2c 20 62 75 74 0a 58 | 20 20 20 20 20 20 20 20 |m, but.X| |
|00001a80| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00001a90| 20 69 74 73 65 6c 66 20 | 77 69 6c 6c 20 6e 6f 74 | itself |will not|
|00001aa0| 20 62 65 20 61 66 66 65 | 63 74 65 64 2e 0a 58 0a | be affe|cted..X.|
|00001ab0| 58 20 20 20 45 78 61 6d | 70 6c 65 3a 0a 58 20 20 |X Exam|ple:.X |
|00001ac0| 20 20 20 66 73 61 6e 61 | 6c 79 7a 65 20 2f 64 65 | fsana|lyze /de|
|00001ad0| 76 2f 64 73 6b 2f 30 73 | 32 09 2f 2a 20 61 6e 61 |v/dsk/0s|2./* ana|
|00001ae0| 6c 79 7a 65 73 20 61 6e | 20 65 6e 74 69 72 65 20 |lyzes an| entire |
|00001af0| 66 69 6c 65 20 73 79 73 | 74 65 6d 20 2a 2f 0a 58 |file sys|tem */.X|
|00001b00| 20 20 20 20 20 66 73 61 | 6e 61 6c 79 7a 65 20 2f | fsa|nalyze /|
|00001b10| 64 65 76 2f 64 73 6b 2f | 30 73 32 20 2a 09 2f 2a |dev/dsk/|0s2 *./*|
|00001b20| 20 61 6e 61 6c 79 7a 65 | 73 20 61 6c 6c 20 66 69 | analyze|s all fi|
|00001b30| 6c 65 73 20 69 6e 20 74 | 68 65 20 63 75 72 72 65 |les in t|he curre|
|00001b40| 6e 74 0a 58 20 20 20 20 | 20 20 20 20 20 20 20 20 |nt.X | |
|00001b50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b60| 20 20 20 20 20 2a 20 64 | 69 72 65 63 74 6f 72 79 | * d|irectory|
|00001b70| 20 6f 66 20 74 68 65 20 | 66 69 6c 65 20 73 79 73 | of the |file sys|
|00001b80| 74 65 6d 20 2a 2f 0a 58 | 0a 58 20 20 20 53 69 6e |tem */.X|.X Sin|
|00001b90| 63 65 20 66 73 61 6e 61 | 6c 79 7a 65 20 75 73 65 |ce fsana|lyze use|
|00001ba0| 73 20 74 68 65 20 73 75 | 70 65 72 62 6c 6f 63 6b |s the su|perblock|
|00001bb0| 20 69 6e 66 6f 20 4f 4e | 20 54 48 45 20 44 49 53 | info ON| THE DIS|
|00001bc0| 4b 2c 20 6d 6f 72 65 20 | 61 63 63 75 72 61 74 65 |K, more |accurate|
|00001bd0| 0a 58 20 20 20 72 65 73 | 75 6c 74 73 20 77 69 6c |.X res|ults wil|
|00001be0| 6c 20 62 65 20 72 65 74 | 75 72 6e 65 64 20 66 73 |l be ret|urned fs|
|00001bf0| 61 6e 61 6c 79 7a 65 20 | 69 73 20 72 75 6e 20 6f |analyze |is run o|
|00001c00| 6e 20 61 6e 20 75 6e 6d | 6f 75 6e 74 65 64 2c 20 |n an unm|ounted, |
|00001c10| 6f 72 20 72 65 61 64 2d | 6f 6e 6c 79 0a 58 20 20 |or read-|only.X |
|00001c20| 20 6d 6f 75 6e 74 65 64 | 20 66 69 6c 65 20 73 79 | mounted| file sy|
|00001c30| 73 74 65 6d 20 69 6d 6d | 65 64 69 61 74 65 6c 79 |stem imm|ediately|
|00001c40| 20 61 66 74 65 72 20 61 | 20 73 79 6e 63 28 32 29 | after a| sync(2)|
|00001c50| 2e 0a 58 0a 58 20 20 20 | 4e 6f 74 65 20 74 68 61 |..X.X |Note tha|
|00001c60| 74 20 66 73 61 6e 61 6c | 79 7a 65 20 77 69 6c 6c |t fsanal|yze will|
|00001c70| 20 77 6f 72 6b 20 77 69 | 74 68 20 35 31 32 2d 20 | work wi|th 512- |
|00001c80| 6f 72 20 31 30 32 34 2d | 62 79 74 65 20 66 69 6c |or 1024-|byte fil|
|00001c90| 65 73 79 73 74 65 6d 73 | 2e 20 20 49 6e 0a 58 20 |esystems|. In.X |
|00001ca0| 20 20 66 69 6c 65 73 79 | 73 74 65 6d 73 20 77 69 | filesy|stems wi|
|00001cb0| 74 68 20 31 30 32 34 2d | 62 79 74 65 20 62 6c 6f |th 1024-|byte blo|
|00001cc0| 63 6b 69 6e 67 2d 66 61 | 63 74 6f 72 73 2c 20 66 |cking-fa|ctors, f|
|00001cd0| 72 65 65 2d 62 6c 6f 63 | 6b 73 2c 20 65 74 63 2e |ree-bloc|ks, etc.|
|00001ce0| 2c 20 61 72 65 0a 58 20 | 20 20 72 65 70 6f 72 74 |, are.X | report|
|00001cf0| 65 64 20 61 73 20 31 30 | 32 34 2d 62 79 74 65 20 |ed as 10|24-byte |
|00001d00| 62 6c 6f 63 6b 73 20 28 | 75 6e 6c 69 6b 65 20 64 |blocks (|unlike d|
|00001d10| 66 28 31 29 20 61 6e 64 | 20 64 75 28 31 29 29 2e |f(1) and| du(1)).|
|00001d20| 20 20 54 68 65 72 65 66 | 6f 72 65 2c 20 74 68 65 | Theref|ore, the|
|00001d30| 20 74 6f 74 61 6c 0a 58 | 20 20 20 6e 75 6d 62 65 | total.X| numbe|
|00001d40| 72 20 6f 66 20 66 72 65 | 65 20 62 6c 6f 63 6b 73 |r of fre|e blocks|
|00001d50| 20 69 6e 20 79 6f 75 72 | 20 66 69 6c 65 20 73 79 | in your| file sy|
|00001d60| 73 74 65 6d 20 77 69 6c | 6c 20 62 65 20 72 65 70 |stem wil|l be rep|
|00001d70| 6f 72 74 65 64 20 61 73 | 20 68 61 6c 66 20 74 68 |orted as| half th|
|00001d80| 65 0a 58 20 20 20 76 61 | 6c 75 65 20 72 65 70 6f |e.X va|lue repo|
|00001d90| 72 74 65 64 20 62 79 20 | 64 66 28 31 29 2e 20 20 |rted by |df(1). |
|00001da0| 49 20 70 72 65 66 65 72 | 20 69 74 20 74 68 69 73 |I prefer| it this|
|00001db0| 20 77 61 79 2e 20 20 49 | 66 20 79 6f 75 20 77 61 | way. I|f you wa|
|00001dc0| 6e 74 20 69 74 20 74 68 | 65 0a 58 20 20 20 6f 74 |nt it th|e.X ot|
|00001dd0| 68 65 72 20 77 61 79 2c | 20 69 74 20 72 65 71 75 |her way,| it requ|
|00001de0| 69 72 65 73 20 61 20 73 | 69 6d 70 6c 65 20 63 68 |ires a s|imple ch|
|00001df0| 61 6e 67 65 20 74 6f 20 | 70 72 69 6e 74 5f 72 65 |ange to |print_re|
|00001e00| 70 6f 72 74 28 29 2e 0a | 58 0a 58 20 20 20 53 69 |port()..|X.X Si|
|00001e10| 6e 63 65 20 66 73 61 6e | 61 6c 79 7a 65 20 64 6f |nce fsan|alyze do|
|00001e20| 65 73 20 69 74 73 20 77 | 6f 72 6b 20 74 68 65 20 |es its w|ork the |
|00001e30| 6f 6c 64 20 66 61 73 68 | 69 6f 6e 65 64 20 77 61 |old fash|ioned wa|
|00001e40| 79 20 28 62 72 75 74 65 | 2d 66 6f 72 63 65 29 2c |y (brute|-force),|
|00001e50| 20 69 74 0a 58 20 20 20 | 6d 75 73 74 20 73 63 61 | it.X |must sca|
|00001e60| 6e 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 66 69 |n throug|h the fi|
|00001e70| 6c 65 20 73 79 73 74 65 | 6d 20 69 6e 6f 64 65 20 |le syste|m inode |
|00001e80| 62 79 20 69 6e 6f 64 65 | 2e 20 20 49 74 20 74 68 |by inode|. It th|
|00001e90| 65 72 65 66 6f 72 65 20 | 74 61 6b 65 73 0a 58 20 |erefore |takes.X |
|00001ea0| 20 20 61 62 6f 75 74 20 | 61 73 20 6c 6f 6e 67 20 | about |as long |
|00001eb0| 61 73 20 66 73 63 6b 20 | 74 6f 20 64 6f 20 69 74 |as fsck |to do it|
|00001ec0| 73 20 77 6f 72 6b 2e 20 | 20 42 65 20 70 61 74 69 |s work. | Be pati|
|00001ed0| 65 6e 74 2e 0a 58 0a 58 | 42 75 67 73 3a 0a 58 20 |ent..X.X|Bugs:.X |
|00001ee0| 20 20 50 6c 65 61 73 65 | 20 72 65 70 6f 72 74 20 | Please| report |
|00001ef0| 61 6e 79 20 62 75 67 73 | 20 28 61 6e 64 20 70 6f |any bugs| (and po|
|00001f00| 73 73 69 62 6c 65 20 66 | 69 78 65 73 29 20 74 6f |ssible f|ixes) to|
|00001f10| 20 6d 65 2c 20 73 6f 20 | 49 20 63 61 6e 20 6b 65 | me, so |I can ke|
|00001f20| 65 70 20 6d 79 0a 58 20 | 20 20 73 6f 75 72 63 65 |ep my.X | source|
|00001f30| 20 75 70 2d 74 6f 2d 64 | 61 74 65 2e 20 20 49 20 | up-to-d|ate. I |
|00001f40| 77 6f 75 6c 64 20 61 6c | 73 6f 20 6c 69 6b 65 20 |would al|so like |
|00001f50| 74 6f 20 6d 61 6b 65 20 | 66 73 61 6e 61 6c 79 7a |to make |fsanalyz|
|00001f60| 65 20 77 6f 72 6b 20 6f | 6e 20 6f 74 68 65 72 0a |e work o|n other.|
|00001f70| 58 20 20 20 75 6e 69 78 | 20 73 79 73 74 65 6d 73 |X unix| systems|
|00001f80| 2c 20 62 75 74 20 49 20 | 64 6f 6e 27 74 20 68 61 |, but I |don't ha|
|00001f90| 76 65 20 61 63 63 65 73 | 73 20 74 6f 20 61 6e 79 |ve acces|s to any|
|00001fa0| 74 68 69 6e 67 20 62 75 | 74 20 6d 79 20 6c 69 74 |thing bu|t my lit|
|00001fb0| 74 6c 65 20 0a 58 20 20 | 20 75 70 6f 72 74 2e 20 |tle .X | uport. |
|00001fc0| 20 49 66 20 79 6f 75 20 | 63 61 6e 20 68 65 6c 70 | If you |can help|
|00001fd0| 20 6d 65 20 70 6f 72 74 | 20 69 74 20 74 6f 20 42 | me port| it to B|
|00001fe0| 53 44 20 6f 72 20 61 6e | 79 74 68 69 6e 67 20 65 |SD or an|ything e|
|00001ff0| 6c 73 65 2c 20 49 20 77 | 6f 75 6c 64 0a 58 20 20 |lse, I w|ould.X |
|00002000| 20 61 70 70 72 65 63 69 | 61 74 65 20 69 74 2e 0a | appreci|ate it..|
|00002010| 58 0a 58 50 6f 72 74 69 | 6e 67 20 66 73 61 6e 61 |X.XPorti|ng fsana|
|00002020| 6c 79 7a 65 20 74 6f 20 | 6f 74 68 65 72 20 73 79 |lyze to |other sy|
|00002030| 73 74 65 6d 73 3a 0a 58 | 20 20 20 46 73 61 6e 61 |stems:.X| Fsana|
|00002040| 6c 79 7a 65 20 74 61 6b | 65 73 20 69 74 73 20 69 |lyze tak|es its i|
|00002050| 6e 66 6f 72 6d 61 74 69 | 6f 6e 20 6f 6e 20 74 68 |nformati|on on th|
|00002060| 65 20 73 74 72 75 63 74 | 75 72 65 20 6f 66 20 74 |e struct|ure of t|
|00002070| 68 65 20 66 69 6c 65 20 | 73 79 73 74 65 6d 0a 58 |he file |system.X|
|00002080| 20 20 20 66 72 6f 6d 20 | 2f 75 73 72 2f 69 6e 63 | from |/usr/inc|
|00002090| 6c 75 64 65 2f 73 79 73 | 2f 66 69 6c 73 79 73 2e |lude/sys|/filsys.|
|000020a0| 68 20 61 6e 64 20 2f 75 | 73 72 2f 69 6e 63 6c 75 |h and /u|sr/inclu|
|000020b0| 64 65 2f 73 79 73 2f 69 | 6e 6f 2e 68 2e 20 20 41 |de/sys/i|no.h. A|
|000020c0| 73 20 6c 6f 6e 67 0a 58 | 20 20 20 61 73 20 74 68 |s long.X| as th|
|000020d0| 65 73 65 20 66 69 6c 65 | 73 20 28 6f 72 20 65 71 |ese file|s (or eq|
|000020e0| 75 69 76 61 6c 65 6e 74 | 29 20 61 72 65 20 70 72 |uivalent|) are pr|
|000020f0| 65 73 65 6e 74 20 6f 6e | 20 79 6f 75 72 20 73 79 |esent on| your sy|
|00002100| 73 74 65 6d 2c 20 70 6f | 72 74 69 6e 67 0a 58 20 |stem, po|rting.X |
|00002110| 20 20 73 68 6f 75 6c 64 | 20 62 65 20 73 74 72 61 | should| be stra|
|00002120| 69 67 68 74 66 6f 72 77 | 61 72 64 2e 20 20 57 68 |ightforw|ard. Wh|
|00002130| 65 6e 20 6c 6f 6f 6b 69 | 6e 67 20 66 6f 72 20 74 |en looki|ng for t|
|00002140| 68 65 20 65 71 75 69 76 | 61 6c 65 6e 74 20 6f 66 |he equiv|alent of|
|00002150| 20 74 68 65 73 65 0a 58 | 20 20 20 66 69 6c 65 73 | these.X| files|
|00002160| 20 6f 6e 20 79 6f 75 72 | 20 73 79 73 74 65 6d 2c | on your| system,|
|00002170| 20 62 65 20 73 75 72 65 | 20 74 6f 20 67 65 74 20 | be sure| to get |
|00002180| 74 68 65 20 64 69 73 6b | 2d 62 61 73 65 64 20 76 |the disk|-based v|
|00002190| 65 72 73 69 6f 6e 73 2c | 20 72 61 74 68 65 72 0a |ersions,| rather.|
|000021a0| 58 20 20 20 74 68 61 6e | 20 74 68 65 20 69 6e 2d |X than| the in-|
|000021b0| 6d 65 6d 6f 72 79 20 73 | 74 72 75 63 74 75 72 65 |memory s|tructure|
|000021c0| 73 20 2d 2d 20 74 68 65 | 79 20 61 72 65 20 64 69 |s -- the|y are di|
|000021d0| 66 66 65 72 65 6e 74 2e | 20 20 49 6e 20 53 79 73 |fferent.| In Sys|
|000021e0| 74 65 6d 20 56 0a 58 20 | 20 20 64 65 72 69 76 61 |tem V.X | deriva|
|000021f0| 74 69 76 65 73 2c 20 74 | 68 65 73 65 20 73 74 72 |tives, t|hese str|
|00002200| 75 63 74 75 72 65 73 20 | 73 68 6f 75 6c 64 20 62 |uctures |should b|
|00002210| 65 20 64 6f 63 75 6d 65 | 6e 74 65 64 20 61 73 20 |e docume|nted as |
|00002220| 66 73 28 34 20 6f 72 20 | 35 29 20 61 6e 64 0a 58 |fs(4 or |5) and.X|
|00002230| 20 20 20 69 6e 6f 64 65 | 28 34 20 6f 72 20 35 29 | inode|(4 or 5)|
|00002240| 2c 20 6f 6e 20 42 53 44 | 20 73 79 73 74 65 6d 73 |, on BSD| systems|
|00002250| 20 61 6e 64 20 56 37 20 | 73 79 73 74 65 6d 73 20 | and V7 |systems |
|00002260| 61 73 20 66 69 6c 73 79 | 73 28 35 29 2c 20 61 6e |as filsy|s(5), an|
|00002270| 64 20 6f 6e 0a 58 20 20 | 20 58 45 4e 49 58 20 33 |d on.X | XENIX 3|
|00002280| 2e 30 20 61 6e 64 20 35 | 2e 30 20 61 73 20 66 69 |.0 and 5|.0 as fi|
|00002290| 6c 65 73 79 73 74 65 6d | 28 46 29 2e 0a 58 0a 58 |lesystem|(F)..X.X|
|000022a0| 20 20 20 46 73 61 6e 61 | 6c 79 7a 65 20 75 73 65 | Fsana|lyze use|
|000022b0| 73 20 66 73 73 74 61 74 | 28 31 4d 29 20 74 6f 20 |s fsstat|(1M) to |
|000022c0| 64 65 74 65 72 6d 69 6e | 65 20 66 69 6c 65 20 73 |determin|e file s|
|000022d0| 79 73 74 65 6d 20 69 6e | 74 65 67 72 69 74 79 2e |ystem in|tegrity.|
|000022e0| 20 20 49 20 64 6f 6e 27 | 74 0a 58 20 20 20 74 68 | I don'|t.X th|
|000022f0| 69 6e 6b 20 74 68 69 73 | 20 70 72 6f 67 72 61 6d |ink this| program|
|00002300| 20 69 73 20 61 76 61 69 | 6c 61 62 6c 65 20 69 6e | is avai|lable in|
|00002310| 20 6f 74 68 65 72 20 76 | 65 72 73 69 6f 6e 73 20 | other v|ersions |
|00002320| 6f 66 20 55 6e 69 78 2e | 20 20 49 66 20 79 6f 75 |of Unix.| If you|
|00002330| 72 0a 58 20 20 20 73 79 | 73 74 65 6d 20 64 6f 65 |r.X sy|stem doe|
|00002340| 73 6e 27 74 20 68 61 76 | 65 20 69 74 20 28 6f 72 |sn't hav|e it (or|
|00002350| 20 61 6e 79 74 68 69 6e | 67 20 6c 69 6b 65 20 69 | anythin|g like i|
|00002360| 74 29 2c 20 79 6f 75 20 | 77 69 6c 6c 20 68 61 76 |t), you |will hav|
|00002370| 65 20 74 6f 20 72 65 77 | 72 69 74 65 0a 58 20 20 |e to rew|rite.X |
|00002380| 20 63 68 65 63 6b 5f 66 | 73 28 29 2e 20 20 54 68 | check_f|s(). Th|
|00002390| 65 20 6b 69 6e 64 73 20 | 6f 66 20 74 68 69 6e 67 |e kinds |of thing|
|000023a0| 73 20 74 6f 20 63 68 65 | 63 6b 20 77 68 65 6e 20 |s to che|ck when |
|000023b0| 74 65 73 74 69 6e 67 20 | 66 6f 72 20 66 69 6c 65 |testing |for file|
|000023c0| 20 73 79 73 74 65 6d 0a | 58 20 20 20 69 6e 74 65 | system.|X inte|
|000023d0| 67 72 69 74 79 20 69 6e | 63 6c 75 64 65 3a 0a 58 |grity in|clude:.X|
|000023e0| 09 31 2e 20 20 4d 61 6b | 65 20 73 75 72 65 20 74 |.1. Mak|e sure t|
|000023f0| 68 65 20 64 65 76 69 63 | 65 20 69 73 20 62 6c 6f |he devic|e is blo|
|00002400| 63 6b 20 73 74 72 75 63 | 74 75 72 65 64 2e 0a 58 |ck struc|tured..X|
|00002410| 09 32 2e 20 20 44 65 74 | 65 72 6d 69 6e 65 20 77 |.2. Det|ermine w|
|00002420| 68 65 74 68 65 72 20 6f | 72 20 6e 6f 74 20 74 68 |hether o|r not th|
|00002430| 65 20 64 65 76 69 63 65 | 20 69 73 20 6d 6f 75 6e |e device| is moun|
|00002440| 74 65 64 2e 0a 58 09 33 | 2e 20 20 43 68 65 63 6b |ted..X.3|. Check|
|00002450| 20 73 5f 73 74 61 74 65 | 20 69 6e 20 74 68 65 20 | s_state| in the |
|00002460| 66 69 6c 73 79 73 20 73 | 74 72 75 63 74 75 72 65 |filsys s|tructure|
|00002470| 20 74 6f 20 73 65 65 20 | 69 66 20 69 74 20 69 73 | to see |if it is|
|00002480| 20 69 6e 20 61 0a 58 09 | 20 20 20 20 6b 6e 6f 77 | in a.X.| know|
|00002490| 6e 20 73 74 61 74 65 2e | 0a 58 09 34 2e 20 20 41 |n state.|.X.4. A|
|000024a0| 6e 79 69 6e 67 20 65 6c | 73 65 20 79 6f 75 20 63 |nying el|se you c|
|000024b0| 61 6e 20 74 68 69 6e 6b | 20 6f 66 2e 0a 58 20 20 |an think| of..X |
|000024c0| 20 49 20 75 73 65 64 20 | 66 73 73 74 61 74 20 62 | I used |fsstat b|
|000024d0| 65 63 61 75 73 65 20 69 | 74 20 73 65 65 6d 73 20 |ecause i|t seems |
|000024e0| 74 6f 20 62 65 20 6d 6f | 72 65 20 72 6f 62 75 73 |to be mo|re robus|
|000024f0| 74 20 74 68 61 6e 20 61 | 6e 79 74 68 69 6e 67 20 |t than a|nything |
|00002500| 49 0a 58 20 20 20 63 6f | 75 6c 64 20 63 6f 6d 65 |I.X co|uld come|
|00002510| 20 75 70 20 77 69 74 68 | 2e 20 20 49 74 20 61 6c | up with|. It al|
|00002520| 73 6f 20 61 70 70 65 61 | 72 73 20 74 6f 20 75 73 |so appea|rs to us|
|00002530| 65 20 75 6e 64 6f 63 75 | 6d 65 6e 74 65 64 20 69 |e undocu|mented i|
|00002540| 6e 66 6f 72 6d 61 74 69 | 6f 6e 0a 58 20 20 20 74 |nformati|on.X t|
|00002550| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 66 69 6c 65 |o determ|ine file|
|00002560| 20 73 79 73 74 65 6d 20 | 73 74 61 74 75 73 2e 0a | system |status..|
|00002570| 58 0a 58 20 20 20 66 73 | 73 74 61 74 28 31 4d 29 |X.X fs|stat(1M)|
|00002580| 20 72 65 74 75 72 6e 73 | 20 30 20 69 66 20 74 68 | returns| 0 if th|
|00002590| 65 20 66 69 6c 65 20 73 | 79 73 74 65 6d 20 69 73 |e file s|ystem is|
|000025a0| 20 6f 6b 2c 20 31 20 69 | 66 20 69 74 20 6e 65 65 | ok, 1 i|f it nee|
|000025b0| 64 73 20 74 6f 20 62 65 | 0a 58 20 20 20 63 68 65 |ds to be|.X che|
|000025c0| 63 6b 65 64 2c 20 32 20 | 69 66 20 69 74 20 69 73 |cked, 2 |if it is|
|000025d0| 20 6d 6f 75 6e 74 65 64 | 2c 20 61 6e 64 20 33 20 | mounted|, and 3 |
|000025e0| 66 6f 72 20 6f 74 68 65 | 72 20 65 72 72 6f 72 73 |for othe|r errors|
|000025f0| 2e 20 20 55 6e 66 6f 72 | 74 75 6e 61 74 65 6c 79 |. Unfor|tunately|
|00002600| 2c 0a 58 20 20 20 74 68 | 65 20 65 78 69 74 20 73 |,.X th|e exit s|
|00002610| 74 61 74 75 73 20 61 70 | 70 65 61 72 73 20 74 6f |tatus ap|pears to|
|00002620| 20 62 65 20 62 79 74 65 | 2d 73 77 61 70 70 65 64 | be byte|-swapped|
|00002630| 20 77 68 65 6e 20 66 73 | 61 6e 61 6c 79 7a 65 20 | when fs|analyze |
|00002640| 67 65 74 73 20 69 74 2e | 0a 58 20 20 20 49 27 6d |gets it.|.X I'm|
|00002650| 20 6e 6f 74 20 73 75 72 | 65 20 69 66 20 74 68 69 | not sur|e if thi|
|00002660| 73 20 69 73 20 61 20 62 | 75 67 20 69 6e 20 73 79 |s is a b|ug in sy|
|00002670| 73 74 65 6d 28 33 53 29 | 2c 20 6f 72 20 6d 79 20 |stem(3S)|, or my |
|00002680| 75 73 65 20 6f 66 20 69 | 74 2c 20 62 75 74 0a 58 |use of i|t, but.X|
|00002690| 20 20 20 62 65 20 63 61 | 72 65 66 75 6c 20 77 68 | be ca|reful wh|
|000026a0| 65 6e 20 70 6f 72 74 69 | 6e 67 20 74 6f 20 79 6f |en porti|ng to yo|
|000026b0| 75 72 20 73 79 73 74 65 | 6d 2e 0a 58 20 20 0a 58 |ur syste|m..X .X|
|000026c0| 20 20 20 49 20 61 74 74 | 65 6d 70 74 65 64 20 74 | I att|empted t|
|000026d0| 6f 20 75 73 65 20 74 79 | 70 65 73 20 64 65 66 69 |o use ty|pes defi|
|000026e0| 6e 65 64 20 69 6e 20 2f | 75 73 72 2f 69 6e 63 6c |ned in /|usr/incl|
|000026f0| 75 64 65 2f 73 79 73 2f | 74 79 70 65 73 2e 68 20 |ude/sys/|types.h |
|00002700| 77 68 65 72 65 76 65 72 | 0a 58 20 20 20 70 6f 73 |wherever|.X pos|
|00002710| 73 69 62 6c 65 20 74 6f | 20 65 6e 73 75 72 65 20 |sible to| ensure |
|00002720| 70 6f 72 74 61 62 69 6c | 69 74 79 2e 20 20 49 20 |portabil|ity. I |
|00002730| 64 6f 6e 27 74 20 74 68 | 69 6e 6b 20 49 20 6d 61 |don't th|ink I ma|
|00002740| 64 65 20 61 6e 79 20 61 | 73 73 75 6d 70 74 69 6f |de any a|ssumptio|
|00002750| 6e 73 0a 58 20 20 20 61 | 62 6f 75 74 20 73 69 7a |ns.X a|bout siz|
|00002760| 65 6f 66 28 69 6e 74 29 | 20 3d 3d 20 73 69 7a 65 |eof(int)| == size|
|00002770| 6f 66 28 6c 6f 6e 67 29 | 20 3d 3d 20 73 69 7a 65 |of(long)| == size|
|00002780| 6f 66 28 63 68 61 72 20 | 2a 29 2c 20 73 6f 20 74 |of(char |*), so t|
|00002790| 68 65 72 65 20 73 68 6f | 75 6c 64 0a 58 20 20 20 |here sho|uld.X |
|000027a0| 62 65 20 6e 6f 20 70 72 | 6f 62 6c 65 6d 73 20 74 |be no pr|oblems t|
|000027b0| 68 65 72 65 2e 0a 58 0a | 58 20 20 20 50 6c 65 61 |here..X.|X Plea|
|000027c0| 73 65 20 74 72 79 20 74 | 6f 20 6d 61 6b 65 20 63 |se try t|o make c|
|000027d0| 68 61 6e 67 65 73 20 74 | 6f 20 74 68 65 20 73 6f |hanges t|o the so|
|000027e0| 75 72 63 65 20 75 73 69 | 6e 67 20 23 64 65 66 69 |urce usi|ng #defi|
|000027f0| 6e 65 73 20 61 6e 64 20 | 23 69 66 64 65 66 73 0a |nes and |#ifdefs.|
|00002800| 58 20 20 20 77 68 65 72 | 65 76 65 72 20 70 6f 73 |X wher|ever pos|
|00002810| 73 69 62 6c 65 2c 20 61 | 6e 64 20 70 6c 65 61 73 |sible, a|nd pleas|
|00002820| 65 20 65 6d 61 69 6c 20 | 6d 65 20 74 68 65 20 63 |e email |me the c|
|00002830| 68 61 6e 67 65 73 20 79 | 6f 75 20 6d 61 6b 65 20 |hanges y|ou make |
|00002840| 61 6c 6f 6e 67 20 77 69 | 74 68 0a 58 20 20 20 61 |along wi|th.X a|
|00002850| 20 64 65 73 63 72 69 70 | 74 69 6f 6e 20 6f 66 20 | descrip|tion of |
|00002860| 74 68 65 20 73 79 73 74 | 65 6d 20 79 6f 75 20 70 |the syst|em you p|
|00002870| 6f 72 74 65 64 20 69 74 | 20 74 6f 20 28 61 6e 64 |orted it| to (and|
|00002880| 20 70 72 6f 62 6c 65 6d | 73 20 65 6e 63 6f 75 6e | problem|s encoun|
|00002890| 74 65 72 65 64 29 2c 0a | 58 20 20 20 73 6f 20 49 |tered),.|X so I|
|000028a0| 20 63 61 6e 20 6d 65 72 | 67 65 20 61 6c 6c 20 74 | can mer|ge all t|
|000028b0| 68 65 20 63 68 61 6e 67 | 65 73 20 69 6e 74 6f 20 |he chang|es into |
|000028c0| 61 20 73 69 6e 67 6c 65 | 20 63 6f 70 79 2e 0a 58 |a single| copy..X|
|000028d0| 0a 58 20 20 20 54 68 61 | 6e 6b 73 20 61 6e 64 20 |.X Tha|nks and |
|000028e0| 67 6f 6f 64 20 6c 75 63 | 6b 21 0a 45 4e 44 5f 4f |good luc|k!.END_O|
|000028f0| 46 5f 52 45 41 44 4d 45 | 0a 69 66 20 74 65 73 74 |F_README|.if test|
|00002900| 20 37 39 31 35 20 2d 6e | 65 20 60 77 63 20 2d 63 | 7915 -n|e `wc -c|
|00002910| 20 3c 52 45 41 44 4d 45 | 60 3b 20 74 68 65 6e 0a | <README|`; then.|
|00002920| 20 20 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 5c | echo| shar: \|
|00002930| 22 52 45 41 44 4d 45 5c | 22 20 75 6e 70 61 63 6b |"README\|" unpack|
|00002940| 65 64 20 77 69 74 68 20 | 77 72 6f 6e 67 20 73 69 |ed with |wrong si|
|00002950| 7a 65 21 0a 66 69 0a 23 | 20 65 6e 64 20 6f 66 20 |ze!.fi.#| end of |
|00002960| 6f 76 65 72 77 72 69 74 | 69 6e 67 20 63 68 65 63 |overwrit|ing chec|
|00002970| 6b 0a 66 69 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |k.fi.if |test -f |
|00002980| 66 73 61 6e 61 6c 79 7a | 65 2e 38 20 2d 61 20 22 |fsanalyz|e.8 -a "|
|00002990| 24 7b 31 7d 22 20 21 3d | 20 22 2d 63 22 20 3b 20 |${1}" !=| "-c" ; |
|000029a0| 74 68 65 6e 20 0a 20 20 | 65 63 68 6f 20 73 68 61 |then . |echo sha|
|000029b0| 72 3a 20 57 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: Will |not over|
|000029c0| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|000029d0| 66 69 6c 65 20 5c 22 66 | 73 61 6e 61 6c 79 7a 65 |file \"f|sanalyze|
|000029e0| 2e 38 5c 22 0a 65 6c 73 | 65 0a 65 63 68 6f 20 73 |.8\".els|e.echo s|
|000029f0| 68 61 72 3a 20 45 78 74 | 72 61 63 74 69 6e 67 20 |har: Ext|racting |
|00002a00| 5c 22 66 73 61 6e 61 6c | 79 7a 65 2e 38 5c 22 20 |\"fsanal|yze.8\" |
|00002a10| 5c 28 33 34 34 31 20 63 | 68 61 72 61 63 74 65 72 |\(3441 c|haracter|
|00002a20| 73 5c 29 0a 73 65 64 20 | 22 73 2f 5e 58 2f 2f 22 |s\).sed |"s/^X//"|
|00002a30| 20 3e 66 73 61 6e 61 6c | 79 7a 65 2e 38 20 3c 3c | >fsanal|yze.8 <<|
|00002a40| 27 45 4e 44 5f 4f 46 5f | 66 73 61 6e 61 6c 79 7a |'END_OF_|fsanalyz|
|00002a50| 65 2e 38 27 0a 58 2e 54 | 48 20 46 53 41 4e 41 4c |e.8'.X.T|H FSANAL|
|00002a60| 59 5a 45 20 38 0a 58 2e | 61 64 20 62 0a 58 2e 53 |YZE 8.X.|ad b.X.S|
|00002a70| 48 20 4e 41 4d 45 0a 58 | 66 73 61 6e 61 6c 79 7a |H NAME.X|fsanalyz|
|00002a80| 65 20 5c 2d 20 61 20 66 | 69 6c 65 20 73 79 73 74 |e \- a f|ile syst|
|00002a90| 65 6d 20 61 6e 61 6c 79 | 7a 65 72 20 74 6f 6f 6c |em analy|zer tool|
|00002aa0| 0a 58 2e 53 48 20 53 59 | 4e 4f 50 53 49 53 0a 58 |.X.SH SY|NOPSIS.X|
|00002ab0| 2e 42 20 66 73 61 6e 61 | 6c 79 7a 65 0a 58 5b 0a |.B fsana|lyze.X[.|
|00002ac0| 58 2e 42 20 5c 2d 64 65 | 69 6f 0a 58 5d 0a 58 2e |X.B \-de|io.X].X.|
|00002ad0| 42 20 73 70 65 63 69 61 | 6c 0a 58 5b 0a 58 2e 42 |B specia|l.X[.X.B|
|00002ae0| 20 66 69 6c 65 73 0a 58 | 5d 0a 58 2e 53 48 20 44 | files.X|].X.SH D|
|00002af0| 45 53 43 52 49 50 54 49 | 4f 4e 0a 58 2e 49 20 46 |ESCRIPTI|ON.X.I F|
|00002b00| 73 61 6e 61 6c 79 7a 65 | 0a 58 69 73 20 61 20 73 |sanalyze|.Xis a s|
|00002b10| 69 6d 70 6c 65 20 74 6f | 6f 6c 20 74 68 61 74 20 |imple to|ol that |
|00002b20| 65 73 74 69 6d 61 74 65 | 73 20 66 69 6c 65 20 6f |estimate|s file o|
|00002b30| 72 20 66 69 6c 65 20 73 | 79 73 74 65 6d 20 66 72 |r file s|ystem fr|
|00002b40| 61 67 6d 65 6e 74 61 74 | 69 6f 6e 2e 20 20 49 74 |agmentat|ion. It|
|00002b50| 20 61 63 63 6f 6d 70 6c | 69 73 68 65 73 0a 58 74 | accompl|ishes.Xt|
|00002b60| 68 69 73 20 62 79 20 73 | 63 61 6e 6e 69 6e 67 20 |his by s|canning |
|00002b70| 74 68 65 20 64 61 74 61 | 20 62 6c 6f 63 6b 73 20 |the data| blocks |
|00002b80| 6f 66 20 65 61 63 68 20 | 69 6e 6f 64 65 20 6c 6f |of each |inode lo|
|00002b90| 6f 6b 69 6e 67 20 66 6f | 72 20 62 6c 6f 63 6b 20 |oking fo|r block |
|00002ba0| 6e 75 6d 62 65 72 73 20 | 74 68 61 74 0a 58 61 72 |numbers |that.Xar|
|00002bb0| 65 20 6f 75 74 20 6f 66 | 20 73 65 71 75 65 6e 63 |e out of| sequenc|
|00002bc0| 65 2e 20 20 49 6e 20 65 | 66 66 65 63 74 2c 20 69 |e. In e|ffect, i|
|00002bd0| 74 20 69 73 20 63 6f 75 | 6e 74 69 6e 67 20 74 68 |t is cou|nting th|
|00002be0| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 64 69 73 6b |e number| of disk|
|00002bf0| 20 73 65 65 6b 73 0a 58 | 72 65 71 75 69 72 65 64 | seeks.X|required|
|00002c00| 20 74 6f 20 72 65 61 64 | 20 61 20 66 69 6c 65 20 | to read| a file |
|00002c10| 73 65 71 75 65 6e 74 69 | 61 6c 6c 79 2e 20 20 46 |sequenti|ally. F|
|00002c20| 72 61 67 6d 65 6e 74 61 | 74 69 6f 6e 20 69 73 20 |ragmenta|tion is |
|00002c30| 74 68 65 6e 20 63 6f 6d | 70 75 74 65 64 20 61 73 |then com|puted as|
|00002c40| 20 74 68 65 0a 58 72 61 | 74 69 6f 20 6f 66 20 61 | the.Xra|tio of a|
|00002c50| 63 74 75 61 6c 20 22 73 | 65 65 6b 73 22 20 74 6f |ctual "s|eeks" to|
|00002c60| 20 74 68 65 20 70 6f 74 | 65 6e 74 69 61 6c 20 6e | the pot|ential n|
|00002c70| 75 6d 62 65 72 20 22 73 | 65 65 6b 73 22 20 77 68 |umber "s|eeks" wh|
|00002c80| 69 63 68 20 77 6f 75 6c | 64 20 62 65 0a 58 72 65 |ich woul|d be.Xre|
|00002c90| 71 75 69 72 65 64 20 69 | 66 20 74 68 65 20 66 69 |quired i|f the fi|
|00002ca0| 6c 65 20 77 65 72 65 20 | 63 6f 6d 70 6c 65 74 65 |le were |complete|
|00002cb0| 6c 79 20 66 72 61 67 6d | 65 6e 74 65 64 2e 0a 58 |ly fragm|ented..X|
|00002cc0| 2e 4c 50 0a 58 49 66 20 | 74 68 65 20 6f 70 74 69 |.LP.XIf |the opti|
|00002cd0| 6f 6e 61 6c 20 5c 66 42 | 66 69 6c 65 73 5c 66 52 |onal \fB|files\fR|
|00002ce0| 20 61 72 67 75 6d 65 6e | 74 20 69 73 20 6f 6d 69 | argumen|t is omi|
|00002cf0| 74 74 65 64 2c 0a 58 2e | 49 20 66 73 61 6e 61 6c |tted,.X.|I fsanal|
|00002d00| 79 7a 65 0a 58 77 69 6c | 6c 20 61 6e 61 6c 79 7a |yze.Xwil|l analyz|
|00002d10| 65 20 74 68 65 20 65 6e | 74 69 72 65 20 66 69 6c |e the en|tire fil|
|00002d20| 65 20 73 79 73 74 65 6d | 20 73 70 65 63 69 66 69 |e system| specifi|
|00002d30| 65 64 20 62 79 20 74 68 | 65 20 5c 66 42 73 70 65 |ed by th|e \fBspe|
|00002d40| 63 69 61 6c 5c 66 52 20 | 61 72 67 75 6d 65 6e 74 |cial\fR |argument|
|00002d50| 2e 0a 58 5c 66 42 53 70 | 65 63 69 61 6c 5c 66 52 |..X\fBSp|ecial\fR|
|00002d60| 20 6d 75 73 74 20 62 65 | 20 61 20 62 6c 6f 63 6b | must be| a block|
|00002d70| 2d 6f 72 69 65 6e 74 65 | 64 20 66 69 6c 65 20 73 |-oriente|d file s|
|00002d80| 79 73 74 65 6d 20 64 65 | 76 69 63 65 2e 0a 58 2e |ystem de|vice..X.|
|00002d90| 49 20 46 73 61 6e 61 6c | 79 7a 65 0a 58 72 65 70 |I Fsanal|yze.Xrep|
|00002da0| 6f 72 74 73 20 76 61 72 | 69 6f 75 73 20 73 74 61 |orts var|ious sta|
|00002db0| 74 69 73 74 69 63 73 20 | 72 65 67 61 72 64 69 6e |tistics |regardin|
|00002dc0| 67 20 66 69 6c 65 20 73 | 79 73 74 65 6d 20 75 73 |g file s|ystem us|
|00002dd0| 61 67 65 20 61 6e 64 20 | 64 61 74 61 2d 62 6c 6f |age and |data-blo|
|00002de0| 63 6b 0a 58 69 6e 64 69 | 72 65 63 74 69 6f 6e 2c |ck.Xindi|rection,|
|00002df0| 20 70 6c 75 73 20 61 20 | 6c 69 73 74 20 6f 66 20 | plus a |list of |
|00002e00| 74 68 65 20 31 30 20 6d | 6f 73 74 20 66 72 61 67 |the 10 m|ost frag|
|00002e10| 6d 65 6e 74 65 64 20 69 | 6e 6f 64 65 73 20 69 6e |mented i|nodes in|
|00002e20| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00002e30| 2e 0a 58 54 68 65 20 31 | 30 20 6d 6f 73 74 20 66 |..XThe 1|0 most f|
|00002e40| 72 61 67 6d 65 6e 74 65 | 64 20 66 69 6c 65 73 20 |ragmente|d files |
|00002e50| 61 72 65 20 6c 69 73 74 | 65 64 20 69 6e 20 64 65 |are list|ed in de|
|00002e60| 63 72 65 61 73 69 6e 67 | 20 6f 72 64 65 72 20 6f |creasing| order o|
|00002e70| 66 20 66 72 61 67 6d 65 | 6e 74 61 74 69 6f 6e 0a |f fragme|ntation.|
|00002e80| 58 62 61 73 65 64 20 6f | 6e 20 74 68 65 20 61 62 |Xbased o|n the ab|
|00002e90| 73 6f 6c 75 74 65 20 6e | 75 6d 62 65 72 20 6f 66 |solute n|umber of|
|00002ea0| 20 66 72 61 67 6d 65 6e | 74 73 2e 20 20 46 6f 72 | fragmen|ts. For|
|00002eb0| 20 65 78 61 6d 70 6c 65 | 20 61 20 31 30 30 2d 62 | example| a 100-b|
|00002ec0| 6c 6f 63 6b 20 66 69 6c | 65 0a 58 74 68 61 74 20 |lock fil|e.Xthat |
|00002ed0| 63 6f 6e 74 61 69 6e 73 | 20 34 30 20 69 6e 64 69 |contains| 40 indi|
|00002ee0| 76 69 64 75 61 6c 20 66 | 72 61 67 6d 65 6e 74 73 |vidual f|ragments|
|00002ef0| 20 69 73 20 33 39 2e 33 | 39 25 20 66 72 61 67 6d | is 39.3|9% fragm|
|00002f00| 65 6e 74 65 64 20 28 33 | 39 20 73 65 65 6b 73 20 |ented (3|9 seeks |
|00002f10| 2f 20 39 39 0a 58 70 6f | 74 65 6e 74 69 61 6c 20 |/ 99.Xpo|tential |
|00002f20| 73 65 65 6b 73 29 2c 20 | 62 75 74 20 69 73 20 6c |seeks), |but is l|
|00002f30| 69 73 74 65 64 20 62 65 | 66 6f 72 65 20 61 20 32 |isted be|fore a 2|
|00002f40| 2d 62 6c 6f 63 6b 20 66 | 69 6c 65 20 74 68 61 74 |-block f|ile that|
|00002f50| 20 63 6f 6e 74 61 69 6e | 73 20 32 0a 58 66 72 61 | contain|s 2.Xfra|
|00002f60| 67 6d 65 6e 74 73 20 28 | 31 30 30 25 20 66 72 61 |gments (|100% fra|
|00002f70| 67 6d 65 6e 74 65 64 29 | 2e 0a 58 2e 4c 50 0a 58 |gmented)|..X.LP.X|
|00002f80| 49 66 20 74 68 65 20 5c | 66 42 66 69 6c 65 73 5c |If the \|fBfiles\|
|00002f90| 66 52 20 61 72 67 75 6d | 65 6e 74 20 69 73 20 70 |fR argum|ent is p|
|00002fa0| 72 65 73 65 6e 74 2c 0a | 58 2e 49 20 66 73 61 6e |resent,.|X.I fsan|
|00002fb0| 61 6c 79 7a 65 0a 58 77 | 69 6c 6c 20 72 65 70 6f |alyze.Xw|ill repo|
|00002fc0| 72 74 20 74 68 65 20 66 | 72 61 67 6d 65 6e 74 61 |rt the f|ragmenta|
|00002fd0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 64 65 73 69 |tion of |the desi|
|00002fe0| 67 6e 61 74 65 64 20 66 | 69 6c 65 73 20 6f 6e 6c |gnated f|iles onl|
|00002ff0| 79 2e 0a 58 2e 4c 50 0a | 58 42 65 66 6f 72 65 20 |y..X.LP.|XBefore |
|00003000| 70 65 72 66 6f 72 6d 69 | 6e 67 20 61 6e 79 20 61 |performi|ng any a|
|00003010| 6e 61 6c 79 73 69 73 2c | 0a 58 2e 49 20 66 73 61 |nalysis,|.X.I fsa|
|00003020| 6e 61 6c 79 7a 65 0a 58 | 63 68 65 63 6b 73 20 74 |nalyze.X|checks t|
|00003030| 68 65 20 66 69 6c 65 20 | 73 79 73 74 65 6d 20 69 |he file |system i|
|00003040| 6e 74 65 67 72 69 74 79 | 20 62 79 20 69 6e 76 6f |ntegrity| by invo|
|00003050| 6b 69 6e 67 0a 58 2e 49 | 20 66 73 73 74 61 74 20 |king.X.I| fsstat |
|00003060| 28 31 4d 29 2e 0a 58 49 | 66 20 74 68 65 20 66 69 |(1M)..XI|f the fi|
|00003070| 6c 65 20 73 79 73 74 65 | 6d 20 6e 65 65 64 73 20 |le syste|m needs |
|00003080| 74 6f 20 62 65 20 63 68 | 65 63 6b 65 64 2c 0a 58 |to be ch|ecked,.X|
|00003090| 2e 49 20 66 73 61 6e 61 | 6c 79 7a 65 0a 58 74 65 |.I fsana|lyze.Xte|
|000030a0| 72 6d 69 6e 61 74 65 73 | 20 77 69 74 68 20 61 20 |rminates| with a |
|000030b0| 6d 65 73 73 61 67 65 20 | 74 6f 20 74 68 61 74 20 |message |to that |
|000030c0| 65 66 66 65 63 74 2e 20 | 20 49 66 20 61 20 6e 6f |effect. | If a no|
|000030d0| 6e 2d 72 6f 6f 74 20 66 | 69 6c 65 20 73 79 73 74 |n-root f|ile syst|
|000030e0| 65 6d 20 69 73 0a 58 6d | 6f 75 6e 74 65 64 2c 20 |em is.Xm|ounted, |
|000030f0| 61 20 77 61 72 6e 69 6e | 67 20 6d 65 73 73 61 67 |a warnin|g messag|
|00003100| 65 20 69 73 20 64 69 73 | 70 6c 61 79 65 64 2c 20 |e is dis|played, |
|00003110| 62 75 74 20 61 6e 61 6c | 79 73 69 73 20 63 6f 6e |but anal|ysis con|
|00003120| 74 69 6e 75 65 73 2e 20 | 20 57 68 65 6e 0a 58 75 |tinues. | When.Xu|
|00003130| 73 65 64 20 6f 6e 20 61 | 20 6d 6f 75 6e 74 65 64 |sed on a| mounted|
|00003140| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 2c 20 69 74 | file sy|stem, it|
|00003150| 20 69 73 20 72 65 63 6f | 6d 6d 65 6e 64 65 64 20 | is reco|mmended |
|00003160| 74 68 61 74 20 61 0a 58 | 2e 49 20 73 79 6e 63 20 |that a.X|.I sync |
|00003170| 28 31 29 0a 58 62 65 20 | 70 65 72 66 6f 72 6d 65 |(1).Xbe |performe|
|00003180| 64 20 69 6d 6d 65 64 69 | 61 74 65 6c 79 20 70 72 |d immedi|ately pr|
|00003190| 69 6f 72 20 74 6f 20 72 | 75 6e 6e 69 6e 67 0a 58 |ior to r|unning.X|
|000031a0| 2e 49 20 66 73 61 6e 61 | 6c 79 7a 65 20 2e 0a 58 |.I fsana|lyze ..X|
|000031b0| 49 66 0a 58 2e 49 20 73 | 79 6e 63 20 28 31 29 0a |If.X.I s|ync (1).|
|000031c0| 58 69 73 20 6e 6f 74 20 | 70 65 72 66 6f 72 6d 65 |Xis not |performe|
|000031d0| 64 2c 20 74 68 65 20 66 | 69 6c 65 20 73 79 73 74 |d, the f|ile syst|
|000031e0| 65 6d 20 77 69 6c 6c 20 | 6e 6f 74 20 62 65 20 64 |em will |not be d|
|000031f0| 61 6d 61 67 65 64 2c 20 | 62 75 74 20 65 72 72 6f |amaged, |but erro|
|00003200| 6e 65 6f 75 73 0a 58 73 | 74 61 74 69 73 74 69 63 |neous.Xs|tatistic|
|00003210| 73 20 6d 61 79 20 62 65 | 20 72 65 70 6f 72 74 65 |s may be| reporte|
|00003220| 64 2e 0a 58 2e 53 48 20 | 4f 50 54 49 4f 4e 53 0a |d..X.SH |OPTIONS.|
|00003230| 58 2e 49 50 20 5c 66 42 | 5c 2d 64 5c 66 52 0a 58 |X.IP \fB|\-d\fR.X|
|00003240| 64 69 73 70 6c 61 79 20 | 69 6e 6f 64 65 20 6e 75 |display |inode nu|
|00003250| 6d 62 65 72 73 20 61 73 | 20 74 68 65 79 20 61 72 |mbers as| they ar|
|00003260| 65 20 65 78 61 6d 69 6e | 65 64 2e 20 20 54 68 69 |e examin|ed. Thi|
|00003270| 73 20 66 6c 61 67 20 6d | 61 6b 65 73 20 69 74 20 |s flag m|akes it |
|00003280| 65 61 73 79 20 74 6f 0a | 58 63 68 61 72 74 20 74 |easy to.|Xchart t|
|00003290| 68 65 20 70 72 6f 67 72 | 65 73 73 20 6f 66 20 66 |he progr|ess of f|
|000032a0| 73 61 6e 61 6c 79 7a 65 | 20 74 68 72 6f 75 67 68 |sanalyze| through|
|000032b0| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|000032c0| 2e 20 20 55 73 65 64 20 | 6d 61 69 6e 6c 79 20 66 |. Used |mainly f|
|000032d0| 6f 72 0a 58 64 65 62 75 | 67 67 69 6e 67 2e 0a 58 |or.Xdebu|gging..X|
|000032e0| 2e 49 50 20 5c 66 42 5c | 2d 65 5c 66 52 0a 58 72 |.IP \fB\|-e\fR.Xr|
|000032f0| 65 70 6f 72 74 20 66 69 | 6c 65 20 73 69 7a 65 20 |eport fi|le size |
|00003300| 69 6e 63 6f 6e 73 69 73 | 74 65 6e 63 69 65 73 20 |inconsis|tencies |
|00003310| 2d 20 74 68 65 20 69 6e | 6f 64 65 20 6e 75 6d 62 |- the in|ode numb|
|00003320| 65 72 73 20 61 72 65 20 | 72 65 70 6f 72 74 65 64 |ers are |reported|
|00003330| 20 66 6f 72 20 66 69 6c | 65 73 0a 58 77 68 65 72 | for fil|es.Xwher|
|00003340| 65 20 74 68 65 20 66 69 | 6c 65 20 73 69 7a 65 20 |e the fi|le size |
|00003350| 61 6e 64 20 6e 75 6d 62 | 65 72 20 6f 66 20 64 61 |and numb|er of da|
|00003360| 74 61 20 62 6c 6f 63 6b | 73 20 61 72 65 20 69 6e |ta block|s are in|
|00003370| 63 6f 6e 73 69 73 74 65 | 6e 74 2e 20 20 54 68 69 |consiste|nt. Thi|
|00003380| 73 0a 58 6f 70 74 69 6f | 6e 20 70 72 6f 76 69 64 |s.Xoptio|n provid|
|00003390| 65 73 20 74 68 65 20 73 | 61 6d 65 20 69 6e 66 6f |es the s|ame info|
|000033a0| 72 6d 61 74 69 6f 6e 20 | 61 73 0a 58 2e 49 20 66 |rmation |as.X.I f|
|000033b0| 73 63 6b 20 28 31 29 0a | 58 70 68 61 73 65 20 31 |sck (1).|Xphase 1|
|000033c0| 2e 0a 58 2e 49 50 20 5c | 66 42 5c 2d 69 5c 66 52 |..X.IP \|fB\-i\fR|
|000033d0| 0a 58 72 65 70 6f 72 74 | 20 64 6f 75 62 6c 65 20 |.Xreport| double |
|000033e0| 61 6e 64 20 74 72 69 70 | 6c 65 20 69 6e 64 69 72 |and trip|le indir|
|000033f0| 65 63 74 69 6f 6e 20 2d | 20 74 68 65 20 69 6e 6f |ection -| the ino|
|00003400| 64 65 20 6e 75 6d 62 65 | 72 73 20 61 72 65 20 72 |de numbe|rs are r|
|00003410| 65 70 6f 72 74 65 64 20 | 66 6f 72 0a 58 66 69 6c |eported |for.Xfil|
|00003420| 65 73 20 74 68 61 74 20 | 63 6f 6e 74 61 69 6e 20 |es that |contain |
|00003430| 64 6f 75 62 6c 65 20 61 | 6e 64 2f 6f 72 20 74 72 |double a|nd/or tr|
|00003440| 69 70 6c 65 20 64 61 74 | 61 2d 62 6c 6f 63 6b 20 |iple dat|a-block |
|00003450| 69 6e 64 69 72 65 63 74 | 69 6f 6e 2e 0a 58 2e 49 |indirect|ion..X.I|
|00003460| 50 20 5c 66 42 5c 2d 6f | 5c 66 52 0a 58 6f 76 65 |P \fB\-o|\fR.Xove|
|00003470| 72 72 69 64 65 73 20 66 | 69 6c 65 20 73 79 73 74 |rrides f|ile syst|
|00003480| 65 6d 20 69 6e 74 65 67 | 72 69 74 79 20 63 68 65 |em integ|rity che|
|00003490| 63 6b 73 2e 20 20 54 68 | 65 20 66 69 6c 65 20 73 |cks. Th|e file s|
|000034a0| 79 73 74 65 6d 20 77 69 | 6c 6c 20 62 65 20 61 6e |ystem wi|ll be an|
|000034b0| 61 6c 79 7a 65 64 0a 58 | 65 76 65 6e 20 69 66 0a |alyzed.X|even if.|
|000034c0| 58 2e 49 20 66 73 73 74 | 61 74 20 28 31 4d 29 0a |X.I fsst|at (1M).|
|000034d0| 58 72 65 70 6f 72 74 73 | 20 74 68 61 74 20 69 74 |Xreports| that it|
|000034e0| 20 69 73 20 64 61 6d 61 | 67 65 64 2e 20 20 4e 6f | is dama|ged. No|
|000034f0| 74 65 20 74 68 61 74 0a | 58 2e 49 20 66 73 61 6e |te that.|X.I fsan|
|00003500| 61 6c 79 7a 65 0a 58 6d | 61 79 20 67 69 76 65 20 |alyze.Xm|ay give |
|00003510| 65 72 72 6f 6e 65 6f 75 | 73 20 72 65 73 75 6c 74 |erroneou|s result|
|00003520| 73 20 69 66 20 75 73 65 | 64 20 6f 6e 20 61 20 64 |s if use|d on a d|
|00003530| 61 6d 61 67 65 64 20 66 | 69 6c 65 20 73 79 73 74 |amaged f|ile syst|
|00003540| 65 6d 2c 20 62 75 74 20 | 74 68 65 20 66 69 6c 65 |em, but |the file|
|00003550| 0a 58 73 79 73 74 65 6d | 20 69 74 73 65 6c 66 20 |.Xsystem| itself |
|00003560| 77 69 6c 6c 20 6e 6f 74 | 20 62 65 20 61 66 66 65 |will not| be affe|
|00003570| 63 74 65 64 2e 0a 58 2e | 53 48 20 45 58 41 4d 50 |cted..X.|SH EXAMP|
|00003580| 4c 45 53 0a 58 66 73 61 | 6e 61 6c 79 7a 65 20 2f |LES.Xfsa|nalyze /|
|00003590| 64 65 76 2f 64 73 6b 2f | 30 73 32 20 20 20 20 23 |dev/dsk/|0s2 #|
|000035a0| 20 61 6e 61 6c 79 7a 65 | 20 66 69 6c 65 20 73 79 | analyze| file sy|
|000035b0| 73 74 65 6d 0a 58 2e 62 | 72 0a 58 66 73 61 6e 61 |stem.X.b|r.Xfsana|
|000035c0| 6c 79 7a 65 20 2f 64 65 | 76 2f 64 73 6b 2f 30 73 |lyze /de|v/dsk/0s|
|000035d0| 32 20 2a 20 20 23 20 61 | 6e 61 6c 79 7a 65 20 66 |2 * # a|nalyze f|
|000035e0| 69 6c 65 73 20 69 6e 20 | 63 75 72 72 65 6e 74 20 |iles in |current |
|000035f0| 64 69 72 0a 58 2e 53 48 | 20 46 49 4c 45 53 0a 58 |dir.X.SH| FILES.X|
|00003600| 2f 75 73 72 2f 69 6e 63 | 6c 75 64 65 2f 73 79 73 |/usr/inc|lude/sys|
|00003610| 2f 66 69 6c 65 73 79 73 | 2e 68 09 73 75 70 65 72 |/filesys|.h.super|
|00003620| 20 62 6c 6f 63 6b 20 73 | 74 72 75 63 74 75 72 65 | block s|tructure|
|00003630| 0a 58 2e 62 72 0a 58 2f | 75 73 72 2f 69 6e 63 6c |.X.br.X/|usr/incl|
|00003640| 75 64 65 2f 73 79 73 2f | 69 6e 6f 2e 68 09 09 64 |ude/sys/|ino.h..d|
|00003650| 69 73 6b 20 69 6e 6f 64 | 65 20 73 74 72 75 63 74 |isk inod|e struct|
|00003660| 75 72 65 0a 58 2e 62 72 | 0a 58 2f 75 73 72 2f 69 |ure.X.br|.X/usr/i|
|00003670| 6e 63 6c 75 64 65 2f 73 | 79 73 2f 70 61 72 61 6d |nclude/s|ys/param|
|00003680| 2e 68 09 73 79 73 74 65 | 6d 20 70 61 72 61 6d 65 |.h.syste|m parame|
|00003690| 74 65 72 73 0a 58 2e 62 | 72 0a 58 2f 75 73 72 2f |ters.X.b|r.X/usr/|
|000036a0| 69 6e 63 6c 75 64 65 2f | 73 79 73 2f 74 79 70 65 |include/|sys/type|
|000036b0| 73 2e 68 09 73 79 73 74 | 65 6d 20 74 79 70 65 20 |s.h.syst|em type |
|000036c0| 64 65 66 69 6e 69 74 69 | 6f 6e 73 0a 58 2e 53 48 |definiti|ons.X.SH|
|000036d0| 20 42 55 47 53 0a 58 2e | 49 20 46 73 61 6e 61 6c | BUGS.X.|I Fsanal|
|000036e0| 79 7a 65 0a 58 69 73 20 | 73 75 70 70 6f 72 74 65 |yze.Xis |supporte|
|000036f0| 64 20 62 79 20 53 79 73 | 74 65 6d 20 56 20 52 65 |d by Sys|tem V Re|
|00003700| 6c 65 61 73 65 20 32 2e | 20 20 49 74 20 68 61 73 |lease 2.| It has|
|00003710| 20 6e 6f 74 20 79 65 74 | 20 62 65 65 6e 20 70 6f | not yet| been po|
|00003720| 72 74 65 64 20 74 6f 20 | 61 6e 79 0a 58 6f 74 68 |rted to |any.Xoth|
|00003730| 65 72 20 76 65 72 73 69 | 6f 6e 20 6f 66 20 55 6e |er versi|on of Un|
|00003740| 69 78 2e 0a 58 2e 53 48 | 20 22 53 45 45 20 41 4c |ix..X.SH| "SEE AL|
|00003750| 53 4f 22 0a 58 66 73 73 | 74 61 74 28 31 4d 29 2c |SO".Xfss|tat(1M),|
|00003760| 20 66 73 63 6b 28 31 4d | 29 2c 20 66 73 64 62 28 | fsck(1M|), fsdb(|
|00003770| 31 4d 29 0a 58 2e 53 48 | 20 41 55 54 48 4f 52 0a |1M).X.SH| AUTHOR.|
|00003780| 58 4d 69 63 68 61 65 6c | 20 4a 2e 20 59 6f 75 6e |XMichael| J. Youn|
|00003790| 67 0a 58 2e 62 72 0a 58 | 7b 64 65 63 76 61 78 7c |g.X.br.X|{decvax||
|000037a0| 68 61 72 76 61 72 64 7c | 6c 69 6e 75 73 7c 6d 69 |harvard||linus|mi|
|000037b0| 74 2d 65 64 64 69 65 7d | 21 6e 65 63 6e 74 63 21 |t-eddie}|!necntc!|
|000037c0| 6e 65 63 69 73 21 6d 72 | 73 74 21 73 64 74 69 21 |necis!mr|st!sdti!|
|000037d0| 6d 6a 79 0a 58 2e 62 72 | 0a 58 49 6e 74 65 72 6e |mjy.X.br|.XIntern|
|000037e0| 65 74 20 3a 20 6d 6a 79 | 25 73 64 74 69 2e 75 75 |et : mjy|%sdti.uu|
|000037f0| 63 70 40 68 61 72 76 61 | 72 64 2e 68 61 72 76 61 |cp@harva|rd.harva|
|00003800| 72 64 2e 65 64 75 0a 58 | 2e 53 48 20 56 45 52 53 |rd.edu.X|.SH VERS|
|00003810| 49 4f 4e 0a 58 76 32 2e | 30 34 20 5c 2d 20 37 20 |ION.Xv2.|04 \- 7 |
|00003820| 4a 61 6e 75 61 72 79 20 | 31 39 38 38 0a 45 4e 44 |January |1988.END|
|00003830| 5f 4f 46 5f 66 73 61 6e | 61 6c 79 7a 65 2e 38 0a |_OF_fsan|alyze.8.|
|00003840| 69 66 20 74 65 73 74 20 | 33 34 34 31 20 2d 6e 65 |if test |3441 -ne|
|00003850| 20 60 77 63 20 2d 63 20 | 3c 66 73 61 6e 61 6c 79 | `wc -c |<fsanaly|
|00003860| 7a 65 2e 38 60 3b 20 74 | 68 65 6e 0a 20 20 20 20 |ze.8`; t|hen. |
|00003870| 65 63 68 6f 20 73 68 61 | 72 3a 20 5c 22 66 73 61 |echo sha|r: \"fsa|
|00003880| 6e 61 6c 79 7a 65 2e 38 | 5c 22 20 75 6e 70 61 63 |nalyze.8|\" unpac|
|00003890| 6b 65 64 20 77 69 74 68 | 20 77 72 6f 6e 67 20 73 |ked with| wrong s|
|000038a0| 69 7a 65 21 0a 66 69 0a | 23 20 65 6e 64 20 6f 66 |ize!.fi.|# end of|
|000038b0| 20 6f 76 65 72 77 72 69 | 74 69 6e 67 20 63 68 65 | overwri|ting che|
|000038c0| 63 6b 0a 66 69 0a 69 66 | 20 74 65 73 74 20 2d 66 |ck.fi.if| test -f|
|000038d0| 20 66 73 61 6e 61 6c 79 | 7a 65 2e 63 20 2d 61 20 | fsanaly|ze.c -a |
|000038e0| 22 24 7b 31 7d 22 20 21 | 3d 20 22 2d 63 22 20 3b |"${1}" !|= "-c" ;|
|000038f0| 20 74 68 65 6e 20 0a 20 | 20 65 63 68 6f 20 73 68 | then . | echo sh|
|00003900| 61 72 3a 20 57 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: Will| not ove|
|00003910| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|00003920| 20 66 69 6c 65 20 5c 22 | 66 73 61 6e 61 6c 79 7a | file \"|fsanalyz|
|00003930| 65 2e 63 5c 22 0a 65 6c | 73 65 0a 65 63 68 6f 20 |e.c\".el|se.echo |
|00003940| 73 68 61 72 3a 20 45 78 | 74 72 61 63 74 69 6e 67 |shar: Ex|tracting|
|00003950| 20 5c 22 66 73 61 6e 61 | 6c 79 7a 65 2e 63 5c 22 | \"fsana|lyze.c\"|
|00003960| 20 5c 28 32 35 32 32 35 | 20 63 68 61 72 61 63 74 | \(25225| charact|
|00003970| 65 72 73 5c 29 0a 73 65 | 64 20 22 73 2f 5e 58 2f |ers\).se|d "s/^X/|
|00003980| 2f 22 20 3e 66 73 61 6e | 61 6c 79 7a 65 2e 63 20 |/" >fsan|alyze.c |
|00003990| 3c 3c 27 45 4e 44 5f 4f | 46 5f 66 73 61 6e 61 6c |<<'END_O|F_fsanal|
|000039a0| 79 7a 65 2e 63 27 0a 58 | 2f 2a 0a 58 20 2a 20 66 |yze.c'.X|/*.X * f|
|000039b0| 73 61 6e 61 6c 79 7a 65 | 2e 63 20 2d 20 66 69 6c |sanalyze|.c - fil|
|000039c0| 65 20 73 79 73 74 65 6d | 20 61 6e 61 6c 79 7a 65 |e system| analyze|
|000039d0| 72 20 2d 20 76 32 2e 30 | 34 3b 20 37 20 4a 61 6e |r - v2.0|4; 7 Jan|
|000039e0| 75 61 72 79 20 31 39 38 | 38 0a 58 20 2a 0a 58 20 |uary 198|8.X *.X |
|000039f0| 2a 20 41 75 74 68 6f 72 | 20 20 20 3a 20 4d 69 63 |* Author| : Mic|
|00003a00| 68 61 65 6c 20 4a 2e 20 | 59 6f 75 6e 67 0a 58 20 |hael J. |Young.X |
|00003a10| 2a 20 55 53 6d 61 69 6c | 20 20 20 3a 20 53 6f 66 |* USmail| : Sof|
|00003a20| 74 77 61 72 65 20 44 65 | 76 65 6c 6f 70 6d 65 6e |tware De|velopmen|
|00003a30| 74 20 54 65 63 68 6e 6f | 6c 6f 67 69 65 73 2c 20 |t Techno|logies, |
|00003a40| 49 6e 63 2e 0a 58 20 2a | 20 20 20 20 20 20 20 20 |Inc..X *| |
|00003a50| 20 20 20 20 33 37 35 20 | 44 75 74 74 6f 6e 20 52 | 375 |Dutton R|
|00003a60| 64 0a 58 20 2a 20 20 20 | 20 20 20 20 20 20 20 20 |d.X * | |
|00003a70| 20 53 75 64 62 75 72 79 | 20 4d 41 20 30 31 37 37 | Sudbury| MA 0177|
|00003a80| 36 0a 58 20 2a 20 55 55 | 43 50 20 20 20 20 20 3a |6.X * UU|CP :|
|00003a90| 20 7b 64 65 63 76 61 78 | 7c 68 61 72 76 61 72 64 | {decvax||harvard|
|00003aa0| 7c 6c 69 6e 75 73 7c 6d | 69 74 2d 65 64 64 69 65 ||linus|m|it-eddie|
|00003ab0| 7d 21 6e 65 63 6e 74 63 | 21 6e 65 63 69 73 21 6d |}!necntc|!necis!m|
|00003ac0| 72 73 74 21 73 64 74 69 | 21 6d 6a 79 0a 58 20 2a |rst!sdti|!mjy.X *|
|00003ad0| 20 49 6e 74 65 72 6e 65 | 74 20 3a 20 6d 6a 79 25 | Interne|t : mjy%|
|00003ae0| 73 64 74 69 2e 75 75 63 | 70 40 68 61 72 76 61 72 |sdti.uuc|p@harvar|
|00003af0| 64 2e 68 61 72 76 61 72 | 64 2e 65 64 75 0a 58 20 |d.harvar|d.edu.X |
|00003b00| 2a 0a 58 20 2a 20 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |*.X * ==|========|
|00003b10| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003b20| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003b30| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003b40| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 0a |========|=======.|
|00003b50| 58 20 2a 20 4e 6f 74 65 | 20 3a 20 54 68 69 73 20 |X * Note| : This |
|00003b60| 70 72 6f 67 72 61 6d 20 | 68 61 73 20 62 65 65 6e |program |has been|
|00003b70| 20 70 6c 61 63 65 64 20 | 69 6e 20 74 68 65 20 70 | placed |in the p|
|00003b80| 75 62 6c 69 63 20 64 6f | 6d 61 69 6e 20 74 6f 20 |ublic do|main to |
|00003b90| 70 65 72 6d 69 74 0a 58 | 20 2a 20 75 6e 72 65 73 |permit.X| * unres|
|00003ba0| 74 72 69 63 74 65 64 20 | 64 69 73 74 72 69 62 75 |tricted |distribu|
|00003bb0| 74 69 6f 6e 20 61 6e 64 | 20 75 73 65 2e 20 20 49 |tion and| use. I|
|00003bc0| 20 68 61 76 65 20 70 6c | 61 63 65 64 20 6e 6f 20 | have pl|aced no |
|00003bd0| 63 6f 70 79 72 69 67 68 | 74 20 6f 6e 20 69 74 2c |copyrigh|t on it,|
|00003be0| 20 62 75 74 0a 58 20 2a | 20 49 20 72 65 71 75 65 | but.X *| I reque|
|00003bf0| 73 74 20 74 68 61 74 20 | 79 6f 75 20 6b 65 65 70 |st that |you keep|
|00003c00| 20 6d 65 20 69 6e 66 6f | 72 6d 65 64 20 61 62 6f | me info|rmed abo|
|00003c10| 75 74 20 61 6e 79 20 65 | 6e 68 61 6e 63 65 6d 65 |ut any e|nhanceme|
|00003c20| 6e 74 73 20 61 6e 64 20 | 62 75 67 20 66 69 78 65 |nts and |bug fixe|
|00003c30| 73 0a 58 20 2a 20 79 6f | 75 20 6d 61 6b 65 20 73 |s.X * yo|u make s|
|00003c40| 6f 20 49 20 63 61 6e 20 | 6b 65 65 70 20 61 6e 20 |o I can |keep an |
|00003c50| 75 70 2d 74 6f 2d 64 61 | 74 65 20 63 6f 70 79 20 |up-to-da|te copy |
|00003c60| 66 6f 72 20 66 75 72 74 | 68 65 72 20 64 69 73 74 |for furt|her dist|
|00003c70| 72 69 62 75 74 69 6f 6e | 2e 0a 58 20 2a 20 3d 3d |ribution|..X * ==|
|00003c80| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003c90| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003ca0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003cb0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003cc0| 3d 3d 3d 3d 3d 3d 3d 0a | 58 20 2a 0a 58 20 2a 20 |=======.|X *.X * |
|00003cd0| 66 73 61 6e 61 6c 79 7a | 65 20 69 73 20 61 20 73 |fsanalyz|e is a s|
|00003ce0| 69 6d 70 6c 65 20 74 6f | 6f 6c 20 74 68 61 74 20 |imple to|ol that |
|00003cf0| 65 73 74 69 6d 61 74 65 | 73 20 66 69 6c 65 20 73 |estimate|s file s|
|00003d00| 79 73 74 65 6d 20 66 72 | 61 67 6d 65 6e 74 61 74 |ystem fr|agmentat|
|00003d10| 69 6f 6e 2e 20 20 49 74 | 0a 58 20 2a 20 61 63 63 |ion. It|.X * acc|
|00003d20| 6f 6d 70 6c 69 73 68 65 | 73 20 74 68 69 73 20 62 |omplishe|s this b|
|00003d30| 79 20 73 63 61 6e 6e 69 | 6e 67 20 74 68 65 20 64 |y scanni|ng the d|
|00003d40| 61 74 61 20 62 6c 6f 63 | 6b 73 20 66 6f 72 20 65 |ata bloc|ks for e|
|00003d50| 61 63 68 20 69 2d 6e 6f | 64 65 20 69 6e 20 74 68 |ach i-no|de in th|
|00003d60| 65 20 0a 58 20 2a 20 66 | 69 6c 65 20 73 79 73 74 |e .X * f|ile syst|
|00003d70| 65 6d 2c 20 6c 6f 6f 6b | 69 6e 67 20 66 6f 72 20 |em, look|ing for |
|00003d80| 62 6c 6f 63 6b 20 6e 75 | 6d 62 65 72 73 20 74 68 |block nu|mbers th|
|00003d90| 61 74 20 61 72 65 20 6f | 75 74 20 6f 66 20 73 65 |at are o|ut of se|
|00003da0| 71 75 65 6e 63 65 2e 20 | 20 0a 58 20 2a 20 46 72 |quence. | .X * Fr|
|00003db0| 61 67 6d 65 6e 74 61 74 | 69 6f 6e 20 69 73 20 74 |agmentat|ion is t|
|00003dc0| 68 65 6e 20 63 6f 6d 70 | 75 74 65 64 20 61 73 20 |hen comp|uted as |
|00003dd0| 74 68 65 20 72 61 74 69 | 6f 20 6f 66 20 6f 75 74 |the rati|o of out|
|00003de0| 2d 6f 66 2d 73 65 71 75 | 65 6e 63 65 20 62 6c 6f |-of-sequ|ence blo|
|00003df0| 63 6b 73 20 74 6f 0a 58 | 20 2a 20 74 6f 74 61 6c |cks to.X| * total|
|00003e00| 20 64 61 74 61 20 62 6c | 6f 63 6b 73 2e 0a 58 20 | data bl|ocks..X |
|00003e10| 2a 20 0a 58 20 2a 20 66 | 73 61 6e 61 6c 79 7a 65 |* .X * f|sanalyze|
|00003e20| 20 61 6c 73 6f 20 70 72 | 6f 76 69 64 65 73 20 73 | also pr|ovides s|
|00003e30| 74 61 74 69 73 74 69 63 | 73 20 72 65 67 61 72 64 |tatistic|s regard|
|00003e40| 69 6e 67 20 74 68 65 20 | 6e 75 6d 62 65 72 20 28 |ing the |number (|
|00003e50| 61 6e 64 20 69 64 65 6e | 74 69 74 79 29 20 6f 66 |and iden|tity) of|
|00003e60| 0a 58 20 2a 20 66 69 6c | 65 73 20 74 68 61 74 20 |.X * fil|es that |
|00003e70| 61 72 65 20 76 65 72 79 | 20 6c 61 72 67 65 2c 20 |are very| large, |
|00003e80| 61 6e 64 20 65 73 70 65 | 63 69 61 6c 6c 79 20 65 |and espe|cially e|
|00003e90| 78 63 65 73 73 69 76 65 | 6c 79 20 6c 61 72 67 65 |xcessive|ly large|
|00003ea0| 20 64 69 72 65 63 74 6f | 72 69 65 73 20 0a 58 20 | directo|ries .X |
|00003eb0| 2a 20 28 77 68 69 63 68 | 20 61 72 65 20 76 65 72 |* (which| are ver|
|00003ec0| 79 20 69 6e 65 66 66 69 | 63 69 65 6e 74 29 2e 0a |y ineffi|cient)..|
|00003ed0| 58 20 2a 20 0a 58 20 2a | 20 54 6f 20 62 75 69 6c |X * .X *| To buil|
|00003ee0| 64 20 66 73 61 6e 61 6c | 79 7a 65 20 74 68 65 20 |d fsanal|yze the |
|00003ef0| 73 74 65 70 73 20 61 72 | 65 3a 0a 58 20 2a 20 20 |steps ar|e:.X * |
|00003f00| 20 20 20 20 20 63 63 20 | 2d 4f 20 2d 6f 20 66 73 | cc |-O -o fs|
|00003f10| 61 6e 61 6c 79 7a 65 20 | 66 73 61 6e 61 6c 79 7a |analyze |fsanalyz|
|00003f20| 65 2e 63 0a 58 20 2a 20 | 20 20 20 20 20 20 6d 76 |e.c.X * | mv|
|00003f30| 20 66 73 61 6e 61 6c 79 | 7a 65 20 2f 62 69 6e 0a | fsanaly|ze /bin.|
|00003f40| 58 20 2a 0a 58 20 2a 20 | 55 73 61 67 65 3a 0a 58 |X *.X * |Usage:.X|
|00003f50| 20 2a 20 20 20 20 66 73 | 61 6e 61 6c 79 7a 65 20 | * fs|analyze |
|00003f60| 5b 2d 66 6c 61 67 73 5d | 20 73 70 65 63 69 61 6c |[-flags]| special|
|00003f70| 20 5b 66 69 6c 65 5d 20 | 2e 2e 2e 0a 58 20 2a 0a | [file] |....X *.|
|00003f80| 58 20 2a 20 20 20 20 77 | 68 65 72 65 20 5b 66 6c |X * w|here [fl|
|00003f90| 61 67 73 5d 20 69 6e 63 | 6c 75 64 65 20 74 68 65 |ags] inc|lude the|
|00003fa0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 3a 0a 58 20 2a 20 | followi|ng:.X * |
|00003fb0| 20 20 20 20 20 64 20 20 | 20 64 69 73 70 6c 61 79 | d | display|
|00003fc0| 20 69 2d 6e 6f 64 65 20 | 6e 75 6d 62 65 72 73 20 | i-node |numbers |
|00003fd0| 61 73 20 74 68 65 79 20 | 61 72 65 20 65 78 61 6d |as they |are exam|
|00003fe0| 69 6e 65 64 0a 58 20 2a | 20 20 20 20 20 20 65 20 |ined.X *| e |
|00003ff0| 20 20 72 65 70 6f 72 74 | 20 66 69 6c 65 20 73 69 | report| file si|
|00004000| 7a 65 20 69 6e 63 6f 6e | 73 69 73 74 65 6e 63 69 |ze incon|sistenci|
|00004010| 65 73 0a 58 20 2a 20 20 | 20 20 20 20 69 20 20 20 |es.X * | i |
|00004020| 72 65 70 6f 72 74 20 69 | 6e 6f 64 65 73 20 6e 75 |report i|nodes nu|
|00004030| 6d 62 65 72 73 20 77 69 | 74 68 20 64 6f 75 62 6c |mbers wi|th doubl|
|00004040| 65 20 61 6e 64 20 74 72 | 69 70 6c 65 20 69 6e 64 |e and tr|iple ind|
|00004050| 69 72 65 63 74 69 6f 6e | 0a 58 20 2a 09 6f 20 20 |irection|.X *.o |
|00004060| 20 6f 76 65 72 72 69 64 | 65 20 65 72 72 6f 72 20 | overrid|e error |
|00004070| 63 68 65 63 6b 69 6e 67 | 20 6f 6e 20 66 69 6c 65 |checking| on file|
|00004080| 20 73 79 73 74 65 6d 20 | 73 75 70 65 72 62 6c 6f | system |superblo|
|00004090| 63 6b 0a 58 20 2a 0a 58 | 20 2a 20 20 20 20 49 66 |ck.X *.X| * If|
|000040a0| 20 74 68 65 20 6f 70 74 | 69 6f 6e 61 6c 20 66 69 | the opt|ional fi|
|000040b0| 6c 65 20 61 72 67 75 6d | 65 6e 74 28 73 29 20 61 |le argum|ent(s) a|
|000040c0| 72 65 20 70 72 65 73 65 | 6e 74 2c 20 6f 6e 6c 79 |re prese|nt, only|
|000040d0| 20 74 68 65 20 73 70 65 | 63 69 66 69 65 64 0a 58 | the spe|cified.X|
|000040e0| 20 2a 20 20 20 20 69 6e | 64 69 76 69 64 75 61 6c | * in|dividual|
|000040f0| 20 66 69 6c 65 73 20 6f | 6e 20 74 68 65 20 66 69 | files o|n the fi|
|00004100| 6c 65 20 73 79 73 74 65 | 6d 20 61 72 65 20 61 6e |le syste|m are an|
|00004110| 61 6c 79 7a 65 64 2e 20 | 20 49 66 20 61 62 73 65 |alyzed. | If abse|
|00004120| 6e 74 2c 20 74 68 65 0a | 58 20 2a 20 20 20 20 65 |nt, the.|X * e|
|00004130| 6e 74 69 72 65 20 66 69 | 6c 65 20 73 79 73 74 65 |ntire fi|le syste|
|00004140| 6d 20 69 73 20 61 6e 61 | 6c 79 7a 65 64 2e 0a 58 |m is ana|lyzed..X|
|00004150| 20 2a 0a 58 20 2a 20 20 | 20 20 45 78 61 6d 70 6c | *.X * | Exampl|
|00004160| 65 3a 0a 58 20 2a 20 20 | 20 20 20 20 66 73 61 6e |e:.X * | fsan|
|00004170| 61 6c 79 7a 65 20 2f 64 | 65 76 2f 64 73 6b 2f 30 |alyze /d|ev/dsk/0|
|00004180| 73 32 0a 58 20 2a 0a 58 | 20 2a 20 20 20 20 53 69 |s2.X *.X| * Si|
|00004190| 6e 63 65 20 66 73 61 6e | 61 6c 79 7a 65 20 75 73 |nce fsan|alyze us|
|000041a0| 65 73 20 74 68 65 20 73 | 75 70 65 72 62 6c 6f 63 |es the s|uperbloc|
|000041b0| 6b 20 69 6e 66 6f 20 4f | 4e 20 54 48 45 20 44 49 |k info O|N THE DI|
|000041c0| 53 4b 2c 20 6d 6f 72 65 | 20 61 63 63 75 72 61 74 |SK, more| accurat|
|000041d0| 65 0a 58 20 2a 20 20 20 | 20 72 65 73 75 6c 74 73 |e.X * | results|
|000041e0| 20 77 69 6c 6c 20 62 65 | 20 72 65 74 75 72 6e 65 | will be| returne|
|000041f0| 64 20 69 66 20 73 79 6e | 63 28 31 29 20 69 73 20 |d if syn|c(1) is |
|00004200| 65 78 65 63 75 74 65 64 | 20 69 6d 6d 65 64 69 61 |executed| immedia|
|00004210| 74 65 6c 79 20 70 72 69 | 6f 72 20 74 6f 0a 58 20 |tely pri|or to.X |
|00004220| 2a 20 20 20 20 66 73 61 | 6e 61 6c 79 7a 65 2e 0a |* fsa|nalyze..|
|00004230| 58 20 2a 2f 0a 58 0a 58 | 2f 2a 0a 58 20 2a 20 4d |X */.X.X|/*.X * M|
|00004240| 6f 64 69 66 69 63 61 74 | 69 6f 6e 20 48 69 73 74 |odificat|ion Hist|
|00004250| 6f 72 79 3a 0a 58 20 2a | 0a 58 20 2a 20 20 20 20 |ory:.X *|.X * |
|00004260| 44 61 74 65 20 20 20 20 | 20 20 20 41 75 74 68 6f |Date | Autho|
|00004270| 72 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |r | |
|00004280| 20 20 20 20 44 65 73 63 | 72 69 70 74 69 6f 6e 0a | Desc|ription.|
|00004290| 58 20 2a 20 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 20 |X * ----|------- |
|000042a0| 20 2d 2d 2d 2d 2d 2d 2d | 2d 20 20 2d 2d 2d 2d 2d | -------|- -----|
|000042b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 58 20 2a 20 32 |--------|--.X * 2|
|000042e0| 38 20 4a 75 6c 20 31 39 | 38 37 20 20 20 20 4d 4a |8 Jul 19|87 MJ|
|000042f0| 59 20 20 20 20 20 20 20 | 4f 72 69 67 69 6e 61 74 |Y |Originat|
|00004300| 65 64 0a 58 20 2a 20 20 | 35 20 4f 63 74 20 31 39 |ed.X * |5 Oct 19|
|00004310| 38 37 20 20 20 20 4d 4a | 59 20 20 20 20 20 20 20 |87 MJ|Y |
|00004320| 43 61 70 61 62 69 6c 69 | 74 79 20 74 6f 20 61 6e |Capabili|ty to an|
|00004330| 61 6c 79 7a 65 20 69 6e | 64 69 76 69 64 75 61 6c |alyze in|dividual|
|00004340| 20 66 69 6c 65 73 2c 0a | 58 20 2a 09 09 09 20 20 | files,.|X *... |
|00004350| 20 20 41 64 64 65 64 20 | 65 72 72 6f 72 20 63 68 | Added |error ch|
|00004360| 65 63 6b 69 6e 67 20 74 | 6f 20 66 69 6c 65 20 73 |ecking t|o file s|
|00004370| 79 73 74 65 6d 20 61 72 | 67 75 6d 65 6e 74 2c 0a |ystem ar|gument,.|
|00004380| 58 20 2a 09 09 09 20 20 | 20 20 41 64 64 65 64 20 |X *... | Added |
|00004390| 2d 6f 20 66 6c 61 67 0a | 58 20 2a 09 09 09 20 20 |-o flag.|X *... |
|000043a0| 20 20 50 72 69 6e 74 73 | 20 6f 75 74 20 76 6f 6c | Prints| out vol|
|000043b0| 75 6d 65 20 61 6e 64 20 | 66 69 6c 65 20 73 79 73 |ume and |file sys|
|000043c0| 74 65 6d 20 6e 61 6d 65 | 20 69 6e 20 73 75 6d 6d |tem name| in summ|
|000043d0| 61 72 79 0a 58 20 2a 20 | 31 32 20 4f 63 74 20 31 |ary.X * |12 Oct 1|
|000043e0| 39 38 37 20 20 20 20 4d | 4a 59 20 20 20 20 20 20 |987 M|JY |
|000043f0| 20 55 73 65 20 2f 65 74 | 63 2f 66 73 73 74 61 74 | Use /et|c/fsstat|
|00004400| 20 74 6f 20 64 6f 20 66 | 69 6c 65 20 73 79 73 74 | to do f|ile syst|
|00004410| 65 6d 20 76 61 6c 69 64 | 69 74 79 0a 58 20 2a 20 |em valid|ity.X * |
|00004420| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004430| 20 20 20 20 20 20 20 20 | 20 63 68 65 63 6b 69 6e | | checkin|
|00004440| 67 0a 58 20 2a 20 20 39 | 20 4e 6f 76 20 31 39 38 |g.X * 9| Nov 198|
|00004450| 37 20 20 20 20 4d 4a 59 | 20 20 20 20 20 20 20 70 |7 MJY| p|
|00004460| 72 69 6e 74 20 6f 75 74 | 20 77 61 72 6e 69 6e 67 |rint out| warning|
|00004470| 20 69 66 20 66 69 6c 65 | 20 73 79 73 74 65 6d 20 | if file| system |
|00004480| 69 73 20 6d 6f 75 6e 74 | 65 64 0a 58 20 2a 20 31 |is mount|ed.X * 1|
|00004490| 32 20 4e 6f 76 20 31 39 | 38 37 20 20 20 20 4d 4a |2 Nov 19|87 MJ|
|000044a0| 59 20 20 20 20 20 20 20 | 56 6f 6c 75 6d 65 20 73 |Y |Volume s|
|000044b0| 69 7a 65 20 73 74 61 74 | 69 73 74 69 63 73 20 6e |ize stat|istics n|
|000044c0| 6f 77 20 6c 6f 6e 67 20 | 69 6e 73 74 65 61 64 20 |ow long |instead |
|000044d0| 6f 66 20 69 6e 74 0a 58 | 20 2a 20 20 37 20 4a 61 |of int.X| * 7 Ja|
|000044e0| 6e 20 31 39 38 38 20 20 | 20 20 4d 4a 59 20 20 20 |n 1988 | MJY |
|000044f0| 20 20 20 20 4d 6f 64 69 | 66 69 65 64 20 62 6c 6b | Modi|fied blk|
|00004500| 5f 6e 6f 28 29 20 74 6f | 20 75 73 65 20 6c 33 74 |_no() to| use l3t|
|00004510| 6f 6c 28 29 0a 58 20 2a | 2f 0a 58 0a 58 0a 58 23 |ol().X *|/.X.X.X#|
|00004520| 20 69 6e 63 6c 75 64 65 | 20 3c 73 74 64 69 6f 2e | include| <stdio.|
|00004530| 68 3e 0a 58 23 20 69 6e | 63 6c 75 64 65 20 3c 73 |h>.X# in|clude <s|
|00004540| 79 73 2f 74 79 70 65 73 | 2e 68 3e 0a 58 23 20 69 |ys/types|.h>.X# i|
|00004550| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 69 6e 6f 2e |nclude <|sys/ino.|
|00004560| 68 3e 0a 58 23 20 69 6e | 63 6c 75 64 65 20 3c 73 |h>.X# in|clude <s|
|00004570| 79 73 2f 70 61 72 61 6d | 2e 68 3e 0a 58 23 20 69 |ys/param|.h>.X# i|
|00004580| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 66 69 6c 73 |nclude <|sys/fils|
|00004590| 79 73 2e 68 3e 0a 58 23 | 20 69 6e 63 6c 75 64 65 |ys.h>.X#| include|
|000045a0| 20 3c 73 79 73 2f 73 74 | 61 74 2e 68 3e 0a 58 0a | <sys/st|at.h>.X.|
|000045b0| 58 23 20 64 65 66 69 6e | 65 20 42 4c 4b 5f 53 49 |X# defin|e BLK_SI|
|000045c0| 5a 45 09 35 31 32 09 09 | 2f 2a 20 62 6c 6f 63 6b |ZE.512..|/* block|
|000045d0| 20 73 69 7a 65 20 2a 2f | 0a 58 23 20 64 65 66 69 | size */|.X# defi|
|000045e0| 6e 65 20 49 42 4c 4b 20 | 09 09 32 09 09 2f 2a 20 |ne IBLK |..2../* |
|000045f0| 62 6c 6f 63 6b 20 6e 75 | 6d 62 65 72 20 6f 66 20 |block nu|mber of |
|00004600| 66 69 72 73 74 20 69 2d | 6e 6f 64 65 20 2a 2f 0a |first i-|node */.|
|00004610| 58 0a 58 23 20 64 65 66 | 69 6e 65 20 49 5f 42 4c |X.X# def|ine I_BL|
|00004620| 4f 43 4b 5f 46 41 43 54 | 4f 52 09 33 32 09 09 2f |OCK_FACT|OR.32../|
|00004630| 2a 20 6e 75 6d 62 65 72 | 20 6f 66 20 69 2d 6e 6f |* number| of i-no|
|00004640| 64 65 73 20 70 65 72 20 | 62 6c 6f 63 6b 20 2a 2f |des per |block */|
|00004650| 0a 58 0a 58 2f 2a 0a 58 | 20 2a 20 66 69 6c 65 20 |.X.X/*.X| * file |
|00004660| 6d 6f 64 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |mode def|initions|
|00004670| 0a 58 20 2a 2f 0a 58 23 | 20 64 65 66 69 6e 65 20 |.X */.X#| define |
|00004680| 46 49 4c 45 5f 54 59 50 | 45 28 61 29 20 09 28 28 |FILE_TYP|E(a) .((|
|00004690| 61 29 2d 3e 64 69 5f 6d | 6f 64 65 20 26 20 53 5f |a)->di_m|ode & S_|
|000046a0| 49 46 4d 54 29 0a 58 23 | 20 64 65 66 69 6e 65 20 |IFMT).X#| define |
|000046b0| 49 53 5f 53 50 45 43 49 | 41 4c 28 61 29 09 28 28 |IS_SPECI|AL(a).((|
|000046c0| 28 61 29 20 26 20 53 5f | 49 46 4d 54 20 3d 3d 20 |(a) & S_|IFMT == |
|000046d0| 53 5f 49 46 42 4c 4b 29 | 20 7c 7c 20 28 28 61 29 |S_IFBLK)| || ((a)|
|000046e0| 20 26 20 53 5f 49 46 4d | 54 20 3d 3d 20 53 5f 49 | & S_IFM|T == S_I|
|000046f0| 46 43 48 52 29 20 7c 7c | 20 28 28 61 29 20 26 20 |FCHR) ||| ((a) & |
|00004700| 53 5f 49 46 4d 54 20 3d | 3d 20 53 5f 49 46 49 46 |S_IFMT =|= S_IFIF|
|00004710| 4f 29 29 0a 58 0a 58 2f | 2a 0a 58 20 2a 20 62 61 |O)).X.X/|*.X * ba|
|00004720| 73 69 63 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 0a |sic defi|nitions.|
|00004730| 58 20 2a 2f 0a 58 23 20 | 64 65 66 69 6e 65 20 46 |X */.X# |define F|
|00004740| 41 4c 53 45 09 30 0a 58 | 23 20 64 65 66 69 6e 65 |ALSE.0.X|# define|
|00004750| 20 54 52 55 45 09 31 0a | 58 0a 58 74 79 70 65 64 | TRUE.1.|X.Xtyped|
|00004760| 65 66 20 69 6e 74 20 62 | 6f 6f 6c 65 61 6e 3b 0a |ef int b|oolean;.|
|00004770| 58 0a 58 2f 2a 0a 58 20 | 2a 20 70 65 72 2d 66 69 |X.X/*.X |* per-fi|
|00004780| 6c 65 20 73 74 61 74 69 | 73 74 69 63 73 20 73 74 |le stati|stics st|
|00004790| 72 75 63 74 75 72 65 0a | 58 20 2a 2f 0a 58 73 74 |ructure.|X */.Xst|
|000047a0| 72 75 63 74 20 66 69 6c | 65 5f 64 61 74 61 20 7b |ruct fil|e_data {|
|000047b0| 0a 58 09 69 6e 74 20 69 | 6e 6f 64 65 3b 09 09 09 |.X.int i|node;...|
|000047c0| 2f 2a 20 69 2d 6e 6f 64 | 65 20 6e 75 6d 62 65 72 |/* i-nod|e number|
|000047d0| 20 2a 2f 0a 58 09 6c 6f | 6e 67 20 74 6f 74 61 6c | */.X.lo|ng total|
|000047e0| 5f 62 6c 6f 63 6b 73 3b | 09 09 2f 2a 20 74 6f 74 |_blocks;|../* tot|
|000047f0| 61 6c 20 62 6c 6f 63 6b | 73 20 69 6e 20 66 69 6c |al block|s in fil|
|00004800| 65 20 28 69 6e 63 6c 20 | 0a 58 09 09 09 09 09 20 |e (incl |.X..... |
|00004810| 2a 20 69 6e 64 69 72 65 | 63 74 20 62 6c 6f 63 6b |* indire|ct block|
|00004820| 73 20 2a 2f 0a 58 09 6c | 6f 6e 67 20 64 61 74 61 |s */.X.l|ong data|
|00004830| 5f 62 6c 6f 63 6b 73 3b | 09 09 2f 2a 20 74 6f 74 |_blocks;|../* tot|
|00004840| 61 6c 20 64 61 74 61 20 | 62 6c 6f 63 6b 73 20 69 |al data |blocks i|
|00004850| 6e 20 66 69 6c 65 20 2a | 2f 0a 58 09 6c 6f 6e 67 |n file *|/.X.long|
|00004860| 20 70 6f 74 65 6e 74 69 | 61 6c 5f 73 65 65 6b 73 | potenti|al_seeks|
|00004870| 3b 09 09 2f 2a 20 6e 75 | 6d 62 65 72 20 6f 66 20 |;../* nu|mber of |
|00004880| 70 6f 74 65 6e 74 69 61 | 6c 20 73 65 65 6b 73 20 |potentia|l seeks |
|00004890| 69 6e 20 66 69 6c 65 20 | 2a 2f 0a 58 09 6c 6f 6e |in file |*/.X.lon|
|000048a0| 67 20 73 65 65 6b 73 3b | 09 09 09 2f 2a 20 61 63 |g seeks;|.../* ac|
|000048b0| 74 75 61 6c 20 73 65 65 | 6b 73 20 69 6e 20 66 69 |tual see|ks in fi|
|000048c0| 6c 65 20 2a 2f 0a 58 09 | 66 6c 6f 61 74 20 66 72 |le */.X.|float fr|
|000048d0| 61 67 6d 3b 09 09 09 2f | 2a 20 66 72 61 67 6d 65 |agm;.../|* fragme|
|000048e0| 6e 74 61 74 69 6f 6e 20 | 28 73 65 65 6b 73 2f 70 |ntation |(seeks/p|
|000048f0| 6f 74 2e 73 65 65 6b 73 | 29 20 2a 2f 0a 58 09 7d |ot.seeks|) */.X.}|
|00004900| 3b 0a 58 0a 58 46 49 4c | 45 20 2a 66 73 79 73 20 |;.X.XFIL|E *fsys |
|00004910| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 3d 20 | | = |
|00004920| 4e 55 4c 4c 3b 09 2f 2a | 20 66 69 6c 65 20 73 79 |NULL;./*| file sy|
|00004930| 73 74 65 6d 20 75 6e 64 | 65 72 20 74 65 73 74 20 |stem und|er test |
|00004940| 2a 2f 0a 58 63 68 61 72 | 20 2a 73 70 65 63 69 61 |*/.Xchar| *specia|
|00004950| 6c 20 20 20 20 20 20 20 | 20 20 20 20 20 3d 20 4e |l | = N|
|00004960| 55 4c 4c 3b 09 2f 2a 20 | 66 69 6c 65 20 73 79 73 |ULL;./* |file sys|
|00004970| 74 65 6d 20 64 65 76 69 | 63 65 20 6e 61 6d 65 20 |tem devi|ce name |
|00004980| 2a 2f 0a 58 0a 58 2f 2a | 0a 58 20 2a 20 66 69 6c |*/.X.X/*|.X * fil|
|00004990| 65 20 73 79 73 74 65 6d | 20 73 74 61 74 69 63 20 |e system| static |
|000049a0| 64 61 74 61 0a 58 20 2a | 2f 0a 58 73 74 72 75 63 |data.X *|/.Xstruc|
|000049b0| 74 20 66 69 6c 73 79 73 | 20 73 75 70 65 72 20 20 |t filsys| super |
|000049c0| 20 20 20 20 3d 20 7b 30 | 7d 3b 09 09 2f 2a 20 68 | = {0|};../* h|
|000049d0| 6f 6c 64 73 20 66 69 6c | 65 20 73 79 73 74 65 6d |olds fil|e system|
|000049e0| 20 73 75 70 65 72 20 62 | 6c 6f 63 6b 20 2a 2f 0a | super b|lock */.|
|000049f0| 58 69 6e 74 20 66 73 5f | 74 79 70 65 20 20 20 20 |Xint fs_|type |
|00004a00| 20 20 20 20 20 20 20 20 | 20 20 3d 20 31 3b 09 09 | | = 1;..|
|00004a10| 2f 2a 20 66 69 6c 65 20 | 73 79 73 74 65 6d 20 6c |/* file |system l|
|00004a20| 6f 67 69 63 61 6c 20 62 | 6c 6f 63 6b 20 73 69 7a |ogical b|lock siz|
|00004a30| 65 0a 58 09 09 09 09 09 | 20 2a 20 28 69 6e 20 35 |e.X.....| * (in 5|
|00004a40| 31 32 20 62 79 74 65 20 | 75 6e 69 74 73 29 20 2a |12 byte |units) *|
|00004a50| 2f 0a 58 6c 6f 6e 67 20 | 6e 75 6d 5f 69 6e 6f 64 |/.Xlong |num_inod|
|00004a60| 65 73 20 20 20 20 20 20 | 20 20 20 20 3d 20 30 3b |es | = 0;|
|00004a70| 09 09 2f 2a 20 6e 75 6d | 62 65 72 20 6f 66 20 69 |../* num|ber of i|
|00004a80| 2d 6e 6f 64 65 73 20 69 | 6e 20 66 69 6c 65 20 73 |-nodes i|n file s|
|00004a90| 79 73 74 65 6d 20 2a 2f | 0a 58 0a 58 2f 2a 0a 58 |ystem */|.X.X/*.X|
|00004aa0| 20 2a 20 63 61 6c 63 75 | 6c 61 74 65 64 20 67 6c | * calcu|lated gl|
|00004ab0| 6f 62 61 6c 20 73 74 61 | 74 69 73 74 69 63 73 0a |obal sta|tistics.|
|00004ac0| 58 20 2a 2f 0a 58 6c 6f | 6e 67 20 62 6c 6f 63 6b |X */.Xlo|ng block|
|00004ad0| 73 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 3d |s | =|
|00004ae0| 20 30 3b 09 09 2f 2a 20 | 72 75 6e 6e 69 6e 67 20 | 0;../* |running |
|00004af0| 62 6c 6f 63 6b 20 63 6f | 75 6e 74 20 2a 2f 0a 58 |block co|unt */.X|
|00004b00| 6c 6f 6e 67 20 66 72 65 | 65 5f 69 6e 6f 64 65 73 |long fre|e_inodes|
|00004b10| 20 20 20 20 20 20 20 20 | 20 3d 20 30 3b 09 09 2f | | = 0;../|
|00004b20| 2a 20 6e 75 6d 62 65 72 | 20 6f 66 20 75 6e 75 73 |* number| of unus|
|00004b30| 65 64 20 69 2d 6e 6f 64 | 65 73 20 2a 2f 0a 58 6c |ed i-nod|es */.Xl|
|00004b40| 6f 6e 67 20 70 6f 74 65 | 6e 74 69 61 6c 5f 73 65 |ong pote|ntial_se|
|00004b50| 65 6b 73 20 20 20 20 20 | 3d 20 30 3b 09 09 2f 2a |eks |= 0;../*|
|00004b60| 20 70 6f 74 65 6e 74 69 | 61 6c 20 6e 75 6d 62 65 | potenti|al numbe|
|00004b70| 72 20 6f 66 20 64 69 73 | 6b 20 73 65 65 6b 73 0a |r of dis|k seeks.|
|00004b80| 58 09 09 09 09 09 20 2a | 20 64 75 72 69 6e 67 20 |X..... *| during |
|00004b90| 73 65 71 75 65 6e 74 69 | 61 6c 20 61 63 63 65 73 |sequenti|al acces|
|00004ba0| 73 20 6f 66 20 61 20 0a | 58 09 09 09 09 09 20 2a |s of a .|X..... *|
|00004bb0| 20 66 69 6c 65 20 2a 2f | 0a 58 6c 6f 6e 67 20 73 | file */|.Xlong s|
|00004bc0| 65 65 6b 73 20 20 20 20 | 20 20 20 20 20 20 20 20 |eeks | |
|00004bd0| 20 20 20 3d 20 30 3b 09 | 09 2f 2a 20 61 63 74 75 | = 0;.|./* actu|
|00004be0| 61 6c 20 6e 75 6d 62 65 | 72 20 6f 66 20 64 69 73 |al numbe|r of dis|
|00004bf0| 6b 20 73 65 65 6b 73 0a | 58 09 09 09 09 09 20 2a |k seeks.|X..... *|
|00004c00| 20 72 65 71 75 69 72 65 | 64 20 64 75 72 69 6e 67 | require|d during|
|00004c10| 20 73 65 71 75 65 6e 74 | 69 61 6c 20 61 63 63 65 | sequent|ial acce|
|00004c20| 73 73 0a 58 09 09 09 09 | 09 20 2a 20 6f 66 20 61 |ss.X....|. * of a|
|00004c30| 20 66 69 6c 65 20 2a 2f | 0a 58 6c 6f 6e 67 20 69 | file */|.Xlong i|
|00004c40| 6e 64 69 72 65 63 74 73 | 20 20 20 20 20 20 20 20 |ndirects| |
|00004c50| 20 20 20 3d 20 30 3b 09 | 09 2f 2a 20 6e 75 6d 62 | = 0;.|./* numb|
|00004c60| 65 72 20 6f 66 20 66 69 | 6c 65 73 20 77 2f 20 6d |er of fi|les w/ m|
|00004c70| 6f 72 65 20 74 68 61 6e | 0a 58 09 09 09 09 09 20 |ore than|.X..... |
|00004c80| 2a 20 31 30 20 64 61 74 | 61 20 62 6c 6f 63 6b 73 |* 10 dat|a blocks|
|00004c90| 20 2a 2f 0a 58 6c 6f 6e | 67 20 64 6f 75 62 6c 65 | */.Xlon|g double|
|00004ca0| 5f 69 6e 64 69 72 65 63 | 74 73 20 20 20 20 3d 20 |_indirec|ts = |
|00004cb0| 30 3b 09 09 2f 2a 20 6e | 75 6d 62 65 72 20 6f 66 |0;../* n|umber of|
|00004cc0| 20 66 69 6c 65 73 20 77 | 2f 20 6d 6f 72 65 20 74 | files w|/ more t|
|00004cd0| 68 61 6e 0a 58 09 09 09 | 09 09 2f 2a 20 6f 6e 65 |han.X...|../* one|
|00004ce0| 20 6c 65 76 65 6c 20 6f | 66 20 69 6e 64 69 72 65 | level o|f indire|
|00004cf0| 63 74 69 6f 6e 20 2a 2f | 0a 58 6c 6f 6e 67 20 74 |ction */|.Xlong t|
|00004d00| 72 69 70 6c 65 5f 69 6e | 64 69 72 65 63 74 73 20 |riple_in|directs |
|00004d10| 20 20 20 3d 20 30 3b 09 | 09 2f 2a 20 6e 75 6d 62 | = 0;.|./* numb|
|00004d20| 65 72 20 6f 66 20 66 69 | 6c 65 73 20 77 2f 20 6d |er of fi|les w/ m|
|00004d30| 6f 72 65 20 74 68 61 6e | 0a 58 09 09 09 09 09 20 |ore than|.X..... |
|00004d40| 2a 20 74 77 6f 20 6c 65 | 76 65 6c 73 20 6f 66 20 |* two le|vels of |
|00004d50| 69 6e 64 69 72 65 63 74 | 69 6f 6e 20 2a 2f 0a 58 |indirect|ion */.X|
|00004d60| 69 6e 74 20 62 69 67 5f | 64 69 72 65 63 74 6f 72 |int big_|director|
|00004d70| 69 65 73 20 20 20 20 20 | 20 3d 20 30 3b 09 09 2f |ies | = 0;../|
|00004d80| 2a 20 6e 75 6d 62 65 72 | 20 6f 66 20 64 69 72 65 |* number| of dire|
|00004d90| 63 74 6f 72 69 65 73 20 | 77 69 74 68 0a 58 09 09 |ctories |with.X..|
|00004da0| 09 09 09 20 2a 20 69 6e | 64 69 72 65 63 74 69 6f |... * in|directio|
|00004db0| 6e 20 2a 2f 0a 58 69 6e | 74 20 6e 75 6d 5f 64 69 |n */.Xin|t num_di|
|00004dc0| 72 65 63 74 6f 72 69 65 | 73 20 20 20 20 20 20 3d |rectorie|s =|
|00004dd0| 20 30 3b 09 09 2f 2a 20 | 6e 75 6d 62 65 72 20 6f | 0;../* |number o|
|00004de0| 66 20 64 69 72 65 63 74 | 6f 72 69 65 73 20 2a 2f |f direct|ories */|
|00004df0| 0a 58 69 6e 74 20 6c 69 | 6e 6b 65 64 5f 66 69 6c |.Xint li|nked_fil|
|00004e00| 65 73 20 20 20 20 20 20 | 20 20 20 3d 20 30 3b 09 |es | = 0;.|
|00004e10| 09 2f 2a 20 6e 75 6d 62 | 65 72 20 6f 66 20 6d 75 |./* numb|er of mu|
|00004e20| 6c 74 69 70 6c 79 2d 6c | 69 6e 6b 65 64 20 66 69 |ltiply-l|inked fi|
|00004e30| 6c 65 73 20 2a 2f 0a 58 | 69 6e 74 20 73 69 7a 65 |les */.X|int size|
|00004e40| 5f 65 72 72 6f 72 73 20 | 20 20 20 20 20 20 20 20 |_errors | |
|00004e50| 20 3d 20 30 3b 09 09 2f | 2a 20 6e 75 6d 62 65 72 | = 0;../|* number|
|00004e60| 20 6f 66 20 66 69 6c 65 | 20 73 69 7a 65 20 64 69 | of file| size di|
|00004e70| 73 63 72 65 70 61 6e 63 | 69 65 73 20 2a 2f 0a 58 |screpanc|ies */.X|
|00004e80| 0a 58 0a 58 73 74 72 75 | 63 74 20 66 69 6c 65 5f |.X.Xstru|ct file_|
|00004e90| 64 61 74 61 20 66 69 6c | 65 5f 6c 6f 67 5b 31 30 |data fil|e_log[10|
|00004ea0| 5d 20 3d 20 7b 30 7d 3b | 09 09 2f 2a 20 31 30 20 |] = {0};|../* 10 |
|00004eb0| 77 6f 72 73 74 20 6f 66 | 66 65 6e 64 65 72 73 20 |worst of|fenders |
|00004ec0| 2a 2f 0a 58 0a 58 0a 58 | 2f 2a 0a 58 20 2a 20 66 |*/.X.X.X|/*.X * f|
|00004ed0| 73 61 6e 61 6c 79 7a 65 | 20 63 6f 6d 6d 61 6e 64 |sanalyze| command|
|00004ee0| 2d 6c 69 6e 65 20 66 6c | 61 67 73 0a 58 20 2a 2f |-line fl|ags.X */|
|00004ef0| 0a 58 62 6f 6f 6c 65 61 | 6e 20 72 65 70 6f 72 74 |.Xboolea|n report|
|00004f00| 5f 69 6e 64 69 72 65 63 | 74 73 20 3d 20 46 41 4c |_indirec|ts = FAL|
|00004f10| 53 45 3b 09 2f 2a 20 63 | 6f 6d 6d 61 6e 64 20 6c |SE;./* c|ommand l|
|00004f20| 69 6e 65 20 6f 70 74 69 | 6f 6e 20 2d 2d 20 72 65 |ine opti|on -- re|
|00004f30| 70 6f 72 74 0a 58 09 09 | 09 09 09 20 2a 20 66 69 |port.X..|... * fi|
|00004f40| 6c 65 73 20 77 69 74 68 | 20 69 6e 64 69 72 65 63 |les with| indirec|
|00004f50| 74 20 64 61 74 61 20 62 | 6c 6f 63 6b 73 20 2a 2f |t data b|locks */|
|00004f60| 0a 58 62 6f 6f 6c 65 61 | 6e 20 72 65 70 6f 72 74 |.Xboolea|n report|
|00004f70| 5f 65 72 72 6f 72 73 20 | 20 20 20 3d 20 46 41 4c |_errors | = FAL|
|00004f80| 53 45 3b 09 2f 2a 20 63 | 6f 6d 6d 61 6e 64 20 6c |SE;./* c|ommand l|
|00004f90| 69 6e 65 20 6f 70 74 69 | 6f 6e 20 2d 2d 20 72 65 |ine opti|on -- re|
|00004fa0| 70 6f 72 74 0a 58 09 09 | 09 09 09 20 2a 20 66 69 |port.X..|... * fi|
|00004fb0| 6c 65 20 73 69 7a 65 20 | 64 69 73 63 72 65 70 61 |le size |discrepa|
|00004fc0| 6e 63 69 65 73 20 2a 2f | 0a 58 62 6f 6f 6c 65 61 |ncies */|.Xboolea|
|00004fd0| 6e 20 64 65 62 75 67 20 | 20 20 20 20 20 20 20 20 |n debug | |
|00004fe0| 20 20 20 3d 20 46 41 4c | 53 45 3b 09 2f 2a 20 72 | = FAL|SE;./* r|
|00004ff0| 65 70 6f 72 74 20 69 2d | 6e 6f 64 65 20 23 73 20 |eport i-|node #s |
|00005000| 61 73 20 74 68 65 79 20 | 61 72 65 0a 58 09 09 09 |as they |are.X...|
|00005010| 09 09 20 2a 20 65 78 61 | 6d 69 6e 65 64 20 2a 2f |.. * exa|mined */|
|00005020| 0a 58 62 6f 6f 6c 65 61 | 6e 20 6f 76 65 72 72 69 |.Xboolea|n overri|
|00005030| 64 65 09 20 3d 20 46 41 | 4c 53 45 3b 09 2f 2a 20 |de. = FA|LSE;./* |
|00005040| 6f 76 65 72 72 69 64 65 | 20 62 61 64 20 66 73 20 |override| bad fs |
|00005050| 74 65 73 74 20 2a 2f 0a | 58 0a 58 0a 58 2f 2a 0a |test */.|X.X.X/*.|
|00005060| 58 20 2a 20 69 6e 74 65 | 72 66 61 63 65 20 74 6f |X * inte|rface to|
|00005070| 20 73 79 73 74 65 6d 20 | 65 72 72 6f 72 20 6d 65 | system |error me|
|00005080| 73 73 61 67 65 73 0a 58 | 20 2a 2f 0a 58 65 78 74 |ssages.X| */.Xext|
|00005090| 65 72 6e 20 69 6e 74 20 | 65 72 72 6e 6f 3b 0a 58 |ern int |errno;.X|
|000050a0| 65 78 74 65 72 6e 20 63 | 68 61 72 20 2a 73 79 73 |extern c|har *sys|
|000050b0| 5f 65 72 72 6c 69 73 74 | 5b 5d 3b 0a 58 65 78 74 |_errlist|[];.Xext|
|000050c0| 65 72 6e 20 69 6e 74 20 | 73 79 73 5f 6e 65 72 72 |ern int |sys_nerr|
|000050d0| 3b 0a 58 0a 58 2f 2a 0a | 58 20 2a 20 75 73 61 67 |;.X.X/*.|X * usag|
|000050e0| 65 20 3a 20 70 72 69 6e | 74 73 20 6f 75 74 20 61 |e : prin|ts out a|
|000050f0| 20 73 68 6f 72 74 20 6d | 65 73 73 61 67 65 20 64 | short m|essage d|
|00005100| 65 73 63 72 69 62 69 6e | 67 20 63 6f 6d 6d 61 6e |escribin|g comman|
|00005110| 64 20 75 73 61 67 65 2e | 20 20 54 68 69 73 0a 58 |d usage.| This.X|
|00005120| 20 2a 20 66 75 6e 63 74 | 69 6f 6e 20 64 6f 65 73 | * funct|ion does|
|00005130| 20 6e 6f 74 20 72 65 74 | 75 72 6e 2e 0a 58 20 2a | not ret|urn..X *|
|00005140| 2f 0a 58 76 6f 69 64 20 | 75 73 61 67 65 28 29 7b |/.Xvoid |usage(){|
|00005150| 0a 58 09 70 72 69 6e 74 | 66 20 28 22 46 69 6c 65 |.X.print|f ("File|
|00005160| 20 53 79 73 74 65 6d 20 | 61 6e 61 6c 79 7a 65 72 | System |analyzer|
|00005170| 20 2d 20 76 32 2e 30 31 | 5c 6e 22 29 3b 0a 58 09 | - v2.01|\n");.X.|
|00005180| 70 72 69 6e 74 66 20 28 | 22 55 73 61 67 65 3a 5c |printf (|"Usage:\|
|00005190| 6e 20 20 20 66 73 61 6e | 61 6c 79 7a 65 20 5b 2d |n fsan|alyze [-|
|000051a0| 5b 64 65 69 6f 5d 5d 20 | 73 70 65 63 69 61 6c 20 |[deio]] |special |
|000051b0| 5b 66 69 6c 65 5d 20 2e | 2e 2e 5c 6e 22 29 3b 0a |[file] .|..\n");.|
|000051c0| 58 09 70 72 69 6e 74 66 | 20 28 22 5c 6e 5c 74 49 |X.printf| ("\n\tI|
|000051d0| 66 20 74 68 65 20 5b 66 | 69 6c 65 5d 20 61 72 67 |f the [f|ile] arg|
|000051e0| 75 6d 65 6e 74 28 73 29 | 20 61 72 65 20 6d 69 73 |ument(s)| are mis|
|000051f0| 73 69 6e 67 2c 20 74 68 | 65 20 65 6e 74 69 72 65 |sing, th|e entire|
|00005200| 5c 6e 22 29 3b 0a 58 09 | 70 72 69 6e 74 66 20 28 |\n");.X.|printf (|
|00005210| 22 5c 74 66 69 6c 65 20 | 73 79 73 74 65 6d 20 69 |"\tfile |system i|
|00005220| 73 20 73 63 61 6e 6e 65 | 64 2e 20 20 4f 74 68 65 |s scanne|d. Othe|
|00005230| 72 77 69 73 65 2c 20 6f | 6e 6c 79 20 74 68 65 20 |rwise, o|nly the |
|00005240| 73 70 65 63 69 66 69 65 | 64 5c 6e 22 29 3b 0a 58 |specifie|d\n");.X|
|00005250| 09 70 72 69 6e 74 66 20 | 28 22 5c 74 66 69 6c 65 |.printf |("\tfile|
|00005260| 73 20 61 72 65 20 65 78 | 61 6d 69 6e 65 64 2e 20 |s are ex|amined. |
|00005270| 20 56 61 6c 69 64 20 66 | 6c 61 67 20 61 72 65 3a | Valid f|lag are:|
|00005280| 5c 6e 5c 6e 22 29 3b 0a | 58 09 70 72 69 6e 74 66 |\n\n");.|X.printf|
|00005290| 20 28 22 5c 74 64 5c 74 | 64 69 73 70 6c 61 79 20 | ("\td\t|display |
|000052a0| 69 2d 6e 6f 64 65 20 6e | 75 6d 62 65 72 73 20 61 |i-node n|umbers a|
|000052b0| 73 20 74 68 65 79 20 61 | 72 65 20 65 78 61 6d 69 |s they a|re exami|
|000052c0| 6e 65 64 5c 6e 22 29 3b | 0a 58 09 70 72 69 6e 74 |ned\n");|.X.print|
|000052d0| 66 20 28 22 5c 74 65 5c | 74 72 65 70 6f 72 74 20 |f ("\te\|treport |
|000052e0| 66 69 6c 65 20 73 69 7a | 65 20 69 6e 63 6f 6e 73 |file siz|e incons|
|000052f0| 69 73 74 65 6e 63 69 65 | 73 5c 6e 22 29 3b 0a 58 |istencie|s\n");.X|
|00005300| 09 70 72 69 6e 74 66 20 | 28 22 5c 74 69 5c 74 72 |.printf |("\ti\tr|
|00005310| 65 70 6f 72 74 20 64 61 | 74 61 20 62 6c 6f 63 6b |eport da|ta block|
|00005320| 20 64 6f 75 62 6c 65 20 | 61 6e 64 20 74 72 69 70 | double |and trip|
|00005330| 6c 65 20 69 6e 64 69 72 | 65 63 74 69 6f 6e 5c 6e |le indir|ection\n|
|00005340| 22 29 3b 0a 58 09 70 72 | 69 6e 74 66 20 28 22 5c |");.X.pr|intf ("\|
|00005350| 74 6f 5c 74 6f 76 65 72 | 72 69 64 65 20 65 72 72 |to\tover|ride err|
|00005360| 6f 72 20 63 68 65 63 6b | 69 6e 67 20 6f 6e 20 66 |or check|ing on f|
|00005370| 69 6c 65 20 73 79 73 74 | 65 6d 20 61 72 67 75 6d |ile syst|em argum|
|00005380| 65 6e 74 5c 6e 22 29 3b | 0a 58 09 65 78 69 74 28 |ent\n");|.X.exit(|
|00005390| 31 29 3b 0a 58 09 7d 0a | 58 0a 58 2f 2a 0a 58 20 |1);.X.}.|X.X/*.X |
|000053a0| 2a 20 63 68 65 63 6b 5f | 66 73 20 3a 20 63 68 65 |* check_|fs : che|
|000053b0| 63 6b 73 20 74 68 65 20 | 66 69 6c 65 20 73 79 73 |cks the |file sys|
|000053c0| 74 65 6d 20 74 6f 20 62 | 65 20 73 75 72 65 20 69 |tem to b|e sure i|
|000053d0| 74 20 69 73 20 6e 6f 74 | 20 69 6e 20 6e 65 65 64 |t is not| in need|
|000053e0| 20 6f 66 0a 58 20 2a 20 | 63 68 65 63 6b 69 6e 67 | of.X * |checking|
|000053f0| 2e 20 20 49 66 20 74 68 | 65 20 66 69 6c 65 20 73 |. If th|e file s|
|00005400| 79 73 74 65 6d 20 69 73 | 20 64 61 6d 61 67 65 64 |ystem is| damaged|
|00005410| 2c 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 64 |, the fu|nction d|
|00005420| 69 73 70 6c 61 79 73 20 | 61 0a 58 20 2a 20 6d 65 |isplays |a.X * me|
|00005430| 73 73 61 67 65 20 66 72 | 6f 6d 20 66 73 73 74 61 |ssage fr|om fssta|
|00005440| 74 2c 20 74 68 65 6e 20 | 72 65 74 75 72 6e 73 20 |t, then |returns |
|00005450| 46 41 4c 53 45 2e 20 20 | 4f 74 68 65 72 73 69 7a |FALSE. |Othersiz|
|00005460| 65 2c 20 72 65 74 75 72 | 6e 73 20 54 52 55 45 2e |e, retur|ns TRUE.|
|00005470| 0a 58 20 2a 2f 0a 58 62 | 6f 6f 6c 65 61 6e 20 63 |.X */.Xb|oolean c|
|00005480| 68 65 63 6b 5f 66 73 20 | 28 73 70 65 63 69 61 6c |heck_fs |(special|
|00005490| 29 0a 58 63 68 61 72 20 | 2a 73 70 65 63 69 61 6c |).Xchar |*special|
|000054a0| 3b 0a 58 7b 0a 58 09 63 | 68 61 72 20 62 75 66 66 |;.X{.X.c|har buff|
|000054b0| 65 72 5b 32 35 36 5d 3b | 09 09 09 2f 2a 20 62 75 |er[256];|.../* bu|
|000054c0| 66 66 65 72 20 74 6f 20 | 68 6f 6c 64 20 63 6d 64 |ffer to |hold cmd|
|000054d0| 20 2a 2f 0a 58 09 69 6e | 74 20 66 73 74 61 74 3b | */.X.in|t fstat;|
|000054e0| 09 09 09 09 2f 2a 20 65 | 78 69 74 20 73 74 61 74 |..../* e|xit stat|
|000054f0| 75 73 20 6f 66 20 66 73 | 73 74 61 74 20 2a 2f 0a |us of fs|stat */.|
|00005500| 58 0a 58 09 73 70 72 69 | 6e 74 66 20 28 62 75 66 |X.X.spri|ntf (buf|
|00005510| 66 65 72 2c 20 22 2f 65 | 74 63 2f 66 73 73 74 61 |fer, "/e|tc/fssta|
|00005520| 74 20 25 73 20 32 3e 2f | 64 65 76 2f 6e 75 6c 6c |t %s 2>/|dev/null|
|00005530| 22 2c 20 73 70 65 63 69 | 61 6c 29 3b 0a 58 09 66 |", speci|al);.X.f|
|00005540| 73 74 61 74 20 3d 20 73 | 79 73 74 65 6d 20 28 62 |stat = s|ystem (b|
|00005550| 75 66 66 65 72 29 3b 0a | 58 09 69 66 20 28 66 73 |uffer);.|X.if (fs|
|00005560| 74 61 74 20 21 3d 20 30 | 20 26 26 20 21 6f 76 65 |tat != 0| && !ove|
|00005570| 72 72 69 64 65 29 7b 0a | 58 09 09 69 66 20 28 66 |rride){.|X..if (f|
|00005580| 73 74 61 74 20 3d 3d 20 | 35 31 32 20 2f 2a 20 77 |stat == |512 /* w|
|00005590| 68 79 20 69 73 20 74 68 | 69 73 20 62 79 74 65 2d |hy is th|is byte-|
|000055a0| 73 77 61 70 70 65 64 3f | 20 2a 2f 29 7b 0a 58 09 |swapped?| */){.X.|
|000055b0| 09 09 66 70 72 69 6e 74 | 66 20 28 73 74 64 65 72 |..fprint|f (stder|
|000055c0| 72 2c 20 22 77 61 72 6e | 69 6e 67 3a 20 66 69 6c |r, "warn|ing: fil|
|000055d0| 65 20 73 79 73 74 65 6d | 20 69 73 20 6d 6f 75 6e |e system| is moun|
|000055e0| 74 65 64 5c 6e 22 29 3b | 0a 58 09 09 09 7d 0a 58 |ted\n");|.X...}.X|
|000055f0| 09 09 65 6c 73 65 20 7b | 0a 58 09 09 09 2f 2a 0a |..else {|.X.../*.|
|00005600| 58 09 09 09 20 2a 20 72 | 75 6e 20 66 73 73 74 61 |X... * r|un fssta|
|00005610| 74 20 61 67 61 69 6e 20 | 74 6f 20 67 65 74 20 65 |t again |to get e|
|00005620| 72 72 6f 72 20 6d 65 73 | 73 61 67 65 20 28 74 68 |rror mes|sage (th|
|00005630| 69 73 20 69 73 20 61 20 | 6b 6c 75 64 67 65 2c 0a |is is a |kludge,.|
|00005640| 58 09 09 09 20 2a 20 62 | 75 74 20 49 20 68 6f 70 |X... * b|ut I hop|
|00005650| 65 20 6d 6f 72 65 20 70 | 6f 72 74 61 62 6c 65 20 |e more p|ortable |
|00005660| 74 68 61 74 20 68 61 76 | 69 6e 67 20 66 73 61 6e |that hav|ing fsan|
|00005670| 61 6c 79 7a 65 20 64 6f | 20 74 68 65 0a 58 09 09 |alyze do| the.X..|
|00005680| 09 20 2a 20 61 6e 61 6c | 79 73 69 73 20 69 74 73 |. * anal|ysis its|
|00005690| 65 6c 66 29 0a 58 09 09 | 09 20 2a 2f 0a 58 09 09 |elf).X..|. */.X..|
|000056a0| 09 73 70 72 69 6e 74 66 | 20 28 62 75 66 66 65 72 |.sprintf| (buffer|
|000056b0| 2c 20 22 2f 65 74 63 2f | 66 73 73 74 61 74 20 25 |, "/etc/|fsstat %|
|000056c0| 73 22 2c 20 73 70 65 63 | 69 61 6c 29 3b 0a 58 09 |s", spec|ial);.X.|
|000056d0| 09 09 73 79 73 74 65 6d | 28 62 75 66 66 65 72 29 |..system|(buffer)|
|000056e0| 3b 0a 58 09 09 09 72 65 | 74 75 72 6e 20 28 46 41 |;.X...re|turn (FA|
|000056f0| 4c 53 45 29 3b 0a 58 09 | 09 09 7d 0a 58 09 09 7d |LSE);.X.|..}.X..}|
|00005700| 0a 58 09 72 65 74 75 72 | 6e 20 28 54 52 55 45 29 |.X.retur|n (TRUE)|
|00005710| 3b 0a 58 09 7d 0a 58 0a | 58 2f 2a 0a 58 20 2a 20 |;.X.}.X.|X/*.X * |
|00005720| 65 72 72 6f 72 20 3a 20 | 70 72 69 6e 74 73 20 6f |error : |prints o|
|00005730| 75 74 20 61 20 66 6f 72 | 6d 61 74 74 65 64 20 65 |ut a for|matted e|
|00005740| 72 72 6f 72 20 73 74 72 | 69 6e 67 20 74 6f 20 73 |rror str|ing to s|
|00005750| 74 64 65 72 72 2c 20 66 | 6f 6c 6c 6f 77 65 64 20 |tderr, f|ollowed |
|00005760| 69 66 0a 58 20 2a 20 70 | 6f 73 73 69 62 6c 65 20 |if.X * p|ossible |
|00005770| 62 79 20 61 6e 20 61 70 | 70 72 6f 70 72 69 61 74 |by an ap|propriat|
|00005780| 65 20 73 79 73 74 65 6d | 20 65 72 72 6f 72 20 6d |e system| error m|
|00005790| 65 73 73 61 67 65 2e 20 | 20 43 6f 6e 74 72 6f 6c |essage. | Control|
|000057a0| 20 69 73 20 74 68 65 6e | 0a 58 20 2a 20 72 65 74 | is then|.X * ret|
|000057b0| 75 72 6e 65 64 20 74 6f | 20 74 68 65 20 73 79 73 |urned to| the sys|
|000057c0| 74 65 6d 20 77 69 74 68 | 20 61 6e 20 65 72 72 6f |tem with| an erro|
|000057d0| 72 20 73 74 61 74 75 73 | 2e 20 20 54 68 69 73 20 |r status|. This |
|000057e0| 66 75 6e 63 74 69 6f 6e | 20 64 6f 65 73 20 6e 6f |function| does no|
|000057f0| 74 0a 58 20 2a 20 72 65 | 74 75 72 6e 2e 0a 58 20 |t.X * re|turn..X |
|00005800| 2a 2f 0a 58 76 6f 69 64 | 20 65 72 72 6f 72 20 28 |*/.Xvoid| error (|
|00005810| 65 72 72 2c 20 73 74 72 | 2c 20 61 72 67 31 2c 20 |err, str|, arg1, |
|00005820| 61 72 67 32 29 0a 58 69 | 6e 74 20 65 72 72 3b 09 |arg2).Xi|nt err;.|
|00005830| 09 09 2f 2a 20 76 61 6c | 75 65 20 6f 66 20 65 72 |../* val|ue of er|
|00005840| 72 6e 6f 20 61 74 20 74 | 69 6d 65 20 6f 66 20 63 |rno at t|ime of c|
|00005850| 61 6c 6c 20 2a 2f 0a 58 | 63 68 61 72 20 2a 73 74 |all */.X|char *st|
|00005860| 72 3b 09 09 09 2f 2a 20 | 65 72 72 6f 72 20 73 74 |r;.../* |error st|
|00005870| 72 69 6e 67 20 2a 2f 0a | 58 63 68 61 72 20 2a 61 |ring */.|Xchar *a|
|00005880| 72 67 31 2c 20 2a 61 72 | 67 32 3b 09 09 2f 2a 20 |rg1, *ar|g2;../* |
|00005890| 61 64 64 69 74 69 6f 6e | 61 6c 20 70 72 69 6e 74 |addition|al print|
|000058a0| 66 20 61 72 67 75 6d 65 | 6e 74 73 2c 20 69 66 20 |f argume|nts, if |
|000058b0| 61 6e 79 20 2a 2f 0a 58 | 7b 0a 58 09 66 70 72 69 |any */.X|{.X.fpri|
|000058c0| 6e 74 66 20 28 73 74 64 | 65 72 72 2c 20 73 74 72 |ntf (std|err, str|
|000058d0| 2c 20 61 72 67 31 2c 20 | 61 72 67 32 29 3b 0a 58 |, arg1, |arg2);.X|
|000058e0| 09 69 66 20 28 65 72 72 | 20 3c 3d 20 73 79 73 5f |.if (err| <= sys_|
|000058f0| 6e 65 72 72 20 26 26 20 | 65 72 72 20 3e 20 30 29 |nerr && |err > 0)|
|00005900| 0a 58 09 09 66 70 72 69 | 6e 74 66 20 28 73 74 64 |.X..fpri|ntf (std|
|00005910| 65 72 72 2c 20 22 25 73 | 5c 6e 22 2c 20 73 79 73 |err, "%s|\n", sys|
|00005920| 5f 65 72 72 6c 69 73 74 | 5b 65 72 72 5d 29 3b 0a |_errlist|[err]);.|
|00005930| 58 09 65 6c 73 65 0a 58 | 09 09 66 70 72 69 6e 74 |X.else.X|..fprint|
|00005940| 66 20 28 73 74 64 65 72 | 72 2c 20 22 75 6e 6b 6e |f (stder|r, "unkn|
|00005950| 6f 77 6e 20 65 72 72 6f | 72 20 3a 20 25 64 5c 6e |own erro|r : %d\n|
|00005960| 22 2c 20 65 72 72 29 3b | 0a 58 09 65 78 69 74 28 |", err);|.X.exit(|
|00005970| 31 29 3b 09 09 09 2f 2a | 20 65 78 69 74 20 77 69 |1);.../*| exit wi|
|00005980| 74 68 20 65 72 72 6f 72 | 20 73 74 61 74 75 73 20 |th error| status |
|00005990| 2a 2f 0a 58 09 7d 0a 58 | 0a 58 2f 2a 0a 58 20 2a |*/.X.}.X|.X/*.X *|
|000059a0| 20 69 6e 69 74 5f 73 74 | 61 74 73 20 3a 20 69 6e | init_st|ats : in|
|000059b0| 69 74 69 61 6c 69 7a 65 | 73 20 70 65 72 2d 66 69 |itialize|s per-fi|
|000059c0| 6c 65 20 73 74 61 74 69 | 73 74 69 63 73 20 73 74 |le stati|stics st|
|000059d0| 72 75 63 74 75 72 65 0a | 58 20 2a 2f 0a 58 76 6f |ructure.|X */.Xvo|
|000059e0| 69 64 20 69 6e 69 74 5f | 73 74 61 74 73 20 28 64 |id init_|stats (d|
|000059f0| 61 74 61 2c 20 69 6e 6f | 64 65 29 0a 58 73 74 72 |ata, ino|de).Xstr|
|00005a00| 75 63 74 20 66 69 6c 65 | 5f 64 61 74 61 20 2a 64 |uct file|_data *d|
|00005a10| 61 74 61 3b 09 09 09 09 | 2f 2a 20 66 69 6c 65 20 |ata;....|/* file |
|00005a20| 73 74 61 74 73 20 74 6f | 20 69 6e 69 74 20 2a 2f |stats to| init */|
|00005a30| 0a 58 69 6e 74 20 69 6e | 6f 64 65 3b 09 09 09 09 |.Xint in|ode;....|
|00005a40| 09 2f 2a 20 69 2d 6e 6f | 64 65 20 6e 75 6d 62 65 |./* i-no|de numbe|
|00005a50| 72 20 2a 2f 0a 58 7b 0a | 58 09 64 61 74 61 2d 3e |r */.X{.|X.data->|
|00005a60| 69 6e 6f 64 65 20 3d 20 | 69 6e 6f 64 65 3b 0a 58 |inode = |inode;.X|
|00005a70| 09 64 61 74 61 2d 3e 74 | 6f 74 61 6c 5f 62 6c 6f |.data->t|otal_blo|
|00005a80| 63 6b 73 20 3d 20 64 61 | 74 61 2d 3e 64 61 74 61 |cks = da|ta->data|
|00005a90| 5f 62 6c 6f 63 6b 73 20 | 3d 20 30 3b 0a 58 09 64 |_blocks |= 0;.X.d|
|00005aa0| 61 74 61 2d 3e 70 6f 74 | 65 6e 74 69 61 6c 5f 73 |ata->pot|ential_s|
|00005ab0| 65 65 6b 73 20 3d 20 64 | 61 74 61 2d 3e 73 65 65 |eeks = d|ata->see|
|00005ac0| 6b 73 20 3d 20 30 3b 0a | 58 09 64 61 74 61 2d 3e |ks = 0;.|X.data->|
|00005ad0| 66 72 61 67 6d 20 3d 20 | 30 2e 30 3b 0a 58 09 7d |fragm = |0.0;.X.}|
|00005ae0| 0a 58 0a 58 2f 2a 0a 58 | 20 2a 20 69 6e 69 74 20 |.X.X/*.X| * init |
|00005af0| 3a 20 70 61 72 73 65 73 | 20 63 6f 6d 6d 61 6e 64 |: parses| command|
|00005b00| 20 6c 69 6e 65 20 66 6c | 61 67 73 20 61 6e 64 20 | line fl|ags and |
|00005b10| 74 68 65 20 66 69 6c 65 | 20 73 79 73 74 65 6d 20 |the file| system |
|00005b20| 64 65 76 69 63 65 20 6e | 61 6d 65 2c 20 74 68 65 |device n|ame, the|
|00005b30| 6e 0a 58 20 2a 20 72 65 | 61 64 73 20 74 68 65 20 |n.X * re|ads the |
|00005b40| 66 69 6c 65 20 73 79 73 | 74 65 6d 20 73 75 70 65 |file sys|tem supe|
|00005b50| 72 20 62 6c 6f 63 6b 2e | 20 20 69 6e 69 74 20 72 |r block.| init r|
|00005b60| 65 74 75 72 6e 73 20 74 | 68 65 20 6e 75 6d 62 65 |eturns t|he numbe|
|00005b70| 72 20 6f 66 20 74 68 65 | 0a 58 20 2a 20 70 61 72 |r of the|.X * par|
|00005b80| 61 6d 65 74 65 72 20 41 | 46 54 45 52 20 74 68 65 |ameter A|FTER the|
|00005b90| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 20 64 65 76 | file sy|stem dev|
|00005ba0| 69 63 65 20 6e 61 6d 65 | 2e 20 20 41 6c 6c 20 73 |ice name|. All s|
|00005bb0| 75 62 73 65 71 75 65 6e | 74 20 70 61 72 61 6d 65 |ubsequen|t parame|
|00005bc0| 74 65 72 73 0a 58 20 2a | 20 61 72 65 20 61 73 73 |ters.X *| are ass|
|00005bd0| 75 6d 65 64 20 74 6f 20 | 62 65 20 73 70 65 63 69 |umed to |be speci|
|00005be0| 66 69 63 20 66 69 6c 65 | 73 20 74 6f 20 62 65 20 |fic file|s to be |
|00005bf0| 74 65 73 74 65 64 2e 0a | 58 20 2a 2f 0a 58 69 6e |tested..|X */.Xin|
|00005c00| 74 20 69 6e 69 74 20 28 | 61 72 67 63 2c 20 61 72 |t init (|argc, ar|
|00005c10| 67 76 29 0a 58 69 6e 74 | 20 61 72 67 63 3b 0a 58 |gv).Xint| argc;.X|
|00005c20| 63 68 61 72 20 2a 61 72 | 67 76 5b 5d 3b 0a 58 7b |char *ar|gv[];.X{|
|00005c30| 0a 58 09 69 6e 74 20 69 | 3b 09 09 09 09 09 2f 2a |.X.int i|;...../*|
|00005c40| 20 6c 6f 6f 70 20 63 6f | 75 6e 74 65 72 20 2a 2f | loop co|unter */|
|00005c50| 0a 58 09 63 68 61 72 20 | 2a 63 70 3b 09 09 09 09 |.X.char |*cp;....|
|00005c60| 2f 2a 20 63 6d 64 2d 6c | 69 6e 65 20 66 6c 61 67 |/* cmd-l|ine flag|
|00005c70| 20 70 6f 69 6e 74 65 72 | 20 2a 2f 0a 58 09 62 6f | pointer| */.X.bo|
|00005c80| 6f 6c 65 61 6e 20 73 70 | 65 63 69 61 6c 5f 66 6f |olean sp|ecial_fo|
|00005c90| 75 6e 64 20 3d 20 46 41 | 4c 53 45 3b 09 09 2f 2a |und = FA|LSE;../*|
|00005ca0| 20 54 52 55 45 20 3d 20 | 66 6f 75 6e 64 20 73 70 | TRUE = |found sp|
|00005cb0| 65 63 69 61 6c 20 61 72 | 67 20 2a 2f 0a 58 09 0a |ecial ar|g */.X..|
|00005cc0| 58 09 66 6f 72 20 28 69 | 20 3d 20 31 3b 20 69 20 |X.for (i| = 1; i |
|00005cd0| 3c 20 61 72 67 63 20 26 | 26 20 21 73 70 65 63 69 |< argc &|& !speci|
|00005ce0| 61 6c 5f 66 6f 75 6e 64 | 3b 20 69 2b 2b 29 7b 0a |al_found|; i++){.|
|00005cf0| 58 09 09 63 70 20 3d 20 | 61 72 67 76 5b 69 5d 3b |X..cp = |argv[i];|
|00005d00| 0a 58 09 09 69 66 20 28 | 2a 63 70 20 3d 3d 20 27 |.X..if (|*cp == '|
|00005d10| 2d 27 29 7b 0a 58 09 09 | 09 77 68 69 6c 65 20 28 |-'){.X..|.while (|
|00005d20| 2a 2b 2b 63 70 29 7b 0a | 58 09 09 09 09 73 77 69 |*++cp){.|X....swi|
|00005d30| 74 63 68 20 28 2a 63 70 | 29 7b 0a 58 0a 58 09 09 |tch (*cp|){.X.X..|
|00005d40| 09 09 09 09 2f 2a 20 72 | 65 70 6f 72 74 20 69 2d |..../* r|eport i-|
|00005d50| 6e 6f 64 65 73 20 77 69 | 74 68 0a 58 09 09 09 09 |nodes wi|th.X....|
|00005d60| 09 09 20 2a 20 6f 6e 65 | 20 6f 72 20 6d 6f 72 65 |.. * one| or more|
|00005d70| 20 6c 65 76 65 6c 73 20 | 6f 66 0a 58 09 09 09 09 | levels |of.X....|
|00005d80| 09 09 20 2a 20 69 6e 64 | 69 72 65 63 74 69 6f 6e |.. * ind|irection|
|00005d90| 20 2a 2f 0a 58 09 09 09 | 09 09 63 61 73 65 20 27 | */.X...|..case '|
|00005da0| 69 27 3a 0a 58 09 09 09 | 09 09 09 72 65 70 6f 72 |i':.X...|...repor|
|00005db0| 74 5f 69 6e 64 69 72 65 | 63 74 73 20 3d 20 54 52 |t_indire|cts = TR|
|00005dc0| 55 45 3b 0a 58 09 09 09 | 09 09 09 62 72 65 61 6b |UE;.X...|...break|
|00005dd0| 3b 0a 58 0a 58 09 09 09 | 09 09 09 2f 2a 20 72 65 |;.X.X...|.../* re|
|00005de0| 70 6f 72 74 20 66 69 6c | 65 20 73 69 7a 65 20 65 |port fil|e size e|
|00005df0| 72 72 6f 72 73 20 2a 2f | 0a 58 09 09 09 09 09 63 |rrors */|.X.....c|
|00005e00| 61 73 65 20 27 65 27 3a | 0a 58 09 09 09 09 09 09 |ase 'e':|.X......|
|00005e10| 72 65 70 6f 72 74 5f 65 | 72 72 6f 72 73 20 3d 20 |report_e|rrors = |
|00005e20| 54 52 55 45 3b 0a 58 09 | 09 09 09 09 09 62 72 65 |TRUE;.X.|.....bre|
|00005e30| 61 6b 3b 0a 58 0a 58 09 | 09 09 09 09 09 2f 2a 20 |ak;.X.X.|...../* |
|00005e40| 64 65 62 75 67 67 69 6e | 67 20 66 6c 61 67 20 2a |debuggin|g flag *|
|00005e50| 2f 0a 58 09 09 09 09 09 | 63 61 73 65 20 27 64 27 |/.X.....|case 'd'|
|00005e60| 3a 0a 58 09 09 09 09 09 | 09 64 65 62 75 67 20 3d |:.X.....|.debug =|
|00005e70| 20 54 52 55 45 3b 0a 58 | 09 09 09 09 09 09 62 72 | TRUE;.X|......br|
|00005e80| 65 61 6b 3b 0a 58 0a 58 | 09 09 09 09 09 09 2f 2a |eak;.X.X|....../*|
|00005e90| 20 6f 76 65 72 72 69 64 | 65 20 62 61 64 20 66 73 | overrid|e bad fs|
|00005ea0| 20 74 65 73 74 20 2a 2f | 0a 58 09 09 09 09 09 63 | test */|.X.....c|
|00005eb0| 61 73 65 20 27 6f 27 3a | 0a 58 09 09 09 09 09 09 |ase 'o':|.X......|
|00005ec0| 6f 76 65 72 72 69 64 65 | 20 3d 20 54 52 55 45 3b |override| = TRUE;|
|00005ed0| 0a 58 09 09 09 09 09 09 | 62 72 65 61 6b 3b 0a 58 |.X......|break;.X|
|00005ee0| 09 09 09 09 09 64 65 66 | 61 75 6c 74 3a 0a 58 09 |.....def|ault:.X.|
|00005ef0| 09 09 09 09 09 66 70 72 | 69 6e 74 66 20 28 73 74 |.....fpr|intf (st|
|00005f00| 64 65 72 72 2c 20 22 69 | 6c 6c 65 67 61 6c 20 6f |derr, "i|llegal o|
|00005f10| 70 74 69 6f 6e 20 3a 20 | 25 63 5c 6e 22 2c 20 2a |ption : |%c\n", *|
|00005f20| 63 70 29 3b 0a 58 09 09 | 09 09 09 09 75 73 61 67 |cp);.X..|....usag|
|00005f30| 65 28 29 3b 0a 58 09 09 | 09 09 09 7d 0a 58 09 09 |e();.X..|...}.X..|
|00005f40| 09 09 7d 0a 58 09 09 09 | 7d 0a 58 09 09 65 6c 73 |..}.X...|}.X..els|
|00005f50| 65 20 7b 0a 58 09 09 09 | 73 70 65 63 69 61 6c 20 |e {.X...|special |
|00005f60| 3d 20 61 72 67 76 5b 69 | 5d 3b 0a 58 09 09 09 73 |= argv[i|];.X...s|
|00005f70| 70 65 63 69 61 6c 5f 66 | 6f 75 6e 64 20 3d 20 54 |pecial_f|ound = T|
|00005f80| 52 55 45 3b 0a 58 09 09 | 09 7d 0a 58 09 09 7d 0a |RUE;.X..|.}.X..}.|
|00005f90| 58 09 69 66 20 28 73 70 | 65 63 69 61 6c 20 3d 3d |X.if (sp|ecial ==|
|00005fa0| 20 4e 55 4c 4c 29 75 73 | 61 67 65 28 29 3b 09 09 | NULL)us|age();..|
|00005fb0| 2f 2a 20 6e 6f 20 66 73 | 20 70 61 72 61 6d 65 74 |/* no fs| paramet|
|00005fc0| 65 72 20 2a 2f 0a 58 0a | 58 09 2f 2a 0a 58 09 20 |er */.X.|X./*.X. |
|00005fd0| 2a 20 63 68 65 63 6b 20 | 66 6f 72 20 67 6f 6f 64 |* check |for good|
|00005fe0| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 20 28 6c 65 | file sy|stem (le|
|00005ff0| 74 20 66 73 73 74 61 74 | 20 64 6f 20 74 68 65 20 |t fsstat| do the |
|00006000| 64 69 72 74 79 20 77 6f | 72 6b 21 29 0a 58 09 20 |dirty wo|rk!).X. |
|00006010| 2a 2f 0a 58 09 69 66 20 | 28 63 68 65 63 6b 5f 66 |*/.X.if |(check_f|
|00006020| 73 20 28 73 70 65 63 69 | 61 6c 29 29 7b 0a 58 0a |s (speci|al)){.X.|
|00006030| 58 09 09 2f 2a 0a 58 09 | 09 20 2a 20 6f 70 65 6e |X../*.X.|. * open|
|00006040| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 20 61 6e 64 | file sy|stem and|
|00006050| 20 72 65 61 64 20 74 68 | 65 20 73 75 70 65 72 20 | read th|e super |
|00006060| 62 6c 6f 63 6b 0a 58 09 | 09 20 2a 2f 0a 58 09 09 |block.X.|. */.X..|
|00006070| 69 66 20 28 28 66 73 79 | 73 3d 66 6f 70 65 6e 20 |if ((fsy|s=fopen |
|00006080| 28 73 70 65 63 69 61 6c | 2c 20 22 72 22 29 29 20 |(special|, "r")) |
|00006090| 3d 3d 20 4e 55 4c 4c 29 | 7b 0a 58 09 09 09 65 72 |== NULL)|{.X...er|
|000060a0| 72 6f 72 20 28 65 72 72 | 6e 6f 2c 20 22 65 72 72 |ror (err|no, "err|
|000060b0| 6f 72 20 6f 70 65 6e 69 | 6e 67 20 5c 22 25 73 5c |or openi|ng \"%s\|
|000060c0| 22 5c 6e 22 2c 20 73 70 | 65 63 69 61 6c 29 3b 0a |"\n", sp|ecial);.|
|000060d0| 58 09 09 09 2f 2a 20 4e | 4f 54 52 45 41 43 48 45 |X.../* N|OTREACHE|
|000060e0| 44 20 2a 2f 0a 58 09 09 | 09 7d 0a 58 09 09 69 66 |D */.X..|.}.X..if|
|000060f0| 20 28 66 73 65 65 6b 20 | 28 66 73 79 73 2c 20 35 | (fseek |(fsys, 5|
|00006100| 31 32 4c 2c 20 30 29 29 | 7b 0a 58 09 09 09 65 72 |12L, 0))|{.X...er|
|00006110| 72 6f 72 20 28 65 72 72 | 6e 6f 2c 20 22 65 72 72 |ror (err|no, "err|
|00006120| 6f 72 20 73 65 65 6b 69 | 6e 67 20 73 75 70 65 72 |or seeki|ng super|
|00006130| 62 6c 6f 63 6b 22 29 3b | 0a 58 09 09 09 2f 2a 20 |block");|.X.../* |
|00006140| 4e 4f 54 52 45 41 43 48 | 45 44 20 2a 2f 0a 58 09 |NOTREACH|ED */.X.|
|00006150| 09 09 7d 0a 58 09 09 69 | 66 20 28 66 72 65 61 64 |..}.X..i|f (fread|
|00006160| 20 28 26 73 75 70 65 72 | 2c 20 73 69 7a 65 6f 66 | (&super|, sizeof|
|00006170| 20 28 73 74 72 75 63 74 | 20 66 69 6c 73 79 73 29 | (struct| filsys)|
|00006180| 2c 20 31 2c 20 66 73 79 | 73 29 20 21 3d 20 31 29 |, 1, fsy|s) != 1)|
|00006190| 7b 0a 58 09 09 09 65 72 | 72 6f 72 20 28 65 72 72 |{.X...er|ror (err|
|000061a0| 6e 6f 2c 20 22 65 72 72 | 6f 72 20 72 65 61 64 69 |no, "err|or readi|
|000061b0| 6e 67 20 73 75 70 65 72 | 62 6c 6f 63 6b 22 29 3b |ng super|block");|
|000061c0| 0a 58 09 09 09 2f 2a 20 | 4e 4f 54 52 45 41 43 48 |.X.../* |NOTREACH|
|000061d0| 45 44 20 2a 2f 0a 58 09 | 09 09 7d 0a 58 0a 58 09 |ED */.X.|..}.X.X.|
|000061e0| 09 6e 75 6d 5f 69 6e 6f | 64 65 73 20 3d 20 28 73 |.num_ino|des = (s|
|000061f0| 75 70 65 72 2e 73 5f 69 | 73 69 7a 65 2d 32 29 20 |uper.s_i|size-2) |
|00006200| 2a 20 31 36 3b 0a 58 09 | 09 69 66 20 28 73 75 70 |* 16;.X.|.if (sup|
|00006210| 65 72 2e 73 5f 6d 61 67 | 69 63 20 21 3d 20 46 73 |er.s_mag|ic != Fs|
|00006220| 4d 41 47 49 43 29 0a 58 | 09 09 09 66 73 5f 74 79 |MAGIC).X|...fs_ty|
|00006230| 70 65 20 3d 20 46 73 31 | 62 3b 0a 58 09 09 65 6c |pe = Fs1|b;.X..el|
|00006240| 73 65 20 66 73 5f 74 79 | 70 65 20 3d 20 73 75 70 |se fs_ty|pe = sup|
|00006250| 65 72 2e 73 5f 74 79 70 | 65 3b 0a 58 0a 58 09 09 |er.s_typ|e;.X.X..|
|00006260| 72 65 74 75 72 6e 20 69 | 3b 09 09 2f 2a 20 72 65 |return i|;../* re|
|00006270| 74 75 72 6e 20 23 20 6f | 66 20 6e 65 78 74 20 61 |turn # o|f next a|
|00006280| 72 67 75 6d 65 6e 74 20 | 74 6f 20 62 65 20 70 72 |rgument |to be pr|
|00006290| 6f 63 65 73 73 65 64 20 | 2a 2f 0a 58 09 09 7d 0a |ocessed |*/.X..}.|
|000062a0| 58 09 65 6c 73 65 20 7b | 0a 58 09 09 65 78 69 74 |X.else {|.X..exit|
|000062b0| 28 31 29 3b 09 09 2f 2a | 20 62 61 64 20 66 69 6c |(1);../*| bad fil|
|000062c0| 65 20 73 79 73 74 65 6d | 2c 20 65 72 72 6f 72 20 |e system|, error |
|000062d0| 73 74 61 74 75 73 20 2a | 2f 0a 58 09 09 7d 0a 58 |status *|/.X..}.X|
|000062e0| 09 7d 0a 58 0a 58 2f 2a | 0a 58 20 2a 20 62 6c 6b |.}.X.X/*|.X * blk|
|000062f0| 5f 6e 6f 20 3a 20 67 69 | 76 65 6e 20 61 20 70 6f |_no : gi|ven a po|
|00006300| 69 6e 74 65 72 20 74 6f | 20 61 20 33 2d 62 79 74 |inter to| a 3-byt|
|00006310| 65 20 62 69 6e 61 72 79 | 20 6e 75 6d 62 65 72 2c |e binary| number,|
|00006320| 20 72 65 74 75 72 6e 73 | 20 61 20 28 6c 6f 6e 67 | returns| a (long|
|00006330| 29 0a 58 20 2a 20 62 6c | 6f 63 6b 20 6e 75 6d 62 |).X * bl|ock numb|
|00006340| 65 72 2e 20 20 55 73 65 | 64 20 74 6f 20 61 63 63 |er. Use|d to acc|
|00006350| 65 73 73 20 74 68 65 20 | 66 69 72 73 74 20 31 30 |ess the |first 10|
|00006360| 20 64 61 74 61 20 62 6c | 6f 63 6b 20 6e 75 6d 62 | data bl|ock numb|
|00006370| 65 72 73 20 6f 66 20 61 | 6e 0a 58 20 2a 20 69 2d |ers of a|n.X * i-|
|00006380| 6e 6f 64 65 2e 20 20 54 | 68 65 20 66 75 6e 63 74 |node. T|he funct|
|00006390| 69 6f 6e 20 6c 33 74 6f | 6c 20 69 73 20 75 73 65 |ion l3to|l is use|
|000063a0| 64 20 66 6f 72 20 70 6f | 72 74 61 62 69 6c 69 74 |d for po|rtabilit|
|000063b0| 79 2e 0a 58 20 2a 2f 0a | 58 64 61 64 64 72 5f 74 |y..X */.|Xdaddr_t|
|000063c0| 20 62 6c 6b 5f 6e 6f 20 | 28 6f 66 66 29 0a 58 75 | blk_no |(off).Xu|
|000063d0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 6f 66 66 |nsigned |char off|
|000063e0| 5b 5d 3b 09 09 09 09 2f | 2a 20 33 2d 62 79 74 65 |[];..../|* 3-byte|
|000063f0| 20 6f 66 66 73 65 74 20 | 2a 2f 0a 58 7b 0a 58 09 | offset |*/.X{.X.|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.