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" <erich@xxxxxxxxxxxx> wrote:

> From: Erich Chen <erich@xxxxxxxxxxxx>
> 
>   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@xxxxxxxxxxxx>
> 
> 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.
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux