All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Jones <drjones@redhat.com>
Subject: Re: [kvm-unit-tests PATCH] s390x: unify header guards
Date: Wed, 02 Jun 2021 08:59:36 +0200	[thread overview]
Message-ID: <87h7igrbtz.fsf@redhat.com> (raw)
In-Reply-To: <d87b32d6-1d41-1413-96c6-0d6b2361b079@redhat.com>

Thomas Huth <thuth@redhat.com> writes:

> On 01/06/2021 18.15, Cornelia Huck wrote:
>> Let's unify the header guards to _ASM_S390X_FILE_H_ respectively
>> _S390X_FILE_H_. This makes it more obvious what the file is
>> about, and avoids possible name space collisions.
>> 
>> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
>> ---
>> 
>> Only did s390x for now; the other archs seem to be inconsistent in
>> places as well, and I can also try to tackle them if it makes sense.
> ...
>> diff --git a/lib/s390x/asm/bitops.h b/lib/s390x/asm/bitops.h
>> index 792881ec3249..61cd38fd36b7 100644
>> --- a/lib/s390x/asm/bitops.h
>> +++ b/lib/s390x/asm/bitops.h
>> @@ -8,8 +8,8 @@
>>    *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
>>    *
>>    */
>> -#ifndef _ASMS390X_BITOPS_H_
>> -#define _ASMS390X_BITOPS_H_
>> +#ifndef _ASM_S390X_BITOPS_H_
>> +#define _ASM_S390X_BITOPS_H_
>
> Why not the other way round (S390X_ASM_BITOPS_H) ?

Most existing guards were this way around, I don't really have a
preference here, we should just agree on one format :)

>
>  > diff --git a/s390x/sthyi.h b/s390x/sthyi.h
>  > index bbd74c6197c3..eb92fdd2f2b2 100644
>  > --- a/s390x/sthyi.h
>  > +++ b/s390x/sthyi.h
>  > @@ -7,8 +7,8 @@
>  >   * Authors:
>  >   *    Janosch Frank <frankja@linux.vnet.ibm.com>
>  >   */
>  > -#ifndef _STHYI_H_
>  > -#define _STHYI_H_
>  > +#ifndef _S390X_STHYI_H_
>  > +#define _S390X_STHYI_H_
>
> While we're at it: Do we also want to drop the leading (and trailing) 
> underscores here? ... since leading underscore followed by a capital letter 
> is a reserved namespace in C and you should normally not use these in nice 
> programs...? I think I'm ok with keeping the underscores in the files in the 
> lib folder (since these are our core libraries, similar to the system and 
> libc headers on a normal system), but in files that are not part of the lib 
> folder, we should rather avoid them.

Hm, I actually ended up _adding_ some underscores in various places... I
can certainly drop them for !lib.

What about the following structure:

- in lib/<arch>/asm/: _ARCH_ASM_FILE_H_
- in lib/<arch>/: _ARCH_FILE_H_
- in lib/linux/: _LINUX_FILE_H_
- in lib/: _FILE_H_
(lib/libfdt is imported code, leave untouched)
- in <arch>/: ARCH_FILE_H


      parent reply	other threads:[~2021-06-02  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 16:15 [kvm-unit-tests PATCH] s390x: unify header guards Cornelia Huck
2021-06-01 16:25 ` Claudio Imbrenda
2021-06-01 16:55   ` Cornelia Huck
2021-06-02  3:56 ` Thomas Huth
2021-06-02  6:49   ` Janosch Frank
2021-06-02  6:59   ` Cornelia Huck [this message]

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=87h7igrbtz.fsf@redhat.com \
    --to=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.