mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0024-drives-Ensure-all-scratch-drives-use-cachemode-unsaf.patch

022f11
From 053061f66f79d21bb48d089717a171470e05e47e Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Sat, 31 Aug 2013 22:38:03 +0100
022f11
Subject: [PATCH] drives: Ensure all scratch drives use cachemode "unsafe".
022f11
022f11
They are _scratch_ drives so any data on them doesn't matter and can
022f11
be reconstructed in the event of a host system crash.
022f11
022f11
(cherry picked from commit 96cd7fcecb031bfe6baa49addfb026ae988fb7c1)
022f11
---
022f11
 src/drives.c | 6 ++++--
022f11
 1 file changed, 4 insertions(+), 2 deletions(-)
022f11
022f11
diff --git a/src/drives.c b/src/drives.c
022f11
index 97be2ed..f310b06 100644
022f11
--- a/src/drives.c
022f11
+++ b/src/drives.c
022f11
@@ -1029,13 +1029,15 @@ int
022f11
 guestfs__add_drive_scratch (guestfs_h *g, int64_t size,
022f11
                                  const struct guestfs_add_drive_scratch_argv *optargs)
022f11
 {
022f11
-  struct guestfs_add_drive_opts_argv add_drive_optargs;
022f11
+  struct guestfs_add_drive_opts_argv add_drive_optargs = { .bitmask = 0 };
022f11
   CLEANUP_FREE char *filename = NULL;
022f11
   int fd;
022f11
 
022f11
   /* Some parameters we always set. */
022f11
-  add_drive_optargs.bitmask = GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK;
022f11
+  add_drive_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK;
022f11
   add_drive_optargs.format = "raw";
022f11
+  add_drive_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_CACHEMODE_BITMASK;
022f11
+  add_drive_optargs.cachemode = "unsafe";
022f11
 
022f11
   /* Copy the optional arguments through to guestfs_add_drive_opts. */
022f11
   if (optargs->bitmask & GUESTFS_ADD_DRIVE_SCRATCH_NAME_BITMASK) {
022f11
-- 
022f11
1.8.3.1
022f11