summaryrefslogtreecommitdiff
path: root/ufs-fsck
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
commitfcd4d641b9f4ccea6fc0cd13fd2146e44f4bb31b (patch)
tree2c110219fee028d6f52406a9a3b367e1594b012b /ufs-fsck
parent5f1ad1678c6f0afdaf2dff224e5096b60be4650a (diff)
Formerly utilities.c.~2~
Diffstat (limited to 'ufs-fsck')
-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);
+}
+