In sysfs store function count value and buf not appropriate

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

 



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

thanks in advance


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
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