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

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User ack@xxxxxxxxxxxxxxxxxxxxx
# Node ID c157418212d820f03552f8dff87b2859fa2257e1
# Parent  18f8dde91fbd46af9eb38352ed64e48d429f95d8
# Parent  266573a53949e97bdfbc75d0de58f41dc62bd821
Merge
---
 tools/python/xen/util/security.py |   22 +++++++++++++---------
 tools/python/xen/xm/addlabel.py   |   18 ++++++++++++------
 tools/python/xen/xm/getlabel.py   |   19 +++++++++++--------
 tools/python/xen/xm/resources.py  |   23 ++++++++++++++++-------
 tools/python/xen/xm/rmlabel.py    |   20 ++++++++++++--------
 xen/include/public/arch-ia64.h    |    2 ++
 xen/include/public/arch-x86_32.h  |    2 ++
 xen/include/public/arch-x86_64.h  |    2 ++
 xen/include/public/memory.h       |   12 ++++++------
 9 files changed, 76 insertions(+), 44 deletions(-)

diff -r 18f8dde91fbd -r c157418212d8 tools/python/xen/util/security.py
--- a/tools/python/xen/util/security.py Thu Jun 29 14:39:07 2006 +0100
+++ b/tools/python/xen/util/security.py Thu Jun 29 14:49:41 2006 +0100
@@ -22,10 +22,10 @@ import sys, os, string, re
 import sys, os, string, re
 import traceback
 import shutil
+#from xml.marshal import generic
 from xen.lowlevel import acm
 from xen.xend import sxp
 from xen.xend.XendLogging import log
-from xen.util import dictio
 
 #global directories and tools for security management
 policy_dir_prefix = "/etc/xen/acm-security/policies"
@@ -551,16 +551,20 @@ def get_res_label(resource):
     (label, policy) = default_res_label()
 
     # load the resource label file
-    res_label_cache = {}
-    try:
-        res_label_cache = dictio.dict_read("resources", res_label_filename)
-    except:
+    configfile = res_label_filename
+    if not os.path.isfile(configfile):
         log.info("Resource label file not found.")
         return default_res_label()
-
-    # find the resource information
-    if res_label_cache.has_key(resource):
-        (policy, label) = res_label_cache[resource]
+#
+# Commented out pending replacement for xml.marshal.generic
+#
+#     fd = open(configfile, "rb")
+#     res_label_cache = generic.load(fd)
+#     fd.close()
+
+#     # find the resource information
+#     if res_label_cache.has_key(resource):
+#         (policy, label) = res_label_cache[resource]
 
     return (label, policy)
 
diff -r 18f8dde91fbd -r c157418212d8 tools/python/xen/xm/addlabel.py
--- a/tools/python/xen/xm/addlabel.py   Thu Jun 29 14:39:07 2006 +0100
+++ b/tools/python/xen/xm/addlabel.py   Thu Jun 29 14:49:41 2006 +0100
@@ -22,7 +22,7 @@ import sys, os
 import sys, os
 import string
 import traceback
-from xen.util import dictio
+#from xml.marshal import generic
 from xen.util import security
 
 def usage():
@@ -79,13 +79,17 @@ def add_resource_label(label, resource, 
             return
 
         # see if this resource is already in the file
-        access_control = {}
         file = security.res_label_filename
-        try:
-            access_control = dictio.dict_read("resources", file)
-        except:
+        if not os.path.isfile(file):
             print "Resource file not found, creating new file at:"
             print "%s" % (file)
+            fd = open(file, "w")
+            fd.close();
+            access_control = {}
+        else:
+            fd = open(file, "rb")
+#            access_control = generic.load(fd)
+            fd.close()
 
         if access_control.has_key(resource):
             security.err("This resource is already labeled.")
@@ -93,7 +97,9 @@ def add_resource_label(label, resource, 
         # write the data to file
         new_entry = { resource : tuple([policyref, label]) }
         access_control.update(new_entry)
-        dictio.dict_write(access_control, "resources", file)
+        fd = open(file, "wb")
+#        generic.dump(access_control, fd)
+        fd.close()
 
     except security.ACMError:
         pass
diff -r 18f8dde91fbd -r c157418212d8 tools/python/xen/xm/getlabel.py
--- a/tools/python/xen/xm/getlabel.py   Thu Jun 29 14:39:07 2006 +0100
+++ b/tools/python/xen/xm/getlabel.py   Thu Jun 29 14:49:41 2006 +0100
@@ -21,7 +21,7 @@ import sys, os, re
 import sys, os, re
 import string
 import traceback
-from xen.util import dictio
+#from xml.marshal import generic
 from xen.util import security
 
 def usage():
@@ -33,15 +33,17 @@ def get_resource_label(resource):
 def get_resource_label(resource):
     """Gets the resource label
     """
-    # read in the resource file
-    file = security.res_label_filename
     try:
-        access_control = dictio.dict_read("resources", file)
-    except:
-        print "Resource label file not found"
-        return
+        # read in the resource file
+        file = security.res_label_filename
+        if os.path.isfile(file):
+            fd = open(file, "rb")
+#            access_control = generic.load(fd)
+            fd.close()
+        else:
+            print "Resource label file not found"
+            return
 
-    try:
         # get the entry and print label
         if access_control.has_key(resource):
             policy = access_control[resource][0]
@@ -98,6 +100,7 @@ def get_domain_label(configfile):
         data = data.strip()
         data = data.lstrip("[\'")
         data = data.rstrip("\']")
+        (p, l) = data.split(",")
         print data
 
     except security.ACMError:
diff -r 18f8dde91fbd -r c157418212d8 tools/python/xen/xm/resources.py
--- a/tools/python/xen/xm/resources.py  Thu Jun 29 14:39:07 2006 +0100
+++ b/tools/python/xen/xm/resources.py  Thu Jun 29 14:49:41 2006 +0100
@@ -21,7 +21,7 @@ import sys, os
 import sys, os
 import string
 import traceback
-from xen.util import dictio
+#from xml.marshal import generic
 from xen.util import security
 
 def usage():
@@ -40,15 +40,24 @@ def print_resource_data(access_control):
         print "    label:  "+label
 
 
+def get_resource_data():
+    """Returns the resource dictionary.
+    """
+    file = security.res_label_filename
+    if not os.path.isfile(file):
+        security.err("Resource file not found.")
+
+    fd = open(file, "rb")
+#    access_control = generic.load(fd)
+    fd.close()
+    return access_control
+
+
 def main (argv):
     try:
-        file = security.res_label_filename
-        access_control = dictio.dict_read("resources", file)
-    except:
-        security.err("Resource file not found.")
+        access_control = get_resource_data()
+        print_resource_data(access_control)
 
-    try:
-        print_resource_data(access_control)
     except security.ACMError:
         pass
     except:
diff -r 18f8dde91fbd -r c157418212d8 tools/python/xen/xm/rmlabel.py
--- a/tools/python/xen/xm/rmlabel.py    Thu Jun 29 14:39:07 2006 +0100
+++ b/tools/python/xen/xm/rmlabel.py    Thu Jun 29 14:49:41 2006 +0100
@@ -21,7 +21,7 @@ import sys, os, re
 import sys, os, re
 import string
 import traceback
-from xen.util import dictio
+#from xml.marshal import generic
 from xen.util import security
 
 def usage():
@@ -36,18 +36,22 @@ def rm_resource_label(resource):
 def rm_resource_label(resource):
     """Removes a resource label from the global resource label file.
     """
-    # read in the resource file
-    file = security.res_label_filename
     try:
-        access_control = dictio.dict_read("resources", file)
-    except:
-        security.err("Resource file not found, cannot remove label!")
+        # read in the resource file
+        file = security.res_label_filename
+        if os.path.isfile(file):
+            fd = open(file, "rb")
+#            access_control = generic.load(fd)
+            fd.close()
+        else:
+            security.err("Resource file not found, cannot remove label!")
 
-    try:
         # remove the entry and update file
         if access_control.has_key(resource):
             del access_control[resource]
-            dictio.dict_write(access_control, "resources", file)
+            fd = open(file, "wb")
+#            generic.dump(access_control, fd)
+            fd.close()
         else:
             security.err("Label does not exist in resource label file.")
 
diff -r 18f8dde91fbd -r c157418212d8 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Thu Jun 29 14:39:07 2006 +0100
+++ b/xen/include/public/arch-ia64.h    Thu Jun 29 14:49:41 2006 +0100
@@ -39,6 +39,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 64
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 #define MAX_NR_SECTION  32  /* at most 32 memory holes */
 struct mm_section {
diff -r 18f8dde91fbd -r c157418212d8 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h  Thu Jun 29 14:39:07 2006 +0100
+++ b/xen/include/public/arch-x86_32.h  Thu Jun 29 14:49:41 2006 +0100
@@ -97,6 +97,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 32
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 /*
  * Send an array of these to HYPERVISOR_set_trap_table()
diff -r 18f8dde91fbd -r c157418212d8 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h  Thu Jun 29 14:39:07 2006 +0100
+++ b/xen/include/public/arch-x86_64.h  Thu Jun 29 14:49:41 2006 +0100
@@ -104,6 +104,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 32
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 /*
  * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
diff -r 18f8dde91fbd -r c157418212d8 xen/include/public/memory.h
--- a/xen/include/public/memory.h       Thu Jun 29 14:39:07 2006 +0100
+++ b/xen/include/public/memory.h       Thu Jun 29 14:49:41 2006 +0100
@@ -32,7 +32,7 @@ struct xen_memory_reservation {
     XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
 
     /* Number of extents, and size/alignment of each (2^extent_order pages). */
-    unsigned long  nr_extents;
+    xen_ulong_t    nr_extents;
     unsigned int   extent_order;
 
     /*
@@ -90,7 +90,7 @@ struct xen_memory_exchange {
      *     command will be non-zero.
      *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
      */
-    unsigned long nr_exchanged;
+    xen_ulong_t nr_exchanged;
 };
 typedef struct xen_memory_exchange xen_memory_exchange_t;
 DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
@@ -148,8 +148,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn
  */
 #define XENMEM_machphys_mapping     12
 struct xen_machphys_mapping {
-    unsigned long v_start, v_end; /* Start and end virtual addresses.   */
-    unsigned long max_mfn;        /* Maximum MFN that can be looked up. */
+    xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
+    xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
 };
 typedef struct xen_machphys_mapping xen_machphys_mapping_t;
 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
@@ -170,7 +170,7 @@ struct xen_add_to_physmap {
     unsigned int space;
 
     /* Index into source mapping space. */
-    unsigned long idx;
+    xen_ulong_t idx;
 
     /* GPFN where the source mapping page should appear. */
     xen_pfn_t     gpfn;
@@ -188,7 +188,7 @@ struct xen_translate_gpfn_list {
     domid_t domid;
 
     /* Length of list. */
-    unsigned long nr_gpfns;
+    xen_ulong_t nr_gpfns;
 
     /* List of GPFNs to translate. */
     XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.