Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/include/linux Add some notes on usin...



details:   https://anonhg.NetBSD.org/src/rev/ac98f48b7854
branches:  trunk
changeset: 797059:ac98f48b7854
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jul 03 20:48:19 2014 +0000

description:
Add some notes on using these shims to port Linux kernel code.

diffstat:

 sys/external/bsd/common/include/linux/completion.h |  16 +++++++++++++++-
 sys/external/bsd/common/include/linux/errno.h      |  11 ++++++++++-
 sys/external/bsd/common/include/linux/list.h       |  14 +++++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)

diffs (83 lines):

diff -r 26e595a0f9f3 -r ac98f48b7854 sys/external/bsd/common/include/linux/completion.h
--- a/sys/external/bsd/common/include/linux/completion.h        Thu Jul 03 19:09:16 2014 +0000
+++ b/sys/external/bsd/common/include/linux/completion.h        Thu Jul 03 20:48:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: completion.h,v 1.3 2014/05/05 15:59:11 skrll Exp $     */
+/*     $NetBSD: completion.h,v 1.4 2014/07/03 20:48:19 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -29,6 +29,20 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Notes on porting:
+ *
+ * - Linux does not have destroy_completion.  You must add it yourself
+ *   in the appropriate place.
+ *
+ * - Some Linux code does `completion->done++' or similar.  Convert
+ *   that to complete(completion) and suggest the same change upstream,
+ *   unless it turns out there actually is a good reason to do that, in
+ *   which case the Linux completion API should be extended with a
+ *   sensible name for this that doesn't expose the guts of `struct
+ *   completion'.
+ */
+
 #ifndef _LINUX_COMPLETION_H_
 #define _LINUX_COMPLETION_H_
 
diff -r 26e595a0f9f3 -r ac98f48b7854 sys/external/bsd/common/include/linux/errno.h
--- a/sys/external/bsd/common/include/linux/errno.h     Thu Jul 03 19:09:16 2014 +0000
+++ b/sys/external/bsd/common/include/linux/errno.h     Thu Jul 03 20:48:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: errno.h,v 1.1 2014/04/07 11:55:29 riastradh Exp $      */
+/*     $NetBSD: errno.h,v 1.2 2014/07/03 20:48:19 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -29,6 +29,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Notes on porting:
+ *
+ * - Linux consistently passes around negative errno values.  NetBSD
+ *   consistently passes around positive ones, except the special magic
+ *   in-kernel ones (EJUSTRETURN, ERESTART, &c.) which should not be
+ *   exposed to userland.  Be careful!
+ */
+
 #ifndef _LINUX_ERRNO_H_
 #define _LINUX_ERRNO_H_
 
diff -r 26e595a0f9f3 -r ac98f48b7854 sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Thu Jul 03 19:09:16 2014 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Thu Jul 03 20:48:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.1 2013/09/05 15:28:07 skrll Exp $   */
+/*     $NetBSD: list.h,v 1.2 2014/07/03 20:48:19 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -29,6 +29,18 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Notes on porting:
+ *
+ * - LIST_HEAD(x) means a declaration `struct list_head x =
+ *   LIST_HEAD_INIT(x)' in Linux, but something else in NetBSD.
+ *   Replace by the expansion.
+ *
+ * - The `_rcu' routines here are not actually pserialize(9)-safe.
+ *   They need dependent read memory barriers added.  Please fix this
+ *   if you need to use them with pserialize(9).
+ */
+
 #ifndef _LINUX_LIST_H_
 #define _LINUX_LIST_H_
 



Home | Main Index | Thread Index | Old Index