Module Name: src
Committed By: pooka
Date: Fri May 22 10:51:54 UTC 2009
Modified Files:
src/sys/rump/include/rump: rump.h
src/sys/rump/librump/rumpvfs: compat.c
Log Message:
Add compat routines for vattr translation over time_t change.
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/rump/include/rump/rump.h
cvs rdiff -u -r1.1 -r1.2 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.20 src/sys/rump/include/rump/rump.h:1.21
--- src/sys/rump/include/rump/rump.h:1.20 Fri May 22 08:59:32 2009
+++ src/sys/rump/include/rump/rump.h Fri May 22 10:51:54 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.h,v 1.20 2009/05/22 08:59:32 pooka Exp $ */
+/* $NetBSD: rump.h,v 1.21 2009/05/22 10:51:54 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -163,6 +163,13 @@
int rump_sys___lstat30(const char *, struct stat *);
/*
+ * Other compat glue (for sniffing purposes)
+ * XXX: (lack of) types
+ */
+void rump_vattr50_to_vattr(const struct vattr *, struct vattr *);
+void rump_vattr_to_vattr50(const struct vattr *, struct vattr *);
+
+/*
* Begin rump syscall conditionals. Yes, something a little better
* is required here.
*/
Index: src/sys/rump/librump/rumpvfs/compat.c
diff -u src/sys/rump/librump/rumpvfs/compat.c:1.1 src/sys/rump/librump/rumpvfs/compat.c:1.2
--- src/sys/rump/librump/rumpvfs/compat.c:1.1 Fri May 22 08:59:32 2009
+++ src/sys/rump/librump/rumpvfs/compat.c Fri May 22 10:51:54 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $ */
+/* $NetBSD: compat.c,v 1.2 2009/05/22 10:51:54 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,10 +28,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.2 2009/05/22 10:51:54 pooka Exp $");
#include <sys/param.h>
+#include <sys/kmem.h>
#include <sys/syscallargs.h>
+#include <sys/vnode.h>
+
+#include <compat/sys/time.h>
#include <rump/rump.h>
#include <rump/rumpuser.h>
@@ -49,6 +53,29 @@
#define SPARG(p,k) ((p)->k.le.datum)
#endif
+struct vattr50 {
+ enum vtype va_type; /* vnode type (for create) */
+ mode_t va_mode; /* files access mode and type */
+ nlink_t va_nlink; /* number of references to file */
+ uid_t va_uid; /* owner user id */
+ gid_t va_gid; /* owner group id */
+ u_long va_fsid; /* file system id (dev for now) */
+ ino_t va_fileid; /* file id */
+ u_quad_t va_size; /* file size in bytes */
+ long va_blocksize; /* blocksize preferred for i/o */
+ struct timespec50 va_atime; /* time of last access */
+ struct timespec50 va_mtime; /* time of last modification */
+ struct timespec50 va_ctime; /* time file changed */
+ struct timespec50 va_birthtime; /* time file created */
+ u_long va_gen; /* generation number of file */
+ u_long va_flags; /* flags defined for file */
+ uint32_t va_rdev; /* device the special file represents */
+ u_quad_t va_bytes; /* bytes of disk space held by file */
+ u_quad_t va_filerev; /* file modification number */
+ u_int va_vaflags; /* operations flags, see below */
+ long va_spare; /* remain quad aligned */
+};
+
int
rump_sys___stat30(const char *path, struct stat *sb)
{
@@ -84,3 +111,59 @@
}
return retval;
}
+
+/*
+ * XXX: types. But I don't want to start playing compat games in
+ * the userspace namespace too
+ */
+void
+rump_vattr50_to_vattr(const struct vattr *_va50, struct vattr *va)
+{
+ const struct vattr50 *va50 = (const struct vattr50 *)_va50;
+
+ va->va_type = va50->va_type;
+ va->va_mode = va50->va_mode;
+ va->va_nlink = va50->va_nlink;
+ va->va_uid = va50->va_uid;
+ va->va_gid = va50->va_gid;
+ va->va_fsid = (long)va50->va_fsid;
+ va->va_fileid = va50->va_fileid;
+ va->va_size = va50->va_size;
+ va->va_blocksize = va50->va_blocksize;
+ timespec50_to_timespec(&va50->va_atime, &va->va_atime);
+ timespec50_to_timespec(&va50->va_ctime, &va->va_ctime);
+ timespec50_to_timespec(&va50->va_mtime, &va->va_mtime);
+ timespec50_to_timespec(&va50->va_birthtime, &va->va_birthtime);
+ va->va_gen = va50->va_gen;
+ va->va_flags = va50->va_flags;
+ va->va_rdev = (int32_t)va50->va_rdev;
+ va->va_bytes = va50->va_bytes;
+ va->va_filerev = va50->va_filerev;
+ va->va_vaflags = va50->va_flags;
+}
+
+void
+rump_vattr_to_vattr50(const struct vattr *va, struct vattr *_va50)
+{
+ struct vattr50 *va50 = (struct vattr50 *)_va50;
+
+ va50->va_type = va->va_type;
+ va50->va_mode = va->va_mode;
+ va50->va_nlink = va->va_nlink;
+ va50->va_uid = va->va_uid;
+ va50->va_gid = va->va_gid;
+ va50->va_fsid = (u_long)va->va_fsid;
+ va50->va_fileid = va->va_fileid;
+ va50->va_size = va->va_size;
+ va50->va_blocksize = va->va_blocksize;
+ timespec_to_timespec50(&va->va_atime, &va50->va_atime);
+ timespec_to_timespec50(&va->va_ctime, &va50->va_ctime);
+ timespec_to_timespec50(&va->va_mtime, &va50->va_mtime);
+ timespec_to_timespec50(&va->va_birthtime, &va50->va_birthtime);
+ va50->va_gen = va->va_gen;
+ va50->va_flags = va->va_flags;
+ va50->va_rdev = (uint32_t)va->va_rdev;
+ va50->va_bytes = va->va_bytes;
+ va50->va_filerev = va->va_filerev;
+ va50->va_vaflags = va->va_flags;
+}