diff mbox series

[v3,1/3] update-linux-headers: Include const.h

Message ID 20210104202057.48048-2-farman@linux.ibm.com
State New
Headers show
Series vfio-ccw: Implement request notifier | expand

Commit Message

Eric Farman Jan. 4, 2021, 8:20 p.m. UTC
Kernel commit a85cbe6159ff ("uapi: move constants from
<linux/kernel.h> to <linux/const.h>") breaks our script
because of the unrecognized include. Let's add that to
our processing.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 scripts/update-linux-headers.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Peter Xu Jan. 6, 2021, 7:03 p.m. UTC | #1
On Mon, Jan 04, 2021 at 09:20:55PM +0100, Eric Farman wrote:
> Kernel commit a85cbe6159ff ("uapi: move constants from
> <linux/kernel.h> to <linux/const.h>") breaks our script
> because of the unrecognized include. Let's add that to
> our processing.
> 
> Signed-off-by: Eric Farman <farman@linux.ibm.com>
> ---
>  scripts/update-linux-headers.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 9efbaf2f84..fa6f2b6272 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -41,6 +41,7 @@ cp_portable() {
>                                       -e 'pvrdma_verbs' \
>                                       -e 'drm.h' \
>                                       -e 'limits' \
> +                                     -e 'linux/const' \
>                                       -e 'linux/kernel' \
>                                       -e 'linux/sysinfo' \
>                                       -e 'asm-generic/kvm_para' \
> @@ -190,7 +191,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
>           "$tmpdir/include/linux/input.h" \
>           "$tmpdir/include/linux/input-event-codes.h" \
>           "$tmpdir/include/linux/pci_regs.h" \
> -         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
> +         "$tmpdir/include/linux/ethtool.h" \
> +         "$tmpdir/include/linux/const.h" \
> +         "$tmpdir/include/linux/kernel.h" \
>           "$tmpdir/include/linux/vhost_types.h" \
>           "$tmpdir/include/linux/sysinfo.h"; do
>      cp_portable "$i" "$output/include/standard-headers/linux"
> -- 
> 2.17.1

So I think I came to the same change when trying to update the headers. :)

Reviewed-by: Peter Xu <peterx@redhat.com>

Could I ask why the const.h is installed into include/standard-headers/linux
rather than linux-headers/linux?  When I was working on my version I failed to
figure out the difference.

One answer is ethtool.h is there which included const.h, but I guess that's not
the real one.

Thanks,
Philippe Mathieu-Daudé Jan. 7, 2021, 6:52 a.m. UTC | #2
On 1/4/21 9:20 PM, Eric Farman wrote:
> Kernel commit a85cbe6159ff ("uapi: move constants from
> <linux/kernel.h> to <linux/const.h>") breaks our script
> because of the unrecognized include. Let's add that to
> our processing.
> 
> Signed-off-by: Eric Farman <farman@linux.ibm.com>
> ---
>  scripts/update-linux-headers.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Eric Farman Jan. 7, 2021, 4:51 p.m. UTC | #3
On 1/6/21 2:03 PM, Peter Xu wrote:
> On Mon, Jan 04, 2021 at 09:20:55PM +0100, Eric Farman wrote:
>> Kernel commit a85cbe6159ff ("uapi: move constants from
>> <linux/kernel.h> to <linux/const.h>") breaks our script
>> because of the unrecognized include. Let's add that to
>> our processing.
>>
>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>> ---
>>   scripts/update-linux-headers.sh | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
>> index 9efbaf2f84..fa6f2b6272 100755
>> --- a/scripts/update-linux-headers.sh
>> +++ b/scripts/update-linux-headers.sh
>> @@ -41,6 +41,7 @@ cp_portable() {
>>                                        -e 'pvrdma_verbs' \
>>                                        -e 'drm.h' \
>>                                        -e 'limits' \
>> +                                     -e 'linux/const' \
>>                                        -e 'linux/kernel' \
>>                                        -e 'linux/sysinfo' \
>>                                        -e 'asm-generic/kvm_para' \
>> @@ -190,7 +191,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
>>            "$tmpdir/include/linux/input.h" \
>>            "$tmpdir/include/linux/input-event-codes.h" \
>>            "$tmpdir/include/linux/pci_regs.h" \
>> -         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
>> +         "$tmpdir/include/linux/ethtool.h" \
>> +         "$tmpdir/include/linux/const.h" \
>> +         "$tmpdir/include/linux/kernel.h" \
>>            "$tmpdir/include/linux/vhost_types.h" \
>>            "$tmpdir/include/linux/sysinfo.h"; do
>>       cp_portable "$i" "$output/include/standard-headers/linux"
>> -- 
>> 2.17.1
> 
> So I think I came to the same change when trying to update the headers. :)
> 
> Reviewed-by: Peter Xu <peterx@redhat.com>

Thank you!  :)

> 
> Could I ask why the const.h is installed into include/standard-headers/linux
> rather than linux-headers/linux?  When I was working on my version I failed to
> figure out the difference.

Considering the main difference is whether the header file is copied 
directly or edited with a bunch of substitutions, and const.h doesn't 
get modified by those substitutions, I suppose it could go in 
linux-headers itself. But I opted to just keep it near its friends 
(ethtool.h and kernel.h both include const.h, and end up including 
if_ether.h, sysinfo.h, and types.h) in include/standard-headers.

> 
> One answer is ethtool.h is there which included const.h, but I guess that's not
> the real one.
> 
> Thanks,
>
Peter Maydell Jan. 7, 2021, 5:05 p.m. UTC | #4
On Thu, 7 Jan 2021 at 16:52, Eric Farman <farman@linux.ibm.com> wrote:
> On 1/6/21 2:03 PM, Peter Xu wrote:
> > Could I ask why the const.h is installed into include/standard-headers/linux
> > rather than linux-headers/linux?  When I was working on my version I failed to
> > figure out the difference.
>
> Considering the main difference is whether the header file is copied
> directly or edited with a bunch of substitutions, and const.h doesn't
> get modified by those substitutions, I suppose it could go in
> linux-headers itself.

No, it can't, because linux-headers/ only goes on the include
path when on a Linux host and on a CPU architecture with KVM support,
whereas include/standard-headers/ headers are available and
used on all host OSes/architectures.

Because include/standard-headers/linux/ethtool.h will end up
with a line
 #include "standard-headers/linux/const.h"
we need to provide a const.h in that location so that the #include
pulls in the file correctly.

thanks
-- PMM
Eric Farman Jan. 7, 2021, 5:50 p.m. UTC | #5
On 1/7/21 12:05 PM, Peter Maydell wrote:
> On Thu, 7 Jan 2021 at 16:52, Eric Farman <farman@linux.ibm.com> wrote:
>> On 1/6/21 2:03 PM, Peter Xu wrote:
>>> Could I ask why the const.h is installed into include/standard-headers/linux
>>> rather than linux-headers/linux?  When I was working on my version I failed to
>>> figure out the difference.
>>
>> Considering the main difference is whether the header file is copied
>> directly or edited with a bunch of substitutions, and const.h doesn't
>> get modified by those substitutions, I suppose it could go in
>> linux-headers itself.
> 
> No, it can't, because linux-headers/ only goes on the include
> path when on a Linux host and on a CPU architecture with KVM support,
> whereas include/standard-headers/ headers are available and
> used on all host OSes/architectures.
> 
> Because include/standard-headers/linux/ethtool.h will end up
> with a line
>   #include "standard-headers/linux/const.h"
> we need to provide a const.h in that location so that the #include
> pulls in the file correctly.

Ah, today I learned.  Thanks, Peter.

  - Eric

> 
> thanks
> -- PMM
>
Peter Xu Jan. 7, 2021, 7:12 p.m. UTC | #6
On Thu, Jan 07, 2021 at 12:50:34PM -0500, Eric Farman wrote:
> 
> 
> On 1/7/21 12:05 PM, Peter Maydell wrote:
> > On Thu, 7 Jan 2021 at 16:52, Eric Farman <farman@linux.ibm.com> wrote:
> > > On 1/6/21 2:03 PM, Peter Xu wrote:
> > > > Could I ask why the const.h is installed into include/standard-headers/linux
> > > > rather than linux-headers/linux?  When I was working on my version I failed to
> > > > figure out the difference.
> > > 
> > > Considering the main difference is whether the header file is copied
> > > directly or edited with a bunch of substitutions, and const.h doesn't
> > > get modified by those substitutions, I suppose it could go in
> > > linux-headers itself.
> > 
> > No, it can't, because linux-headers/ only goes on the include
> > path when on a Linux host and on a CPU architecture with KVM support,
> > whereas include/standard-headers/ headers are available and
> > used on all host OSes/architectures.
> > 
> > Because include/standard-headers/linux/ethtool.h will end up
> > with a line
> >   #include "standard-headers/linux/const.h"
> > we need to provide a const.h in that location so that the #include
> > pulls in the file correctly.
> 
> Ah, today I learned.  Thanks, Peter.

Yeah.  Peter taught me the rules on IRC after I posted the email, and I didn't
update later.  So I guess my r-b stands. :) Thanks,
diff mbox series

Patch

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 9efbaf2f84..fa6f2b6272 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -41,6 +41,7 @@  cp_portable() {
                                      -e 'pvrdma_verbs' \
                                      -e 'drm.h' \
                                      -e 'limits' \
+                                     -e 'linux/const' \
                                      -e 'linux/kernel' \
                                      -e 'linux/sysinfo' \
                                      -e 'asm-generic/kvm_para' \
@@ -190,7 +191,9 @@  for i in "$tmpdir"/include/linux/*virtio*.h \
          "$tmpdir/include/linux/input.h" \
          "$tmpdir/include/linux/input-event-codes.h" \
          "$tmpdir/include/linux/pci_regs.h" \
-         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
+         "$tmpdir/include/linux/ethtool.h" \
+         "$tmpdir/include/linux/const.h" \
+         "$tmpdir/include/linux/kernel.h" \
          "$tmpdir/include/linux/vhost_types.h" \
          "$tmpdir/include/linux/sysinfo.h"; do
     cp_portable "$i" "$output/include/standard-headers/linux"