From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] libgfs2: Import gfs2_ondisk.h
Date: Tue, 9 Apr 2019 13:21:23 +0100 [thread overview]
Message-ID: <58b0f320-407b-bae0-d261-9182b3b5912c@redhat.com> (raw)
In-Reply-To: <e19c558c-76d0-4b7f-c7e9-7375e72c9ace@redhat.com>
Hi,
On 09/04/2019 13:18, Andrew Price wrote:
> On 09/04/2019 13:03, Christoph Hellwig wrote:
>> On Tue, Apr 09, 2019 at 10:41:53AM +0100, Andrew Price wrote:
>>> Give gfs2-utils its own copy of gfs2_ondisk.h which uses userspace
>>> types. This allows us to always support the latest ondisk structures
>>> and
>>> obsoletes a lot of #ifdef GFS2_HAS_<FEATURE> blocks and configure.ac
>>> checks.
>>>
>>> gfs2_ondisk.h was changed simply by search-and-replace of the kernel
>>> int
>>> types with the uintN_t, i.e.:
>>>
>>> :%s/__u\(8\|16\|32\|64\)/uint\1_t/g
>>> :%s/__be\(64\|32\|16\|8\)/uint\1_t/g
>>>
>>> and the linux/types.h include replaced with stdint.h
>>
>> Why?
>
> Because I'd like to be able to build gfs2-utils on FreeBSD one day.
> Plus we get the handy stuff in inttypes.h to use, Linux doesn't have
> that.
>
>> At least the be types give you really useful type checking with
>> sparse, which can be trivially wired up in userspace as well.
>
> If you mean the bitwise annotations that only sparse checks, we're
> fairly safe in gfs2-utils in that anything represented by a struct is
> going to have been parsed through one of the libgfs2/ondisk.c
> functions so will be the right endianness. I run sparse over this code
> very rarely anyway.
Those conversion functions are not sensible, thats why we got rid of
them from the kernel code. It is better to have a set of types that have
the endianess specified so that we can use sparse. Compile time checking
is always a good plan where it is possible.
>
>> Also
>> keeping the file 1:1 the same is going to make your life much easier
>> in the future..
>
> It's really no difficulty to run the above substitutions the next time
> the file changes, but gfs2_ondisk.h changes once in a blue moon anyway
> so the maintenance overhead is going to be tiny.
>
> Andy
>
Thats true, but lets keep the ability to do endianess checks,
Steve.
next prev parent reply other threads:[~2019-04-09 12:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 9:41 [Cluster-devel] [PATCH] libgfs2: Import gfs2_ondisk.h Andrew Price
2019-04-09 12:03 ` Christoph Hellwig
2019-04-09 12:18 ` Andrew Price
2019-04-09 12:21 ` Steven Whitehouse [this message]
2019-04-09 12:35 ` Christoph Hellwig
2019-11-08 9:50 ` Andrew Price
2019-04-09 12:48 ` Andrew Price
2019-04-09 13:03 ` Steven Whitehouse
2019-04-09 13:14 ` Andrew Price
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=58b0f320-407b-bae0-d261-9182b3b5912c@redhat.com \
--to=swhiteho@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).