Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Prepare for adding MP-safe stuff.



details:   https://anonhg.NetBSD.org/src/rev/a0c45bf71a2d
branches:  pgoyette-compat
changeset: 830709:a0c45bf71a2d
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Sep 15 05:56:50 2018 +0000

description:
Prepare for adding MP-safe stuff.

While here, move some header #includes

diffstat:

 sys/kern/compat_stub.c |  12 +++++++++++-
 sys/sys/compat_stub.h  |  36 +++++++++++++++++++++++++++++-------
 2 files changed, 40 insertions(+), 8 deletions(-)

diffs (101 lines):

diff -r 372e64ddb3a7 -r a0c45bf71a2d sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Sat Sep 15 02:14:39 2018 +0000
+++ b/sys/kern/compat_stub.c    Sat Sep 15 05:56:50 2018 +0000
@@ -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 @@
 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
  */
diff -r 372e64ddb3a7 -r a0c45bf71a2d sys/sys/compat_stub.h
--- a/sys/sys/compat_stub.h     Sat Sep 15 02:14:39 2018 +0000
+++ b/sys/sys/compat_stub.h     Sat Sep 15 05:56:50 2018 +0000
@@ -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 (*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 @@
  * 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;



Home | Main Index | Thread Index | Old Index