Hi all,<br> I am new to Lustre code. So i am sorry if my question is trivial or silly.<br><br>My question:<br><br>On line number 116 of the file lnet/lnet/router_proc.c<br>variable ver_p is getting set from the proc file object's private data.<br>
<br>Can any one tell me which part of the lustre code dose this file object private data <br>gets initialized / set .<br><br>conceptually in can imagine it should (correct me if I am worng) be set in open call of the file ( /proc/sys/lnet/routers ) <br>
<br>BUT I cant locate the Lustre code that dose that(sets the private data of file object).<br> <br><br><br><br><br><br>code snippet form lnet/lnet/router_proc.c<br><br>int LL_PROC_PROTO(proc_lnet_routes)<br>{<br> int rc = 0;<br>
char *tmpstr;<br> char *s;<br> const int tmpsiz = 256;<br> int len;<br> int *ver_p = (unsigned int *)(&filp->private_data);<br><br> DECLARE_LL_PROC_PPOS_DECL;<br>
<br> LASSERT (!write);<br><br> if (*lenp == 0)<br> return 0;<br><br> LIBCFS_ALLOC(tmpstr, tmpsiz);<br> if (tmpstr == NULL)<br> return -ENOMEM;<br><br> s = tmpstr; /* points to current position in tmpstr[] */<br>
<br> if (*ppos == 0) {<br> s += snprintf(s, tmpstr + tmpsiz - s, "Routing %s\n",<br> the_lnet.ln_routing ? "enabled" : "disabled");<br> LASSERT (tmpstr + tmpsiz - s > 0);<br>
<br> s += snprintf(s, tmpstr + tmpsiz - s, "%-8s %4s %7s %s\n",<br> "net", "hops", "state", "router");<br> LASSERT (tmpstr + tmpsiz - s > 0);<br>
<br> LNET_LOCK();<br> *ver_p = (unsigned int)the_lnet.ln_remote_nets_version;<br> LNET_UNLOCK();<br><br>} else {<br> struct list_head *n;<br> struct list_head *r;<br>
lnet_route_t *route = NULL;<br> lnet_remotenet_t *rnet = NULL;<br> int skip = *ppos - 1;<br><br> LNET_LOCK();<br><br> if (*ver_p != (unsigned int)the_lnet.ln_remote_nets_version) {<br>
LNET_UNLOCK();<br> LIBCFS_FREE(tmpstr, tmpsiz);<br> return -ESTALE;<br> }<br><br> n = the_lnet.ln_remote_nets.next;<br><br>
<br><br>