public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "erich" <erich@areca.com.tw>
Cc: James.Bottomley@SteelEye.com, rdunlap@xenotime.net,
	hch@infradead.org, brong@fastmail.fm, dax@gurulabs.com,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	robm@fastmail.fm
Subject: Re: Areca driver recap + status
Date: Fri, 7 Jul 2006 02:04:37 -0700	[thread overview]
Message-ID: <20060707020437.0f3532e4.akpm@osdl.org> (raw)
In-Reply-To: <001601c6a1a1$34a17180$0132a8c0@erich2003>

On Fri, 7 Jul 2006 16:41:53 +0800
"erich" <erich@areca.com.tw> wrote:

> From: Erich Chen <erich@areca.com.tw>
> 
>   1- fix sysfs has more than one value per file
>   2- PAE issues (cast of dma_addr_t to unsigned long)
>   3- unblock SYNCHRONIZE_CACHE
> 
> Signed-off-by: Erich Chen <erich@areca.com.tw>
> 
> Areca had tested its arcmsr linux raid driver on ppc machines G5 and it 
> worked fine.

Thanks.

> +static ssize_t
> +arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off,
> +    size_t count)
> +{
> +	struct class_device *cdev = container_of(kobj,struct class_device,kobj);
> +	struct Scsi_Host *host = class_to_shost(cdev);
> +	struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
> +	struct MessageUnit __iomem *reg = acb->pmu;
> +	uint8_t *pQbuffer;
> +
> +	if (!capable(CAP_SYS_ADMIN) || (count && off) == 0)
> +		return 0;

That (count && off) == 0 looks odd.  Are you sure that's what you meant to
do?

Also, a write() handler shouldn't return zero if it didn't write anything. 
Some applications will see that the write() returned less than expected and
didn't return an error so they'll just loop around and try to write more
data.  They'll hang up when writing to your sysfs file.

http://www.opengroup.org/onlinepubs/009695399/functions/write.html says

RETURN VALUE

    Upon successful completion, write() and pwrite() shall return the
    number of bytes actually written to the file associated with fildes. 
    This number shall never be greater than nbyte.  Otherwise, -1 shall be
    returned and errno set to indicate the error.

So you should return -EINVAL here, and perhaps -EACCES or -EPERM.  Because
nothing was written.

  reply	other threads:[~2006-07-07  9:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-22  4:18 Areca driver recap + status Robert Mueller
2006-06-22  5:28 ` Andrew Morton
2006-06-22  6:35   ` Jeff Garzik
2006-06-26 14:48   ` James Bottomley
2006-06-26 15:01     ` Andrew Morton
2006-07-07  8:41       ` erich
2006-07-07  9:04         ` Andrew Morton [this message]
2006-06-26 22:32     ` Robert Mueller
2006-06-27 15:27       ` James Bottomley
2006-06-27 15:51         ` Alan Cox
2006-06-27 15:39           ` James Bottomley
2006-06-27 16:36             ` Alan Cox
2006-06-27  0:23     ` Dax Kelson
2006-06-27 15:27       ` James Bottomley
2006-06-27  9:47     ` erich
2006-06-27 16:12       ` James Bottomley

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=20060707020437.0f3532e4.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=James.Bottomley@SteelEye.com \
    --cc=brong@fastmail.fm \
    --cc=dax@gurulabs.com \
    --cc=erich@areca.com.tw \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=robm@fastmail.fm \
    /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