Patchwork CODING_STYLE: Reserve qemu_ prefix for library wrappers

login
register
mail settings
Submitter Avi Kivity
Date March 11, 2010, 2:48 p.m.
Message ID <1268318923-13397-1-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/47337/
State New
Headers show

Comments

Avi Kivity - March 11, 2010, 2:48 p.m.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 CODING_STYLE |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Anthony Liguori - March 11, 2010, 2:55 p.m.
On 03/11/2010 08:48 AM, Avi Kivity wrote:
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
>   CODING_STYLE |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>   Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>   QEMU coding style.
>
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>    

Acked-by: Anthony Liguori <aliguori@us.ibm.com>

But I'd like to also see others agree with this.

Regards,

Anthony Liguori

>   4. Block structure
>
>   Every indented statement is braced; even if the block contains just one
>
Markus Armbruster - March 11, 2010, 4:19 p.m.
Avi Kivity <avi@redhat.com> writes:

> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  CODING_STYLE |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>  QEMU coding style.
>  
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>  4. Block structure
>  
>  Every indented statement is braced; even if the block contains just one

ACK
Jamie Lokier - March 11, 2010, 11:08 p.m.
Anthony Liguori wrote:
> On 03/11/2010 08:48 AM, Avi Kivity wrote:
> >Signed-off-by: Avi Kivity<avi@redhat.com>
> >---
> >  CODING_STYLE |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> >diff --git a/CODING_STYLE b/CODING_STYLE
> >index a579cb1..92036f3 100644
> >--- a/CODING_STYLE
> >+++ b/CODING_STYLE
> >@@ -49,6 +49,9 @@ and is therefore likely to be changed.
> >  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
> >  QEMU coding style.
> >
> >+When wrapping standard library functions, use the prefix qemu_ to alert
> >+readers that they are seeing a wrapped version; otherwise avoid this 
> >prefix.
> >+
> >   
> 
> Acked-by: Anthony Liguori <aliguori@us.ibm.com>
> 
> But I'd like to also see others agree with this.

I agree - not that I've contributed any code, mind you, but I do read
bits of it from time to time.

However if qemu is ever made into a library used by other
applications, i.e. libqemu.a or libqemu.so, then you might decide
application-visible functions should have the prefix

-- Jamie
Juan Quintela - March 11, 2010, 11:21 p.m.
Avi Kivity <avi@redhat.com> wrote:
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  CODING_STYLE |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>  QEMU coding style.
>  
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>  4. Block structure
>  
>  Every indented statement is braced; even if the block contains just one

Acked-by: Juan Quintela
Aurelien Jarno - March 12, 2010, 7:58 a.m.
On Thu, Mar 11, 2010 at 04:48:43PM +0200, Avi Kivity wrote:
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  CODING_STYLE |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>  QEMU coding style.
>  
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>  4. Block structure
>  
>  Every indented statement is braced; even if the block contains just one

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Paul Brook - March 12, 2010, 11:28 a.m.
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this
>  prefix. +

I'm tempted to say "When wrapping or providing functionality that could easily 
be confused with standard library functions [...]".

I'm not going to argue either way though.

Paul
Blue Swirl - March 12, 2010, 6:47 p.m.
On 3/11/10, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 03/11/2010 08:48 AM, Avi Kivity wrote:
>
> > Signed-off-by: Avi Kivity<avi@redhat.com>
> > ---
> >  CODING_STYLE |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/CODING_STYLE b/CODING_STYLE
> > index a579cb1..92036f3 100644
> > --- a/CODING_STYLE
> > +++ b/CODING_STYLE
> > @@ -49,6 +49,9 @@ and is therefore likely to be changed.
> >  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
> >  QEMU coding style.
> >
> > +When wrapping standard library functions, use the prefix qemu_ to alert
> > +readers that they are seeing a wrapped version; otherwise avoid this
> prefix.
> > +
> >
> >
>
>  Acked-by: Anthony Liguori <aliguori@us.ibm.com>
>
>  But I'd like to also see others agree with this.

OK for me too.
Edgar Iglesias - March 13, 2010, 2:55 a.m.
On Thu, Mar 11, 2010 at 04:48:43PM +0200, Avi Kivity wrote:
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  CODING_STYLE |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>  Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>  QEMU coding style.
>  
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>  4. Block structure
>  
>  Every indented statement is braced; even if the block contains just one


Not sure what "standard library functions" includes but I think the
qemu prefix should be allowed whenever one needs to wrap external
code blocks into qemu.

I don't feel very strongly about this though. I can call my stuff
wrap_xxx if I need to :)

Cheers,
Edde
Avi Kivity - March 13, 2010, 8:17 a.m.
On 03/13/2010 04:55 AM, Edgar E. Iglesias wrote:
> On Thu, Mar 11, 2010 at 04:48:43PM +0200, Avi Kivity wrote:
>    
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>> ---
>>   CODING_STYLE |    3 +++
>>   1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/CODING_STYLE b/CODING_STYLE
>> index a579cb1..92036f3 100644
>> --- a/CODING_STYLE
>> +++ b/CODING_STYLE
>> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>>   Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>>   QEMU coding style.
>>
>> +When wrapping standard library functions, use the prefix qemu_ to alert
>> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
>> +
>>   4. Block structure
>>
>>   Every indented statement is braced; even if the block contains just one
>>      
>
> Not sure what "standard library functions" includes but I think the
> qemu prefix should be allowed whenever one needs to wrap external
> code blocks into qemu.
>
>    

That was the intent.

> I don't feel very strongly about this though. I can call my stuff
> wrap_xxx if I need to :)
>
>    

A downside of a formal coding style document is that people start 
lawyering about it.  Common sense can still be applied, if there is a 
use case that is similar to what is described, surely qemu_ can still hold.
Edgar Iglesias - March 13, 2010, 11:11 a.m.
On Sat, Mar 13, 2010 at 10:17:37AM +0200, Avi Kivity wrote:
> On 03/13/2010 04:55 AM, Edgar E. Iglesias wrote:
> > On Thu, Mar 11, 2010 at 04:48:43PM +0200, Avi Kivity wrote:
> >    
> >> Signed-off-by: Avi Kivity<avi@redhat.com>
> >> ---
> >>   CODING_STYLE |    3 +++
> >>   1 files changed, 3 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/CODING_STYLE b/CODING_STYLE
> >> index a579cb1..92036f3 100644
> >> --- a/CODING_STYLE
> >> +++ b/CODING_STYLE
> >> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
> >>   Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
> >>   QEMU coding style.
> >>
> >> +When wrapping standard library functions, use the prefix qemu_ to alert
> >> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> >> +
> >>   4. Block structure
> >>
> >>   Every indented statement is braced; even if the block contains just one
> >>      
> >
> > Not sure what "standard library functions" includes but I think the
> > qemu prefix should be allowed whenever one needs to wrap external
> > code blocks into qemu.
> >    
> 
> That was the intent.

Great

ACK
Anthony Liguori - March 22, 2010, 7:39 p.m.
On 03/11/2010 08:48 AM, Avi Kivity wrote:
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
>   CODING_STYLE |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/CODING_STYLE b/CODING_STYLE
> index a579cb1..92036f3 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -49,6 +49,9 @@ and is therefore likely to be changed.
>   Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
>   QEMU coding style.
>
> +When wrapping standard library functions, use the prefix qemu_ to alert
> +readers that they are seeing a wrapped version; otherwise avoid this prefix.
> +
>   4. Block structure
>
>   Every indented statement is braced; even if the block contains just one
>    

Applied.  Thanks.

Regards,

Anthony Liguori

Patch

diff --git a/CODING_STYLE b/CODING_STYLE
index a579cb1..92036f3 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -49,6 +49,9 @@  and is therefore likely to be changed.
 Typedefs are used to eliminate the redundant 'struct' keyword.  It is the
 QEMU coding style.
 
+When wrapping standard library functions, use the prefix qemu_ to alert
+readers that they are seeing a wrapped version; otherwise avoid this prefix.
+
 4. Block structure
 
 Every indented statement is braced; even if the block contains just one