Module Name: src
Committed By: riastradh
Date: Thu Jul 3 20:48:19 UTC 2014
Modified Files:
src/sys/external/bsd/common/include/linux: completion.h errno.h list.h
Log Message:
Add some notes on using these shims to port Linux kernel code.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/common/include/linux/completion.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/common/include/linux/errno.h \
src/sys/external/bsd/common/include/linux/list.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/external/bsd/common/include/linux/completion.h
diff -u src/sys/external/bsd/common/include/linux/completion.h:1.3 src/sys/external/bsd/common/include/linux/completion.h:1.4
--- src/sys/external/bsd/common/include/linux/completion.h:1.3 Mon May 5 15:59:11 2014
+++ src/sys/external/bsd/common/include/linux/completion.h Thu Jul 3 20:48:19 2014
@@ -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_
Index: src/sys/external/bsd/common/include/linux/errno.h
diff -u src/sys/external/bsd/common/include/linux/errno.h:1.1 src/sys/external/bsd/common/include/linux/errno.h:1.2
--- src/sys/external/bsd/common/include/linux/errno.h:1.1 Mon Apr 7 11:55:29 2014
+++ src/sys/external/bsd/common/include/linux/errno.h Thu Jul 3 20:48:19 2014
@@ -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_
Index: src/sys/external/bsd/common/include/linux/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.1 src/sys/external/bsd/common/include/linux/list.h:1.2
--- src/sys/external/bsd/common/include/linux/list.h:1.1 Thu Sep 5 15:28:07 2013
+++ src/sys/external/bsd/common/include/linux/list.h Thu Jul 3 20:48:19 2014
@@ -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_