Module Name: src
Committed By: rtr
Date: Thu Jul 31 14:12:57 UTC 2014
Modified Files:
src/sys/kern: uipc_usrreq.c
src/sys/sys: un.h
Log Message:
* remove declarations of unp_bind, unp_discard, unp_disconnect1, unp_drop,
unp_shutdown1, unp_internalize and unp_output functions from sys/un.h
and instead declare them as static in uipc_usrreq.c with prototype
declarations as necessary.
* remove struct lwp * parameter from unp_output() while here and just
use curlwp instead.
as discussed with rmind
To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/un.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.163 src/sys/kern/uipc_usrreq.c:1.164
--- src/sys/kern/uipc_usrreq.c:1.163 Thu Jul 31 03:39:35 2014
+++ src/sys/kern/uipc_usrreq.c Thu Jul 31 14:12:57 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq.c,v 1.163 2014/07/31 03:39:35 rtr Exp $ */
+/* $NetBSD: uipc_usrreq.c,v 1.164 2014/07/31 14:12:57 rtr Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.163 2014/07/31 03:39:35 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.164 2014/07/31 14:12:57 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -170,14 +170,18 @@ const struct sockaddr_un sun_noname = {
};
ino_t unp_ino; /* prototype for fake inode numbers */
-static void unp_detach(struct socket *);
-struct mbuf *unp_addsockcred(struct lwp *, struct mbuf *);
-static void unp_mark(file_t *);
-static void unp_scan(struct mbuf *, void (*)(file_t *), int);
-static void unp_discard_now(file_t *);
-static void unp_discard_later(file_t *);
-static void unp_thread(void *);
-static void unp_thread_kick(void);
+static struct mbuf * unp_addsockcred(struct lwp *, struct mbuf *);
+static void unp_discard_later(file_t *);
+static void unp_discard_now(file_t *);
+static void unp_disconnect1(struct unpcb *);
+static bool unp_drop(struct unpcb *, int);
+static int unp_internalize(struct mbuf **);
+static void unp_mark(file_t *);
+static void unp_scan(struct mbuf *, void (*)(file_t *), int);
+static void unp_shutdown1(struct unpcb *);
+static void unp_thread(void *);
+static void unp_thread_kick(void);
+
static kmutex_t *uipc_lock;
static kcondvar_t unp_thread_cv;
@@ -296,9 +300,8 @@ unp_free(struct unpcb *unp)
kmem_free(unp, sizeof(*unp));
}
-int
-unp_output(struct mbuf *m, struct mbuf *control, struct unpcb *unp,
- struct lwp *l)
+static int
+unp_output(struct mbuf *m, struct mbuf *control, struct unpcb *unp)
{
struct socket *so2;
const struct sockaddr_un *sun;
@@ -315,7 +318,7 @@ unp_output(struct mbuf *m, struct mbuf *
else
sun = &sun_noname;
if (unp->unp_conn->unp_flags & UNP_WANTCRED)
- control = unp_addsockcred(l, control);
+ control = unp_addsockcred(curlwp, control);
if (sbappendaddr(&so2->so_rcv, (const struct sockaddr *)sun, m,
control) == 0) {
so2->so_rcv.sb_overflowed++;
@@ -329,7 +332,7 @@ unp_output(struct mbuf *m, struct mbuf *
}
}
-void
+static void
unp_setaddr(struct socket *so, struct mbuf *nam, bool peeraddr)
{
const struct sockaddr_un *sun;
@@ -505,7 +508,7 @@ unp_usrreq(struct socket *so, int req, s
break;
}
KASSERT(l != NULL);
- error = unp_output(m, control, unp, l);
+ error = unp_output(m, control, unp);
if (nam)
unp_disconnect1(unp);
break;
@@ -916,7 +919,7 @@ makeun(struct mbuf *nam, size_t *addrlen
return sun;
}
-int
+static int
unp_bind(struct socket *so, struct mbuf *nam)
{
struct sockaddr_un *sun;
@@ -1226,7 +1229,7 @@ unp_connect2(struct socket *so, struct s
return (0);
}
-void
+static void
unp_disconnect1(struct unpcb *unp)
{
struct unpcb *unp2 = unp->unp_conn;
@@ -1266,7 +1269,7 @@ unp_disconnect1(struct unpcb *unp)
}
}
-void
+static void
unp_shutdown1(struct unpcb *unp)
{
struct socket *so;
@@ -1282,7 +1285,7 @@ unp_shutdown1(struct unpcb *unp)
}
}
-bool
+static bool
unp_drop(struct unpcb *unp, int errno)
{
struct socket *so = unp->unp_socket;
@@ -1437,7 +1440,7 @@ unp_externalize(struct mbuf *rights, str
return error;
}
-int
+static int
unp_internalize(struct mbuf **controlp)
{
filedesc_t *fdescp = curlwp->l_fd;
Index: src/sys/sys/un.h
diff -u src/sys/sys/un.h:1.51 src/sys/sys/un.h:1.52
--- src/sys/sys/un.h:1.51 Thu Jul 31 03:39:36 2014
+++ src/sys/sys/un.h Thu Jul 31 14:12:57 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: un.h,v 1.51 2014/07/31 03:39:36 rtr Exp $ */
+/* $NetBSD: un.h,v 1.52 2014/07/31 14:12:57 rtr Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -84,19 +84,10 @@ kmutex_t *uipc_dgramlock (void);
kmutex_t *uipc_streamlock (void);
kmutex_t *uipc_rawlock (void);
-int unp_bind (struct socket *, struct mbuf *);
int unp_connect (struct socket *, struct mbuf *);
int unp_connect2 (struct socket *, struct socket *, int);
-void unp_discard (struct file *);
-void unp_disconnect1 (struct unpcb *);
-bool unp_drop (struct unpcb *, int);
-void unp_shutdown1 (struct unpcb *);
-int unp_externalize (struct mbuf *, struct lwp *, int);
-int unp_internalize (struct mbuf **);
void unp_dispose (struct mbuf *);
-int unp_output (struct mbuf *, struct mbuf *, struct unpcb *,
- struct lwp *);
-void unp_setaddr (struct socket *, struct mbuf *, bool);
+int unp_externalize (struct mbuf *, struct lwp *, int);
#else /* !_KERNEL */