sys/param.h: Add DEV_BSIZE and make use of it.

POSIX-2024 says:

> There is no correlation between values of the st_blocks and
> st_blksize, and the f_bsize (from <sys/statvfs.h>) structure members.

Some code in Haiku has mixed that up in the past (e.g. the write_overlay).
This will allow a constant to be used instead, clarifying what's happening.

POSIX-2024 does not actually require this constant, but it does say:

> Traditionally, some implementations defined the multiplier for
> st_blocks in <sys/param.h> as the symbol DEV_BSIZE.

And indeed, glibc, musl, and FreeBSD (at least) all define it.
So it seems to make sense for us to do the same.

Related to #19251.
This commit is contained in:
Augustin Cavalier
2026-01-20 14:43:37 -05:00
parent 79e95cdfc7
commit 999bb2e88a
16 changed files with 22 additions and 25 deletions
@@ -154,6 +154,10 @@
#define B_MIME_TYPE_LENGTH FSSH_B_MIME_TYPE_LENGTH
#define B_MAX_SYMLINKS FSSH_B_MAX_SYMLINKS
// Params
#define DEV_BSIZE FSSH_DEV_BSIZE
// Open Modes
#define B_READ_ONLY FSSH_B_READ_ONLY
#define B_WRITE_ONLY FSSH_B_WRITE_ONLY
+3
View File
@@ -24,6 +24,9 @@
#define FSSH_B_MIME_TYPE_LENGTH (FSSH_B_ATTR_NAME_LENGTH - 15)
#define FSSH_B_MAX_SYMLINKS 16
// Params
#define FSSH_DEV_BSIZE 512
// Open Modes
#define FSSH_B_READ_ONLY FSSH_O_RDONLY // read only
#define FSSH_B_WRITE_ONLY FSSH_O_WRONLY // write only