All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Oleg Drokin <oleg.drokin@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between elements" checkpatch errors
Date: Thu, 15 Jun 2017 09:19:44 -0700	[thread overview]
Message-ID: <1497543584.14396.8.camel@perches.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1706151700220.11322@casper.infradead.org>

On Thu, 2017-06-15 at 17:03 +0100, James Simmons wrote:
> > On Wed, 2017-06-14 at 11:01 -0400, James Simmons wrote:
> > > Due to the way the DFID was embedded in our debug strings checkpatch
> > > would report the following error:
> > 
> > unrelated trivia
> > 
> > > diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
> > 
> > []
> > > @@ -532,7 +532,7 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)
> > >  #define FID_NOBRACE_LEN 40
> > >  #define FID_LEN (FID_NOBRACE_LEN + 2)
> > >  #define DFID_NOBRACE "%#llx:0x%x:0x%x"
> > 
> > It's odd to use a mixture of %#x and 0x%x.
> > 
> > Using
> > 	#define DFID_NOBRACE "%#llx:%#x:%#x"
> > would also save a couple bytes per use.
> 
> Changing that format would break things very badly. This is used in user 
> land utilities and the kernel code. 

Really?  Why would anything break?

$ cat fmt.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	printf("%#llx:0x%x:0x%x\n", (unsigned long long)1, 2, 3);
	printf("%#llx:%#x:%#x\n", (unsigned long long)1, 2, 3);
	return 0;
}

$ gcc fmt.c
$ ./a.out
0x1:0x2:0x3
0x1:0x2:0x3

WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Oleg Drokin <oleg.drokin@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between elements" checkpatch errors
Date: Thu, 15 Jun 2017 09:19:44 -0700	[thread overview]
Message-ID: <1497543584.14396.8.camel@perches.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1706151700220.11322@casper.infradead.org>

On Thu, 2017-06-15 at 17:03 +0100, James Simmons wrote:
> > On Wed, 2017-06-14 at 11:01 -0400, James Simmons wrote:
> > > Due to the way the DFID was embedded in our debug strings checkpatch
> > > would report the following error:
> > 
> > unrelated trivia
> > 
> > > diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
> > 
> > []
> > > @@ -532,7 +532,7 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)
> > >  #define FID_NOBRACE_LEN 40
> > >  #define FID_LEN (FID_NOBRACE_LEN + 2)
> > >  #define DFID_NOBRACE "%#llx:0x%x:0x%x"
> > 
> > It's odd to use a mixture of %#x and 0x%x.
> > 
> > Using
> > 	#define DFID_NOBRACE "%#llx:%#x:%#x"
> > would also save a couple bytes per use.
> 
> Changing that format would break things very badly. This is used in user 
> land utilities and the kernel code. 

Really?  Why would anything break?

$ cat fmt.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	printf("%#llx:0x%x:0x%x\n", (unsigned long long)1, 2, 3);
	printf("%#llx:%#x:%#x\n", (unsigned long long)1, 2, 3);
	return 0;
}

$ gcc fmt.c
$ ./a.out
0x1:0x2:0x3
0x1:0x2:0x3

  reply	other threads:[~2017-06-15 16:19 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 15:01 [lustre-devel] [PATCH 0/6] staging: lustre: lustre: assortment of checkpatch cleanups James Simmons
2017-06-14 15:01 ` James Simmons
2017-06-14 15:01 ` [lustre-devel] [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between elements" checkpatch errors James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 18:10   ` [lustre-devel] " Joe Perches
2017-06-14 18:10     ` Joe Perches
2017-06-15 16:03     ` [lustre-devel] " James Simmons
2017-06-15 16:03       ` James Simmons
2017-06-15 16:19       ` Joe Perches [this message]
2017-06-15 16:19         ` Joe Perches
2017-06-15 16:57         ` [lustre-devel] " James Simmons
2017-06-15 16:57           ` James Simmons
2017-06-15 17:04           ` [lustre-devel] " Joe Perches
2017-06-15 17:04             ` Joe Perches
2017-06-15 17:16             ` [lustre-devel] " James Simmons
2017-06-15 17:16               ` James Simmons
2017-06-14 15:01 ` [lustre-devel] [PATCH 2/6] staging: lustre: lustre: make all struct file_operations constant James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 15:01 ` [lustre-devel] [PATCH 3/6] staging: lustre: lustre: fix all bare unsigned usage James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 15:01 ` [lustre-devel] [PATCH 4/6] staging: lustre: lustre: add all missing indentifier names James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 15:01 ` [lustre-devel] [PATCH 5/6] staging: lustre: lustre: several over 80 characters cleanups James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 18:15   ` [lustre-devel] " Joe Perches
2017-06-14 18:15     ` Joe Perches
2017-06-15 16:06     ` [lustre-devel] " James Simmons
2017-06-15 16:06       ` James Simmons
2017-06-15 16:12       ` [lustre-devel] " Joe Perches
2017-06-15 16:12         ` Joe Perches
2017-06-23 16:12       ` [lustre-devel] " Greg Kroah-Hartman
2017-06-23 16:12         ` Greg Kroah-Hartman
2017-06-23 16:15   ` [lustre-devel] " Greg Kroah-Hartman
2017-06-23 16:15     ` Greg Kroah-Hartman
2017-06-14 15:01 ` [lustre-devel] [PATCH 6/6] staging: lustre: lustre: fix all braces issues reported by checkpatch James Simmons
2017-06-14 15:01   ` James Simmons
2017-06-14 18:25   ` [lustre-devel] " Joe Perches
2017-06-14 18:25     ` Joe Perches
2017-06-15 16:38     ` [lustre-devel] " James Simmons
2017-06-15 16:38       ` James Simmons
2017-06-15 16:58       ` [lustre-devel] " Joe Perches
2017-06-15 16:58         ` Joe Perches
2017-06-23 16:17   ` [lustre-devel] " Greg Kroah-Hartman
2017-06-23 16:17     ` Greg Kroah-Hartman

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=1497543584.14396.8.camel@perches.com \
    --to=joe@perches.com \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.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.