Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys * remove declarations of unp_bind, unp_discard, unp_disc...



details:   https://anonhg.NetBSD.org/src/rev/d98c2b6b979a
branches:  trunk
changeset: 797866:d98c2b6b979a
user:      rtr <rtr%NetBSD.org@localhost>
date:      Thu Jul 31 14:12:57 2014 +0000

description:
* 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

diffstat:

 sys/kern/uipc_usrreq.c |  45 ++++++++++++++++++++++++---------------------
 sys/sys/un.h           |  13 ++-----------
 2 files changed, 26 insertions(+), 32 deletions(-)

diffs (159 lines):

diff -r d84fe31a4a9d -r d98c2b6b979a sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Thu Jul 31 14:05:57 2014 +0000
+++ b/sys/kern/uipc_usrreq.c    Thu Jul 31 14:12:57 2014 +0000
@@ -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 @@
 };
 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 @@
        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 @@
        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 @@
        }
 }
 
-void
+static void
 unp_setaddr(struct socket *so, struct mbuf *nam, bool peeraddr)
 {
        const struct sockaddr_un *sun;
@@ -505,7 +508,7 @@
                                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 @@
        return sun;
 }
 
-int
+static int
 unp_bind(struct socket *so, struct mbuf *nam)
 {
        struct sockaddr_un *sun;
@@ -1226,7 +1229,7 @@
        return (0);
 }
 
-void
+static void
 unp_disconnect1(struct unpcb *unp)
 {
        struct unpcb *unp2 = unp->unp_conn;
@@ -1266,7 +1269,7 @@
        }
 }
 
-void
+static void
 unp_shutdown1(struct unpcb *unp)
 {
        struct socket *so;
@@ -1282,7 +1285,7 @@
        }
 }
 
-bool
+static bool
 unp_drop(struct unpcb *unp, int errno)
 {
        struct socket *so = unp->unp_socket;
@@ -1437,7 +1440,7 @@
        return error;
 }
 
-int
+static int
 unp_internalize(struct mbuf **controlp)
 {
        filedesc_t *fdescp = curlwp->l_fd;
diff -r d84fe31a4a9d -r d98c2b6b979a sys/sys/un.h
--- a/sys/sys/un.h      Thu Jul 31 14:05:57 2014 +0000
+++ b/sys/sys/un.h      Thu Jul 31 14:12:57 2014 +0000
@@ -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_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 *);
+void   unp_dispose (struct mbuf *);
 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);
 
 #else /* !_KERNEL */
 



Home | Main Index | Thread Index | Old Index