public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Kyle McMartin <kyle@parisc-linux.org>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, parisc-linux@lists.parisc-linux.org
Subject: Re: [PATCH] Common compat_sys_sysinfo
Date: Sun, 7 Jan 2007 15:13:19 +0000	[thread overview]
Message-ID: <20070107151319.GA23478@infradead.org> (raw)
In-Reply-To: <20070107144850.GB3207@athena.road.mcmartin.ca>

On Sun, Jan 07, 2007 at 09:48:50AM -0500, Kyle McMartin wrote:
> While tracking a bug for Thibaut Varene, I noticed that almost all
> architectures implemented exactly the same sys32_sysinfo... except
> parisc, where a bug was to be found in handling of the uptime. So
> let's remove a whole whack of code for fun and profit. Cribbed
> compat_sys_sysinfo from x86_64's implementation, since I figured
> it would be the best tested.
> 
> This patch incorporates Arnd's suggestion of not using set_fs/get_fs,
> but instead extracting out the common code from sys_sysinfo.
> 
> Tested on a handful of architectures (ia64, parisc, x86_64.)

Looks generally good to me, but..

> +asmlinkage long
> +compat_sys_sysinfo(struct compat_sysinfo __user *info)
> +{
> +	extern int do_sysinfo(struct sysinfo *info);

Please always put prototypes for functions with external linkage in
header files.

> +int do_sysinfo(struct sysinfo *info)
>  {
> -	struct sysinfo val;
>  	unsigned long mem_total, sav_total;
>  	unsigned int mem_unit, bitcount;
>  	unsigned long seq;
>  
> -	memset((char *)&val, 0, sizeof(struct sysinfo));
> +	memset((char *)info, 0, sizeof(struct sysinfo));

No need for the cast here.


Btw, in case you have some spare time there are some other syscalls
that want similar treatment.  sendfile(64) come to mind as these
could use a do_sendfile helper aswell, the various stat and readdir/getdents
variants could do with some unification, the various timing calls
like alarm and get/settimeofday are common across architectures,
sysctl should be the same everywhere, the uid/git related syscalls
should be consolidated, sched_rr_get_interval looks trivial,
and last but not least we probably want a unified mechanisms to deal
with the 64bit arguments that are broken up into two 32bit ones (not just
for emulation but also for 32it BE architectures)

Okay, okay - we should probably put this into a Wiki somewhere :)

  reply	other threads:[~2007-01-07 15:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-07 14:48 [PATCH] Common compat_sys_sysinfo Kyle McMartin
2007-01-07 15:13 ` Christoph Hellwig [this message]
2007-01-07 15:18   ` Matthew Wilcox
2007-01-07 15:22   ` Kyle McMartin
2007-01-07 15:40     ` [PATCH] Common compat_sys_sysinfo (v2) Kyle McMartin
2007-01-07 23:43       ` Stephen Rothwell
2007-01-08  5:54         ` Arnd Bergmann
2007-01-08  7:29           ` Stephen Rothwell

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=20070107151319.GA23478@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@osdl.org \
    --cc=kyle@parisc-linux.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parisc-linux@lists.parisc-linux.org \
    /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