direct-io.hg

changeset 10312:c1163951ee2f

[XEN][ACM] Clean up ACM interface to use explicitly-sized types
and guest handles.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 09 16:26:05 2006 +0100 (2006-06-09)
parents 43f1d77bc7ad
children 96b1479305ce
files tools/python/xen/lowlevel/acm/acm.c xen/acm/acm_policy.c xen/include/public/acm_ops.h
line diff
     1.1 --- a/tools/python/xen/lowlevel/acm/acm.c	Fri Jun 09 16:19:42 2006 +0100
     1.2 +++ b/tools/python/xen/lowlevel/acm/acm.c	Fri Jun 09 16:26:05 2006 +0100
     1.3 @@ -52,7 +52,7 @@ void * __getssid(int domid, uint32_t *bu
     1.4      }
     1.5      memset(buf, 0, SSID_BUFFER_SIZE);
     1.6      getssid.interface_version = ACM_INTERFACE_VERSION;
     1.7 -    getssid.ssidbuf = buf;
     1.8 +    set_xen_guest_handle(getssid.ssidbuf, buf);
     1.9      getssid.ssidbuf_size = SSID_BUFFER_SIZE;
    1.10      getssid.get_ssid_by = DOMAINID;
    1.11      getssid.id.domainid = domid;
     2.1 --- a/xen/acm/acm_policy.c	Fri Jun 09 16:19:42 2006 +0100
     2.2 +++ b/xen/acm/acm_policy.c	Fri Jun 09 16:26:05 2006 +0100
     2.3 @@ -32,7 +32,7 @@
     2.4  #include <acm/acm_endian.h>
     2.5  
     2.6  int
     2.7 -acm_set_policy(void *buf, u32 buf_size, int isuserbuffer)
     2.8 +acm_set_policy(XEN_GUEST_HANDLE(void) buf, u32 buf_size, int isuserbuffer)
     2.9  {
    2.10      u8 *policy_buffer = NULL;
    2.11      struct acm_policy_buffer *pol;
    2.12 @@ -45,7 +45,7 @@ acm_set_policy(void *buf, u32 buf_size, 
    2.13          return -ENOMEM;
    2.14  
    2.15      if (isuserbuffer) {
    2.16 -        if (copy_from_user(policy_buffer, buf, buf_size))
    2.17 +        if (copy_from_guest(policy_buffer, buf, buf_size))
    2.18          {
    2.19              printk("%s: Error copying!\n",__func__);
    2.20              goto error_free;
    2.21 @@ -116,7 +116,7 @@ acm_set_policy(void *buf, u32 buf_size, 
    2.22  }
    2.23  
    2.24  int
    2.25 -acm_get_policy(void *buf, u32 buf_size)
    2.26 +acm_get_policy(XEN_GUEST_HANDLE(void) buf, u32 buf_size)
    2.27  { 
    2.28      u8 *policy_buffer;
    2.29      int ret;
    2.30 @@ -162,7 +162,7 @@ acm_get_policy(void *buf, u32 buf_size)
    2.31          goto error_free_unlock;
    2.32  
    2.33      bin_pol->len = htonl(ntohl(bin_pol->len) + ret);
    2.34 -    if (copy_to_user(buf, policy_buffer, ntohl(bin_pol->len)))
    2.35 +    if (copy_to_guest(buf, policy_buffer, ntohl(bin_pol->len)))
    2.36          goto error_free_unlock;
    2.37  
    2.38      read_unlock(&acm_bin_pol_rwlock);
    2.39 @@ -177,7 +177,7 @@ acm_get_policy(void *buf, u32 buf_size)
    2.40  }
    2.41  
    2.42  int
    2.43 -acm_dump_statistics(void *buf, u16 buf_size)
    2.44 +acm_dump_statistics(XEN_GUEST_HANDLE(void) buf, u16 buf_size)
    2.45  { 
    2.46      /* send stats to user space */
    2.47      u8 *stats_buffer;
    2.48 @@ -208,7 +208,7 @@ acm_dump_statistics(void *buf, u16 buf_s
    2.49  
    2.50      memcpy(stats_buffer, &acm_stats, sizeof(struct acm_stats_buffer));
    2.51  
    2.52 -    if (copy_to_user(buf, stats_buffer, sizeof(struct acm_stats_buffer) + len1 + len2))
    2.53 +    if (copy_to_guest(buf, stats_buffer, sizeof(struct acm_stats_buffer) + len1 + len2))
    2.54          goto error_lock_free;
    2.55  
    2.56      read_unlock(&acm_bin_pol_rwlock);
    2.57 @@ -223,7 +223,7 @@ acm_dump_statistics(void *buf, u16 buf_s
    2.58  
    2.59  
    2.60  int
    2.61 -acm_get_ssid(ssidref_t ssidref, u8 *buf, u16 buf_size)
    2.62 +acm_get_ssid(ssidref_t ssidref, XEN_GUEST_HANDLE(void) buf, u16 buf_size)
    2.63  {
    2.64      /* send stats to user space */
    2.65      u8 *ssid_buffer;
    2.66 @@ -272,7 +272,7 @@ acm_get_ssid(ssidref_t ssidref, u8 *buf,
    2.67      acm_ssid->len += ret;
    2.68      acm_ssid->secondary_max_types = ret;
    2.69  
    2.70 -    if (copy_to_user(buf, ssid_buffer, acm_ssid->len))
    2.71 +    if (copy_to_guest(buf, ssid_buffer, acm_ssid->len))
    2.72          goto error_free_unlock;
    2.73  
    2.74      read_unlock(&acm_bin_pol_rwlock);
     3.1 --- a/xen/include/public/acm_ops.h	Fri Jun 09 16:19:42 2006 +0100
     3.2 +++ b/xen/include/public/acm_ops.h	Fri Jun 09 16:26:05 2006 +0100
     3.3 @@ -17,7 +17,7 @@
     3.4   * This makes sure that old versions of acm tools will stop working in a
     3.5   * well-defined way (rather than crashing the machine, for instance).
     3.6   */
     3.7 -#define ACM_INTERFACE_VERSION   0xAAAA0007
     3.8 +#define ACM_INTERFACE_VERSION   0xAAAA0008
     3.9  
    3.10  /************************************************************************/
    3.11  
    3.12 @@ -33,7 +33,7 @@
    3.13  struct acm_setpolicy {
    3.14      /* IN */
    3.15      uint32_t interface_version;
    3.16 -    void *pushcache;
    3.17 +    XEN_GUEST_HANDLE(void) pushcache;
    3.18      uint32_t pushcache_size;
    3.19  };
    3.20  
    3.21 @@ -42,7 +42,7 @@ struct acm_setpolicy {
    3.22  struct acm_getpolicy {
    3.23      /* IN */
    3.24      uint32_t interface_version;
    3.25 -    void *pullcache;
    3.26 +    XEN_GUEST_HANDLE(void) pullcache;
    3.27      uint32_t pullcache_size;
    3.28  };
    3.29  
    3.30 @@ -51,7 +51,7 @@ struct acm_getpolicy {
    3.31  struct acm_dumpstats {
    3.32      /* IN */
    3.33      uint32_t interface_version;
    3.34 -    void *pullcache;
    3.35 +    XEN_GUEST_HANDLE(void) pullcache;
    3.36      uint32_t pullcache_size;
    3.37  };
    3.38  
    3.39 @@ -61,12 +61,12 @@ enum get_type {UNSET=0, SSIDREF, DOMAINI
    3.40  struct acm_getssid {
    3.41      /* IN */
    3.42      uint32_t interface_version;
    3.43 -    enum get_type get_ssid_by;
    3.44 +    uint32_t get_ssid_by;
    3.45      union {
    3.46          domaintype_t domainid;
    3.47          ssidref_t    ssidref;
    3.48      } id;
    3.49 -    void *ssidbuf;
    3.50 +    XEN_GUEST_HANDLE(void) ssidbuf;
    3.51      uint32_t ssidbuf_size;
    3.52  };
    3.53  
    3.54 @@ -74,8 +74,8 @@ struct acm_getssid {
    3.55  struct acm_getdecision {
    3.56      /* IN */
    3.57      uint32_t interface_version;
    3.58 -    enum get_type get_decision_by1;
    3.59 -    enum get_type get_decision_by2;
    3.60 +    uint32_t get_decision_by1;
    3.61 +    uint32_t get_decision_by2;
    3.62      union {
    3.63          domaintype_t domainid;
    3.64          ssidref_t    ssidref;
    3.65 @@ -84,9 +84,9 @@ struct acm_getdecision {
    3.66          domaintype_t domainid;
    3.67          ssidref_t    ssidref;
    3.68      } id2;
    3.69 -    enum acm_hook_type hook;
    3.70 +    uint32_t hook;
    3.71      /* OUT */
    3.72 -    int acm_decision;
    3.73 +    uint32_t acm_decision;
    3.74  };
    3.75  
    3.76  #endif /* __XEN_PUBLIC_ACM_OPS_H__ */