merge and resolve soucre conflicts.
authorKitae Kim <kt920.kim@samsung.com>
Thu, 4 Jul 2013 05:01:21 +0000 (14:01 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Thu, 4 Jul 2013 05:06:57 +0000 (14:06 +0900)
Change-Id: I51a12628b4b36c5756988221e9f3cf411ff3c822
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
block/raw-win32.c
qemu-char.c

index 06af7a53314278699b49ea5b2ccf95f214d9f1d1..bc7825927ae84a423ac35f8ece8e262a09f734bd 100644 (file)
@@ -246,22 +246,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
 
     s->type = FTYPE_FILE;
 
-<<<<<<< HEAD
-#ifndef CONFIG_MARU
-    if (flags & BDRV_O_RDWR) {
-        access_flags = GENERIC_READ | GENERIC_WRITE;
-    } else {
-        access_flags = GENERIC_READ;
-    }
-
-    overlapped = FILE_ATTRIBUTE_NORMAL;
-    if (flags & BDRV_O_NOCACHE)
-        overlapped |= FILE_FLAG_NO_BUFFERING;
-    if (!(flags & BDRV_O_CACHE_WB))
-        overlapped |= FILE_FLAG_WRITE_THROUGH;
-    s->hfile = CreateFile(filename,
-                          access_flags,
-=======
     opts = qemu_opts_create_nofail(&raw_runtime_opts);
     qemu_opts_absorb_qdict(opts, options, &local_err);
     if (error_is_set(&local_err)) {
@@ -273,6 +257,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
 
     filename = qemu_opt_get(opts, "filename");
 
+#ifndef CONFIG_MARU
     raw_parse_flags(flags, &access_flags, &overlapped);
 
     if ((flags & BDRV_O_NATIVE_AIO) && aio == NULL) {
@@ -284,7 +269,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
     }
 
     s->hfile = CreateFile(filename, access_flags,
->>>>>>> test1.5
                           FILE_SHARE_READ, NULL,
                           OPEN_EXISTING, overlapped, NULL);
        if (s->hfile == INVALID_HANDLE_VALUE) {
@@ -297,12 +281,11 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
         }
         goto fail;
     }
-
-<<<<<<< HEAD
 #else
 #include <errno.h>
-       int open_flags = O_BINARY;
-       open_flags &= ~O_ACCMODE;
+       int open_flags, ret;
+
+       open_flags = O_BINARY & ~O_ACCMODE;
        if (flags & BDRV_O_RDWR) {
                open_flags |= O_RDWR;
        } else {
@@ -320,16 +303,22 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
        }
        */
 
-       int ret = qemu_open(filename, open_flags, 0644);
+       if ((flags & BDRV_O_NATIVE_AIO) && aio == NULL) {
+               aio = win32_aio_init();
+               if (aio == NULL) {
+                       ret = -EINVAL;
+                       goto fail;
+               }
+       }
+
+       ret = qemu_open(filename, open_flags, 0644);
        if (ret < 0) {
                error_report("raw_open failed(%d) \n", ret);
                return -errno;
        }
        s->hfile = (HANDLE)_get_osfhandle(ret);
-
 #endif
-       return 0;
-=======
+
     if (flags & BDRV_O_NATIVE_AIO) {
         ret = win32_aio_attach(aio, s->hfile);
         if (ret < 0) {
@@ -343,7 +332,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags)
 fail:
     qemu_opts_del(opts);
     return ret;
->>>>>>> test1.5
 }
 
 static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,
@@ -603,30 +591,12 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
     }
     s->type = find_device_type(bs, filename);
 
-<<<<<<< HEAD
 #ifndef CONFIG_MARU
-       if (flags & BDRV_O_RDWR) {
-        access_flags = GENERIC_READ | GENERIC_WRITE;
-    } else {
-        access_flags = GENERIC_READ;
-    }
-    create_flags = OPEN_EXISTING;
-
-    overlapped = FILE_ATTRIBUTE_NORMAL;
-    if (flags & BDRV_O_NOCACHE)
-        overlapped |= FILE_FLAG_NO_BUFFERING;
-    if (!(flags & BDRV_O_CACHE_WB))
-        overlapped |= FILE_FLAG_WRITE_THROUGH;
-
-    s->hfile = CreateFile(filename,
-                          access_flags,
-=======
     raw_parse_flags(flags, &access_flags, &overlapped);
 
     create_flags = OPEN_EXISTING;
 
     s->hfile = CreateFile(filename, access_flags,
->>>>>>> test1.5
                           FILE_SHARE_READ, NULL,
                           create_flags, overlapped, NULL);
        if (s->hfile == INVALID_HANDLE_VALUE) {
@@ -636,7 +606,6 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
             return -EACCES;
         return -1;
     }
-
 #else
        /*
     s->hfile = CreateFile(g_win32_locale_filename_from_utf8(filename),
@@ -671,9 +640,8 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
                return -errno;
        }
        s->hfile = (HANDLE)_get_osfhandle(ret);
-
 #endif
-       return 0;
+    return 0;
 }
 
 static int hdev_has_zero_init(BlockDriverState *bs)
index 3319b857958c5330d802b4b68cc8676195e22ced..aefa663b89e527f0c0e9a93c01836cdc646deec0 100644 (file)
@@ -1932,36 +1932,6 @@ static CharDriverState *qemu_chr_open_win_con(void)
     return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));
 }
 
-<<<<<<< HEAD
-static CharDriverState *qemu_chr_open_win_file_out(QemuOpts *opts)
-{
-    const char *file_out = qemu_opt_get(opts, "path");
-    HANDLE fd_out;
-
-#ifndef CONFIG_MARU
-    fd_out = CreateFile(file_out, GENERIC_WRITE, FILE_SHARE_READ, NULL,
-                        OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-#else
-       int open_flags = O_BINARY | O_RDWR | O_CREAT | O_TRUNC;
-
-       int ret = qemu_open(file_out, open_flags, 0644);
-       if (ret < 0) {
-               error_report("qemu_chr_open_win_file_out failed(%d) \n", ret);
-               return -errno;
-       }
-       fd_out = (HANDLE)_get_osfhandle(ret);
-
-#endif
-
-    if (fd_out == INVALID_HANDLE_VALUE) {
-        return NULL;
-    }
-
-    return qemu_chr_open_win_file(fd_out);
-}
-
-=======
->>>>>>> test1.5
 static int win_stdio_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
     HANDLE  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -3550,12 +3520,25 @@ static CharDriverState *qmp_chardev_open_file(ChardevFile *file, Error **errp)
         return NULL;
     }
 
+#ifndef CONFIG_MARU
     out = CreateFile(file->out, GENERIC_WRITE, FILE_SHARE_READ, NULL,
                      OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+#else
+       int open_flags, ret;
+
+       open_flags = O_BINARY | O_RDWR | O_CREAT | O_TRUNC;
+       ret = qemu_open(file_out, open_flags, 0644);
+       if (ret < 0) {
+               error_report("qemu_chr_open_win_file_out failed(%d) \n", ret);
+               return -errno;
+       }
+       out = (HANDLE)_get_osfhandle(ret);
+#endif
     if (out == INVALID_HANDLE_VALUE) {
         error_setg(errp, "open %s failed", file->out);
         return NULL;
     }
+
     return qemu_chr_open_win_file(out);
 }