errseq: eliminate special limitation for macro MAX_ERRNO
authorZijun Hu <quic_zijuhu@quicinc.com>
Mon, 7 Apr 2025 11:44:16 +0000 (19:44 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:54:06 +0000 (17:54 -0700)
commit3eff6a3e574c2f704f9be1f4867c3d0b3d804435
treeab0878810d73192dcb7353e57d1794f2bba62359
parentae5b3500856fb9a565470d83033bb91786ec16f1
errseq: eliminate special limitation for macro MAX_ERRNO

Current errseq implementation depends on a very special precondition that
macro MAX_ERRNO must be (2^n - 1).

Eliminate the limitation by

- redefining macro ERRSEQ_SHIFT
- defining a new macro ERRNO_MASK instead of MAX_ERRNO for errno mask.

There is no plan to change the value of MAX_ERRNO, but this makes the
implementation more generic and eliminates the BUILD_BUG_ON().

Link: https://lkml.kernel.org/r/20250407-improve_errseq-v1-1-7b27cbeb8298@quicinc.com
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/errseq.c