WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] stubdom: support file creation

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] stubdom: support file creation
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 11 Mar 2008 17:36:52 +0000
Delivery-date: Tue, 11 Mar 2008 11:09:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Stubdom: add support for file creation.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 73ec21ad5dc7 extras/mini-os/include/fcntl.h
--- a/extras/mini-os/include/fcntl.h    Tue Mar 11 16:01:04 2008 +0000
+++ b/extras/mini-os/include/fcntl.h    Tue Mar 11 17:35:14 2008 +0000
@@ -1,5 +1,9 @@
 #ifndef _I386_FCNTL_H
 #define _I386_FCNTL_H
+
+#ifdef HAVE_LIBC
+#include_next <fcntl.h>
+#else
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -90,3 +94,5 @@ int open(const char *path, int flags, ..
 int open(const char *path, int flags, ...);
 int fcntl(int fd, int cmd, ...);
 #endif
+
+#endif
diff -r 73ec21ad5dc7 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c  Tue Mar 11 16:01:04 2008 +0000
+++ b/extras/mini-os/lib/sys.c  Tue Mar 11 17:35:14 2008 +0000
@@ -172,8 +172,26 @@ int open(const char *pathname, int flags
         printk("open(%s) -> %d\n", pathname, fd);
         return fd;
     }
-    printk("open(%s)", pathname);
-    fs_fd = fs_open(fs_import, (void *) pathname);
+    printk("open(%s, %x)", pathname, flags);
+    switch (flags & ~O_ACCMODE) {
+        case 0:
+            fs_fd = fs_open(fs_import, (void *) pathname);
+            break;
+        case O_CREAT|O_TRUNC:
+        {
+            va_list ap;
+            mode_t mode;
+            va_start(ap, flags);
+            mode = va_arg(ap, mode_t);
+            va_end(ap);
+            fs_fd = fs_create(fs_import, (void *) pathname, 0, mode);
+            break;
+        }
+        default:
+            printk(" unsupported flags\n");
+            stack_walk();
+            do_exit();
+    }
     if (fs_fd < 0) {
        errno = EIO;
        return -1;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] stubdom: support file creation, Samuel Thibault <=