Re: Areca driver recap + status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 7 Jul 2006 16:41:53 +0800
"erich" <[email protected]> wrote:

> From: Erich Chen <[email protected]>
> 
>   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 <[email protected]>
> 
> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux