From nobody Mon Nov 15 06:10:55 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 060AB185AE41; Mon, 15 Nov 2021 06:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HszMg6dg3z3Pmy; Mon, 15 Nov 2021 06:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C475D14A77; Mon, 15 Nov 2021 06:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AF6At9W078224; Mon, 15 Nov 2021 06:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AF6AtDu078208; Mon, 15 Nov 2021 06:10:55 GMT (envelope-from git) Date: Mon, 15 Nov 2021 06:10:55 GMT Message-Id: <202111150610.1AF6AtDu078208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: b366ee4868bc - main - Consolodate four copies of the STDSB define into a single place. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b366ee4868bca2b3ebe4bb29c9590a29b6cecc29 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=b366ee4868bca2b3ebe4bb29c9590a29b6cecc29 commit b366ee4868bca2b3ebe4bb29c9590a29b6cecc29 Author: Kirk McKusick AuthorDate: 2021-11-15 06:09:06 +0000 Commit: Kirk McKusick CommitDate: 2021-11-15 06:10:16 +0000 Consolodate four copies of the STDSB define into a single place. The STDSB macro is passed to the ffs_sbget() routine to fetch a UFS/FFS superblock "from the stadard place". It was identically defined in lib/libufs/libufs.h, stand/libsa/ufs.c, sys/ufs/ffs/ffs_extern.h, and sys/ufs/ffs/ffs_subr.c. Delete it from these four files and define it instead in sys/ufs/ffs/fs.h. All existing uses of this macro already include sys/ufs/ffs/fs.h so no include changes need to be made. No functional change intended. Sponsored by: Netflix --- lib/libufs/libufs.h | 6 ------ stand/libsa/ufs.c | 5 ----- sys/ufs/ffs/ffs_extern.h | 6 ------ sys/ufs/ffs/ffs_subr.c | 5 ----- sys/ufs/ffs/fs.h | 12 ++++++++++++ 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h index 8160fdcd68a9..63a8dc170997 100644 --- a/lib/libufs/libufs.h +++ b/lib/libufs/libufs.h @@ -117,12 +117,6 @@ int ffs_sbput(void *, struct fs *, off_t, void ffs_update_dinode_ckhash(struct fs *, struct ufs2_dinode *); int ffs_verify_dinode_ckhash(struct fs *, struct ufs2_dinode *); -/* - * Request standard superblock location in ffs_sbget - */ -#define STDSB -1 /* Fail if check-hash is bad */ -#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ - /* * block.c */ diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c index a4015dea74c2..31212bf3473a 100644 --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -154,11 +154,6 @@ static int ufs_use_sa_read(void *, off_t, void **, int); /* from ffs_subr.c */ int ffs_sbget(void *, struct fs **, off_t, char *, int (*)(void *, off_t, void **, int)); -/* - * Request standard superblock location in ffs_sbget - */ -#define STDSB -1 /* Fail if check-hash is bad */ -#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ /* * Read a new inode into a file structure. diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index c835239986ba..fdc08dc6aafb 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -137,12 +137,6 @@ int ffs_breadz(struct ufsmount *, struct vnode *, daddr_t, daddr_t, int, #define FFSR_FORCE 0x0001 #define FFSR_UNSUSPEND 0x0002 -/* - * Request standard superblock location in ffs_sbget - */ -#define STDSB -1 /* Fail if check-hash is bad */ -#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ - /* * Definitions for TRIM interface * diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 3e6cefa7be0c..60d90aac5bcc 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -50,11 +50,6 @@ uint32_t ffs_calc_sbhash(struct fs *); struct malloc_type; #define UFS_MALLOC(size, type, flags) malloc(size) #define UFS_FREE(ptr, type) free(ptr) -/* - * Request standard superblock location in ffs_sbget - */ -#define STDSB -1 /* Fail if check-hash is bad */ -#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ #else /* _KERNEL */ #include diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index df003c4282d9..00c153b9684d 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -77,6 +77,18 @@ #define SBLOCKSIZE 8192 #define SBLOCKSEARCH \ { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } +/* + * Request standard superblock location in ffs_sbget(). + * + * STDSB will fail if the superblock has a check hash and it is wrong. + * + * STDSB_NOHASHFAIL will note that the check hash is wrong but will + * still return the superblock. This is used by the bootstrap code + * to give the system a chance to come up so that fsck can be run + * to correct the problem. + */ +#define STDSB -1 /* Fail if check-hash is bad */ +#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ /* * Max number of fragments per block. This value is NOT tweakable.