public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Santos <danielfsantos@att.net>
To: David Howells <dhowells@redhat.com>
Cc: Daniel Santos <daniel.santos@pobox.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Marek <mmarek@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	George Spelvin <linux@horizon.com>
Subject: Re: [PATCH 1/5] scripts: Add mkstrerror.sh
Date: Wed, 18 Sep 2013 17:43:35 -0500	[thread overview]
Message-ID: <523A2C97.6090403@att.net> (raw)
In-Reply-To: <29168.1379504300@warthog.procyon.org.uk>

On 09/18/2013 06:38 AM, David Howells wrote:
> danielfsantos@att.net wrote:
>
>> This is a simple bash script that parses our errno*.h files and formats
>> them into the error_strings.h header that our strerror and strerror_name
>> functions will use later.
> I presume you haven't tried building with a "make O=foo" build directory?  I
> see:
>
>        /bin/sh: /data/fs/linux-2.6-fscache/include/generated/error_strings.h: No such file or directory
>
> when I try it.

No, indeed I haven't, thanks. I'm going to need help figuring out the 
correct way to put this in the build because the current definitely 
isn't correct.  From what I could tell from digging into the build last 
night (which I've never carefully analyzed), this should be added 
somewhere in one of the scripts/Makefile*s and not in the root makefile 
(as I have done), or maybe even in lib/Makefile.

>
>   (2) Storing the leading 'E' for each symbol is redundant as you can add that
>       later so you might want to discard it.

This is a good thought, that's 150-ish bytes, but it will introduce some 
new challenges.  Currently, strerror() functions exactly like "man 3p 
strerror", except that it returns a pointer to a const string like the 
POSIX specification should have done. :)  So I directly return a pointer 
to the string within the .rodata section of the object file (same for 
strerror_name).  Omitting the 'E' would require I work up another 
solution requiring a return buffer or some such, thus increasing 
complexity and possibly loosing that savings to code.

However, if we wanted to squeze that much more out of it, then we could 
7-th bit terminate the strings and save another 150-ish bytes on null 
terminators or go even further and use some encoding scheme (maybe 32 
bits per character)?  At 2k for both the error names and the code, I 
figured it was already pretty low, but if there are some existing 
libraries in the kernel we could use to do this and not further bloat 
the text size for decompression then I wouldn't be opposed, so long as 
it makes sense.  And since we're dealing with error conditions which 
don't happen often, speed shouldn't be a concern.

Thanks!
Daniel


  parent reply	other threads:[~2013-09-18 22:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 23:08 [PATCH 0/5] Preliminary: Add error names & descrptions to printks danielfsantos
2013-09-17 23:08 ` [PATCH 1/5] scripts: Add mkstrerror.sh danielfsantos
2013-09-18 11:38   ` David Howells
2013-09-18 11:55     ` David Howells
2013-09-18 22:27       ` Daniel Santos
2013-09-18 22:43     ` Daniel Santos [this message]
2013-09-19 22:35     ` Daniel Santos
2013-09-19 22:53       ` Daniel Santos
2013-09-17 23:08 ` [PATCH 2/5] lib: Add .config options for error strings in printks danielfsantos
2013-09-17 23:18   ` Daniel Santos
2013-09-17 23:08 ` [PATCH 3/5] Makefile: Generate error_strings.h danielfsantos
2013-09-17 23:08 ` [PATCH 4/5] lib: Add strerror and strerror_name functions danielfsantos
2013-09-17 23:08 ` [PATCH 5/5] lib: Add error string support to printks danielfsantos
2013-09-18  5:36   ` Joe Perches
2013-09-18 11:04     ` David Howells
2013-09-19  1:27       ` Daniel Santos
2013-09-20  1:07         ` Joe Perches
2013-09-20  5:21           ` Daniel Santos
2013-09-20 11:45             ` Joe Perches
2013-09-20 13:07               ` David Howells
2013-09-23 20:17                 ` Daniel Santos
2013-09-23 19:40               ` Daniel Santos
2013-09-18 11:08 ` [PATCH 0/5] Preliminary: Add error names & descrptions " David Howells
2013-09-18 22:47   ` Daniel Santos

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=523A2C97.6090403@att.net \
    --to=danielfsantos@att.net \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.santos@pobox.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=mmarek@suse.cz \
    --cc=mtk.manpages@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    /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