summaryrefslogtreecommitdiff
path: root/ufs-fsck/utilities.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-10-12 23:52:17 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-10-12 23:52:17 +0000
commitecc502cf679a74dae528934aad304b2c57681c84 (patch)
tree4d993f189f916e7f475f814f5623290f2bb3fc06 /ufs-fsck/utilities.c
parente3b907432e2c354bd482ce2bc4bfd0d99cfbfa17 (diff)
Formerly utilities.c.~2~
Diffstat (limited to 'ufs-fsck/utilities.c')
-rw-r--r--ufs-fsck/utilities.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/ufs-fsck/utilities.c b/ufs-fsck/utilities.c
index c4846445..aad3429b 100644
--- a/ufs-fsck/utilities.c
+++ b/ufs-fsck/utilities.c
@@ -38,4 +38,39 @@ writeblock (daddr_t addr, void *buf, size_t size)
errexit ("CANNOT SEEK TO BLOCK %d", addr);
if (write (writefd, buf, size) != size)
errexit ("CANNOT READ BLOCK %d", addr);
+ fsmodified = 1
}
+
+/* Read inode number INO into DINODE. */
+void
+getinode (ino_t ino, struct dinode *di)
+{
+ daddr_t iblk;
+ char buf[sblock->fs_fsize];
+
+ iblk = ino_to_fsba (sblock, ino);
+ readblock (fsbtodb (iblk), buf, sblock->fs_fsize);
+ bcopy (buf + ino_to_fsbo (sblock, ino), di, sizeof (struct dinode));
+}
+
+/* Write inode number INO from DINODE. */
+void
+write_inode (ino_t ino, struct dinode *di)
+{
+ daddr_t iblk;
+ char buf[sblock->fs_fsize];
+
+ iblk = ino_to_fsba (sblock, ino);
+ readblock (fsbtodb (iblk), buf, sblock->fs_fsize);
+ bcopy (di, buf + ino_to_fsbo (sblock, ino), sizeof (struct dinode));
+ writeblock (fsbtodb (iblk, buf, sblock->fs_fsize));
+}
+
+/* Clear inode number INO and zero DI. */
+void
+clear_inode (ino_t ino, struct dinode *di)
+{
+ bzero (di, sizeof (struct dinode));
+ write_inote (ino, di);
+}
+