git: 8e44312642d2 - stable/15 - libufs: Avoid using param.h constants in libufs.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 May 2026 14:09:00 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=8e44312642d227eda977582e2d61767ddb227991
commit 8e44312642d227eda977582e2d61767ddb227991
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-05-12 17:47:17 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-05-19 14:08:33 +0000
libufs: Avoid using param.h constants in libufs.h
MAXBSIZE is defined in param.h, which defines many other things. To
avoid forcing all consumers of libufs.h to include param.h, let's
instead redefine it and verify the definition in inode.c.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56859
(cherry picked from commit 271d25a066b59df1e2bb774990948c985382126a)
---
lib/libufs/inode.c | 3 +++
lib/libufs/libufs.h | 7 +++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/libufs/inode.c b/lib/libufs/inode.c
index 863e71867daa..bc4d99c66203 100644
--- a/lib/libufs/inode.c
+++ b/lib/libufs/inode.c
@@ -48,6 +48,9 @@
#include <libufs.h>
+_Static_assert(LIBUFS_MAXBSIZE >= MAXBSIZE,
+ "LIBUFS_MAXBSIZE must be at least MAXBSIZE");
+
int
getinode(struct uufsd *disk, union dinodep *dp, ino_t inum)
{
diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h
index bb92e082a875..b76d15b338b4 100644
--- a/lib/libufs/libufs.h
+++ b/lib/libufs/libufs.h
@@ -29,6 +29,7 @@
#ifndef __LIBUFS_H__
#define __LIBUFS_H__
+
#include <stdbool.h>
/*
@@ -38,6 +39,8 @@
*/
#define LIBUFS_BUFALIGN 128
+#define LIBUFS_MAXBSIZE 65536
+
/*
* userland ufs disk.
*/
@@ -48,11 +51,11 @@ struct uufsd {
} d_sbunion __aligned(LIBUFS_BUFALIGN);
union {
struct cg d_cg; /* cylinder group */
- char d_buf[MAXBSIZE]; /* cylinder group storage */
+ char d_buf[LIBUFS_MAXBSIZE]; /* cylinder group storage */
} d_cgunion __aligned(LIBUFS_BUFALIGN);
union {
union dinodep d_ino[1]; /* inode block */
- char d_inos[MAXBSIZE]; /* inode block as buffer */
+ char d_inos[LIBUFS_MAXBSIZE]; /* inode block as buffer */
} d_inosunion __aligned(LIBUFS_BUFALIGN);
const char *d_name; /* disk name */
const char *d_error; /* human readable disk error */