main.c (31904) | main.c (34266) |
---|---|
1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; 43#endif 44static const char rcsid[] = |
45 "$Id$"; | 45 "$Id: main.c,v 1.12 1997/12/20 22:24:32 bde Exp $"; |
46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/time.h> 50#include <sys/mount.h> 51 52#include <ufs/ufs/dinode.h> 53#include <ufs/ufs/ufsmount.h> --- 151 unchanged lines hidden (view full) --- 205 sblock.fs_frag * sblock.fs_cstotal.cs_nbfree); 206 printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", 207 sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree, 208 sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize); 209 return (0); 210 } 211 212 /* | 46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/time.h> 50#include <sys/mount.h> 51 52#include <ufs/ufs/dinode.h> 53#include <ufs/ufs/ufsmount.h> --- 151 unchanged lines hidden (view full) --- 205 sblock.fs_frag * sblock.fs_cstotal.cs_nbfree); 206 printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", 207 sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree, 208 sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize); 209 return (0); 210 } 211 212 /* |
213 * Cleared if any questions answered no. Used to decide if 214 * the superblock should be marked clean. 215 */ 216 resolved = 1; 217 /* |
|
213 * 1: scan inodes tallying blocks used 214 */ 215 if (preen == 0) { 216 printf("** Last Mounted on %s\n", sblock.fs_fsmnt); 217 if (hotroot) 218 printf("** Root file system\n"); 219 printf("** Phase 1 - Check Blocks and Sizes\n"); 220 } 221 pass1(); 222 223 /* 224 * 1b: locate first references to duplicates, if any 225 */ 226 if (duplist) { | 218 * 1: scan inodes tallying blocks used 219 */ 220 if (preen == 0) { 221 printf("** Last Mounted on %s\n", sblock.fs_fsmnt); 222 if (hotroot) 223 printf("** Root file system\n"); 224 printf("** Phase 1 - Check Blocks and Sizes\n"); 225 } 226 pass1(); 227 228 /* 229 * 1b: locate first references to duplicates, if any 230 */ 231 if (duplist) { |
227 if (preen) | 232 if (preen || usedsoftdep) |
228 pfatal("INTERNAL ERROR: dups with -p"); 229 printf("** Phase 1b - Rescan For More DUPS\n"); 230 pass1b(); 231 } 232 233 /* 234 * 2: traverse directories from root to mark all connected directories 235 */ --- 65 unchanged lines hidden (view full) --- 301 if (cvtlevel && sblk.b_dirty) { 302 /* 303 * Write out the duplicate super blocks 304 */ 305 for (cylno = 0; cylno < sblock.fs_ncg; cylno++) 306 bwrite(fswritefd, (char *)&sblock, 307 fsbtodb(&sblock, cgsblock(&sblock, cylno)), SBSIZE); 308 } | 233 pfatal("INTERNAL ERROR: dups with -p"); 234 printf("** Phase 1b - Rescan For More DUPS\n"); 235 pass1b(); 236 } 237 238 /* 239 * 2: traverse directories from root to mark all connected directories 240 */ --- 65 unchanged lines hidden (view full) --- 306 if (cvtlevel && sblk.b_dirty) { 307 /* 308 * Write out the duplicate super blocks 309 */ 310 for (cylno = 0; cylno < sblock.fs_ncg; cylno++) 311 bwrite(fswritefd, (char *)&sblock, 312 fsbtodb(&sblock, cgsblock(&sblock, cylno)), SBSIZE); 313 } |
309 if (!hotroot) { 310 ckfini(1); 311 } else { | 314 if (rerun) 315 resolved = 0; 316 flags = 0; 317 if (hotroot) { |
312 struct statfs stfs_buf; 313 /* 314 * Check to see if root is mounted read-write. 315 */ 316 if (statfs("/", &stfs_buf) == 0) 317 flags = stfs_buf.f_flags; | 318 struct statfs stfs_buf; 319 /* 320 * Check to see if root is mounted read-write. 321 */ 322 if (statfs("/", &stfs_buf) == 0) 323 flags = stfs_buf.f_flags; |
318 else 319 flags = 0; 320 ckfini(flags & MNT_RDONLY); | 324 if ((flags & MNT_RDONLY) == 0) 325 resolved = 0; |
321 } | 326 } |
327 ckfini(resolved); |
|
322 free(blockmap); 323 free(statemap); 324 free((char *)lncntp); 325 if (!fsmodified) 326 return (0); 327 if (!preen) 328 printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); 329 if (rerun) --- 24 unchanged lines hidden --- | 328 free(blockmap); 329 free(statemap); 330 free((char *)lncntp); 331 if (!fsmodified) 332 return (0); 333 if (!preen) 334 printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); 335 if (rerun) --- 24 unchanged lines hidden --- |