diff mbox series

[v2,1/2] fs: Export __receive_fd()

Message ID 3a8da760-d58b-04fe-e251-e0d143493df1@ya.ru (mailing list archive)
State Changes Requested
Headers show
Series unix: Add ioctl(SIOCUNIXGRABFDS) to grab files of receive queue skbs | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 354 this patch: 354
netdev/cc_maintainers fail 1 maintainers not CCed: linux-fsdevel@vger.kernel.org
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 354 this patch: 354
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/source_inline success Was 0 now: 0

Commit Message

Kirill Tkhai Aug. 15, 2022, 9:15 p.m. UTC
This is needed to make receive_fd_user() available in modules, and it will be used in next patch.

Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
---
v2: New
 fs/file.c |    1 +
 1 file changed, 1 insertion(+)

Comments

David Laight Aug. 16, 2022, 8:03 a.m. UTC | #1
From: Kirill Tkhai
> Sent: 15 August 2022 22:15
> 
> This is needed to make receive_fd_user() available in modules, and it will be used in next patch.
> 
> Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
> ---
> v2: New
>  fs/file.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/file.c b/fs/file.c
> index 3bcc1ecc314a..e45d45f1dd45 100644
> --- a/fs/file.c
> +++ b/fs/file.c
> @@ -1181,6 +1181,7 @@ int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
>  	__receive_sock(file);
>  	return new_fd;
>  }
> +EXPORT_SYMBOL_GPL(__receive_fd);

It doesn't seem right (to me) to be exporting a function
with a __ prefix.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Kuniyuki Iwashima Aug. 16, 2022, 5:15 p.m. UTC | #2
From:   David Laight <David.Laight@ACULAB.COM>
Date:   Tue, 16 Aug 2022 08:03:14 +0000
> From: Kirill Tkhai
> > Sent: 15 August 2022 22:15
> > 
> > This is needed to make receive_fd_user() available in modules, and it will be used in next patch.
> > 
> > Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
> > ---
> > v2: New
> >  fs/file.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/file.c b/fs/file.c
> > index 3bcc1ecc314a..e45d45f1dd45 100644
> > --- a/fs/file.c
> > +++ b/fs/file.c
> > @@ -1181,6 +1181,7 @@ int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
> >  	__receive_sock(file);
> >  	return new_fd;
> >  }
> > +EXPORT_SYMBOL_GPL(__receive_fd);
> 
> It doesn't seem right (to me) to be exporting a function
> with a __ prefix.

+1.
Now receive_fd() has inline and it's the problem.
Can we avoid this by moving receive_fd() in fs/file.c without inline and
exporting it?
David Laight Aug. 16, 2022, 5:29 p.m. UTC | #3
From: Kuniyuki Iwashima
> Sent: 16 August 2022 18:15
> 
> From:   David Laight <David.Laight@ACULAB.COM>
> Date:   Tue, 16 Aug 2022 08:03:14 +0000
> > From: Kirill Tkhai
> > > Sent: 15 August 2022 22:15
> > >
> > > This is needed to make receive_fd_user() available in modules, and it will be used in next patch.
> > >
> > > Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
> > > ---
> > > v2: New
> > >  fs/file.c |    1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/fs/file.c b/fs/file.c
> > > index 3bcc1ecc314a..e45d45f1dd45 100644
> > > --- a/fs/file.c
> > > +++ b/fs/file.c
> > > @@ -1181,6 +1181,7 @@ int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
> > >  	__receive_sock(file);
> > >  	return new_fd;
> > >  }
> > > +EXPORT_SYMBOL_GPL(__receive_fd);
> >
> > It doesn't seem right (to me) to be exporting a function
> > with a __ prefix.
> 
> +1.
> Now receive_fd() has inline and it's the problem.
> Can we avoid this by moving receive_fd() in fs/file.c without inline and
> exporting it?

It looks like it is receive_fd_user() that should be made a real
function and then exported.
__receive_fd() can then be static.
The extra function call will be noise - and the compiler may
well either tail-call it or inline different copies of __receive_fd()
into the two callers.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Kuniyuki Iwashima Aug. 16, 2022, 5:42 p.m. UTC | #4
From:   David Laight <David.Laight@ACULAB.COM>
Date:   Tue, 16 Aug 2022 17:29:53 +0000
> From: Kuniyuki Iwashima
> > Sent: 16 August 2022 18:15
> > 
> > From:   David Laight <David.Laight@ACULAB.COM>
> > Date:   Tue, 16 Aug 2022 08:03:14 +0000
> > > From: Kirill Tkhai
> > > > Sent: 15 August 2022 22:15
> > > >
> > > > This is needed to make receive_fd_user() available in modules, and it will be used in next patch.
> > > >
> > > > Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
> > > > ---
> > > > v2: New
> > > >  fs/file.c |    1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/fs/file.c b/fs/file.c
> > > > index 3bcc1ecc314a..e45d45f1dd45 100644
> > > > --- a/fs/file.c
> > > > +++ b/fs/file.c
> > > > @@ -1181,6 +1181,7 @@ int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
> > > >  	__receive_sock(file);
> > > >  	return new_fd;
> > > >  }
> > > > +EXPORT_SYMBOL_GPL(__receive_fd);
> > >
> > > It doesn't seem right (to me) to be exporting a function
> > > with a __ prefix.
> > 
> > +1.
> > Now receive_fd() has inline and it's the problem.
> > Can we avoid this by moving receive_fd() in fs/file.c without inline and
> > exporting it?
> 
> It looks like it is receive_fd_user() that should be made a real
> function and then exported.

Right, I did wrong copy-and-paste :p


> __receive_fd() can then be static.
> The extra function call will be noise - and the compiler may
> well either tail-call it or inline different copies of __receive_fd()
> into the two callers.
Kirill Tkhai Aug. 16, 2022, 9:59 p.m. UTC | #5
On 16.08.2022 11:03, David Laight wrote:
> From: Kirill Tkhai
>> Sent: 15 August 2022 22:15
>>
>> This is needed to make receive_fd_user() available in modules, and it will be used in next patch.
>>
>> Signed-off-by: Kirill Tkhai <tkhai@ya.ru>
>> ---
>> v2: New
>>  fs/file.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/file.c b/fs/file.c
>> index 3bcc1ecc314a..e45d45f1dd45 100644
>> --- a/fs/file.c
>> +++ b/fs/file.c
>> @@ -1181,6 +1181,7 @@ int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
>>  	__receive_sock(file);
>>  	return new_fd;
>>  }
>> +EXPORT_SYMBOL_GPL(__receive_fd);
> 
> It doesn't seem right (to me) to be exporting a function
> with a __ prefix.

I don't think so.

$git grep "EXPORT_SYMBOL(__\|EXPORT_SYMBOL_GPL(__" | wc -l
1649
diff mbox series

Patch

diff --git a/fs/file.c b/fs/file.c
index 3bcc1ecc314a..e45d45f1dd45 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -1181,6 +1181,7 @@  int __receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
 	__receive_sock(file);
 	return new_fd;
 }
+EXPORT_SYMBOL_GPL(__receive_fd);
 
 int receive_fd_replace(int new_fd, struct file *file, unsigned int o_flags)
 {