projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
delete unneeded headers
[unix-history]
/
usr
/
src
/
sbin
/
clri
/
clri.c
diff --git
a/usr/src/sbin/clri/clri.c
b/usr/src/sbin/clri/clri.c
index
883762b
..
2aee966
100644
(file)
--- a/
usr/src/sbin/clri/clri.c
+++ b/
usr/src/sbin/clri/clri.c
@@
-1,4
+1,4
@@
-static char sccsid[] = "@(#)clri.c 2.
1
%G%";
+static char sccsid[] = "@(#)clri.c 2.
6
%G%";
/* static char *sccsid = "@(#)clri.c 4.1 (Berkeley) 10/1/80"; */
/* static char *sccsid = "@(#)clri.c 4.1 (Berkeley) 10/1/80"; */
@@
-6,15
+6,9
@@
static char sccsid[] = "@(#)clri.c 2.1 %G%";
* clri filsys inumber ...
*/
* clri filsys inumber ...
*/
-#ifndef SIMFS
#include <sys/param.h>
#include <sys/param.h>
-#include <sys/inode.h>
-#include <sys/fs.h>
-#else
-#include "../h/param.h"
-#include "../h/inode.h"
-#include "../h/fs.h"
-#endif
+#include <ufs/dinode.h>
+#include <ufs/fs.h>
#define ISIZE (sizeof(struct dinode))
#define NI (MAXBSIZE/ISIZE)
#define ISIZE (sizeof(struct dinode))
#define NI (MAXBSIZE/ISIZE)
@@
-30,6
+24,7
@@
union {
#define sblock sb_un.sblk
int status;
#define sblock sb_un.sblk
int status;
+long dev_bsize = 1;
main(argc, argv)
int argc;
main(argc, argv)
int argc;
@@
-49,11
+44,16
@@
main(argc, argv)
printf("cannot open %s\n", argv[1]);
exit(4);
}
printf("cannot open %s\n", argv[1]);
exit(4);
}
- lseek(f, SB
LOCK * DEV_BSIZE
, 0);
+ lseek(f, SB
OFF
, 0);
if (read(f, &sblock, SBSIZE) != SBSIZE) {
printf("cannot read %s\n", argv[1]);
exit(4);
}
if (read(f, &sblock, SBSIZE) != SBSIZE) {
printf("cannot read %s\n", argv[1]);
exit(4);
}
+ if (sblock.fs_magic != FS_MAGIC) {
+ printf("bad super block magic number\n");
+ exit(4);
+ }
+ dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1);
for (i = 2; i < argc; i++) {
if (!isnumber(argv[i])) {
printf("%s: is not a number\n", argv[i]);
for (i = 2; i < argc; i++) {
if (!isnumber(argv[i])) {
printf("%s: is not a number\n", argv[i]);
@@
-66,7
+66,7
@@
main(argc, argv)
status = 1;
continue;
}
status = 1;
continue;
}
- off = fsbtodb(&sblock, itod(&sblock, n)) *
DEV_BSIZE
;
+ off = fsbtodb(&sblock, itod(&sblock, n)) *
dev_bsize
;
lseek(f, off, 0);
if (read(f, (char *)buf, sblock.fs_bsize) != sblock.fs_bsize) {
printf("%s: read error\n", argv[i]);
lseek(f, off, 0);
if (read(f, (char *)buf, sblock.fs_bsize) != sblock.fs_bsize) {
printf("%s: read error\n", argv[i]);
@@
-78,7
+78,7
@@
main(argc, argv)
for (i = 2; i < argc; i++) {
n = atoi(argv[i]);
printf("clearing %u\n", n);
for (i = 2; i < argc; i++) {
n = atoi(argv[i]);
printf("clearing %u\n", n);
- off = fsbtodb(&sblock, itod(&sblock, n)) *
DEV_BSIZE
;
+ off = fsbtodb(&sblock, itod(&sblock, n)) *
dev_bsize
;
lseek(f, off, 0);
read(f, (char *)buf, sblock.fs_bsize);
j = itoo(&sblock, n);
lseek(f, off, 0);
read(f, (char *)buf, sblock.fs_bsize);
j = itoo(&sblock, n);