| 1 | #! /bin/awk -f |
|---|
| 2 | # fsstruct will decode the AIX errpt fsstruct entries to be more readable. |
|---|
| 3 | # extract error messages with errpt -a <filename> |
|---|
| 4 | # setting all=1 will print out all error entries, all=0 will just print out |
|---|
| 5 | # GPFS related error entries. |
|---|
| 6 | ############################################################################# |
|---|
| 7 | # |
|---|
| 8 | # Usage: fsstruct.awk [<all=1>] <filename> |
|---|
| 9 | # |
|---|
| 10 | ############################################################################# |
|---|
| 11 | |
|---|
| 12 | BEGIN { |
|---|
| 13 | if (ARGC<2) |
|---|
| 14 | { |
|---|
| 15 | print "Usage: fsstruct.awk [<all=1>] <filename>" |
|---|
| 16 | terminate=1 |
|---|
| 17 | exit 1 |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | wide=1 #set to 0 for pre-gpfs2.3 versions that do not use wide disk addresses |
|---|
| 21 | all=0 |
|---|
| 22 | decode=1 |
|---|
| 23 | name[101]="FSErrInconsistentInode "; sens[101]=5; fmt[101]="4 8 8 2 v" |
|---|
| 24 | name[102]="FSErrIndirectBlock "; sens[102]=5; fmt[102]="f 4 4 4 v" |
|---|
| 25 | name[104]="FSErrBadReplicationCounts"; sens[104]=5; fmt[104]="4 v" |
|---|
| 26 | name[105]="FSErrBadPtrReplications "; sens[105]=5; fmt[105]="4 2 2 2 v" |
|---|
| 27 | name[106]="FSErrIndirectionLevel "; sens[106]=5; fmt[106]="4 2 v" |
|---|
| 28 | name[107]="FSErrDeallocBlock "; sens[107]=1; fmt[107]="4 4 4 4 4 4 4 4" |
|---|
| 29 | #wide alt#name[107]="FSErrDeallocBlock "; sens[107]=1; fmt[107]="4 4 8 4 4 4 4" |
|---|
| 30 | name[108]="FSErrValidate "; sens[108]=5; fmt[108]="2 d 2 r v" |
|---|
| 31 | name[109]="FSErrBadDiskAddrIndex "; sens[109]=1; fmt[109]="d 2" |
|---|
| 32 | name[110]="FSErrBadDiskAddrSector "; sens[110]=1; fmt[110]="d 2 2" |
|---|
| 33 | name[111]="FSErrBadDirBlock "; sens[111]=2; fmt[111]="4 4 4 4 4 4 4 4 4 4" |
|---|
| 34 | name[112]="FSErrBadInodeStatus "; sens[112]=5; fmt[112]="4 v" |
|---|
| 35 | name[113]="FSErrBadInodeOrGen "; sens[113]=5; fmt[113]="4 4 4 v" |
|---|
| 36 | name[114]="FSErrAllocBlock "; sens[114]=1; fmt[114]="4 4 4 4" |
|---|
| 37 | name[115]="FSErrBadDittoAddr "; sens[115]=2; fmt[115]="4 4 4 4 4 4 4 4 8" |
|---|
| 38 | name[116]="FSErrSnapInodeModified "; sens[116]=5; fmt[116]="4 4 4 4 v" |
|---|
| 39 | |
|---|
| 40 | # subcode of 111 FSErrBadDirBlock |
|---|
| 41 | name[201]="DirErrCheckHeaderFailed "; sens[201]=2; fmt[201]="4 4 4 4 4 4 4 4 4 4" |
|---|
| 42 | name[202]="DirErrDotDotNotFound "; sens[202]=2; fmt[202]="4 4 4 4 4 4" |
|---|
| 43 | name[203]="DirErrGenNumMismatch "; sens[203]=2; fmt[203]="4 4 4 4 4 4" |
|---|
| 44 | name[204]="DirErrInodeNumMismatch "; sens[204]=2; fmt[204]="4 4 4 4 4 4" |
|---|
| 45 | name[205]="DirErrInodeCorrupted "; sens[205]=2; fmt[205]="4 4 4 4 4 4" |
|---|
| 46 | name[206]="DirErrDirectCorrupted "; sens[206]=2; fmt[206]="4 4 4 4 4 4" |
|---|
| 47 | |
|---|
| 48 | valtype[1]="inode" |
|---|
| 49 | valtype[2]="indBlock" |
|---|
| 50 | valtype[3]="dataAllocmap" |
|---|
| 51 | valtype[4]="inodeAllocmap" |
|---|
| 52 | valtype[5]="dirBlock" |
|---|
| 53 | valtype[6]="bufDataAllocMap" |
|---|
| 54 | |
|---|
| 55 | buftype[0]="PBT_UNKNOWN" |
|---|
| 56 | buftype[1]="PBT_FREE" |
|---|
| 57 | buftype[2]="PBT_METADATA" |
|---|
| 58 | buftype[3]="PBT_TEMP" |
|---|
| 59 | buftype[4]="PBT_DISKDESC" |
|---|
| 60 | buftype[5]="PBT_SGDESC" |
|---|
| 61 | buftype[6]="PBT_DATA" |
|---|
| 62 | buftype[7]="PBT_IND" |
|---|
| 63 | buftype[8]="PBT_INODE" |
|---|
| 64 | buftype[9]="PBT_LLDATA" |
|---|
| 65 | buftype[10]="PBT_LLINDIRECT" |
|---|
| 66 | buftype[11]="PBT_LLINODE" |
|---|
| 67 | buftype[12]="PBT_ALLOC" |
|---|
| 68 | buftype[13]="PBT_IALLOC" |
|---|
| 69 | buftype[14]="PBT_LOG" |
|---|
| 70 | buftype[15]="PBT_LOGDESC" |
|---|
| 71 | buftype[16]="PBT_RECOV" |
|---|
| 72 | buftype[17]="PBT_LOG_WRAP" |
|---|
| 73 | buftype[18]="PBT_ISCAN" |
|---|
| 74 | |
|---|
| 75 | allerrtype["FFFF"]="NoBlock" |
|---|
| 76 | allerrtype["FFFE"]="LinkListFirst" |
|---|
| 77 | allerrtype["FFFD"]="NoConsecutive" |
|---|
| 78 | allerrtype["FFFC"]="LinkListNth" |
|---|
| 79 | allerrtype["FFFB"]="LinkListNew" |
|---|
| 80 | |
|---|
| 81 | monthof["Jan"]="01" |
|---|
| 82 | monthof["Feb"]="02" |
|---|
| 83 | monthof["Mar"]="03" |
|---|
| 84 | monthof["Apr"]="04" |
|---|
| 85 | monthof["May"]="05" |
|---|
| 86 | monthof["Jun"]="06" |
|---|
| 87 | monthof["Jul"]="07" |
|---|
| 88 | monthof["Aug"]="08" |
|---|
| 89 | monthof["Sep"]="09" |
|---|
| 90 | monthof["Oct"]="10" |
|---|
| 91 | monthof["Nov"]="11" |
|---|
| 92 | monthof["Dec"]="12" |
|---|
| 93 | } |
|---|
| 94 | function hexToDecimal(hex, d, ch, i, val) |
|---|
| 95 | { |
|---|
| 96 | d = 0 |
|---|
| 97 | for (i=1 ; i<=length(hex) ; i++) |
|---|
| 98 | { |
|---|
| 99 | ch = substr(hex,i,1) |
|---|
| 100 | val = index("0123456789ABCDEF", ch) |
|---|
| 101 | if (val == 0) |
|---|
| 102 | val = index("0123456789abcdef", ch) |
|---|
| 103 | d = d*16 + val - 1 |
|---|
| 104 | } |
|---|
| 105 | return d |
|---|
| 106 | } |
|---|
| 107 | function finishGPFSrec() |
|---|
| 108 | { |
|---|
| 109 | if (ingpfs) |
|---|
| 110 | { |
|---|
| 111 | ingpfs=0 |
|---|
| 112 | printed=0 |
|---|
| 113 | prest="" |
|---|
| 114 | if (ingeneric) |
|---|
| 115 | {ingeneric=0; prest="rc="rcode" reason="rscode" lvl="lvl" line "lineno" "module} |
|---|
| 116 | else if (inshutdown) |
|---|
| 117 | {inshutdown=0; prest="rc="rcode" reason="rscode" lvl="lvl" line "lineno" "module} |
|---|
| 118 | else if (inlongdiskio) {inlongdiskio=0} |
|---|
| 119 | else if (inunmount) |
|---|
| 120 | {inunmount=0; prest="rc="scode" "vol} |
|---|
| 121 | else if (indiskfail) |
|---|
| 122 | {indiskfail=0; prest="rc="rcode" "vol" disk "physvol} |
|---|
| 123 | else if (intraceback) {intraceback=0} |
|---|
| 124 | else if (inmoreinfo) |
|---|
| 125 | {inmoreinfo=0; prest="failedassert="assert} |
|---|
| 126 | else if (inphoenix) |
|---|
| 127 | {inphoenix=0; prest=phoemsg} |
|---|
| 128 | else if (inquota) {inquota=0} |
|---|
| 129 | else if (inenviron) {inenviron=0; prest="rc="rcode" "phoemsg} |
|---|
| 130 | else if (inrecovery) {inrecovery=0} |
|---|
| 131 | else if (inwarning) {inwarning=0} |
|---|
| 132 | else if (infsstruct) {infsstruct=0; printed=1} |
|---|
| 133 | |
|---|
| 134 | if (!printed) |
|---|
| 135 | printf("%s %s %s %s %s\n", date, node, label, id, prest) |
|---|
| 136 | } |
|---|
| 137 | else if (all && havestuff) |
|---|
| 138 | printf("%s %s %s %s %s\n", date, node, label, id, otherstuff) |
|---|
| 139 | havestuff=0 |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | /LABEL:/ {label=$NF; havestuff=1; otherstuff=""} |
|---|
| 143 | /IDENTIFIER:/ {id=$NF} |
|---|
| 144 | /MMFS_GENERIC/ {ingpfs=1; ingeneric=1} |
|---|
| 145 | /MMFS_ABNORMAL_SHUTD/ {ingpfs=1; inshutdown=1} |
|---|
| 146 | /MMFS_LONGDISKIO/ {ingpfs=1; inlongdiskio=1} |
|---|
| 147 | /MMFS_SYSTEM_UNMOUNT/ {ingpfs=1; inunmount=1} |
|---|
| 148 | /MMFS_DISKFAIL/ {ingpfs=1; indiskfail=1} |
|---|
| 149 | /MMFS_TRACEBACK/ {ingpfs=1; intraceback=1} |
|---|
| 150 | /MMFS_MOREINFO/ {ingpfs=1; inmoreinfo=1} |
|---|
| 151 | /MMFS_PHOENIX/ {ingpfs=1; inphoenix=1} |
|---|
| 152 | /MMFS_QUOTA/ {ingpfs=1; inquota=1} |
|---|
| 153 | /MMFS_ENVIRON/ {ingpfs=1; inenviron=1} |
|---|
| 154 | /MMFS_RECOVERY/ {ingpfs=1; inrecovery=1} |
|---|
| 155 | /MMFS_SYSTEM_WARNING/ {ingpfs=1; inwarning=1} |
|---|
| 156 | /MMFS_FSSTRUCT/ {ingpfs=1; infsstruct=1} |
|---|
| 157 | /Date.Time:/ { |
|---|
| 158 | pos=index($0,"Date/Time:") |
|---|
| 159 | $0=substr($0,pos) |
|---|
| 160 | day=$4; if (day < 10) day="0"day |
|---|
| 161 | mon=monthof[$3]; if (mon == "") mon=$3 |
|---|
| 162 | date=$NF"/"mon"/"day"@"$5 |
|---|
| 163 | } |
|---|
| 164 | /Node Id:/ {node=$NF} |
|---|
| 165 | /STATUS CODE/ {getline; scode=$NF} |
|---|
| 166 | /RETURN CODE/ { |
|---|
| 167 | getline; rcode=$NF |
|---|
| 168 | if (label == "VSD_EXT2_ER") {otherstuff=otherstuff" vsderr="$NF} |
|---|
| 169 | } |
|---|
| 170 | /REASON CODE/ {getline; if (NF == 2) rscode=$(NF-1) $NF; else rscode=$NF} |
|---|
| 171 | /ERROR CODE/ {getline; code=$NF; if (infsstruct) count[code]++} |
|---|
| 172 | /LINE/ {if (NF <= 2) {getline; lineno=$NF}} |
|---|
| 173 | /MAINTENANCE LEVEL/ {getline; lvl=$NF} |
|---|
| 174 | /REQUESTER/ {getline; assert=$0} |
|---|
| 175 | /ERROR DATA/ {inphoedata=NF; phoemsg=""} |
|---|
| 176 | /SIGNAL NUMBER/ {getline; otherstuff=otherstuff" sig="$NF} |
|---|
| 177 | /CORE FILE NAME/ {getline; otherstuff=otherstuff" core="$NF} |
|---|
| 178 | /PROGRAM NAME/ {getline; otherstuff=otherstuff" prog="$NF} |
|---|
| 179 | /heartbeat is late/ {getline; otherstuff=otherstuff" lateheartbeat="$NF} |
|---|
| 180 | /process was blocked/ {getline; otherstuff=otherstuff" stucktopologyservice="$NF} |
|---|
| 181 | /Interface name/ {getline; otherstuff=otherstuff" interface="$NF} |
|---|
| 182 | /DIAGNOSTIC EXPLANATION/ { |
|---|
| 183 | if (index($0, "Refer to the") == 0) |
|---|
| 184 | if (label == "VSD_INT_ER" || label == "RVSDD_ER") |
|---|
| 185 | {getline; otherstuff=otherstuff" vsdexpl="$0} |
|---|
| 186 | } |
|---|
| 187 | /INVALID VALUE/ { |
|---|
| 188 | if (label == "VSD_INT_ER") |
|---|
| 189 | {getline; otherstuff=otherstuff" vsderr="$NF} |
|---|
| 190 | } |
|---|
| 191 | /MAJOR NUMBER/ { |
|---|
| 192 | if (label == "VSD_EXT2_ER") |
|---|
| 193 | {getline; otherstuff=otherstuff" major="$NF} |
|---|
| 194 | } |
|---|
| 195 | /MINOR NUMBER/ { |
|---|
| 196 | if (label == "VSD_EXT2_ER") |
|---|
| 197 | {getline; otherstuff=otherstuff" minor="$NF} |
|---|
| 198 | } |
|---|
| 199 | /FUNCTION/ { |
|---|
| 200 | if (label == "VSD_EXT2_ER") |
|---|
| 201 | { |
|---|
| 202 | getline; otherstuff=otherstuff" function="$NF |
|---|
| 203 | getline; getline; otherstuff=otherstuff" extfunc="$NF |
|---|
| 204 | } |
|---|
| 205 | else if (label == "VSD_STOPVSD_ST") |
|---|
| 206 | {getline; otherstuff=otherstuff" function="$NF} |
|---|
| 207 | } |
|---|
| 208 | /FAILING MODULE/ { |
|---|
| 209 | if (label == "SRC_RSTRT" || label == "SRC_TRYX") |
|---|
| 210 | {getline; otherstuff=otherstuff" restart="$NF} |
|---|
| 211 | } |
|---|
| 212 | /Adapter interface name/ { |
|---|
| 213 | if (label == "TS_MISCFG_ER") |
|---|
| 214 | {getline; otherstuff=otherstuff" interface="$NF} |
|---|
| 215 | } |
|---|
| 216 | /Adapter offset/ { |
|---|
| 217 | if (label == "TS_MISCFG_ER") |
|---|
| 218 | {getline; otherstuff=otherstuff" offset="$NF} |
|---|
| 219 | } |
|---|
| 220 | /Adapter expected IP address/ { |
|---|
| 221 | if (label == "TS_MISCFG_ER") |
|---|
| 222 | {getline; otherstuff=otherstuff" expected="$NF} |
|---|
| 223 | } |
|---|
| 224 | /FILE SYSTEM DEVICE AND MOUNT POINT/ { |
|---|
| 225 | if (index(label,"FS_FULL") > 0) |
|---|
| 226 | {getline; otherstuff=otherstuff" "$(NF-1)" "$NF} |
|---|
| 227 | } |
|---|
| 228 | /JFS2 MAJOR/ { |
|---|
| 229 | if (index(label,"FS_FULL") > 0) |
|---|
| 230 | {getline; otherstuff=otherstuff" "$(NF-1)" "$NF} |
|---|
| 231 | } |
|---|
| 232 | /SOFT IPL 1/ { |
|---|
| 233 | if (label == "REBOOT_ID") |
|---|
| 234 | {getline; |
|---|
| 235 | if ($NF == "0") otherstuff=otherstuff" SOFT IPL" |
|---|
| 236 | else if ($NF == "1") otherstuff=otherstuff" HALT" |
|---|
| 237 | else if ($NF == "2") otherstuff=otherstuff" TIME REBOOT" |
|---|
| 238 | else otherstuff=otherstuff" boottype="$NF |
|---|
| 239 | } |
|---|
| 240 | } |
|---|
| 241 | /TIME/ { |
|---|
| 242 | if (label == "DUMP_STATS") |
|---|
| 243 | {getline; otherstuff=otherstuff" "$0} |
|---|
| 244 | } |
|---|
| 245 | /Type:/ { |
|---|
| 246 | if (substr(label,1,2) == "FC" || substr(label,1,7) == "SC_DISK") |
|---|
| 247 | { otherstuff=otherstuff" "$NF} |
|---|
| 248 | } |
|---|
| 249 | /Resource Name:/ { |
|---|
| 250 | if (substr(label,1,2) == "FC" || substr(label,1,7) == "SC_DISK") |
|---|
| 251 | { otherstuff=otherstuff" "$NF} |
|---|
| 252 | } |
|---|
| 253 | /Resource Class:/ { |
|---|
| 254 | if (substr(label,1,2) == "FC" || substr(label,1,7) == "SC_DISK") |
|---|
| 255 | { otherstuff=otherstuff" "$NF} |
|---|
| 256 | } |
|---|
| 257 | /Resource Type:/ { |
|---|
| 258 | if (substr(label,1,2) == "FC" || substr(label,1,7) == "SC_DISK") |
|---|
| 259 | { otherstuff=otherstuff" "$NF} |
|---|
| 260 | } |
|---|
| 261 | /Location:/ { |
|---|
| 262 | if (substr(label,1,2) == "FC" || substr(label,1,7) == "SC_DISK") |
|---|
| 263 | { otherstuff=otherstuff" "$NF} |
|---|
| 264 | } |
|---|
| 265 | /PHYSICAL VOLUME DEVICE MAJOR/ { |
|---|
| 266 | if (label == "LVM_IO_FAIL") |
|---|
| 267 | { |
|---|
| 268 | getline; |
|---|
| 269 | if (NF > 3) |
|---|
| 270 | otherstuff=otherstuff" physicalvol="$(NF-3)$(NF-2)$(NF-1)$NF |
|---|
| 271 | else |
|---|
| 272 | otherstuff=otherstuff" physicalvol="$(NF-1)$NF |
|---|
| 273 | } |
|---|
| 274 | next |
|---|
| 275 | } |
|---|
| 276 | /LOGICAL VOLUME DEVICE MAJOR/ { |
|---|
| 277 | if (label == "LVM_IO_FAIL") |
|---|
| 278 | { |
|---|
| 279 | getline; |
|---|
| 280 | if (NF > 3) |
|---|
| 281 | otherstuff=otherstuff" logicalvol="$(NF-3)$(NF-2)$(NF-1)$NF |
|---|
| 282 | else |
|---|
| 283 | otherstuff=otherstuff" logicalvol="$(NF-1)$NF |
|---|
| 284 | } |
|---|
| 285 | next |
|---|
| 286 | } |
|---|
| 287 | /PHYSICAL VOLUME/ {getline; physvol=$NF; next} |
|---|
| 288 | /VOLUME/ { |
|---|
| 289 | getline; vol=$NF |
|---|
| 290 | if (label == "VSD_STOPVSD_ST") {otherstuff=otherstuff" vg="$NF} |
|---|
| 291 | } |
|---|
| 292 | /PHYSICAL BUFFER TRANSACTION TIME/ { |
|---|
| 293 | if (label == "LVM_IO_FAIL") |
|---|
| 294 | {getline; otherstuff=otherstuff" iotime="$NF} |
|---|
| 295 | next |
|---|
| 296 | } |
|---|
| 297 | /BLOCK NUMBER/ { |
|---|
| 298 | if (label == "LVM_IO_FAIL") |
|---|
| 299 | {getline; otherstuff=otherstuff" err="code" sector="$NF} |
|---|
| 300 | next |
|---|
| 301 | } |
|---|
| 302 | /PANIC STRING/ { |
|---|
| 303 | if (label == "KERNEL_PANIC") |
|---|
| 304 | {getline; otherstuff=otherstuff" panic="$0} |
|---|
| 305 | } |
|---|
| 306 | /ASSERT STRING/ { |
|---|
| 307 | if (label == "KERNEL_PANIC") |
|---|
| 308 | {getline; otherstuff=otherstuff" assert="$0} |
|---|
| 309 | } |
|---|
| 310 | /DETECTING MODULE/ { |
|---|
| 311 | if (ingpfs) |
|---|
| 312 | { |
|---|
| 313 | getline; module=$NF |
|---|
| 314 | pos=index(module,"/") |
|---|
| 315 | while (pos > 0) |
|---|
| 316 | { |
|---|
| 317 | module=substr(module,pos+1) |
|---|
| 318 | pos=index(module,"/") |
|---|
| 319 | } |
|---|
| 320 | } |
|---|
| 321 | else {getline; otherstuff=otherstuff" detectedby="$0} |
|---|
| 322 | } |
|---|
| 323 | /SENSE DATA/ { |
|---|
| 324 | if (infsstruct) |
|---|
| 325 | { |
|---|
| 326 | if (NF == 3) indsh=1 |
|---|
| 327 | else indsh=0 |
|---|
| 328 | sl=sens[code]; if (sl == 0) sl=5 |
|---|
| 329 | sense="" |
|---|
| 330 | for (i=1; i <= sl; i++) |
|---|
| 331 | { |
|---|
| 332 | getline; if (indsh) $1="" |
|---|
| 333 | sense = sense " " $0 |
|---|
| 334 | } |
|---|
| 335 | $0 = sense |
|---|
| 336 | NF = split($0, wds) |
|---|
| 337 | wd=2 |
|---|
| 338 | if (code == 111) # FSErrBadDirBlock |
|---|
| 339 | { |
|---|
| 340 | code=hexToDecimal($(wd+1)); |
|---|
| 341 | if (code >= 201 && code <= 206) |
|---|
| 342 | wd+=2 |
|---|
| 343 | else code=111 |
|---|
| 344 | } |
|---|
| 345 | formt=fmt[code] |
|---|
| 346 | if (!decode || formt == "") |
|---|
| 347 | printf("%s %s %s %s %s %s %s\n", |
|---|
| 348 | date, node, "MMFS_FSSTRUCT", vol, code, name[code], sense) |
|---|
| 349 | else |
|---|
| 350 | { |
|---|
| 351 | tokens=0 |
|---|
| 352 | for (f=1; f <= length(formt); f++) |
|---|
| 353 | { |
|---|
| 354 | ch = substr(formt,f,1) |
|---|
| 355 | if (ch != " ") |
|---|
| 356 | { |
|---|
| 357 | tokens++ |
|---|
| 358 | if (ch == "4") |
|---|
| 359 | { |
|---|
| 360 | tok[tokens] = $wd $(wd+1); wd+=2 |
|---|
| 361 | } |
|---|
| 362 | else if (ch == "2") |
|---|
| 363 | { |
|---|
| 364 | tok[tokens] = $wd; wd+=1 |
|---|
| 365 | } |
|---|
| 366 | else if (ch == "8") |
|---|
| 367 | { |
|---|
| 368 | tok[tokens] = $wd $(wd+1) $(wd+2) $(wd+3); wd+=4 |
|---|
| 369 | } |
|---|
| 370 | else if (ch == "d") |
|---|
| 371 | { |
|---|
| 372 | if (wide) |
|---|
| 373 | { |
|---|
| 374 | tok[tokens] = $wd $(wd+1)":"$(wd+2) $(wd+3) $(wd+4) $(wd+5)"("hexToDecimal($wd $(wd+1))":"hexToDecimal($(wd+2) $(wd+3) $(wd+4) $(wd+5))")"; wd+=6 |
|---|
| 375 | } |
|---|
| 376 | else |
|---|
| 377 | { |
|---|
| 378 | tok[tokens] = $wd":"$(wd+1) $(wd+2)"("hexToDecimal($wd)":"hexToDecimal($(wd+1) $(wd+2))")"; wd+=3 |
|---|
| 379 | } |
|---|
| 380 | } |
|---|
| 381 | else if (ch == "r") |
|---|
| 382 | { |
|---|
| 383 | nval=$wd; wd++ |
|---|
| 384 | if (nval == "FFFF") |
|---|
| 385 | tok[tokens]="[broken]" |
|---|
| 386 | else |
|---|
| 387 | { |
|---|
| 388 | nval+=0 |
|---|
| 389 | tok[tokens] = "[nVal="nval |
|---|
| 390 | while (nval > 0) |
|---|
| 391 | { |
|---|
| 392 | if (wide) |
|---|
| 393 | { |
|---|
| 394 | tok[tokens] = tok[tokens]" "$wd $(wd+1)":"$(wd+2) $(wd+3) $(wd+4) $(wd+5)"("hexToDecimal($wd $(wd+1))":"hexToDecimal($(wd+2) $(wd+3) $(wd+4) $(wd+5))")"; wd+=6 |
|---|
| 395 | } |
|---|
| 396 | else |
|---|
| 397 | { |
|---|
| 398 | tok[tokens] = tok[tokens]" "$wd":"$(wd+1) $(wd+2)"("hexToDecimal($wd)":"hexToDecimal($(wd+1) $(wd+2))")"; wd+=3 |
|---|
| 399 | } |
|---|
| 400 | nval-- |
|---|
| 401 | } |
|---|
| 402 | tok[tokens] = tok[tokens]"]" |
|---|
| 403 | } |
|---|
| 404 | } |
|---|
| 405 | else if (ch == "f") |
|---|
| 406 | { |
|---|
| 407 | nval=$wd; wd++ |
|---|
| 408 | if (nval == "FFFF") |
|---|
| 409 | tok[tokens]="[broken" |
|---|
| 410 | else |
|---|
| 411 | { |
|---|
| 412 | nval+=0 |
|---|
| 413 | tok[tokens] = "[nVal="nval |
|---|
| 414 | while (nval > 0) |
|---|
| 415 | { |
|---|
| 416 | if (wide) |
|---|
| 417 | { |
|---|
| 418 | tok[tokens] = tok[tokens]" "$wd $(wd+1)":"$(wd+2) $(wd+3) $(wd+4) $(wd+5)"("hexToDecimal($wd $(wd+1))":"hexToDecimal($(wd+2) $(wd+3) $(wd+4) $(wd+5))")"; wd+=6 |
|---|
| 419 | } |
|---|
| 420 | else |
|---|
| 421 | { |
|---|
| 422 | tok[tokens] = tok[tokens]" "$wd":"$(wd+1) $(wd+2)"("hexToDecimal($wd)":"hexToDecimal($(wd+1) $(wd+2))")"; wd+=3 |
|---|
| 423 | } |
|---|
| 424 | nval-- |
|---|
| 425 | } |
|---|
| 426 | } |
|---|
| 427 | tok[tokens] = tok[tokens]" subl="$wd"]"; wd++ |
|---|
| 428 | } |
|---|
| 429 | else if (ch == "v") |
|---|
| 430 | { |
|---|
| 431 | tok[tokens] = "(len="$wd $(wd+1)")"; wd+=2 |
|---|
| 432 | while (NF >= wd && $NF == "0000") |
|---|
| 433 | NF-- |
|---|
| 434 | while (wd <= NF) |
|---|
| 435 | { |
|---|
| 436 | tok[tokens] = tok[tokens]" "$wd; wd++ |
|---|
| 437 | } |
|---|
| 438 | } |
|---|
| 439 | } |
|---|
| 440 | } |
|---|
| 441 | rest="" |
|---|
| 442 | while (NF >= wd && $NF == "0000") |
|---|
| 443 | NF-- |
|---|
| 444 | while (wd <= NF) |
|---|
| 445 | { |
|---|
| 446 | rest = rest" "$wd; wd++ |
|---|
| 447 | } |
|---|
| 448 | |
|---|
| 449 | if (code == 101) # FSErrInconsistentInode |
|---|
| 450 | { |
|---|
| 451 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 452 | tok[2]="allocBlks="tok[2] |
|---|
| 453 | tok[3]="lastBlock="tok[3] |
|---|
| 454 | tok[4]="fragSubbl="tok[4] |
|---|
| 455 | tok[5]="inode="tok[5] |
|---|
| 456 | } |
|---|
| 457 | else if (code == 102) # FSErrIndirectBlock |
|---|
| 458 | { |
|---|
| 459 | tok[1]="da="tok[1] |
|---|
| 460 | tok[2]="gen="tok[2] |
|---|
| 461 | tok[3]="inodeNum="tok[3]"("hexToDecimal(tok[3])")" |
|---|
| 462 | tok[4]="expectBlkNum="tok[4] |
|---|
| 463 | tok[5]="indBlock="tok[5] |
|---|
| 464 | } |
|---|
| 465 | else if (code == 104) # FSErrBadReplicationCounts |
|---|
| 466 | { |
|---|
| 467 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 468 | tok[2]="inode="tok[2] |
|---|
| 469 | } |
|---|
| 470 | else if (code == 105) # FSErrBadPtrReplications |
|---|
| 471 | { |
|---|
| 472 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 473 | tok[2]="dataPtrsPerInode="tok[2] |
|---|
| 474 | tok[3]="indPtrsPerInode="tok[3] |
|---|
| 475 | tok[4]="dataPtrsPerIndBlk="tok[4] |
|---|
| 476 | tok[5]="inode="tok[5] |
|---|
| 477 | } |
|---|
| 478 | else if (code == 106) # FSErrIndirectionLevel |
|---|
| 479 | { |
|---|
| 480 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 481 | tok[2]="invalIndLvl="tok[2] |
|---|
| 482 | tok[3]="inode="tok[3] |
|---|
| 483 | } |
|---|
| 484 | else if (code == 107) # FSErrDeallocBlock |
|---|
| 485 | { |
|---|
| 486 | tok[1]="errno="tok[1] |
|---|
| 487 | tok[2]="diskNum="tok[2] |
|---|
| 488 | if (wide || tok[4] > 32) # subblocks too big, assume 8 byte sector number |
|---|
| 489 | { |
|---|
| 490 | tok[3]="sector="tok[3] tok[4] |
|---|
| 491 | tok[4]="nSubblocks="tok[5] |
|---|
| 492 | tok[5]="region="tok[6] |
|---|
| 493 | tok[6]="segment="tok[7] |
|---|
| 494 | tok[7]="subBlock="tok[8] |
|---|
| 495 | } |
|---|
| 496 | else # assume 4 byte sector number |
|---|
| 497 | { |
|---|
| 498 | tok[3]="sector="tok[3] |
|---|
| 499 | tok[4]="nSubblocks="tok[4] |
|---|
| 500 | tok[5]="region="tok[5] |
|---|
| 501 | tok[6]="segment="tok[6] |
|---|
| 502 | tok[7]="subBlock="tok[7] |
|---|
| 503 | } |
|---|
| 504 | } |
|---|
| 505 | else if (code == 108) # FSErrValidate |
|---|
| 506 | { |
|---|
| 507 | type=valtype[tok[1]+0] |
|---|
| 508 | if (type == "") type=tok[1] |
|---|
| 509 | tok[1]="type="type |
|---|
| 510 | tok[2]="da="tok[2] |
|---|
| 511 | tok[3]="sectors="tok[3] |
|---|
| 512 | tok[4]="repda="tok[4] |
|---|
| 513 | tok[5]="data="tok[5] |
|---|
| 514 | } |
|---|
| 515 | else if (code == 109) # FSErrBadDiskAddrIndex |
|---|
| 516 | { |
|---|
| 517 | tok[1]="da="tok[1] |
|---|
| 518 | type=buftype[tok[2]+0] |
|---|
| 519 | if (type == "") type=tok[2] |
|---|
| 520 | tok[2]="type="type |
|---|
| 521 | } |
|---|
| 522 | else if (code == 110) # FSErrBadDiskAddrSector |
|---|
| 523 | { |
|---|
| 524 | tok[1]="da="tok[1] |
|---|
| 525 | tok[2]="sectors="tok[2] |
|---|
| 526 | type=buftype[hexToDecimal(tok[3])] |
|---|
| 527 | if (type == "") type=tok[3] |
|---|
| 528 | tok[3]="type="type |
|---|
| 529 | } |
|---|
| 530 | else if (code == 111) # FSErrBadDirBlock |
|---|
| 531 | { |
|---|
| 532 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 533 | tok[2]="blockNum="tok[2] |
|---|
| 534 | tok[3]="errorcode="tok[3] |
|---|
| 535 | tok[4]="errno="tok[4] |
|---|
| 536 | tok[5]="dirhdr="tok[5] |
|---|
| 537 | # and pick up tok[6 7 8 9] |
|---|
| 538 | } |
|---|
| 539 | else if (code == 112) # FSErrBadInodeStatus |
|---|
| 540 | { |
|---|
| 541 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 542 | tok[2]="inode="tok[2] |
|---|
| 543 | } |
|---|
| 544 | else if (code == 113) # FSErrBadInodeOrGen |
|---|
| 545 | { |
|---|
| 546 | tok[1]="fileInodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 547 | tok[2]="dirInodeNum="tok[2]"("hexToDecimal(tok[2])")" |
|---|
| 548 | tok[3]="gen="tok[3] |
|---|
| 549 | tok[4]="filename="tok[4] |
|---|
| 550 | } |
|---|
| 551 | else if (code == 114) # FSErrAllocBlock |
|---|
| 552 | { |
|---|
| 553 | type=allerrtype[tok[1]] |
|---|
| 554 | if (type == "") type=tok[1] |
|---|
| 555 | tok[1]="type="type |
|---|
| 556 | tok[2]="diskIndex="tok[2] |
|---|
| 557 | tok[3]="recordNo="tok[3] |
|---|
| 558 | tok[4]="nSubblocks="tok[4] |
|---|
| 559 | } |
|---|
| 560 | else if (code == 115) # FSErrBadDittoAddr |
|---|
| 561 | { |
|---|
| 562 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 563 | tok[2]="gen="tok[2] |
|---|
| 564 | tok[3]="snapId="tok[3] |
|---|
| 565 | tok[4]="inodeStatus="tok[4] |
|---|
| 566 | tok[5]="InodeNumPrevSnap="tok[5]"("hexToDecimal(tok[5])")" |
|---|
| 567 | tok[6]="genPrevSnap="tok[6] |
|---|
| 568 | tok[7]="snapIdPrevSnap="tok[7] |
|---|
| 569 | tok[8]="inodeStatusPrevSnap="tok[8] |
|---|
| 570 | tok[9]="blockNum="tok[9] |
|---|
| 571 | } |
|---|
| 572 | else if (code == 116) # FSErrSnapInodeModified |
|---|
| 573 | { |
|---|
| 574 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 575 | tok[2]="snapId="tok[2] |
|---|
| 576 | tok[3]="nextSnapId="tok[3] |
|---|
| 577 | tok[4]="fileModifiedSnapId="tok[4] |
|---|
| 578 | tok[5]="inode="tok[5] |
|---|
| 579 | } |
|---|
| 580 | else if (code == 201) # DirErrCheckHeaderFailed |
|---|
| 581 | { |
|---|
| 582 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 583 | tok[2]="snapId="tok[2] |
|---|
| 584 | tok[3]="blockNum="tok[3] |
|---|
| 585 | tok[4]="errorcode="tok[4] |
|---|
| 586 | tok[5]="rc="tok[5] |
|---|
| 587 | tok[6]="dirhdr="tok[6] |
|---|
| 588 | # and pick up tok[7 8 9 10 11] |
|---|
| 589 | } |
|---|
| 590 | else if (code == 202) # DirErrDotDotNotFound |
|---|
| 591 | { |
|---|
| 592 | tok[1]="errorcode="tok[1] |
|---|
| 593 | tok[2]="rc="tok[2] |
|---|
| 594 | tok[3]="srcInodeNum="tok[3]"("hexToDecimal(tok[3])")" |
|---|
| 595 | tok[4]="srcGen="tok[4] |
|---|
| 596 | } |
|---|
| 597 | else if (code == 203) # DirErrGenNumMismatch |
|---|
| 598 | { |
|---|
| 599 | tok[1]="errorcode="tok[1] |
|---|
| 600 | tok[2]="rc="tok[2] |
|---|
| 601 | tok[3]="srcInodeNum="tok[3]"("hexToDecimal(tok[3])")" |
|---|
| 602 | tok[4]="srcGen="tok[4] |
|---|
| 603 | tok[5]="entryGen="tok[5] |
|---|
| 604 | } |
|---|
| 605 | else if (code == 204) # DirErrInodeNumMismatch |
|---|
| 606 | { |
|---|
| 607 | tok[1]="errorcode="tok[1] |
|---|
| 608 | tok[2]="rc="tok[2] |
|---|
| 609 | tok[3]="srcInodeNum="tok[3]"("hexToDecimal(tok[3])")" |
|---|
| 610 | tok[4]="entryInodeNum="tok[4]"("hexToDecimal(tok[4])")" |
|---|
| 611 | } |
|---|
| 612 | else if (code == 205) # DirErrInodeCorrupted |
|---|
| 613 | { |
|---|
| 614 | tok[3]="inodeNum="tok[3]"("hexToDecimal(tok[3])")" |
|---|
| 615 | tok[4]="srcGen="tok[4] |
|---|
| 616 | tok[5]="entryGen="tok[5] |
|---|
| 617 | tok[6]="entryInodeStatus="tok[6] |
|---|
| 618 | } |
|---|
| 619 | else if (code == 206) # DirErrDirectCorrupted |
|---|
| 620 | { |
|---|
| 621 | tok[1]="inodeNum="tok[1]"("hexToDecimal(tok[1])")" |
|---|
| 622 | tok[2]="blockNum="tok[2] |
|---|
| 623 | tok[3]="errorcode="tok[3] |
|---|
| 624 | tok[4]="errno="tok[4] |
|---|
| 625 | tok[5]="dirhdr="tok[5] |
|---|
| 626 | # and pick up tok[6 7 8 9] |
|---|
| 627 | } |
|---|
| 628 | |
|---|
| 629 | printf("%s %s %s %s %s %s", |
|---|
| 630 | date, node, "MMFS_FSSTRUCT", vol, code, name[code]) |
|---|
| 631 | for (i = 1; i <= tokens; i++) |
|---|
| 632 | printf(" %s", tok[i]) |
|---|
| 633 | if (rest != "") printf(" rest =%s\n", rest) |
|---|
| 634 | else printf("\n") |
|---|
| 635 | } |
|---|
| 636 | } |
|---|
| 637 | } |
|---|
| 638 | /---------------------/ {inphoedata=0; finishGPFSrec()} |
|---|
| 639 | |
|---|
| 640 | { |
|---|
| 641 | if (inphoedata > 0) |
|---|
| 642 | { |
|---|
| 643 | if (inphoedata > 2) $1="" |
|---|
| 644 | phoemsg=phoemsg" "$0 |
|---|
| 645 | } |
|---|
| 646 | } |
|---|
| 647 | END { |
|---|
| 648 | if (terminate) exit 1 |
|---|
| 649 | finishGPFSrec() |
|---|
| 650 | for (code in count) |
|---|
| 651 | printf("+++code: %4d %s %9d times\n", code, name[code], count[code]) |
|---|
| 652 | } |
|---|