Module Name: src
Committed By: pooka
Date: Fri May 22 08:59:32 UTC 2009
Modified Files:
src/sys/rump/include/rump: rump.h
src/sys/rump/librump/rumpvfs: Makefile.rumpvfs
Added Files:
src/sys/rump/librump/rumpvfs: compat.c
Log Message:
Add handrolled stat30 compat syscalls for calling post-time_t rump
kernels from pre-time_t userlands.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/rump/include/rump/rump.h
cvs rdiff -u -r1.6 -r1.7 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs
cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpvfs/compat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/include/rump/rump.h
diff -u src/sys/rump/include/rump/rump.h:1.19 src/sys/rump/include/rump/rump.h:1.20
--- src/sys/rump/include/rump/rump.h:1.19 Fri May 22 08:34:14 2009
+++ src/sys/rump/include/rump/rump.h Fri May 22 08:59:32 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.h,v 1.19 2009/05/22 08:34:14 pooka Exp $ */
+/* $NetBSD: rump.h,v 1.20 2009/05/22 08:59:32 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -157,6 +157,12 @@
int rump_sysproxy_socket_setup_server(int);
/*
+ * compat syscalls. these are currently hand-"generated"
+ */
+int rump_sys___stat30(const char *, struct stat *);
+int rump_sys___lstat30(const char *, struct stat *);
+
+/*
* Begin rump syscall conditionals. Yes, something a little better
* is required here.
*/
Index: src/sys/rump/librump/rumpvfs/Makefile.rumpvfs
diff -u src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.6 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.7
--- src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.6 Thu Mar 19 09:14:37 2009
+++ src/sys/rump/librump/rumpvfs/Makefile.rumpvfs Fri May 22 08:59:32 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpvfs,v 1.6 2009/03/19 09:14:37 pooka Exp $
+# $NetBSD: Makefile.rumpvfs,v 1.7 2009/05/22 08:59:32 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -8,7 +8,8 @@
.PATH: ${RUMPTOP}/librump/rumpvfs \
${RUMPTOP}/../kern ${RUMPTOP}/../lib/libkern \
${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs \
- ${RUMPTOP}/../miscfs/specfs
+ ${RUMPTOP}/../miscfs/specfs \
+ ${RUMPTOP}/../compat/common
#
# Source modules, first the ones specifically implemented for librump.
@@ -32,6 +33,9 @@
SRCS+= subr_bufq.c bufq_disksort.c bufq_fcfs.c bufq_priocscan.c \
bufq_readprio.c
+# compat syscalls
+SRCS+= vfs_syscalls_50.c compat.c
+
SRCS+= rumpvnode_if.c
# no shlib_version because this is automatically in sync with lib/librump
Added files:
Index: src/sys/rump/librump/rumpvfs/compat.c
diff -u /dev/null src/sys/rump/librump/rumpvfs/compat.c:1.1
--- /dev/null Fri May 22 08:59:32 2009
+++ src/sys/rump/librump/rumpvfs/compat.c Fri May 22 08:59:32 2009
@@ -0,0 +1,86 @@
+/* $NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $ */
+
+/*
+ * Copyright (c) 2009 Antti Kantee. All Rights Reserved.
+ *
+ * Development of this software was supported by the Nokia Foundation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $");
+
+#include <sys/param.h>
+#include <sys/syscallargs.h>
+
+#include <rump/rump.h>
+#include <rump/rumpuser.h>
+
+/*
+ * XXX: these are handwritten for now. They provide compat for
+ * calling post-time_t file systems from a pre-time_t userland.
+ * (mknod is missing. I don't care very much)
+ *
+ * Doing remote system calls with these does not (obviously) work.
+ */
+#if BYTE_ORDER == BIG_ENDIAN
+#define SPARG(p,k) ((p)->k.be.datum)
+#else /* LITTLE_ENDIAN, I hope dearly */
+#define SPARG(p,k) ((p)->k.le.datum)
+#endif
+
+int
+rump_sys___stat30(const char *path, struct stat *sb)
+{
+ struct compat_50_sys___stat30_args args;
+ register_t retval = 0;
+ int error = 0;
+
+ SPARG(&args, path) = path;
+ SPARG(&args, ub) = (struct stat30 *)sb;
+
+ error = compat_50_sys___stat30(curlwp, &args, &retval);
+ if (error) {
+ retval = -1;
+ rumpuser_seterrno(error);
+ }
+ return retval;
+}
+
+int
+rump_sys___lstat30(const char *path, struct stat *sb)
+{
+ struct compat_50_sys___lstat30_args args;
+ register_t retval = 0;
+ int error = 0;
+
+ SPARG(&args, path) = path;
+ SPARG(&args, ub) = (struct stat30 *)sb;
+
+ error = compat_50_sys___lstat30(curlwp, &args, &retval);
+ if (error) {
+ retval = -1;
+ rumpuser_seterrno(error);
+ }
+ return retval;
+}