xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xenpaging: Open paging file only if xenpaging_init() succeeds
@ 2010-08-10  8:54 Olaf Hering
  0 siblings, 0 replies; only message in thread
From: Olaf Hering @ 2010-08-10  8:54 UTC (permalink / raw)
  To: xen-devel


Open paging file only if xenpaging_init() succeeds.
It can fail if the host does not support the required virtualization features such as EPT.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 tools/xenpaging/xenpaging.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- xen-unstable.hg-4.1.21890.orig/tools/xenpaging/xenpaging.c
+++ xen-unstable.hg-4.1.21890/tools/xenpaging/xenpaging.c
@@ -499,15 +499,6 @@ int main(int argc, char *argv[])
 
     victims = calloc(num_pages, sizeof(xenpaging_victim_t));
 
-    /* Open file */
-    sprintf(filename, "page_cache_%d", domain_id);
-    fd = open(filename, open_flags, open_mode);
-    if ( fd < 0 )
-    {
-        perror("failed to open file");
-        return -1;
-    }
-
     /* Seed random-number generator */
     srand(time(NULL));
 
@@ -519,6 +510,15 @@ int main(int argc, char *argv[])
         goto out;
     }
 
+    /* Open file */
+    sprintf(filename, "page_cache_%d", domain_id);
+    fd = open(filename, open_flags, open_mode);
+    if ( fd < 0 )
+    {
+        perror("failed to open file");
+        return -1;
+    }
+
     /* Evict pages */
     memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages);
     for ( i = 0; i < num_pages; i++ )

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-10  8:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-10  8:54 [PATCH] xenpaging: Open paging file only if xenpaging_init() succeeds Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).