netgraph7: ng_socket: use lksleep() instead of home brewed version.
authorNuno Antunes <nuno.antunes@gmail.com>
Wed, 22 Sep 2010 14:40:24 +0000 (15:40 +0100)
committerNuno Antunes <nuno.antunes@gmail.com>
Tue, 10 Jan 2012 14:10:34 +0000 (14:10 +0000)
* This eliminates the last function in netgraph7/dragonfly.c.
  Remove the file because it is no longer needed.

sys/conf/files
sys/netgraph7/dragonfly.c [deleted file]
sys/netgraph7/socket/ng_socket.c

index de1145e..6bb2eb4 100644 (file)
@@ -1299,7 +1299,6 @@ netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c        optional netgraph7_bluetooth_
 netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c                optional netgraph7_bluetooth_socket
 netgraph7/netflow/netflow.c    optional netgraph7_netflow
 netgraph7/netflow/ng_netflow.c optional netgraph7_netflow
-netgraph7/dragonfly.c          optional netgraph7
 netgraph7/UI/ng_UI.c           optional netgraph7_UI
 netgraph7/async/ng_async.c     optional netgraph7_async
 netgraph7/atmllc/ng_atmllc.c   optional netgraph7_atmllc
diff --git a/sys/netgraph7/dragonfly.c b/sys/netgraph7/dragonfly.c
deleted file mode 100644 (file)
index 7ee3084..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <netgraph7/ng_message.h>
-
-#include <sys/malloc.h>
-#include <sys/linker.h>
-#include <sys/thread2.h>
-#include <sys/vnode.h>
-
-#include "dragonfly.h"
-
-/* Temporary lock stuff. */
-#include <sys/lock.h>
-/* End Temporary lock stuff. */
-
-
-
-/* Locking stuff. */
-
-
-int
-lockstatus_owned(struct lock *lkp, struct thread *td)
-{
-       int lock_type = 0;
-
-       if (lkp->lk_exclusivecount != 0) {
-               if (td == NULL || lkp->lk_lockholder == td)
-                       lock_type = LK_EXCLUSIVE;
-               else
-                       lock_type = LK_EXCLOTHER;
-       } else if (lkp->lk_sharecount != 0) {
-               lock_type = LK_SHARED;
-       }
-       return (lock_type);
-}
-
-/*
- * Atomically drop a lockmgr lock and go to sleep. The lock is reacquired
- * before returning from this function. Passes on the value returned by
- * tsleep().
- */
-int
-lock_sleep(void *ident, int flags, const char *wmesg, int timo,
-               struct lock *lk)
-{
-       int err, mode;
-
-       mode = lockstatus_owned(lk, curthread);
-       KKASSERT((mode == LK_EXCLUSIVE) || (mode == LK_SHARED));
-
-       crit_enter();
-       tsleep_interlock(ident, flags);
-       lockmgr(lk, LK_RELEASE);
-       err = tsleep(ident, flags, wmesg, timo);
-       crit_exit();
-       lockmgr(lk, mode);
-       return err;
-}
index 9ec2720..07387d3 100644 (file)
@@ -343,8 +343,7 @@ ngc_send(netmsg_t netmsg)
 
        mtx_lock(&priv->mtx);
        if (priv->error == -1)
-               lock_sleep(priv, 0, "ngsock", 0,
-                               (struct lock *)&priv->mtx);
+               lksleep(priv, (struct lock *)&priv->mtx, 0, "ngsock", 0);
        mtx_unlock(&priv->mtx);
        KASSERT(priv->error != -1,
            ("ng_socket: priv->error wasn't updated"));