diff -r a9276dd67cc5 usr/src/cmd/fs.d/ufs/fsdb/fsdb.c --- a/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c Mon Jun 26 20:53:33 2006 -0700 +++ b/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c Sun Jul 02 19:38:17 2006 +1000 @@ -348,6 +348,7 @@ static void syncshadowscan(int); static void syncshadowscan(int); static void log_display_header(void); static void log_show(enum log_enum); +static int log_lodb(u_offset_t, diskaddr_t *); #ifdef sun static void err(); @@ -435,7 +436,7 @@ main(int argc, char *argv[]) switch (getsubopt(&subopts, subopt_v, &optval)) { case OVERRIDE: - printf("error checking off\n"); + (void) printf("error checking off\n"); override = 1; break; @@ -484,7 +485,7 @@ main(int argc, char *argv[]) * name of the special device. */ if (*prompt == NULL) - (void) sprintf(prompt, "%s > ", special); + (void) snprintf(prompt, PROMPTSIZE, "%s > ", special); /* * Attempt to open the special file. @@ -503,12 +504,12 @@ main(int argc, char *argv[]) #ifdef sun if (read(fd, &filesystem, SBSIZE) != SBSIZE) { - printf("%s: cannot read superblock\n", special); + (void) printf("%s: cannot read superblock\n", special); exit(1); } #else if (read(fd, &filesystem, sizeof (filesystem)) != sizeof (filesystem)) { - printf("%s: cannot read superblock\n", special); + (void) printf("%s: cannot read superblock\n", special); exit(1); } #endif /* sun */ @@ -516,15 +517,15 @@ main(int argc, char *argv[]) fs = &filesystem; if ((fs->fs_magic != FS_MAGIC) && (fs->fs_magic != MTB_UFS_MAGIC)) { if (!override) { - printf("%s: Bad magic number in file system\n", + (void) printf("%s: Bad magic number in file system\n", special); exit(1); } - printf("WARNING: Bad magic number in file system. "); - printf("Continue? (y/n): "); + (void) printf("WARNING: Bad magic number in file system. "); + (void) printf("Continue? (y/n): "); (void) fflush(stdout); - if (gets(input_buffer) == NULL) { + if (fgets(input_buffer, INPUTBUFFER, stdin) == NULL) { exit(1); } @@ -540,15 +541,16 @@ main(int argc, char *argv[]) (fs->fs_version > MTB_UFS_VERSION_1 || fs->fs_version < MTB_UFS_VERSION_MIN))) { if (!override) { - printf("%s: Unrecognized UFS version number: %d\n", + (void) printf( + "%s: Unrecognized UFS version number: %d\n", special, fs->fs_version); exit(1); } - printf("WARNING: Unrecognized UFS version number. "); - printf("Continue? (y/n): "); + (void) printf("WARNING: Unrecognized UFS version number. "); + (void) printf("Continue? (y/n): "); (void) fflush(stdout); - if (gets(input_buffer) == NULL) { + if (fgets(input_buffer, INPUTBUFFER, stdin) == NULL) { exit(1); } @@ -560,44 +562,46 @@ main(int argc, char *argv[]) if (fs->fs_postblformat == FS_42POSTBLFMT) fs->fs_nrpos = 8; #endif - printf("fsdb of %s %s -- last mounted on %s\n", + (void) printf("fsdb of %s %s -- last mounted on %s\n", special, (wrtflag == O_RDWR) ? "(Opened for write)" : "(Read only)", &fs->fs_fsmnt[0]); #ifdef sun - printf("fs_clean is currently set to "); + (void) printf("fs_clean is currently set to "); switch (fs->fs_clean) { case FSACTIVE: - printf("FSACTIVE\n"); + (void) printf("FSACTIVE\n"); break; case FSCLEAN: - printf("FSCLEAN\n"); + (void) printf("FSCLEAN\n"); break; case FSSTABLE: - printf("FSSTABLE\n"); + (void) printf("FSSTABLE\n"); break; case FSBAD: - printf("FSBAD\n"); + (void) printf("FSBAD\n"); break; case FSSUSPEND: - printf("FSSUSPEND\n"); + (void) printf("FSSUSPEND\n"); break; case FSLOG: - printf("FSLOG\n"); + (void) printf("FSLOG\n"); break; case FSFIX: - printf("FSFIX\n"); + (void) printf("FSFIX\n"); if (!override) { - printf("%s: fsck may be running on this file system\n", - special); + (void) printf( + "%s: fsck may be running on this file system\n", + special); exit(1); } - printf("WARNING: fsck may be running on this file system. "); - printf("Continue? (y/n): "); + (void) printf( + "WARNING: fsck may be running on this file system. "); + (void) printf("Continue? (y/n): "); (void) fflush(stdout); - if (gets(input_buffer) == NULL) { + if (fgets(input_buffer, INPUTBUFFER, stdin) == NULL) { exit(1); } @@ -606,14 +610,16 @@ main(int argc, char *argv[]) } break; default: - printf("an unknown value (0x%x)\n", fs->fs_clean); + (void) printf("an unknown value (0x%x)\n", fs->fs_clean); break; } if (fs->fs_state == (FSOKAY - fs->fs_time)) { - printf("fs_state consistent (fs_clean CAN be trusted)\n"); + (void) printf( + "fs_state consistent (fs_clean CAN be trusted)\n"); } else { - printf("fs_state inconsistent (fs_clean CAN'T trusted)\n"); + (void) printf( + "fs_state inconsistent (fs_clean CAN'T trusted)\n"); } #endif /* sun */ /* @@ -651,7 +657,7 @@ main(int argc, char *argv[]) filenames = (struct filenames *)calloc(maxfiles, sizeof (struct filenames)); if (filenames == NULL) { - printf("out of memory\n"); + (void) printf("out of memory\n"); exit(1); } } @@ -665,7 +671,7 @@ main(int argc, char *argv[]) stack_path[i] = calloc(1, MAXNAMLEN); current_path[i] = calloc(1, MAXNAMLEN); if (current_path[i] == NULL) { - printf("out of memory\n"); + (void) printf("out of memory\n"); exit(1); } } @@ -695,7 +701,7 @@ main(int argc, char *argv[]) cur_ino = errino; cur_inum = errinum; cur_bytes = errcur_bytes; - printf("?\n"); + (void) printf("?\n"); getnextinput(); if (error) continue; @@ -813,7 +819,7 @@ main(int argc, char *argv[]) value = addr; continue; } - printf("unknown command or bad syntax\n"); + (void) printf("unknown command or bad syntax\n"); error++; continue; @@ -970,7 +976,7 @@ main(int argc, char *argv[]) if (error) continue; if (!temp) { - printf("divide by zero\n"); + (void) printf("divide by zero\n"); error++; continue; } @@ -1054,14 +1060,14 @@ calc: case 't': case 'T': laststyle = '='; - printf("\t\t"); + (void) printf("\t\t"); { /* * Truncation is intentional so * ctime is happy. */ time_t tvalue = (time_t)value; - printf("%s", ctime(&tvalue)); + (void) printf("%s", ctime(&tvalue)); } continue; case 'o': @@ -1079,12 +1085,12 @@ calc: base = HEX; otx: laststyle = '='; - printf("\t\t"); + (void) printf("\t\t"); if (acting_on_inode) print(value & 0177777L, 12, -8, 0); else print(addr & 0177777L, 12, -8, 0); - printf("\n"); + (void) printf("\n"); base = tbase; continue; case 'O': @@ -1097,19 +1103,19 @@ otx: base = HEX; OTX: laststyle = '='; - printf("\t\t"); + (void) printf("\t\t"); if (acting_on_inode) print(value, 12, -8, 0); else print(addr, 12, -8, 0); - printf("\n"); + (void) printf("\n"); base = tbase; continue; default: /* regular assignment */ ungetachar(c); value = expr(); if (error) - printf("syntax error\n"); + (void) printf("syntax error\n"); else put(value, objsz); continue; @@ -1121,8 +1127,9 @@ OTX: should_print = 0; c = getachar(); if (!letter(c) && !digit(c)) { - printf("invalid register specification, "); - printf("must be letter or digit\n"); + (void) printf( + "invalid register specification, "); + (void) printf("must be letter or digit\n"); error++; continue; } @@ -1142,8 +1149,9 @@ OTX: should_print = 0; c = getachar(); if (!letter(c) && !digit(c)) { - printf("invalid register specification, "); - printf("must be letter or digit\n"); + (void) printf( + "invalid register specification, "); + (void) printf("must be letter or digit\n"); error++; continue; } @@ -1209,28 +1217,28 @@ showbase: showbase: if ((c = getachar()) == '\n') { ungetachar(c); - printf("base =\t\t"); + (void) printf("base =\t\t"); switch (base) { case OCTAL: - printf("OCTAL\n"); + (void) printf("OCTAL\n"); continue; case DECIMAL: - printf("DECIMAL\n"); + (void) printf("DECIMAL\n"); continue; case HEX: - printf("HEX\n"); + (void) printf("HEX\n"); continue; } } if (c != '=') { - printf("missing '='\n"); + (void) printf("missing '='\n"); error++; continue; } value = expr(); switch (value) { default: - printf("invalid base\n"); + (void) printf("invalid base\n"); error++; break; case OCTAL: @@ -1267,9 +1275,11 @@ showbase: print_path(input_path, (int)input_pathp); if (nfiles == 0) - printf(" not found\n"); + (void) printf( + " not found\n"); else - printf(" ambiguous\n"); + (void) printf( + " ambiguous\n"); error++; } continue; @@ -1281,7 +1291,7 @@ showbase: restore_inode((ino_t)temp); print_path(input_path, (int)input_pathp); - printf(" not a directory\n"); + (void) printf(" not a directory\n"); error++; continue; } @@ -1295,9 +1305,10 @@ showbase: if (type == NUMB) value = addr; if (value > fs->fs_ncg - 1) { - printf("maximum cylinder group is "); + (void) printf( + "maximum cylinder group is "); print(fs->fs_ncg - 1, 8, -8, 0); - printf("\n"); + (void) printf("\n"); error++; continue; } @@ -1336,9 +1347,10 @@ showbase: if (type == NUMB) value = addr; if (value >= NDADDR) { - printf("direct blocks are 0 to "); + (void) printf( + "direct blocks are 0 to "); print(NDADDR - 1, 0, 0, 0); - printf("\n"); + (void) printf("\n"); error++; continue; } @@ -1355,7 +1367,7 @@ showbase: dirslot = 0; value = get(LONG); if (!value && !override) { - printf("non existent block\n"); + (void) printf("non existent block\n"); error++; } continue; @@ -1403,7 +1415,7 @@ showbase: switch (mode & IFMT) { case IFCHR: case IFBLK: - printf("special device\n"); + (void) printf("special device\n"); error++; continue; } @@ -1419,13 +1431,13 @@ showbase: } if (match("fill", 4)) { /* fill */ if (getachar() != '=') { - printf("missing '='\n"); + (void) printf("missing '='\n"); error++; continue; } if (objsz == INODE || objsz == DIRECTORY || objsz == SHADOW_DATA) { - printf( + (void) printf( "can't fill inode or directory\n"); error++; continue; @@ -1483,9 +1495,10 @@ showbase: if (type == NUMB) value = addr; if (value >= NIADDR) { - printf("indirect blocks are 0 to "); + (void) printf( + "indirect blocks are 0 to "); print(NIADDR - 1, 0, 0, 0); - printf("\n"); + (void) printf("\n"); error++; continue; } @@ -1501,7 +1514,7 @@ showbase: dirslot = 0; value = get(LONG); if (!value && !override) { - printf("non existent block\n"); + (void) printf("non existent block\n"); error++; } continue; @@ -1534,7 +1547,8 @@ showbase: continue; } if (match("log_otodb", 9)) { - if (log_lodb((u_offset_t)addr, &temp)) { + if (log_lodb((u_offset_t)addr, + (diskaddr_t *)&temp)) { addr = temp; should_print = 1; laststyle = '='; @@ -1555,9 +1569,10 @@ showbase: } else if (c == 'l') { long_list = 1; } else { - printf( + (void) printf( "unknown option "); - printf("'%c'\n", c); + (void) printf("'%c'\n", + c); error++; break; } @@ -1581,7 +1596,7 @@ showbase: if (!error) { print_path(input_path, (int)input_pathp); - printf(" not found\n"); + (void) printf(" not found\n"); } continue; } @@ -1591,7 +1606,7 @@ showbase: sizeof (struct filenames), ffcmp); ls(filenames, filenames + (nfiles - 1), 0); } else { - printf("no match\n"); + (void) printf("no match\n"); error++; } restore_inode((ino_t)temp); @@ -1697,9 +1712,9 @@ showbase: if (match("override", 1)) { /* override flip flop */ override = !override; if (override) - printf("error checking off\n"); + (void) printf("error checking off\n"); else - printf("error checking on\n"); + (void) printf("error checking on\n"); continue; } goto bad_syntax; @@ -1711,17 +1726,17 @@ showbase: goto no_colon; if (match("pwd", 2)) { /* print working dir */ print_path(current_path, (int)current_pathp); - printf("\n"); + (void) printf("\n"); continue; } if (match("prompt", 2)) { /* change prompt */ if ((c = getachar()) != '=') { - printf("missing '='\n"); + (void) printf("missing '='\n"); error++; continue; } if ((c = getachar()) != '"') { - printf("missing '\"'\n"); + (void) printf("missing '\"'\n"); error++; continue; } @@ -1730,7 +1745,8 @@ showbase: while ((c = getachar()) != '"' && c != '\n') { prompt[i++] = c; if (i >= PROMPTSIZE) { - printf("string too long\n"); + (void) printf( + "string too long\n"); error++; break; } @@ -1769,9 +1785,10 @@ showbase: if (type == NUMB) value = addr; if (value > fs->fs_ncg - 1) { - printf("maximum super block is "); + (void) printf( + "maximum super block is "); print(fs->fs_ncg - 1, 8, -8, 0); - printf("\n"); + (void) printf("\n"); error++; continue; } @@ -1834,23 +1851,27 @@ showbase: else goto no_colon; for (bp = bhdr.fwd; bp != &bhdr; bp = bp->fwd) - printf("%8" PRIx64 " %d\n", + (void) printf("%8" PRIx64 " %d\n", bp->blkno, bp->valid); - printf("\n"); - printf("# commands\t\t%ld\n", commands); - printf("# read requests\t\t%ld\n", read_requests); - printf("# actual disk reads\t%ld\n", actual_disk_reads); + (void) printf("\n"); + (void) printf("# commands\t\t%ld\n", commands); + (void) printf("# read requests\t\t%ld\n", + read_requests); + (void) printf("# actual disk reads\t%ld\n", + actual_disk_reads); continue; no_colon: - printf("a colon should precede a command\n"); + (void) printf("a colon should precede a command\n"); error++; continue; bad_syntax: - printf("more letters needed to distinguish command\n"); + (void) printf("more letters needed to distinguish command\n"); error++; continue; } } + + return (0); } /* @@ -1859,14 +1880,15 @@ static void static void usage(char *progname) { - printf("usage: %s [options] special\n", progname); - printf("options:\n"); - printf("\t-o Specify ufs filesystem sepcific options\n"); - printf(" Available suboptions are:\n"); - printf("\t\t? display usage\n"); - printf("\t\to override some error conditions\n"); - printf("\t\tp=\"string\" set prompt to string\n"); - printf("\t\tw open for write\n"); + (void) printf("usage: %s [options] special\n", progname); + (void) printf("options:\n"); + (void) printf("\t-o Specify ufs filesystem sepcific " + "options\n"); + (void) printf(" Available suboptions are:\n"); + (void) printf("\t\t? display usage\n"); + (void) printf("\t\to override some error conditions\n"); + (void) printf("\t\tp=\"string\" set prompt to string\n"); + (void) printf("\t\tw open for write\n"); exit(1); } @@ -1886,7 +1908,7 @@ ungetachar(char c) ungetachar(char c) { if (input_pointer == 0) { - printf("internal problem maintaining input buffer\n"); + (void) printf("internal problem maintaining input buffer\n"); error++; return; } @@ -1908,7 +1930,7 @@ getnextinput() newline: i = 0; - printf("%s", prompt); + (void) printf("%s", prompt); ignore_eol: while ((c = getc(stdin)) != '\n' && !(c == '!' && i == 0) && !feof(stdin) && i <= INPUTBUFFER - 2) @@ -1918,7 +1940,7 @@ ignore_eol: goto ignore_eol; } if (feof(stdin)) { - printf("\n"); + (void) printf("\n"); exit(0); } if (c == '!') { @@ -1929,11 +1951,11 @@ ignore_eol: } while ((rpid = wait(&retcode)) != pid && rpid != -1) ; - printf("!\n"); + (void) printf("!\n"); goto newline; } if (c != '\n') - printf("input truncated to 128 characters\n"); + (void) printf("input truncated to 128 characters\n"); input_buffer[i] = '\n'; input_pointer = 0; } @@ -2027,7 +2049,7 @@ expr() case '%': temp = term(); if (!temp) { - printf("divide by zero\n"); + (void) printf("divide by zero\n"); error++; return (~0); } @@ -2041,7 +2063,7 @@ expr() default: ungetachar(c); if (paren && !error) { - printf("missing ')'\n"); + (void) printf("missing ')'\n"); error++; } return (numb); @@ -2159,9 +2181,9 @@ find() if (!error) { print_path(input_path, (int)input_pathp); if (nfiles == 0) - printf(" not found\n"); + (void) printf(" not found\n"); else - printf(" ambiguous\n"); + (void) printf(" ambiguous\n"); error++; return; } @@ -2174,14 +2196,14 @@ find() return; if ((mode & IFMT) != IFDIR) { print_path(input_path, (int)input_pathp); - printf(" not a directory\n"); + (void) printf(" not a directory\n"); error++; return; } eat_spaces(); if ((c = getachar()) != '-') { restore_inode((ino_t)temp); - printf("missing '-'\n"); + (void) printf("missing '-'\n"); error++; return; } @@ -2203,7 +2225,7 @@ find() find_by_inode = 1; } else { restore_inode((ino_t)temp); - printf("use -name or -inum with find\n"); + (void) printf("use -name or -inum with find\n"); error++; return; } @@ -2217,10 +2239,10 @@ find() for (fn = filenames; fn <= top; fn++) { if (fn->find == 0) continue; - printf("i#: "); + (void) printf("i#: "); print(fn->ino, 12, -8, 0); print_path(fn->fname, (int)fn->len); - printf("\n"); + (void) printf("\n"); } restore_inode((ino_t)temp); } @@ -2254,9 +2276,9 @@ ls(struct filenames *fn0, struct filenam ls(fn0, fnn, level + 1); else { if (fn0 != filenames) - printf("\n"); + (void) printf("\n"); print_path(fn0->fname, (int)(fn0->len - 1)); - printf(":\n"); + (void) printf(":\n"); if (fn0->len == 0) cmp_level = level; else @@ -2301,16 +2323,17 @@ formatf(struct filenames *fn0, struct fi for (j = 0; j < columns; j++) { fn = fn0 + j * lines + i; if (long_list) { - printf("i#: "); + (void) printf("i#: "); print(fn->ino, 12, -8, 0); } if ((cp = fmtentry(fn)) == NULL) { - printf("cannot read inode %ld\n", fn->ino); + (void) printf("cannot read inode %ld\n", + fn->ino); return; } - printf("%s", cp); + (void) printf("%s", cp); if (fn + lines > fnlast) { - printf("\n"); + (void) printf("\n"); break; } w = strlen(cp); @@ -2484,14 +2507,14 @@ follow_path(long level, long inum) strcmp(dirp->d_name, "..") == 0))) goto duplicate; if (++top - filenames >= maxfiles) { - printf("too many files\n"); + (void) printf("too many files\n"); error++; return; } top->fname = (char **)calloc(FIRST_DEPTH, sizeof (char **)); top->flag = 0; if (top->fname == 0) { - printf("out of memory\n"); + (void) printf("out of memory\n"); error++; return; } @@ -2510,7 +2533,7 @@ follow_path(long level, long inum) if (top->len + 1 >= FIRST_DEPTH && top->flag == 0) { ccptr = (char **)calloc(SECOND_DEPTH, sizeof (char **)); if (ccptr == 0) { - printf("out of memory\n"); + (void) printf("out of memory\n"); error++; return; } @@ -2521,7 +2544,8 @@ follow_path(long level, long inum) top->flag = 1; } if (top->len >= SECOND_DEPTH) { - printf("maximum depth exceeded, try to cd lower\n"); + (void) printf("maximum depth exceeded, try to cd " + "lower\n"); error++; return; } @@ -2531,7 +2555,7 @@ follow_path(long level, long inum) for (i = 0; i <= stack_pathp; i++) { top->fname[i] = calloc(1, strlen(stack_path[i])+1); if (top->fname[i] == 0) { - printf("out of memory\n"); + (void) printf("out of memory\n"); error++; return; } @@ -2576,7 +2600,7 @@ follow_path(long level, long inum) top->fname[top->len] = calloc(1, strlen(&dirp->d_name[0])+1); if (top->fname[top->len] == 0) { - printf("out of memory\n"); + (void) printf("out of memory\n"); error++; return; } @@ -2637,8 +2661,8 @@ duplicate: sizeof (char **)); fnnn->flag = 1; } else { - printf("maximum depth exceeded, "); - printf("try to cd lower\n"); + (void) printf("maximum depth exceeded, "); + (void) printf("try to cd lower\n"); error++; return; } @@ -2680,8 +2704,8 @@ clear: c = getachar(); if (c == '\\') { if ((int)strlen(input_path[input_pathp]) + 1 >= MAXNAMLEN) { - printf("maximum name length exceeded, "); - printf("truncating\n"); + (void) printf("maximum name length exceeded, "); + (void) printf("truncating\n"); return; } input_path[input_pathp][strlen(input_path[input_pathp])] = c; @@ -2695,15 +2719,15 @@ clear: } if (!doing_find && c == '/') { if (++input_pathp >= MAXPATHLEN) { - printf("maximum path length exceeded, "); - printf("truncating\n"); + (void) printf("maximum path length exceeded, "); + (void) printf("truncating\n"); input_pathp--; return; } goto clear; } if ((int)strlen(input_path[input_pathp]) >= MAXNAMLEN) { - printf("maximum name length exceeded, truncating\n"); + (void) printf("maximum name length exceeded, truncating\n"); return; } input_path[input_pathp][strlen(input_path[input_pathp])] = c; @@ -2751,13 +2775,13 @@ compare(char *s1, char *s2, short at_sta s1++; if (*s2 >= *s1++) { if (*s1++ != '-') { - printf("missing '-'\n"); + (void) printf("missing '-'\n"); error++; return (0); } if (*s2 <= *s1++) { if (*s1++ != ']') { - printf("missing ']'"); + (void) printf("missing ']'"); error++; return (0); } @@ -2802,11 +2826,11 @@ print_path(char *p[], int pntr) { int i; - printf("/"); + (void) printf("/"); if (pntr >= 0) { for (i = 0; i < pntr; i++) - printf("%s/", p[i]); - printf("%s", p[pntr]); + (void) printf("%s/", p[i]); + (void) printf("%s", p[pntr]); } } @@ -2824,7 +2848,7 @@ fill() u_offset_t taddr; if (wrtflag == O_RDONLY) { - printf("not opened for write '-w'\n"); + (void) printf("not opened for write '-w'\n"); error++; return; } @@ -2871,10 +2895,10 @@ fill() cur_bytes += (tcount - 1) * objsz; put((u_offset_t)temp, objsz); if (eof) { - printf("end of file\n"); + (void) printf("end of file\n"); error++; } else if (end) { - printf("end of block\n"); + (void) printf("end of block\n"); error++; } } @@ -2927,17 +2951,17 @@ cgrp_check(long cgrp) { if (cgrp < 0) { if (objsz == CGRP) - printf("beginning of cylinder groups\n"); + (void) printf("beginning of cylinder groups\n"); else - printf("beginning of super blocks\n"); + (void) printf("beginning of super blocks\n"); error++; return (0); } if (cgrp >= fs->fs_ncg) { if (objsz == CGRP) - printf("end of cylinder groups\n"); + (void) printf("end of cylinder groups\n"); else - printf("end of super blocks\n"); + (void) printf("end of super blocks\n"); error++; return (0); } @@ -2965,7 +2989,7 @@ icheck(u_offset_t address) ip = (struct dinode *)cptr; if ((ip->di_mode & IFMT) == 0) { if (!override) { - printf("inode not allocated\n"); + (void) printf("inode not allocated\n"); error++; return (0); } @@ -3012,7 +3036,7 @@ getdirslot(long slot) if (blocksize > filesize) { if (cur_bytes + (long)dirp->d_reclen >= filesize) { - printf("end of file\n"); + (void) printf("end of file\n"); erraddr = addr; errcur_bytes = cur_bytes; stringsize = STRINGSIZE(dirp); @@ -3022,7 +3046,7 @@ getdirslot(long slot) } else { if (cur_bytes + (long)dirp->d_reclen >= blocksize) { - printf("end of %s\n", string); + (void) printf("end of %s\n", string); erraddr = addr; errcur_bytes = cur_bytes; stringsize = STRINGSIZE(dirp); @@ -3036,9 +3060,9 @@ getdirslot(long slot) } if (bod) { if (blocksize > filesize) - printf("beginning of file\n"); + (void) printf("beginning of file\n"); else - printf("beginning of %s\n", string); + (void) printf("beginning of %s\n", string); erraddr = addr; errcur_bytes = cur_bytes; error++; @@ -3050,7 +3074,7 @@ getdirslot(long slot) if ((mode = icheck(addr)) == 0) return (0); if (!override && (mode & IFDIR) == 0) { - printf("inode is not a directory\n"); + (void) printf("inode is not a directory\n"); error++; return (0); } @@ -3071,7 +3095,7 @@ getdirslot(long slot) if (!temp--) break; if (cur_bytes + (long)dirp->d_reclen >= filesize) { - printf("end of file\n"); + (void) printf("end of file\n"); dirslot = slot - temp - 1; objsz = DIRECTORY; erraddr = addr; @@ -3087,7 +3111,7 @@ getdirslot(long slot) dirslot = slot; objsz = DIRECTORY; if (bod) { - printf("beginning of file\n"); + (void) printf("beginning of file\n"); erraddr = addr; errcur_bytes = cur_bytes; error++; @@ -3114,7 +3138,7 @@ getshadowslot(long shadow) } if (type != SHADOW_DATA) { if (shadow < cur_shad) { - printf("can't scan shadow data in reverse\n"); + (void) printf("can't scan shadow data in reverse\n"); error++; return (0); } @@ -3123,7 +3147,7 @@ getshadowslot(long shadow) if ((mode = icheck(addr)) == 0) return (0); if (!override && (mode & IFMT) != IFSHAD) { - printf("inode is not a shadow\n"); + (void) printf("inode is not a shadow\n"); error++; return (0); } @@ -3140,7 +3164,7 @@ getshadowslot(long shadow) cur_bytes = tcurbytes; if (cur_bytes + (long)fsd.fsd_size > filesize) { syncshadowscan(0); - printf("end of file\n"); + (void) printf("end of file\n"); erraddr = addr; errcur_bytes = cur_bytes; error++; @@ -3153,7 +3177,7 @@ getshadowslot(long shadow) if (type == SHADOW_DATA) objsz = SHADOW_DATA; if (bod) { - printf("beginning of file\n"); + (void) printf("beginning of file\n"); erraddr = addr; errcur_bytes = cur_bytes; error++; @@ -3204,26 +3228,26 @@ putf(char c) { if (c <= 037 || c >= 0177 || c == '\\') { - printf("\\"); + (void) printf("\\"); switch (c) { case '\\': - printf("\\"); + (void) printf("\\"); break; case '\t': - printf("t"); + (void) printf("t"); break; case '\n': - printf("n"); + (void) printf("n"); break; case '\0': - printf("0"); + (void) printf("0"); break; default: - printf("?"); + (void) printf("?"); } } else { - printf("%c", c); - printf(" "); + (void) printf("%c", c); + (void) printf(" "); } } @@ -3242,7 +3266,7 @@ put(u_offset_t item, short lngth) long olditem; if (wrtflag == O_RDONLY) { - printf("not opened for write '-w'\n"); + (void) printf("not opened for write '-w'\n"); error++; return; } @@ -3277,22 +3301,22 @@ put(u_offset_t item, short lngth) } if ((s_err = llseek(fd, (offset_t)(addr & fs->fs_bmask), 0)) == -1) { error++; - printf("seek error : %" PRIx64 "\n", addr); + (void) printf("seek error : %" PRIx64 "\n", addr); return; } if ((nbytes = write(fd, sbptr, BLKSIZE)) != BLKSIZE) { error++; - printf("write error : addr = %" PRIx64 "\n", addr); - printf(" : s_err = %lx\n", s_err); - printf(" : nbytes = %lx\n", nbytes); + (void) printf("write error : addr = %" PRIx64 "\n", addr); + (void) printf(" : s_err = %lx\n", s_err); + (void) printf(" : nbytes = %lx\n", nbytes); return; } if (!acting_on_inode && objsz != INODE && objsz != DIRECTORY) { index(base); print(olditem, 8, -8, 0); - printf("\t=\t"); + (void) printf("\t=\t"); print(item, 8, -8, 0); - printf("\n"); + (void) printf("\n"); } else { if (objsz == DIRECTORY) { addr = cur_dir; @@ -3327,7 +3351,7 @@ getblk(u_offset_t address) read_requests++; block = lblkno(fs, address); if (block >= fragstoblks(fs, fs->fs_size)) { - printf("cannot read block %lu\n", block); + (void) printf("cannot read block %lu\n", block); error++; return (0); } @@ -3340,14 +3364,14 @@ getblk(u_offset_t address) bp->valid = 0; if ((s_err = llseek(fd, (offset_t)(address & fs->fs_bmask), 0)) == -1) { error++; - printf("seek error : %" PRIx64 "\n", address); + (void) printf("seek error : %" PRIx64 "\n", address); return (0); } if ((nbytes = read(fd, bp->blkaddr, BLKSIZE)) != BLKSIZE) { error++; - printf("read error : addr = %" PRIx64 "\n", address); - printf(" : s_err = %lx\n", s_err); - printf(" : nbytes = %lx\n", nbytes); + (void) printf("read error : addr = %" PRIx64 "\n", address); + (void) printf(" : s_err = %lx\n", s_err); + (void) printf(" : nbytes = %lx\n", nbytes); return (0); } bp->valid++; @@ -3394,7 +3418,7 @@ err() cur_bytes = errcur_bytes; error = 0; c_count = 0; - printf("\n?\n"); + (void) printf("\n?\n"); (void) fseek(stdin, 0L, 2); longjmp(env, 0); } @@ -3415,7 +3439,7 @@ devcheck(short md) return (0); } - printf("not character or block device\n"); + (void) printf("not character or block device\n"); error++; return (1); } @@ -3430,7 +3454,7 @@ nullblk(long bn) { if (bn != 0) return (0); - printf("non existent block\n"); + (void) printf("non existent block\n"); error++; return (1); } @@ -3453,7 +3477,7 @@ puta() long tcount = 0, item, olditem = 0; if (wrtflag == O_RDONLY) { - printf("not opened for write '-w'\n"); + (void) printf("not opened for write '-w'\n"); error++; return; } @@ -3471,7 +3495,7 @@ puta() maxchars = min(blocksize - cur_bytes, filesize - cur_bytes); while ((c = getachar()) != '"') { if (tcount >= maxchars) { - printf("string too long\n"); + (void) printf("string too long\n"); if (objsz == DIRECTORY) addr = cur_dir; else if (acting_on_inode || objsz == INODE) @@ -3515,14 +3539,14 @@ puta() *cptr++ = '\0'; if ((s_err = llseek(fd, (offset_t)(addr & fs->fs_bmask), 0)) == -1) { error++; - printf("seek error : %" PRIx64 "\n", addr); + (void) printf("seek error : %" PRIx64 "\n", addr); return; } if ((nbytes = write(fd, sbptr, BLKSIZE)) != BLKSIZE) { error++; - printf("write error : addr = %" PRIx64 "\n", addr); - printf(" : s_err = %lx\n", s_err); - printf(" : nbytes = %lx\n", nbytes); + (void) printf("write error : addr = %" PRIx64 "\n", addr); + (void) printf(" : s_err = %lx\n", s_err); + (void) printf(" : nbytes = %lx\n", nbytes); return; } if (!acting_on_inode && objsz != INODE && objsz != DIRECTORY) { @@ -3571,9 +3595,9 @@ puta() olditem &= 0377; } print(olditem, 8, -8, 0); - printf("\t=\t"); + (void) printf("\t=\t"); print(item, 8, -8, 0); - printf("\n"); + (void) printf("\n"); } else { if (objsz == DIRECTORY) { addr = cur_dir; @@ -3654,13 +3678,13 @@ fprnt(char style, char po) for (i = 0; tcount--; i++) { if (i % 16 == 0) { if (i) - printf("\n"); + (void) printf("\n"); index(base); } if (po == 'c') { putf(*cptr++); if ((i + 1) % 16) - printf(" "); + (void) printf(" "); } else { if ((i + 1) % 16 == 0) print(*cptr++ & 0377L, @@ -3672,20 +3696,20 @@ fprnt(char style, char po) addr += CHAR; cur_bytes += CHAR; } - printf("\n"); + (void) printf("\n"); } addr -= CHAR; erraddr = addr; cur_bytes -= CHAR; errcur_bytes = cur_bytes; if (eof) { - printf("end of file\n"); + (void) printf("end of file\n"); error++; } else if (end) { if (type == BLOCK) - printf("end of block\n"); + (void) printf("end of block\n"); else - printf("end of fragment\n"); + (void) printf("end of fragment\n"); error++; } return; @@ -3717,31 +3741,33 @@ otx: &tcount, tbase, i); switch (po) { case 'o': - printf("%06o ", *sptr++); + (void) printf("%06o ", *sptr++); break; case 'd': - printf("%05d ", *sptr++); + (void) printf("%05d ", + *sptr++); break; case 'x': - printf("%04x ", *sptr++); + (void) printf("%04x ", + *sptr++); } addr += SHORT; cur_bytes += SHORT; } - printf("\n"); + (void) printf("\n"); } addr -= SHORT; erraddr = addr; cur_bytes -= SHORT; errcur_bytes = cur_bytes; if (eof) { - printf("end of file\n"); + (void) printf("end of file\n"); error++; } else if (end) { if (type == BLOCK) - printf("end of block\n"); + (void) printf("end of block\n"); else - printf("end of fragment\n"); + (void) printf("end of fragment\n"); error++; } return; @@ -3771,38 +3797,41 @@ OTX: tbase, i); switch (po) { case 'O': - printf("%011lo ", *lptr++); + (void) printf("%011lo ", + *lptr++); break; case 'D': - printf("%010lu ", *lptr++); + (void) printf("%010lu ", + *lptr++); break; case 'X': - printf("%08lx ", *lptr++); + (void) printf("%08lx ", + *lptr++); } addr += LONG; cur_bytes += LONG; } - printf("\n"); + (void) printf("\n"); } addr -= LONG; erraddr = addr; cur_bytes -= LONG; errcur_bytes = cur_bytes; if (eof) { - printf("end of file\n"); + (void) printf("end of file\n"); error++; } else if (end) { if (type == BLOCK) - printf("end of block\n"); + (void) printf("end of block\n"); else - printf("end of fragment\n"); + (void) printf("end of fragment\n"); error++; } return; default: error++; - printf("no such print option\n"); + (void) printf("no such print option\n"); return; } } else @@ -3842,8 +3871,9 @@ OTX: } } if (! override && !cg_chkmagic(cg)) { - printf("invalid cylinder group "); - printf("magic word\n"); + (void) printf( + "invalid cylinder group "); + (void) printf("magic word\n"); if (cur_cgrp) cur_cgrp--; error++; @@ -3851,11 +3881,11 @@ OTX: } printcg(cg); if (tcount) - printf("\n"); + (void) printf("\n"); } cur_cgrp--; if (end) { - printf("end of cylinder groups\n"); + (void) printf("end of cylinder groups\n"); error++; } return; @@ -3865,8 +3895,10 @@ OTX: return; if (type == NUMB) { if (fragoff(fs, addr)) { - printf("address must be at the "); - printf("beginning of a fragment\n"); + (void) printf( + "address must be at the "); + (void) printf( + "beginning of a fragment\n"); error++; return; } @@ -3884,12 +3916,12 @@ OTX: /*LINTED*/ dirp = (struct direct *)cptr; tinode = dirp->d_ino; - printf("i#: "); + (void) printf("i#: "); if (tinode == 0) - printf("free\t"); + (void) printf("free\t"); else print(tinode, 12, -8, 0); - printf("%s\n", &dirp->d_name[0]); + (void) printf("%s\n", &dirp->d_name[0]); erraddr = addr; errcur_bytes = cur_bytes; addr += dirp->d_reclen; @@ -3905,13 +3937,13 @@ OTX: if (tcount >= 0 && !star) { switch (type) { case FRAGMENT: - printf("end of fragment\n"); + (void) printf("end of fragment\n"); break; case BLOCK: - printf("end of block\n"); + (void) printf("end of block\n"); break; default: - printf("end of directory\n"); + (void) printf("end of directory\n"); } error++; } else @@ -3974,27 +4006,27 @@ OTX: goto empty; } - printf("i#: "); + (void) printf("i#: "); print(temp, 12, -8, 0); - printf(" md: "); - printf("%c", c); + (void) printf(" md: "); + (void) printf("%c", c); for (mode = mode << 4; *++p; mode = mode << 1) { if (mode & IFREG) - printf("%c", *p); + (void) printf("%c", *p); else - printf("-"); - } - printf(" uid: "); + (void) printf("-"); + } + (void) printf(" uid: "); print(ip->di_uid, 8, -4, 0); - printf(" gid: "); + (void) printf(" gid: "); print(ip->di_gid, 8, -4, 0); - printf("\n"); - printf("ln: "); + (void) printf("\n"); + (void) printf("ln: "); print((long)ip->di_nlink, 8, -4, 0); - printf(" bs: "); + (void) printf(" bs: "); print(ip->di_blocks, 12, -8, 0); - printf(" sz : "); - printf("c_flags : "); + (void) printf(" sz : "); + (void) printf("c_flags : "); print(ip->di_cflags, 12, -8, 0); #ifdef _LARGEFILE64_SOURCE printll(ip->di_size, 20, -16, 0); @@ -4002,24 +4034,24 @@ OTX: print(ip->di_size, 12, -8, 0); #endif /* _LARGEFILE64_SOURCE */ if (ip->di_shadow) { - printf(" si: "); + (void) printf(" si: "); print(ip->di_shadow, 12, -8, 0); } - printf("\n"); + (void) printf("\n"); if (ip->di_oeftflag) { - printf("ai: "); + (void) printf("ai: "); print(ip->di_oeftflag, 12, -8, 0); - printf("\n"); - } - printf("\n"); + (void) printf("\n"); + } + (void) printf("\n"); switch (ip->di_mode & IFMT) { case IFBLK: case IFCHR: - printf("maj: "); + (void) printf("maj: "); print(major(ip->di_ordev), 4, -2, 0); - printf(" min: "); + (void) printf(" min: "); print(minor(ip->di_ordev), 4, -2, 0); - printf("\n"); + (void) printf("\n"); break; default: /* @@ -4030,17 +4062,17 @@ OTX: for (i = 0; i < NDADDR; ) { if (ip->di_size <= curoff) break; - printf("db#%x: ", i); + (void) printf("db#%x: ", i); print(ip->di_db[i], 11, -8, 0); if (++i % 4 == 0) - printf("\n"); + (void) printf("\n"); else - printf(" "); + (void) printf(" "); curoff += fs->fs_bsize; } if (i % 4) - printf("\n"); + (void) printf("\n"); /* * curioff keeps track of the number @@ -4054,36 +4086,39 @@ OTX: for (i = 0; i < NIADDR; i++) { if (ip->di_size <= curoff) break; - printf("ib#%x: ", i); + (void) printf("ib#%x: ", i); print(ip->di_ib[i], 11, -8, 0); - printf(" "); + (void) printf(" "); curoff += curioff; curioff *= (fs->fs_bsize / sizeof (daddr_t)); } if (i) - printf("\n"); + (void) printf("\n"); break; } if (count == 1) { time_t t; t = ip->di_atime; - printf("\taccessed: %s", ctime(&t)); + (void) printf("\taccessed: %s", + ctime(&t)); t = ip->di_mtime; - printf("\tmodified: %s", ctime(&t)); + (void) printf("\tmodified: %s", + ctime(&t)); t = ip->di_ctime; - printf("\tcreated : %s", ctime(&t)); + (void) printf("\tcreated : %s", + ctime(&t)); } if (tcount) - printf("\n"); + (void) printf("\n"); empty: if (c == '?' && !override) { - printf("i#: "); + (void) printf("i#: "); print(temp, 12, -8, 0); - printf(" is unallocated\n"); + (void) printf(" is unallocated\n"); if (count != 1) - printf("\n"); + (void) printf("\n"); } cur_ino = erraddr = addr; errcur_bytes = cur_bytes; @@ -4094,7 +4129,7 @@ empty: cur_bytes = errcur_bytes; cur_inum--; if (end) { - printf("end of block\n"); + (void) printf("end of block\n"); error++; } return; @@ -4147,8 +4182,9 @@ empty: (sb->fs_magic != MTB_UFS_MAGIC)) { cur_cgrp = 0; if (!override) { - printf("invalid super block "); - printf("magic word\n"); + (void) printf( + "invalid super block "); + (void) printf("magic word\n"); cur_cgrp--; error++; return; @@ -4180,20 +4216,21 @@ empty: } } if (cur_cgrp == 0) - printf("\tsuper block:\n"); + (void) printf("\tsuper block:\n"); else { - printf("\tsuper block in cylinder "); - printf("group "); + (void) printf( + "\tsuper block in cylinder "); + (void) printf("group "); print(cur_cgrp - 1, 0, 0, 0); - printf(":\n"); + (void) printf(":\n"); } printsb(sb); if (tcount) - printf("\n"); + (void) printf("\n"); } cur_cgrp--; if (end) { - printf("end of super blocks\n"); + (void) printf("end of super blocks\n"); error++; } return; @@ -4213,7 +4250,6 @@ empty: (cur_bytes + SHADOW_DATA) <= filesize && (type != SHADOW_DATA || (cur_bytes + SHADOW_DATA)) <= blocksize) { - /*LINTED*/ struct ufs_fsd fsd; long tcur_bytes; @@ -4221,9 +4257,9 @@ empty: tcur_bytes = cur_bytes; index(base); getshadowdata((long *)&fsd, LONG + LONG); - printf(" type: "); + (void) printf(" type: "); print((long)fsd.fsd_type, 8, -8, 0); - printf(" size: "); + (void) printf(" size: "); print((long)fsd.fsd_size, 8, -8, 0); tbase = fsd.fsd_size - LONG - LONG; if (tbase > 256) @@ -4231,17 +4267,18 @@ empty: for (i = 0; i < tbase; i++) { if (i % LONG == 0) { if (i % 16 == 0) { - printf("\n"); + (void) printf("\n"); index(base); } else - printf(" "); + (void) printf(" "); getshadowdata(&temp, LONG); p = (char *)&temp; } else - printf(" "); - printf("%02x", (int)(*p++ & 0377L)); - } - printf("\n"); + (void) printf(" "); + (void) printf("%02x", + (int)(*p++ & 0377L)); + } + (void) printf("\n"); addr = taddr; cur_bytes = tcur_bytes; erraddr = addr; @@ -4257,10 +4294,10 @@ empty: if (tcount >= 0 && !star) { switch (type) { case FRAGMENT: - printf("end of fragment\n"); + (void) printf("end of fragment\n"); break; default: - printf("end of shadow data\n"); + (void) printf("end of shadow data\n"); } error++; } else @@ -4268,7 +4305,7 @@ empty: return; default: error++; - printf("no such print option\n"); + (void) printf("no such print option\n"); return; } } @@ -4287,12 +4324,12 @@ valid_addr() if (cur_bytes < 0) { cur_bytes = 0; if (blocksize > filesize) { - printf("beginning of file\n"); + (void) printf("beginning of file\n"); } else { if (type == BLOCK) - printf("beginning of block\n"); + (void) printf("beginning of block\n"); else - printf("beginning of fragment\n"); + (void) printf("beginning of fragment\n"); } error++; return (0); @@ -4301,25 +4338,25 @@ valid_addr() (void) check_addr(1, &end, &eof, (filesize < blocksize)); count = tcount; if (eof) { - printf("end of file\n"); + (void) printf("end of file\n"); error++; return (0); } if (end == 2) { if (erraddr > addr) { if (type == BLOCK) - printf("beginning of block\n"); + (void) printf("beginning of block\n"); else - printf("beginning of fragment\n"); + (void) printf("beginning of fragment\n"); error++; return (0); } } if (end) { if (type == BLOCK) - printf("end of block\n"); + (void) printf("end of block\n"); else - printf("end of fragment\n"); + (void) printf("end of fragment\n"); error++; return (0); } @@ -4447,16 +4484,16 @@ print_check(unsigned long *lptr, long *t cur_bytes += BYTESPERLINE; } if (first_time) - printf("*"); + (void) printf("*"); else - printf("\n*"); + (void) printf("\n*"); } if (i) - printf("\n"); + (void) printf("\n"); index(tbase); } else { if (i) - printf("\n"); + (void) printf("\n"); index(tbase); } } @@ -4478,7 +4515,7 @@ index(int b) base = b; print(addr, 8, 8, 1); - printf(":\t"); + (void) printf(":\t"); base = tbase; } @@ -4533,9 +4570,9 @@ print(long value, int fieldsz, int digit #endif /* _LARGEFILE64_SOURCE */ "%c", digits, mode); } - printf(string, value); + (void) printf(string, value); for (i = 0; i < fieldsz - digits; i++) - printf(" "); + (void) printf(" "); } /* @@ -4633,19 +4670,19 @@ printsb(struct fs *fs) for (i = 0; i < NRPOS; i++) { if (fs->fs_postbl[c][i] == -1) continue; - printf("\n position %d:\t", i); + (void) printf("\n position %d:\t", i); for (j = fs->fs_postbl[c][i], k = 1; /* void */; j += fs->fs_rotbl[j], k++) { - printf("%5d", j); + (void) printf("%5d", j); if (k % 12 == 0) - printf("\n\t\t"); + (void) printf("\n\t\t"); if (fs->fs_rotbl[j] == 0) break; } } #endif } - printf("\ncs[].cs_(nbfree, ndir, nifree, nffree):"); + (void) printf("\ncs[].cs_(nbfree, ndir, nifree, nffree):"); sip = calloc(1, fs->fs_cssize); fs->fs_u.fs_csp = (struct csum *)sip; for (i = 0, j = 0; i < fs->fs_cssize; i += fs->fs_bsize, j++) { @@ -4663,16 +4700,16 @@ printsb(struct fs *fs) for (i = 0; i < fs->fs_ncg; i++) { struct csum *cs = &fs->fs_cs(fs, i); if (i % 4 == 0) - printf("\n "); - printf("%d:(%ld,%ld,%ld,%ld) ", i, cs->cs_nbfree, cs->cs_ndir, - cs->cs_nifree, cs->cs_nffree); + (void) printf("\n "); + (void) printf("%d:(%d,%d,%d,%d) ", i, cs->cs_nbfree, + cs->cs_ndir, cs->cs_nifree, cs->cs_nffree); } free(fs->fs_u.fs_csp); - printf("\n"); + (void) printf("\n"); if (fs->fs_ncyl % fs->fs_cpg) { - printf("cylinders in last group %d\n", + (void) printf("cylinders in last group %d\n", i = fs->fs_ncyl % fs->fs_cpg); - printf("blocks in last group %ld\n", + (void) printf("blocks in last group %d\n", i * fs->fs_spc / NSPB(fs)); } } @@ -4686,42 +4723,42 @@ printcg(struct cg *cg) int i, j; time_t t; - printf("\ncg %ld:\n", cg->cg_cgx); + (void) printf("\ncg %d:\n", cg->cg_cgx); t = cg->cg_time; #ifdef FS_42POSTBLFMT - printf("magic\t%lx\ttell\t%llx\ttime\t%s", + (void) printf("magic\t%x\ttell\t%llx\ttime\t%s", fs->fs_postblformat == FS_42POSTBLFMT ? ((struct ocg *)cg)->cg_magic : cg->cg_magic, fsbtodb(fs, cgtod(fs, cg->cg_cgx)) * fs->fs_fsize / fsbtodb(fs, 1), ctime(&t)); #else - printf("magic\t%x\ttell\t%llx\ttime\t%s", + (void) printf("magic\t%x\ttell\t%llx\ttime\t%s", cg->cg_magic, fsbtodb(fs, cgtod(fs, cg->cg_cgx)) * fs->fs_fsize / fsbtodb(fs, 1), ctime(&t)); #endif - printf("cgx\t%ld\tncyl\t%d\tniblk\t%d\tndblk\t%ld\n", + (void) printf("cgx\t%d\tncyl\t%d\tniblk\t%d\tndblk\t%d\n", cg->cg_cgx, cg->cg_ncyl, cg->cg_niblk, cg->cg_ndblk); - printf("nbfree\t%ld\tndir\t%ld\tnifree\t%ld\tnffree\t%ld\n", + (void) printf("nbfree\t%d\tndir\t%d\tnifree\t%d\tnffree\t%d\n", cg->cg_cs.cs_nbfree, cg->cg_cs.cs_ndir, cg->cg_cs.cs_nifree, cg->cg_cs.cs_nffree); - printf("rotor\t%ld\tirotor\t%ld\tfrotor\t%ld\nfrsum", + (void) printf("rotor\t%d\tirotor\t%d\tfrotor\t%d\nfrsum", cg->cg_rotor, cg->cg_irotor, cg->cg_frotor); for (i = 1, j = 0; i < fs->fs_frag; i++) { - printf("\t%ld", cg->cg_frsum[i]); + (void) printf("\t%d", cg->cg_frsum[i]); j += i * cg->cg_frsum[i]; } - printf("\nsum of frsum: %d\niused:\t", j); + (void) printf("\nsum of frsum: %d\niused:\t", j); pbits((unsigned char *)cg_inosused(cg), fs->fs_ipg); - printf("free:\t"); + (void) printf("free:\t"); pbits(cg_blksfree(cg), fs->fs_fpg); - printf("b:\n"); + (void) printf("b:\n"); for (i = 0; i < fs->fs_cpg; i++) { /*LINTED*/ if (cg_blktot(cg)[i] == 0) continue; /*LINTED*/ - printf(" c%d:\t(%ld)\t", i, cg_blktot(cg)[i]); + (void) printf(" c%d:\t(%d)\t", i, cg_blktot(cg)[i]); #ifdef FS_42POSTBLFMT for (j = 0; j < fs->fs_nrpos; j++) { if (fs->fs_cpc == 0 || @@ -4729,17 +4766,17 @@ printcg(struct cg *cg) fs_postbl(fs, i % fs->fs_cpc)[j] == -1) continue; /*LINTED*/ - printf(" %d", cg_blks(fs, cg, i)[j]); + (void) printf(" %d", cg_blks(fs, cg, i)[j]); } #else for (j = 0; j < NRPOS; j++) { if (fs->fs_cpc == 0 || fs->fs_postbl[i % fs->fs_cpc][j] == -1) continue; - printf(" %d", cg->cg_b[i][j]); + (void) printf(" %d", cg->cg_b[i][j]); } #endif - printf("\n"); + (void) printf("\n"); } } @@ -4755,16 +4792,16 @@ pbits(unsigned char *cp, int max) for (i = 0; i < max; i++) if (isset(cp, i)) { if (count) - printf(",%s", count % 6 ? " " : "\n\t"); + (void) printf(",%s", count % 6 ? " " : "\n\t"); count++; - printf("%d", i); + (void) printf("%d", i); j = i; while ((i+1) < max && isset(cp, i+1)) i++; if (i != j) - printf("-%d", i); - } - printf("\n"); + (void) printf("-%d", i); + } + (void) printf("\n"); } /* @@ -4820,7 +4857,7 @@ bmap(long bn) bn -= sh; } if (j == 0) { - printf("file too big\n"); + (void) printf("file too big\n"); error++; return (0L); } @@ -4870,26 +4907,26 @@ old_fsdb(int inum, char *special) f = open(special, 2); if (f < 0) { perror("open"); - printf("cannot open %s\n", special); + (void) printf("cannot open %s\n", special); exit(31+4); } (void) llseek(f, (offset_t)SBLOCK * DEV_BSIZE, 0); if (read(f, &sblock, SBSIZE) != SBSIZE) { - printf("cannot read %s\n", special); + (void) printf("cannot read %s\n", special); exit(31+4); } if (sblock.fs_magic != FS_MAGIC) { - printf("bad super block magic number\n"); + (void) printf("bad super block magic number\n"); exit(31+4); } if (inum == 0) { - printf("%d: is zero\n", inum); + (void) printf("%d: is zero\n", inum); exit(31+1); } off = (u_offset_t)fsbtodb(&sblock, itod(&sblock, inum)) * DEV_BSIZE; (void) llseek(f, off, 0); if (read(f, (char *)di_buf, sblock.fs_bsize) != sblock.fs_bsize) { - printf("%s: read error\n", special); + (void) printf("%s: read error\n", special); status = 1; } if (status) @@ -4902,20 +4939,20 @@ old_fsdb(int inum, char *special) (void) time(&t); sblock.fs_time = (time32_t)t; if (write(f, &sblock, SBSIZE) != SBSIZE) { - printf("cannot update %s\n", special); + (void) printf("cannot update %s\n", special); exit(35); } - printf("clearing %u\n", inum); + (void) printf("clearing %u\n", inum); off = (u_offset_t)fsbtodb(&sblock, itod(&sblock, inum)) * DEV_BSIZE; (void) llseek(f, off, 0); - read(f, (char *)di_buf, sblock.fs_bsize); + (void) read(f, (char *)di_buf, sblock.fs_bsize); j = itoo(&sblock, inum); gen = di_buf[j].di_gen; (void) memset((caddr_t)&di_buf[j], 0, ISIZE); di_buf[j].di_gen = gen + 1; (void) llseek(f, off, 0); - write(f, (char *)di_buf, sblock.fs_bsize); + (void) write(f, (char *)di_buf, sblock.fs_bsize); exit(31+status); } @@ -4972,7 +5009,8 @@ log_get_header_info(void) * Either logging is disabled or we've not running 2.7. */ if (fs->fs_logbno == 0) { - printf("Logging doesn't appear to be enabled on this disk\n"); + (void) printf( + "Logging doesn't appear to be enabled on this disk\n"); return (0); } @@ -4983,7 +5021,8 @@ log_get_header_info(void) */ if ((b = getblk((u_offset_t)ldbtob(logbtodb(fs, fs->fs_logbno)))) == 0) { - printf("getblk() indicates an error with logging block\n"); + (void) printf( + "getblk() indicates an error with logging block\n"); return (0); } @@ -4996,7 +5035,7 @@ log_get_header_info(void) */ log_eb = (extent_block_t *)b; if (log_eb->type != LUFS_EXTENTS) { - printf("Extents block has invalid type (0x%x)\n", + (void) printf("Extents block has invalid type (0x%x)\n", log_eb->type); return (0); } @@ -5005,10 +5044,11 @@ log_get_header_info(void) log_eb = (extent_block_t *)malloc(nb); if (log_eb == NULL) { - printf("Failed to allocate memory for extent block log\n"); + (void) printf( + "Failed to allocate memory for extent block log\n"); return (0); } - memcpy(log_eb, b, nb); + (void) memcpy(log_eb, b, nb); if (log_eb->nextbno != 0) /* @@ -5016,7 +5056,8 @@ log_get_header_info(void) * implemented. If someone starts using this sucker we'd * better warn somebody. */ - printf("WARNING: extent block field nextbno is non-zero!\n"); + (void) printf( + "WARNING: extent block field nextbno is non-zero!\n"); /* * Now read in the on disk log structure. This is always in the @@ -5027,10 +5068,11 @@ log_get_header_info(void) if (log_odi == NULL) { free(log_eb); log_eb = NULL; - printf("Failed to allocate memory for ondisk structure\n"); + (void) printf( + "Failed to allocate memory for ondisk structure\n"); return (0); } - memcpy(log_odi, b, sizeof (ml_odunit_t)); + (void) memcpy(log_odi, b, sizeof (ml_odunit_t)); /* * Consistency checks. @@ -5070,10 +5112,6 @@ log_display_header(void) log_eb->nextents, log_eb->nbytes); printf("\tNext Block : 0x%x\n\tExtent List\n\t--------\n", log_eb->nextbno); - for (x = 0; x < log_eb->nextents; x++) - printf("\t [%d] lbno 0x%08x pbno 0x%08x nbno 0x%08x\n", - x, log_eb->extents[x].lbno, log_eb->extents[x].pbno, - log_eb->extents[x].nbno); for (x = 0; x < log_eb->nextents; x++) printf("\t [%d] lbno 0x%08x pbno 0x%08x nbno 0x%08x\n", x, log_eb->extents[x].lbno, log_eb->extents[x].pbno, @@ -5140,7 +5178,7 @@ log_read_log(u_offset_t *addr, caddr_t v while (nb) { if (!log_lodb(*addr, &pblk)) { - printf("Invalid log offset\n"); + (void) printf("Invalid log offset\n"); return (0); } @@ -5152,7 +5190,7 @@ log_read_log(u_offset_t *addr, caddr_t v xfer = MIN(NB_LEFT_IN_SECTOR(*addr), nb); if (va != NULL) { - memcpy(va, bp + blkoff(fs, *addr), xfer); + (void) memcpy(va, bp + blkoff(fs, *addr), xfer); va += xfer; } nb -= xfer; @@ -5167,7 +5205,7 @@ log_read_log(u_offset_t *addr, caddr_t v st = (sect_trailer_t *) (bp + blkoff(fs, *addr)); if (*chk != st->st_ident) { - printf( + (void) printf( "Expected sector trailer id 0x%08x, but saw 0x%08x\n", *chk, st->st_ident); return (0); @@ -5239,11 +5277,11 @@ log_show(enum log_enum l) if (bol == eol) { if ((l == LOG_ALLDELTAS) || (l == LOG_CHECKSCAN)) { - printf("Empty log.\n"); + (void) printf("Empty log.\n"); return; } else - printf("WARNING: empty log. addr may generate bogus" - " information"); + (void) printf("WARNING: empty log. addr may generate " + "bogus information"); } /* @@ -5254,8 +5292,9 @@ log_show(enum log_enum l) addr = (u_offset_t)bol; if (l != LOG_CHECKSCAN) { - printf(" Log Offset Delta Count Type\n"); - printf("-----------------------------------------" + (void) printf( + " Log Offset Delta Count Type\n"); + (void) printf("-----------------------------------------" "-----------------\n"); } @@ -5273,12 +5312,12 @@ log_show(enum log_enum l) goto end_scan; if ((uint32_t)d.d_nb > log_odi->od_logsize) { - printf("Bad delta entry. size out of bounds\n"); + (void) printf("Bad delta entry. size out of bounds\n"); return; } if (l != LOG_CHECKSCAN) - printf("[%04d] %08x %08x.%08x %08x %s\n", x++, bol, - d.d_mof, d.d_nb, + (void) printf("[%04d] %08x %08llx.%08x %s\n", x++, + bol, d.d_mof, d.d_nb, dt_str[d.d_typ >= DT_MAX ? DT_MAX : d.d_typ]); switch (d.d_typ) { @@ -5314,11 +5353,13 @@ end_scan: end_scan: if (lufs_tid_valid == True) { if (lufs_tid == log_odi->od_head_tid) - printf("scan -- okay\n"); + (void) printf("scan -- okay\n"); else - printf("scan -- some transactions have been lost\n"); + (void) printf( + "scan -- some transactions have been lost\n"); } else { - printf("scan -- failed to find a single valid transaction\n"); - printf(" (possibly due to an empty log)\n"); - } -} + (void) printf( + "scan -- failed to find a single valid transaction\n"); + (void) printf(" (possibly due to an empty log)\n"); + } +}