[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH for discussion only 1/3] handle: Define DEFAULT_MEMSIZE, MIN_MEMSIZE constants.



From: "Richard W.M. Jones" <rjones redhat com>

This is just code motion.
---
 src/guestfs-internal.h | 4 ++++
 src/handle.c           | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index c52b9a5..48ab745 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -56,6 +56,10 @@
 #define TRACE4(name, arg1, arg2, arg3, arg4)
 #endif
 
+/* Default, minimum appliance memory size. */
+#define DEFAULT_MEMSIZE 500
+#define MIN_MEMSIZE 128
+
 /* Some limits on what the inspection code will read, for safety. */
 
 /* Small text configuration files.
diff --git a/src/handle.c b/src/handle.c
index 786ba13..c630daf 100644
--- a/src/handle.c
+++ b/src/handle.c
@@ -101,7 +101,7 @@ guestfs_create_flags (unsigned flags, ...)
   g->recovery_proc = 1;
   g->autosync = 1;
 
-  g->memsize = 500;
+  g->memsize = DEFAULT_MEMSIZE;
 
   /* Start with large serial numbers so they are easy to spot
    * inside the protocol.
@@ -202,7 +202,7 @@ parse_environment (guestfs_h *g,
 
   str = do_getenv (data, "LIBGUESTFS_MEMSIZE");
   if (str) {
-    if (sscanf (str, "%d", &memsize) != 1 || memsize < 128) {
+    if (sscanf (str, "%d", &memsize) != 1 || memsize < MIN_MEMSIZE) {
       error (g, _("non-numeric or too small value for LIBGUESTFS_MEMSIZE"));
       return -1;
     }
-- 
1.8.1.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]