From: Matthew Wilcox <willy@debian.org>
To: James Morris <jmorris@intercode.com.au>
Cc: "David S. Miller" <davem@redhat.com>,
kuznet@ms2.inr.ac.ru, Andi Kleen <ak@muc.de>,
linux-kernel@vger.kernel.org, Matthew Wilcox <willy@debian.org>
Subject: Re: [PATCH][RFC] sigurg/sigio cleanup for 2.5.31
Date: Thu, 15 Aug 2002 20:04:36 +0100 [thread overview]
Message-ID: <20020815200436.E29958@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Mutt.LNX.4.44.0208160302100.28909-100000@blackbird.intercode.com.au>; from jmorris@intercode.com.au on Fri, Aug 16, 2002 at 03:16:57AM +1000
On Fri, Aug 16, 2002 at 03:16:57AM +1000, James Morris wrote:
> This patch is a clean up of the sigurg and sigio related code, for
> the 2.5.31 kernel.
In general, this is good... I think it could be better:
> + lock_kernel();
> + error = f_setown(filp, current->pid);
> + unlock_kernel();
There are a lot of these, and you even batch it up as sock_setown()
later. May I suggest renaming f_setown to __setown and sock_setown
to f_setown?
> @@ -306,19 +334,11 @@
> break;
> case F_SETOWN:
> lock_kernel();
> -
> - err = security_ops->file_set_fowner(filp);
> + err = f_setown(filp, arg);
> if (err) {
> unlock_kernel();
> break;
> }
> -
> - filp->f_owner.pid = arg;
> - filp->f_owner.uid = current->uid;
> - filp->f_owner.euid = current->euid;
> - err = 0;
> - if (S_ISSOCK (filp->f_dentry->d_inode->i_mode))
> - err = sock_fcntl (filp, F_SETOWN, arg);
> unlock_kernel();
> break;
> case F_GETSIG:
this one's particularly silly -- now you've done the good job of wrapping
the security_ops up inside f_setown this can simply be:
lock_kernel();
err = f_setown(filp, arg);
unlock_kernel();
break;
though if you accept my suggestion above, it's even easier.
> +int sk_send_sigurg(struct sock *sk)
> +{
> + if (sk->socket && sk->socket->file)
> + return send_sigurg(&sk->socket->file->f_owner);
> + return 0;
> +}
> +
I notice that both the callers of this do:
> /* Tell the world about our new urgent pointer. */
> + if (sk_send_sigurg(sk))
> sk_wake_async(sk, 3, POLL_PRI);
Might make more sense to refactor as:
void sk_send_sigurg(struct sock *sk)
{
if (!sk->socket || !sk->socket->file)
return;
if (send_sigurg(&sk->socket->file->f_owner))
sk_wake_async(sk, 3, POLL_PRI);
}
--
Revolutions do not require corporate support.
next prev parent reply other threads:[~2002-08-15 19:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-15 17:16 [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 James Morris
2002-08-15 19:04 ` Matthew Wilcox [this message]
2002-08-16 0:10 ` James Morris
2002-08-15 22:36 ` kuznet
2002-08-16 13:07 ` James Morris
2002-08-16 14:50 ` kuznet
2002-08-16 15:03 ` James Morris
2002-08-16 15:16 ` kuznet
2002-08-16 7:06 ` Chris Wright
2002-08-16 16:25 ` Jeff Dike
2002-08-16 15:59 ` James Morris
2002-08-17 18:16 ` Alan Cox
2002-08-18 0:57 ` James Morris
2002-08-19 1:16 ` James Morris
2002-08-17 2:58 ` [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 [version 2] James Morris
2002-08-19 2:28 ` Jeff Dike
2002-08-19 1:37 ` James Morris
2002-08-19 10:14 ` [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 [version 3] James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020815200436.E29958@parcelfarce.linux.theplanet.co.uk \
--to=willy@debian.org \
--cc=ak@muc.de \
--cc=davem@redhat.com \
--cc=jmorris@intercode.com.au \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.