Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Catherine Zhang <cxzhang@watson.ibm.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jmorris@redhat.com,
	chrisw@osdl.org, herbert@gondor.apana.org.au, sds@tycho.nsa.gov,
	tjaeger@cse.psu.edu, akpm@osdl.org, latten@austin.ibm.com,
	sergeh@us.ibm.com, gcwilson@us.ibm.com, czhang.us@gmail.com
Subject: Re: updated [Patch 1/1] AF_UNIX Datagram getpeersec
Date: Fri, 16 Jun 2006 21:16:03 -0700	[thread overview]
Message-ID: <20060616211603.14547a1d@localhost.localdomain> (raw)
In-Reply-To: <20060617035440.GA28169@jiayuguan.watson.ibm.com>

O
>  
> +void selinux_get_sock_sid(const struct socket *sock, u32 *sid)
> +{
> +	if (selinux_enabled) {
> +		const struct inode *inode = SOCK_INODE(sock);
> +		selinux_get_inode_sid(inode, sid);
> +		return;
> +	}
> +	*sid = 0;
> +}
> +

This is so short, it would make sense to put it in scm.h
and why not have it return the value instead of call by reference?
Same goes for selinux_get_inode_sid

static inline void selinux_get_sock_sid(const struct socket *sock, u32 *sid)
{
	if (selinux_enabled)
		selinux_get_inode_sid(SOCK_INODE(sock), sid);
	else
		*sid = 0;
}

or
static inline u32 selinux_get_sock_sid(const struct socket *sock)
{
	return selinux_enabled ? selinux_get_inode_sid(SOCK_INODE(sid)) : 0;
}

  reply	other threads:[~2006-06-17  4:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-17  3:54 updated [Patch 1/1] AF_UNIX Datagram getpeersec Catherine Zhang
2006-06-17  4:16 ` Stephen Hemminger [this message]
2006-06-17  6:47   ` Xiaolan Zhang
2006-06-17 15:46     ` James Morris
2006-06-17 15:55   ` James Morris
2006-06-18  4:46     ` Catherine Zhang

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=20060616211603.14547a1d@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=cxzhang@watson.ibm.com \
    --cc=czhang.us@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gcwilson@us.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jmorris@redhat.com \
    --cc=latten@austin.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=sergeh@us.ibm.com \
    --cc=tjaeger@cse.psu.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox