From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH, RFC] libxfs: check the size of on-disk data structures
Date: Thu, 30 Nov 2023 18:06:58 -0800 [thread overview]
Message-ID: <20231201020658.GU361584@frogsfrogsfrogs> (raw)
In-Reply-To: <20231110050846.GA24953@lst.de>
On Fri, Nov 10, 2023 at 06:08:46AM +0100, Christoph Hellwig wrote:
> On Thu, Nov 09, 2023 at 11:52:33AM -0800, Darrick J. Wong wrote:
> > > +#ifndef BUILD_BUG_ON_MSG
> > > +#define BUILD_BUG_ON_MSG(a, b) BUILD_BUG_ON(a)
> >
> > How difficult would it be to port the complex kernel macros that
> > actually result in the message being emitted in the gcc error output?
> >
> > It's helpful that when the kernel build breaks, the robots will report
> > exactly which field/struct/whatever tripped, which makes it easier to
> > start figuring out where things went wrong on some weird architecture.
>
> I did try to pull the entire compile time assert machinery from
> the kernels compiler_types.h in, especially as atomic.h already uses
> a differnet part of it. After it pulled in two more depdendencies
> I gave up, but in principle it should be entirely doable.
>
> > Otherwise I'm all for porting xfs_ondisk.h to xfsprogs. IIRC I tried
> > that a long time ago and Dave or someone said xfs/122 was the answer.
>
> I'd much prefer to do it in C code and inside the libxfs we build.
> If we can agree on that and on killing off xfs/122 I'll look into
> porting the more complex compile time assert.
>
> The other option would be to switch to using static_assert from C11,
> which doesn't allow a custom message, but at least the default message
> isn't confusing as hell.
I copy-pasta'd the whole mess from compiler_types.h and build_bug.h into
include/xfs.h. It works, but it might be kinda egregious though.
--D
next prev parent reply other threads:[~2023-12-01 2:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 16:33 [PATCH, RFC] libxfs: check the size of on-disk data structures Christoph Hellwig
2023-11-09 19:52 ` Darrick J. Wong
2023-11-10 5:08 ` Christoph Hellwig
2023-12-01 2:06 ` Darrick J. Wong [this message]
2023-12-04 4:37 ` Christoph Hellwig
2023-12-04 19:53 ` Darrick J. Wong
2023-12-04 20:04 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231201020658.GU361584@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox