aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2020-09-19 22:48:30 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2020-09-19 22:48:30 +0000
commit85ee267a3eb58f9aa1a73a1abcf033c5c460b324 (patch)
tree76560a561871fae0dc3150bedadc7fd8751ceb9c /sbin
parenta29c0348f0653c25adb65e340e6f5a7edc86b8a2 (diff)
downloadsrc-85ee267a3eb58f9aa1a73a1abcf033c5c460b324.tar.gz
src-85ee267a3eb58f9aa1a73a1abcf033c5c460b324.zip
Update the libufs cgget() and cgput() interfaces to have a similar
API to the sbget() and sbput() interfaces. Specifically they take a file descriptor pointer rather than the struct uufsd *disk pointer used by the libufs cgread() and cgwrite() interfaces. Update fsck_ffs to use these revised interfaces. No functional changes intended. Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=365919
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_ffs/fsutil.c5
-rw-r--r--sbin/fsck_ffs/gjournal.c4
-rw-r--r--sbin/fsck_ffs/suj.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index 98db9e2d50f5..94ea2cf792bf 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -217,6 +217,9 @@ bufinit(void)
/*
* Manage cylinder group buffers.
+ *
+ * Use getblk() here rather than cgget() because the cylinder group
+ * may be corrupted but we want it anyway so we can fix it.
*/
static struct bufarea *cgbufs; /* header for cylinder group cache */
static int flushtries; /* number of tries to reclaim memory */
@@ -370,7 +373,7 @@ flush(int fd, struct bufarea *bp)
fsmodified = 1;
break;
case BT_CYLGRP:
- if (cgput(&disk, bp->b_un.b_cg) == 0)
+ if (cgput(fswritefd, &sblock, bp->b_un.b_cg) == 0)
fsmodified = 1;
break;
default:
diff --git a/sbin/fsck_ffs/gjournal.c b/sbin/fsck_ffs/gjournal.c
index 88d5c0e6c668..6e3dbd2da41e 100644
--- a/sbin/fsck_ffs/gjournal.c
+++ b/sbin/fsck_ffs/gjournal.c
@@ -133,7 +133,7 @@ getcg(int cg)
if (cgc == NULL)
err(1, "malloc(%zu)", sizeof(*cgc));
}
- if (cgget(diskp, cg, &cgc->cgc_cg) == -1)
+ if (cgget(fsreadfd, fs, cg, &cgc->cgc_cg) == -1)
err(1, "cgget(%d)", cg);
cgc->cgc_busy = 0;
cgc->cgc_dirty = 0;
@@ -189,7 +189,7 @@ putcgs(void)
LIST_REMOVE(cgc, cgc_next);
ncgs--;
if (cgc->cgc_dirty) {
- if (cgput(diskp, &cgc->cgc_cg) == -1)
+ if (cgput(fswritefd, fs, &cgc->cgc_cg) == -1)
err(1, "cgput(%d)", cgc->cgc_cg.cg_cgx);
//printf("%s: Wrote cg=%d\n", __func__,
// cgc->cgc_cg.cg_cgx);
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index e1e3da19e195..8ecd1f686ea7 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -1912,7 +1912,7 @@ cg_write(struct suj_cg *sc)
* before writing the block.
*/
fs->fs_cs(fs, sc->sc_cgx) = cgp->cg_cs;
- if (cgput(&disk, cgp) == -1)
+ if (cgput(fswritefd, fs, cgp) == -1)
err_suj("Unable to write cylinder group %d\n", sc->sc_cgx);
}