lkml.org 
[lkml]   [2006]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Areca driver recap + status
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-07 11:09    [W:0.051 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site