<div dir="ltr">Hi, <div><br></div><div>I'm looking for some information about :</div><div><br></div>struct kobj_attribute {<br> struct attribute attr;<br> ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);<br>
ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count);<br>};<div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">My function to handle the operation:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"><div class="gmail_extra">static ssize_t my_store(struct kobject *kobj, struct kobj_attribute *attr,</div><div class="gmail_extra"><span class="" style="white-space:pre">                        </span> const char *buf, size_t count)</div>
<div class="gmail_extra">{</div><div class="gmail_extra"><span class="" style="white-space:pre">        </span>char *buffer;</div><div class="gmail_extra"><br></div><div class="gmail_extra">buffer = (char*) kcalloc(count, sizeof(char), GFP_KERNEL);<br>
</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span class="" style="white-space:pre">        </span>if (count == 13) {</div><div class="gmail_extra"><span class="" style="white-space:pre">                </span></div><div class="gmail_extra">
<span class="" style="white-space:pre">                </span>if (buffer) {</div><div class="gmail_extra"><span class="" style="white-space:pre">                </span> copy_from_user(buffer, buf, count);</div><div class="gmail_extra"><span class="" style="white-space:pre">                        </span>printk("A %s",buffer);</div>
<div class="gmail_extra"><span class="" style="white-space:pre">                        </span>if (0) {</div><div class="gmail_extra"><span class="" style="white-space:pre">                                </span>if (strcmp(buffer, eudyptula_id) == 0)</div><div class="gmail_extra">
<span class="" style="white-space:pre">                                        </span>return count;</div><div class="gmail_extra"><span class="" style="white-space:pre">                        </span> printk("erro na strcmp\n");</div><div class="gmail_extra">
<span class="" style="white-space:pre">                        </span>}</div>
<div class="gmail_extra"><span class="" style="white-space:pre">                        </span>else</div><div class="gmail_extra"><span class="" style="white-space:pre">                                </span>printk("erro na copia\n");</div><div class="gmail_extra">
<span class="" style="white-space:pre">                </span>}</div><div class="gmail_extra"><span class="" style="white-space:pre">        </span>}</div><div class="gmail_extra"><span class="" style="white-space:pre">        </span>return -EINVAL;</div>
<div class="gmail_extra">}</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">So, this <b>const char *buf, </b>where ti come from ? Kernel space</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">
<br clear="all"><div><div dir="ltr"><div>--</div>Lucas Tanure <br>+55 (19) 988176559</div></div></div></div></div>