svn commit: r365971 - stable/12/sbin/newfs
Kirk McKusick
mckusick at FreeBSD.org
Mon Sep 21 19:25:42 UTC 2020
Author: mckusick
Date: Mon Sep 21 19:25:41 2020
New Revision: 365971
URL: https://svnweb.freebsd.org/changeset/base/365971
Log:
MFC of 365700
Switch to more appropriate libufs interfaces in newfs.
Sponsored by: Netflix
Modified:
stable/12/sbin/newfs/mkfs.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sbin/newfs/mkfs.c
==============================================================================
--- stable/12/sbin/newfs/mkfs.c Mon Sep 21 19:03:17 2020 (r365970)
+++ stable/12/sbin/newfs/mkfs.c Mon Sep 21 19:25:41 2020 (r365971)
@@ -544,8 +544,8 @@ restart:
}
}
}
- if (!Nflag && sbput(disk.d_fd, &disk.d_fs, 0) != 0)
- err(1, "sbput: %s", disk.d_error);
+ if (!Nflag && sbwrite(&disk, 0) != 0)
+ err(1, "sbwrite: %s", disk.d_error);
if (Xflag == 1) {
printf("** Exiting on Xflag 1\n");
exit(0);
@@ -611,8 +611,8 @@ restart:
* Reference the summary information so it will also be written.
*/
sblock.fs_csp = fscs;
- if (sbput(disk.d_fd, &disk.d_fs, 0) != 0)
- err(1, "sbput: %s", disk.d_error);
+ if (sbwrite(&disk, 0) != 0)
+ err(1, "sbwrite: %s", disk.d_error);
/*
* For UFS1 filesystems with a blocksize of 64K, the first
* alternate superblock resides at the location used for
@@ -803,11 +803,11 @@ initcg(int cylno, time_t utime)
savedactualloc = sblock.fs_sblockactualloc;
sblock.fs_sblockactualloc =
dbtob(fsbtodb(&sblock, cgsblock(&sblock, cylno)));
- if (sbput(disk.d_fd, &disk.d_fs, 0) != 0)
- err(1, "sbput: %s", disk.d_error);
+ if (sbwrite(&disk, 0) != 0)
+ err(1, "sbwrite: %s", disk.d_error);
sblock.fs_sblockactualloc = savedactualloc;
- if (cgput(&disk, &acg) != 0)
- err(1, "initcg: cgput: %s", disk.d_error);
+ if (cgwrite(&disk) != 0)
+ err(1, "initcg: cgwrite: %s", disk.d_error);
start = 0;
dp1 = (struct ufs1_dinode *)(&iobuf[start]);
dp2 = (struct ufs2_dinode *)(&iobuf[start]);
@@ -1016,8 +1016,8 @@ goth:
for (i = frag; i < sblock.fs_frag; i++)
setbit(cg_blksfree(&acg), d + i);
}
- if (cgput(&disk, &acg) != 0)
- err(1, "alloc: cgput: %s", disk.d_error);
+ if (cgwrite(&disk) != 0)
+ err(1, "alloc: cgwrite: %s", disk.d_error);
return ((ufs2_daddr_t)d);
}
@@ -1037,8 +1037,8 @@ iput(union dinode *ip, ino_t ino)
}
acg.cg_cs.cs_nifree--;
setbit(cg_inosused(&acg), ino);
- if (cgput(&disk, &acg) != 0)
- err(1, "iput: cgput: %s", disk.d_error);
+ if (cgwrite(&disk) != 0)
+ err(1, "iput: cgwrite: %s", disk.d_error);
sblock.fs_cstotal.cs_nifree--;
fscs[0].cs_nifree--;
if (ino >= (unsigned long)sblock.fs_ipg * sblock.fs_ncg) {
More information about the svn-src-all
mailing list