Re: Where is getname () defined

Dan Bokser <[email protected]> Fri, 29 Aug 2025 15:19:59 -0400
Newsgroups org.kernelnewbies.kernelnewbies
Message-ID <CAFff0tR=mjOMbPXAufJNqM+hhMEdwzAZhATWNq1oGNAndY=OWg@mail.gmail.com>
--===============2709685166451599385==
Content-Type: multipart/alternative; boundary="0000000000001ae930063d85e9bc"

--0000000000001ae930063d85e9bc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Aug 29, 2025 at 2:43=E2=80=AFPM Vulturus <[email protected]> wr=
ote:

> Dear kernelnewbies subscribers,
>
> I was reading the kernel source tree in an
> attempt to understand how the chroot syscall workes.
> (I was using the linux-6.17-rc3 tarball from kernel.org.)
>
> At line 1429 of the fs/open.c file, inside the
> definition of the do_sys_openat2() function getname() is called.
>
> I am having trouble finding its definition.
>
> In particular,
> $ grep -rn 'getname' fs
> doesn't return a line like 'struct file *getname (args)'
> or similar, as I would expect.
>
> Can someone point me to the file/line where getname() is defined?
>
> Thank you,
> Vulturus
>
> _______________________________________________
> Kernelnewbies mailing list
> [email protected]
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Looks like it's an inline function defined in a header in
/include/linux/fs.h:
https://elixir.bootlin.com/linux/v6.17-rc3/source/include/linux/fs.h#L2916

Bootlin is a fantastic tool to find where things are defined in the kernel.

-Daniel

>
>

--0000000000001ae930063d85e9bc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" =
class=3D"gmail_attr">On Fri, Aug 29, 2025 at 2:43=E2=80=AFPM Vulturus &lt;<=
a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote=
:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-l=
eft-color:rgb(204,204,204)">Dear kernelnewbies subscribers,<br>
<br>
I was reading the kernel source tree in an<br>
attempt to understand how the chroot syscall workes.<br>
(I was using the linux-6.17-rc3 tarball from <a href=3D"http://kernel.org" =
rel=3D"noreferrer" target=3D"_blank">kernel.org</a>.)<br>
<br>
At line 1429 of the fs/open.c file, inside the<br>
definition of the do_sys_openat2() function getname() is called.<br>
<br>
I am having trouble finding its definition.<br>
<br>
In particular,<br>
$ grep -rn &#39;getname&#39; fs<br>
doesn&#39;t return a line like &#39;struct file *getname (args)&#39;<br>
or similar, as I would expect.<br>
<br>
Can someone point me to the file/line where getname() is defined?<br>
<br>
Thank you,<br>
Vulturus<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Kernel=
[email protected]</a><br>
<a href=3D"https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" =
rel=3D"noreferrer" target=3D"_blank">https://lists.kernelnewbies.org/mailma=
n/listinfo/kernelnewbies</a></blockquote><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:s=
olid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir=3D"auto"></bl=
ockquote><div dir=3D"auto"><br></div><div dir=3D"auto">Looks like it&#39;s =
an inline function defined in a header in /include/linux/fs.h:=C2=A0<div><a=
 href=3D"https://elixir.bootlin.com/linux/v6.17-rc3/source/include/linux/fs=
.h#L2916">https://elixir.bootlin.com/linux/v6.17-rc3/source/include/linux/f=
s.h#L2916</a></div><div dir=3D"auto"><br></div><div dir=3D"auto">Bootlin is=
 a fantastic tool to find where things are defined in the kernel.=C2=A0</di=
v><div dir=3D"auto"><br></div><div dir=3D"auto">-Daniel</div></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-wid=
th:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,2=
04,204)" dir=3D"auto"><br>
</blockquote></div></div>

--0000000000001ae930063d85e9bc--


--===============2709685166451599385==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

--===============2709685166451599385==--