Re: problem in sysfs store function count value and buf not appropriate

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

 



On Wed, Mar 22, 2006 at 09:39:51AM -0800, kanishk rastogi wrote:
> 
> hi all,
> 
> i have created a device file with only write
> permission::
> 
> ssize_t add_target_store(struct device *dev, const
> char *buf, size_t count)
> {
>  int data;
>  struct vt_host_info * vthost;
>  vthost=to_vt_host_info(dev);
>  
>  if(1!=sscanf(buf,"%d",&data))-->it goes inside
>  {
>    printk(KERN_ERR "Invalid Data Entered count ::%u::
> %s",(unsigned int)count,buf);
>    return -EINVAL;
>  }
>  
>  printk("Device target will be  added\n");
>  return count;
> }
> 
> DEVICE_ATTR(add_target, S_IWUSR , NULL,
> add_target_store);
> 
> and created the file using ::
> if((i=device_register(dev)))
>         return i;
>  device_create_file(dev ,&dev_attr_add_target);
> but when i perform
> echo 2 >sysfs file
> it gives garbage

Gives garbage where?

Do you have your whole source code available anywhere?

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux