]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netat/at_proto.c
xnu-792.10.96.tar.gz
[apple/xnu.git] / bsd / netat / at_proto.c
index 3a8cb6055a7cc696ac5f03d636041423712ed6ae..74e1808e68d82aafdb1887f1235108b89326249a 100644 (file)
@@ -36,6 +36,7 @@
 #include <sys/protosw.h>
 #include <sys/domain.h>
 #include <sys/mbuf.h>
+#include <kern/locks.h>
 
 #include <sys/sysctl.h>
 
@@ -45,7 +46,6 @@
 #include <netat/at_var.h>
 #include <netat/ddp.h>
 
-struct domain atalkdomain;
 
 extern int     ddp_pru_abort(struct socket *so);
 
@@ -81,24 +81,76 @@ struct pr_usrreqs ddp_usrreqs = {
        ddp_pru_connect, pru_connect2_notsupp, ddp_pru_control, ddp_pru_detach,
        ddp_pru_disconnect, pru_listen_notsupp, ddp_pru_peeraddr, pru_rcvd_notsupp,
        pru_rcvoob_notsupp, ddp_pru_send, pru_sense_null, ddp_pru_shutdown,
-       ddp_pru_sockaddr, sosend, soreceive, sopoll
+       ddp_pru_sockaddr, sosend, soreceive, pru_sopoll_notsupp
 };
 
+extern struct domain atalkdomain;
+extern void atalk_dominit(void);
+
 struct protosw atalksw[] = {
   { SOCK_RAW,  &atalkdomain,   /*protocol*/ 0, PR_ATOMIC|PR_ADDR,
     /*input*/ 0, /*output*/ 0, /*clinput*/ 0, ddp_ctloutput,
     /*ousrreq*/ 0, 
     ddp_init, /*fastto*/ 0, /*slowto*/ 0, /*drain*/ 0, 
-    /*sysctl*/ 0, &ddp_usrreqs
+    /*sysctl*/ 0, &ddp_usrreqs,
+       0, 0, 0, /*lock, unlock, getlock */
+   {0, 0}, 0, {0} /* filters */
   }
 };
 
 struct domain atalkdomain =
-{ AF_APPLETALK, "appletalk", 0, 0, 0, 
-  atalksw, 0,
-  0, 0, 0,
-  DDP_X_HDR_SIZE, 0
+{ AF_APPLETALK,
+  "appletalk",
+  atalk_dominit,
+  0,
+  0, 
+  atalksw,
+  0,
+  0, /* dom_rtattach */
+  0, 0, /* dom_rtoffset, dom_maxrtkey */
+  DDP_X_HDR_SIZE, 0,
+  0, /* domain global mutex */
+  0,  /* domain flags */
+  {0, 0} /*reserved[2] */
 };
 
+struct domain * atalkdom = &atalkdomain;
+lck_mtx_t  *atalk_mutex = NULL;
+
+static int at_saved_lock, at_saved_unlock;
+
 SYSCTL_NODE(_net, PF_APPLETALK, appletalk, CTLFLAG_RW, 0, "AppleTalk Family");
 
+void
+atalk_dominit(void)
+{
+       atalk_mutex = atalkdom->dom_mtx;
+}
+
+void
+atalk_lock()
+{
+       int lr_saved;
+       lr_saved = (unsigned int) __builtin_return_address(0);
+
+       lck_mtx_assert(atalkdom->dom_mtx, LCK_MTX_ASSERT_NOTOWNED);
+       lck_mtx_lock(atalkdom->dom_mtx);
+       at_saved_lock = lr_saved;
+}
+       
+void
+atalk_unlock()
+{
+       int lr_saved;
+       lr_saved = (unsigned int) __builtin_return_address(0);
+
+       lck_mtx_assert(atalkdom->dom_mtx, LCK_MTX_ASSERT_OWNED);
+       at_saved_unlock = lr_saved;
+       lck_mtx_unlock(atalkdom->dom_mtx);
+
+}
+       
+
+
+
+