Module Name:    src
Committed By:   pgoyette
Date:           Sat Sep 15 05:56:50 UTC 2018

Modified Files:
        src/sys/kern [pgoyette-compat]: compat_stub.c
        src/sys/sys [pgoyette-compat]: compat_stub.h

Log Message:
Prepare for adding MP-safe stuff.

While here, move some header #includes


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/sys/compat_stub.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.15 src/sys/kern/compat_stub.c:1.1.2.16
--- src/sys/kern/compat_stub.c:1.1.2.15	Tue Apr 17 07:24:55 2018
+++ src/sys/kern/compat_stub.c	Sat Sep 15 05:56:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.15 2018/04/17 07:24:55 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.16 2018/09/15 05:56:50 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,6 +39,11 @@
 #include <sys/systm.h>
 #include <sys/compat_stub.h>
 
+#ifdef NTP
+#include <sys/timespec.h>
+#include <sys/timex.h>
+#endif
+
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
  */
@@ -51,6 +56,11 @@ void (*vec_ntp_gettime)(struct ntptimeva
 int (*vec_ntp_timestatus)(void) = NULL;
 #endif
 
+#if NUSB > 0
+#include <dev/usb/usb.h>
+#include <dev/usb/usbdi.h>
+#endif
+
 /*
  * ccd device compatability ioctl
  */

Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.15 src/sys/sys/compat_stub.h:1.1.2.16
--- src/sys/sys/compat_stub.h:1.1.2.15	Tue Apr 17 07:24:55 2018
+++ src/sys/sys/compat_stub.h	Sat Sep 15 05:56:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.15 2018/04/17 07:24:55 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.h,v 1.1.2.16 2018/09/15 05:56:50 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,12 +32,37 @@
 #ifndef _SYS_COMPAT_STUB_H
 #define _SYS_COMPAT_STUB_H
 
+#include <sys/mutex.h>
+#include <sys/localcount.h>
+#include <sys/condvar.h>
+#include <sys/pserialize.h>
+
+/*
+ * Macro for creating MP-safe vectored function calls
+ */
+#if defined(MODULAR)
+#define COMPAT_HOOK(name,type,args)		\
+struct __CONCAT(name,_t) {			\
+	kmutex_t		lock;		\
+	kcondvar_t		cv;		\
+	struct localcount	lc;		\
+	pserialize_t		psz;		\
+        bool			hooked;		\
+	type			(*func)(args);	\
+} name __cacheline_aligned;
+#else	/* defined(MODULAR) */
+#define COMPAT_HOOK(name,type.args)		\
+struct __CONCAT(name,_t) {			\
+        bool			hooked;		\
+	type			(*func)(args);	\
+} name __cacheline_aligned;
+#endif	/* defined(MODULAR) */
+
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
  */
 
-#include <sys/timespec.h>
-#include <sys/timex.h>
+struct ntptimeval;
 
 extern void (*vec_ntp_gettime)(struct ntptimeval *);
 extern int (*vec_ntp_timestatus)(void);
@@ -47,7 +72,7 @@ extern int (*vec_ntp_timestatus)(void);
  */
 
 extern int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *,
-    int (*f)(dev_t, u_long, void *, int, struct lwp *));
+-    int (*f)(dev_t, u_long, void *, int, struct lwp *));
 
 /*
  * Routine vector for dev/clockctl ioctl()
@@ -128,9 +153,6 @@ extern int (*compat_vndioctl_30)(u_long,
  * usb devinfo compatability
  */
 
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-
 struct usbd_device;
 struct usb_device_info;
 struct usb_device_info_old;

Reply via email to