problem 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
why is it so ??
thanks in advance


Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.

[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