<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
	xmlns="http://purl.org/rss/1.0/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:hatena="http://www.hatena.ne.jp/info/xmlns#"
	xml:lang="ja">
	<channel rdf:about="http://kernel.g.hatena.ne.jp/keyword/lookup_one_len">
		<title>Linux kernel source - lookup_one_len</title>
		<link>http://kernel.g.hatena.ne.jp/keyword/lookup_one_len</link>
		<description>Linux kernel source - lookup_one_len</description>
		
		<items>
		<rdf:Seq>

		    <rdf:li rdf:resource="http://kernel.g.hatena.ne.jp/keyword/lookup_one_len?kid=101"/>

        </rdf:Seq>
		</items>
		
	</channel>

	<item rdf:about="http://kernel.g.hatena.ne.jp/keyword/lookup_one_len?kid=101">
	    <title>lookup_one_len</title>
		<link>http://kernel.g.hatena.ne.jp/keyword/lookup_one_len?kid=101</link>
		<description> 		 			fs/namei.c 			ファイル名に対応するdentryを探す。なければdentryを確保する。  /* SMP-safe */ struct dentry * lookup_one_len(const char * name, struct dentry * base, int len) {         unsigned long hash;         struct qstr this;         unsigned int c;          this.name = ...</description>
		<content:encoded><![CDATA[
		<div class="section">
			<p><a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/fs/namei%2Ec">fs/namei.c</a></p>
			<p>ファイル名に対応するdentryを探す。なければdentryを確保する。</p>
<pre>
/* SMP-safe */
<a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20dentry">struct dentry</a> * <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/lookup_one_len">lookup_one_len</a>(<a class="okeyword" href="http://d.hatena.ne.jp/keyword/const">const</a> <a class="okeyword" href="http://d.hatena.ne.jp/keyword/char">char</a> * name, <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20dentry">struct dentry</a> * <a class="okeyword" href="http://d.hatena.ne.jp/keyword/base">base</a>, int <a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>)
{
        unsigned long hash;
        <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20qstr">struct qstr</a> this;
        unsigned int c;

        this.name = name;
        this.<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a> = <a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>;
        if (!<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>)
                goto <a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>;

        hash = init_name_hash();
        while (<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>--) {
                c = *(<a class="okeyword" href="http://d.hatena.ne.jp/keyword/const">const</a> unsigned <a class="okeyword" href="http://d.hatena.ne.jp/keyword/char">char</a> *)name++;
                if (c == '/' || c == '\0')
                        goto <a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>;
                hash = partial_name_hash(c, hash);
        }
        this.hash = end_name_hash(hash);

        return __lookup_hash(&this, <a class="okeyword" href="http://d.hatena.ne.jp/keyword/base">base</a>, NULL);
<a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>:
        return ERR_PTR(-EACCES);
}
</pre>
			<p>lookup_hashが__lookup_hashに変更された模様。</p>
			<p>以下は<a class="okeyword" href="http://d.hatena.ne.jp/keyword/debian">debian</a> sarge の kernel 2.6.3。</p>
<pre>
/* SMP-safe */
<a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20dentry">struct dentry</a> * <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/lookup_one_len">lookup_one_len</a>(<a class="okeyword" href="http://d.hatena.ne.jp/keyword/const">const</a> <a class="okeyword" href="http://d.hatena.ne.jp/keyword/char">char</a> * name, <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20dentry">struct dentry</a> * <a class="okeyword" href="http://d.hatena.ne.jp/keyword/base">base</a>, int <a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>)
{
        unsigned long hash;
        <a class="keyword" href="http://kernel.g.hatena.ne.jp/keyword/struct%20qstr">struct qstr</a> this;
        unsigned int c;

        this.name = name;
        this.<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a> = <a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>;
        if (!<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>)
                goto <a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>;

        hash = init_name_hash();
        while (<a class="okeyword" href="http://d.hatena.ne.jp/keyword/len">len</a>--) {
                c = *(<a class="okeyword" href="http://d.hatena.ne.jp/keyword/const">const</a> unsigned <a class="okeyword" href="http://d.hatena.ne.jp/keyword/char">char</a> *)name++;
                if (c == '/' || c == '\0')
                        goto <a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>;
                hash = partial_name_hash(c, hash);
        }
        this.hash = end_name_hash(hash);

        return lookup_hash(&this, <a class="okeyword" href="http://d.hatena.ne.jp/keyword/base">base</a>);
<a class="okeyword" href="http://d.hatena.ne.jp/keyword/access">access</a>:
        return ERR_PTR(-EACCES);
}
</pre>
		</div>
]]></content:encoded>
		<dc:date>2008-04-16T01:32:03+09:00</dc:date>

	</item>

</rdf:RDF>

