ia64/xen-unstable

changeset 11849:5b036362c1b0

Remove ERR() macro from libxc. Use ERROR/PERROR as appropriate.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Oct 17 18:05:42 2006 +0100 (2006-10-17)
parents 479b17f312b0
children 1e6d52d06fa4
files tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/ia64/xc_ia64_linux_save.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_private.h
line diff
     1.1 --- a/tools/libxc/ia64/xc_ia64_linux_restore.c	Tue Oct 17 18:00:51 2006 +0100
     1.2 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c	Tue Oct 17 18:05:42 2006 +0100
     1.3 @@ -44,11 +44,11 @@ read_page(int xc_handle, int io_fd, uint
     1.4      mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
     1.5                                 PROT_READ|PROT_WRITE, pfn);
     1.6      if (mem == NULL) {
     1.7 -            ERR("cannot map page");
     1.8 +            ERROR("cannot map page");
     1.9  	    return -1;
    1.10      }
    1.11      if (!read_exact(io_fd, mem, PAGE_SIZE)) {
    1.12 -            ERR("Error when reading from state file (5)");
    1.13 +            ERROR("Error when reading from state file (5)");
    1.14              return -1;
    1.15      }
    1.16      munmap(mem, PAGE_SIZE);
    1.17 @@ -85,17 +85,17 @@ xc_linux_restore(int xc_handle, int io_f
    1.18  
    1.19  
    1.20      if (!read_exact(io_fd, &ver, sizeof(unsigned long))) {
    1.21 -	ERR("Error when reading version");
    1.22 +	ERROR("Error when reading version");
    1.23  	goto out;
    1.24      }
    1.25      if (ver != 1) {
    1.26 -	ERR("version of save doesn't match");
    1.27 +	ERROR("version of save doesn't match");
    1.28  	goto out;
    1.29      }
    1.30  
    1.31      if (mlock(&ctxt, sizeof(ctxt))) {
    1.32          /* needed for build domctl, but might as well do early */
    1.33 -        ERR("Unable to mlock ctxt");
    1.34 +        ERROR("Unable to mlock ctxt");
    1.35          return 1;
    1.36      }
    1.37  
    1.38 @@ -103,7 +103,7 @@ xc_linux_restore(int xc_handle, int io_f
    1.39      domctl.cmd = XEN_DOMCTL_getdomaininfo;
    1.40      domctl.domain = (domid_t)dom;
    1.41      if (xc_domctl(xc_handle, &domctl) < 0) {
    1.42 -        ERR("Could not get information on new domain");
    1.43 +        ERROR("Could not get information on new domain");
    1.44          goto out;
    1.45      }
    1.46      shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
    1.47 @@ -115,7 +115,7 @@ xc_linux_restore(int xc_handle, int io_f
    1.48  
    1.49      if (xc_domain_memory_increase_reservation(xc_handle, dom, max_pfn,
    1.50                                                0, 0, NULL) != 0) {
    1.51 -        ERR("Failed to increase reservation by %ld KB", PFN_TO_KB(max_pfn));
    1.52 +        ERROR("Failed to increase reservation by %ld KB", PFN_TO_KB(max_pfn));
    1.53          errno = ENOMEM;
    1.54          goto out;
    1.55      }
    1.56 @@ -123,7 +123,7 @@ xc_linux_restore(int xc_handle, int io_f
    1.57      DPRINTF("Increased domain reservation by %ld KB\n", PFN_TO_KB(max_pfn));
    1.58  
    1.59      if (!read_exact(io_fd, &domctl.u.arch_setup, sizeof(domctl.u.arch_setup))) {
    1.60 -        ERR("read: domain setup");
    1.61 +        ERROR("read: domain setup");
    1.62          goto out;
    1.63      }
    1.64  
    1.65 @@ -141,13 +141,13 @@ xc_linux_restore(int xc_handle, int io_f
    1.66      /* Get pages.  */
    1.67      page_array = malloc(max_pfn * sizeof(unsigned long));
    1.68      if (page_array == NULL ) {
    1.69 -        ERR("Could not allocate memory");
    1.70 +        ERROR("Could not allocate memory");
    1.71          goto out;
    1.72      }
    1.73  
    1.74      if (xc_ia64_get_pfn_list(xc_handle, dom, page_array,
    1.75                               0, max_pfn) != max_pfn) {
    1.76 -        ERR("Could not get the page frame list");
    1.77 +        ERROR("Could not get the page frame list");
    1.78          goto out;
    1.79      }
    1.80  
    1.81 @@ -155,7 +155,7 @@ xc_linux_restore(int xc_handle, int io_f
    1.82  
    1.83      while (1) {
    1.84          if (!read_exact(io_fd, &mfn, sizeof(unsigned long))) {
    1.85 -            ERR("Error when reading batch size");
    1.86 +            ERROR("Error when reading batch size");
    1.87              goto out;
    1.88          }
    1.89  	if (mfn == INVALID_MFN)
    1.90 @@ -178,18 +178,18 @@ xc_linux_restore(int xc_handle, int io_f
    1.91          int rc;
    1.92  
    1.93          if (!read_exact(io_fd, &count, sizeof(count))) {
    1.94 -            ERR("Error when reading pfn count");
    1.95 +            ERROR("Error when reading pfn count");
    1.96              goto out;
    1.97          }
    1.98  
    1.99          pfntab = malloc(sizeof(unsigned long) * count);
   1.100          if (!pfntab) {
   1.101 -            ERR("Out of memory");
   1.102 +            ERROR("Out of memory");
   1.103              goto out;
   1.104          }
   1.105  
   1.106          if (!read_exact(io_fd, pfntab, sizeof(unsigned long)*count)) {
   1.107 -            ERR("Error when reading pfntab");
   1.108 +            ERROR("Error when reading pfntab");
   1.109              goto out;
   1.110          }
   1.111  
   1.112 @@ -211,7 +211,7 @@ xc_linux_restore(int xc_handle, int io_f
   1.113              rc = xc_memory_op(xc_handle, XENMEM_decrease_reservation,
   1.114                                &reservation);
   1.115              if (rc != 1) {
   1.116 -                ERR("Could not decrease reservation : %d", rc);
   1.117 +                ERROR("Could not decrease reservation : %d", rc);
   1.118                  goto out;
   1.119              }
   1.120          }
   1.121 @@ -221,7 +221,7 @@ xc_linux_restore(int xc_handle, int io_f
   1.122  
   1.123  
   1.124      if (!read_exact(io_fd, &ctxt, sizeof(ctxt))) {
   1.125 -        ERR("Error when reading ctxt");
   1.126 +        ERROR("Error when reading ctxt");
   1.127          goto out;
   1.128      }
   1.129  
   1.130 @@ -231,7 +231,7 @@ xc_linux_restore(int xc_handle, int io_f
   1.131      domctl.u.vcpucontext.vcpu   = 0;
   1.132      set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
   1.133      if (xc_domctl(xc_handle, &domctl) != 0) {
   1.134 -	    ERR("Couldn't set vcpu context");
   1.135 +	    ERROR("Couldn't set vcpu context");
   1.136  	    goto out;
   1.137      }
   1.138  
   1.139 @@ -242,19 +242,19 @@ xc_linux_restore(int xc_handle, int io_f
   1.140      domctl.u.vcpucontext.vcpu   = 0;
   1.141      set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
   1.142      if (xc_domctl(xc_handle, &domctl) != 0) {
   1.143 -	    ERR("Couldn't set vcpu context");
   1.144 +	    ERROR("Couldn't set vcpu context");
   1.145  	    goto out;
   1.146      }
   1.147  
   1.148      /* Just a check.  */
   1.149      if (xc_vcpu_getcontext(xc_handle, dom, 0 /* XXX */, &ctxt)) {
   1.150 -        ERR("Could not get vcpu context");
   1.151 +        ERROR("Could not get vcpu context");
   1.152  	goto out;
   1.153      }
   1.154  
   1.155      /* Then get privreg page.  */
   1.156      if (read_page(xc_handle, io_fd, dom, ctxt.privregs_pfn) < 0) {
   1.157 -	    ERR("Could not read vcpu privregs");
   1.158 +	    ERROR("Could not read vcpu privregs");
   1.159  	    goto out;
   1.160      }
   1.161  
   1.162 @@ -262,11 +262,11 @@ xc_linux_restore(int xc_handle, int io_f
   1.163      shared_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
   1.164                                         PROT_READ|PROT_WRITE, shared_info_frame);
   1.165      if (shared_info == NULL) {
   1.166 -            ERR("cannot map page");
   1.167 +            ERROR("cannot map page");
   1.168  	    goto out;
   1.169      }
   1.170      if (!read_exact(io_fd, shared_info, PAGE_SIZE)) {
   1.171 -            ERR("Error when reading shared_info page");
   1.172 +            ERROR("Error when reading shared_info page");
   1.173  	    goto out;
   1.174      }
   1.175  
     2.1 --- a/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Oct 17 18:00:51 2006 +0100
     2.2 +++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Oct 17 18:05:42 2006 +0100
     2.3 @@ -97,14 +97,14 @@ suspend_and_state(int (*suspend)(int), i
     2.4      int i = 0;
     2.5  
     2.6      if (!(*suspend)(dom)) {
     2.7 -        ERR("Suspend request failed");
     2.8 +        ERROR("Suspend request failed");
     2.9          return -1;
    2.10      }
    2.11  
    2.12  retry:
    2.13  
    2.14      if (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) {
    2.15 -        ERR("Could not get domain info");
    2.16 +        ERROR("Could not get domain info");
    2.17          return -1;
    2.18      }
    2.19  
    2.20 @@ -115,7 +115,7 @@ retry:
    2.21          // try unpausing domain, wait, and retest
    2.22          xc_domain_unpause(xc_handle, dom);
    2.23  
    2.24 -        ERR("Domain was paused. Wait and re-test.");
    2.25 +        ERROR("Domain was paused. Wait and re-test.");
    2.26          usleep(10000);  // 10ms
    2.27  
    2.28          goto retry;
    2.29 @@ -123,12 +123,12 @@ retry:
    2.30  
    2.31  
    2.32      if(++i < 100) {
    2.33 -        ERR("Retry suspend domain.");
    2.34 +        ERROR("Retry suspend domain.");
    2.35          usleep(10000);  // 10ms
    2.36          goto retry;
    2.37      }
    2.38  
    2.39 -    ERR("Unable to suspend domain.");
    2.40 +    ERROR("Unable to suspend domain.");
    2.41  
    2.42      return -1;
    2.43  }
    2.44 @@ -191,7 +191,7 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.45      //initialize_mbit_rate();
    2.46  
    2.47      if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
    2.48 -        ERR("Could not get domain info");
    2.49 +        ERROR("Could not get domain info");
    2.50          return 1;
    2.51      }
    2.52  
    2.53 @@ -200,7 +200,7 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.54  #if 0
    2.55      /* cheesy sanity check */
    2.56      if ((info.max_memkb >> (PAGE_SHIFT - 10)) > max_mfn) {
    2.57 -        ERR("Invalid state record -- pfn count out of range: %lu",
    2.58 +        ERROR("Invalid state record -- pfn count out of range: %lu",
    2.59              (info.max_memkb >> (PAGE_SHIFT - 10)));
    2.60          goto out;
    2.61       }
    2.62 @@ -210,7 +210,7 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.63      live_shinfo = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    2.64                                         PROT_READ, shared_info_frame);
    2.65      if (!live_shinfo) {
    2.66 -        ERR("Couldn't map live_shinfo");
    2.67 +        ERROR("Couldn't map live_shinfo");
    2.68          goto out;
    2.69      }
    2.70  
    2.71 @@ -218,13 +218,13 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.72  
    2.73      page_array = malloc(max_pfn * sizeof(unsigned long));
    2.74      if (page_array == NULL) {
    2.75 -        ERR("Could not allocate memory");
    2.76 +        ERROR("Could not allocate memory");
    2.77          goto out;
    2.78      }
    2.79  
    2.80      /* This is expected by xm restore.  */
    2.81      if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
    2.82 -        ERR("write: max_pfn");
    2.83 +        ERROR("write: max_pfn");
    2.84          goto out;
    2.85      }
    2.86  
    2.87 @@ -237,7 +237,7 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.88          unsigned long version = 1;
    2.89  
    2.90          if (!write_exact(io_fd, &version, sizeof(unsigned long))) {
    2.91 -            ERR("write: version");
    2.92 +            ERROR("write: version");
    2.93              goto out;
    2.94          }
    2.95      }
    2.96 @@ -246,12 +246,12 @@ xc_linux_save(int xc_handle, int io_fd, 
    2.97      domctl.domain = (domid_t)dom;
    2.98      domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
    2.99      if (xc_domctl(xc_handle, &domctl) < 0) {
   2.100 -        ERR("Could not get domain setup");
   2.101 +        ERROR("Could not get domain setup");
   2.102          goto out;
   2.103      }
   2.104      if (!write_exact(io_fd, &domctl.u.arch_setup,
   2.105                       sizeof(domctl.u.arch_setup))) {
   2.106 -        ERR("write: domain setup");
   2.107 +        ERROR("write: domain setup");
   2.108          goto out;
   2.109      }
   2.110  
   2.111 @@ -261,7 +261,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.112          if (xc_ia64_shadow_control(xc_handle, dom,
   2.113                                     XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
   2.114                                     NULL, 0, NULL ) < 0) {
   2.115 -            ERR("Couldn't enable shadow mode");
   2.116 +            ERROR("Couldn't enable shadow mode");
   2.117              goto out;
   2.118          }
   2.119  
   2.120 @@ -272,7 +272,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.121          to_skip = malloc(bitmap_size);
   2.122  
   2.123          if (!to_send || !to_skip) {
   2.124 -            ERR("Couldn't allocate bitmap array");
   2.125 +            ERROR("Couldn't allocate bitmap array");
   2.126              goto out;
   2.127          }
   2.128  
   2.129 @@ -280,11 +280,11 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.130          memset(to_send, 0xff, bitmap_size);
   2.131  
   2.132          if (mlock(to_send, bitmap_size)) {
   2.133 -            ERR("Unable to mlock to_send");
   2.134 +            ERROR("Unable to mlock to_send");
   2.135              goto out;
   2.136          }
   2.137          if (mlock(to_skip, bitmap_size)) {
   2.138 -            ERR("Unable to mlock to_skip");
   2.139 +            ERROR("Unable to mlock to_skip");
   2.140              goto out;
   2.141          }
   2.142          
   2.143 @@ -296,7 +296,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.144          last_iter = 1;
   2.145  
   2.146          if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info)) {
   2.147 -            ERR("Domain appears not to have suspended");
   2.148 +            ERROR("Domain appears not to have suspended");
   2.149              goto out;
   2.150          }
   2.151  
   2.152 @@ -315,7 +315,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.153          /* Get the pfn list, as it may change.  */
   2.154          if (xc_ia64_get_pfn_list(xc_handle, dom, page_array,
   2.155                                   0, max_pfn) != max_pfn) {
   2.156 -            ERR("Could not get the page frame list");
   2.157 +            ERROR("Could not get the page frame list");
   2.158              goto out;
   2.159          }
   2.160  
   2.161 @@ -326,7 +326,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.162              if (xc_ia64_shadow_control(xc_handle, dom,
   2.163                                         XEN_DOMCTL_SHADOW_OP_PEEK,
   2.164                                         to_skip, max_pfn, NULL) != max_pfn) {
   2.165 -                ERR("Error peeking shadow bitmap");
   2.166 +                ERROR("Error peeking shadow bitmap");
   2.167                  goto out;
   2.168              }
   2.169          }
   2.170 @@ -358,12 +358,12 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.171              }
   2.172  
   2.173              if (!write_exact(io_fd, &N, sizeof(N))) {
   2.174 -                ERR("write: max_pfn");
   2.175 +                ERROR("write: max_pfn");
   2.176                  goto out;
   2.177              }
   2.178  
   2.179              if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
   2.180 -                ERR("Error when writing to state file (5)");
   2.181 +                ERROR("Error when writing to state file (5)");
   2.182                  goto out;
   2.183              }
   2.184              munmap(mem, PAGE_SIZE);
   2.185 @@ -385,7 +385,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.186                  last_iter = 1;
   2.187  
   2.188                  if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info)) {
   2.189 -                    ERR("Domain appears not to have suspended");
   2.190 +                    ERROR("Domain appears not to have suspended");
   2.191                      goto out;
   2.192                  }
   2.193              }
   2.194 @@ -394,7 +394,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.195              if (xc_ia64_shadow_control(xc_handle, dom,
   2.196                                         XEN_DOMCTL_SHADOW_OP_CLEAN,
   2.197                                         to_send, max_pfn, NULL ) != max_pfn) {
   2.198 -                ERR("Error flushing shadow PT");
   2.199 +                ERROR("Error flushing shadow PT");
   2.200                  goto out;
   2.201              }
   2.202  
   2.203 @@ -411,7 +411,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.204      {
   2.205          unsigned long pfn = INVALID_MFN;
   2.206          if (!write_exact(io_fd, &pfn, sizeof(pfn))) {
   2.207 -            ERR("Error when writing to state file (6)");
   2.208 +            ERROR("Error when writing to state file (6)");
   2.209              goto out;
   2.210          }
   2.211      }
   2.212 @@ -427,7 +427,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.213          }
   2.214  
   2.215          if (!write_exact(io_fd, &j, sizeof(unsigned int))) {
   2.216 -            ERR("Error when writing to state file (6a)");
   2.217 +            ERROR("Error when writing to state file (6a)");
   2.218              goto out;
   2.219          }
   2.220  
   2.221 @@ -439,7 +439,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.222              i++;
   2.223              if (j == 1024 || i == max_pfn) {
   2.224                  if (!write_exact(io_fd, &pfntab, sizeof(unsigned long)*j)) {
   2.225 -                    ERR("Error when writing to state file (6b)");
   2.226 +                    ERROR("Error when writing to state file (6b)");
   2.227                      goto out;
   2.228                  }
   2.229                  j = 0;
   2.230 @@ -449,29 +449,29 @@ xc_linux_save(int xc_handle, int io_fd, 
   2.231      }
   2.232  
   2.233      if (xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt)) {
   2.234 -        ERR("Could not get vcpu context");
   2.235 +        ERROR("Could not get vcpu context");
   2.236          goto out;
   2.237      }
   2.238  
   2.239      if (!write_exact(io_fd, &ctxt, sizeof(ctxt))) {
   2.240 -        ERR("Error when writing to state file (1)");
   2.241 +        ERROR("Error when writing to state file (1)");
   2.242          goto out;
   2.243      }
   2.244  
   2.245      mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
   2.246                                 PROT_READ|PROT_WRITE, ctxt.privregs_pfn);
   2.247      if (mem == NULL) {
   2.248 -        ERR("cannot map privreg page");
   2.249 +        ERROR("cannot map privreg page");
   2.250          goto out;
   2.251      }
   2.252      if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
   2.253 -        ERR("Error when writing privreg to state file (5)");
   2.254 +        ERROR("Error when writing privreg to state file (5)");
   2.255          goto out;
   2.256      }
   2.257      munmap(mem, PAGE_SIZE);    
   2.258  
   2.259      if (!write_exact(io_fd, live_shinfo, PAGE_SIZE)) {
   2.260 -        ERR("Error when writing to state file (1)");
   2.261 +        ERROR("Error when writing to state file (1)");
   2.262          goto out;
   2.263      }
   2.264  
     3.1 --- a/tools/libxc/xc_linux_restore.c	Tue Oct 17 18:00:51 2006 +0100
     3.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Oct 17 18:05:42 2006 +0100
     3.3 @@ -79,7 +79,7 @@ int uncanonicalize_pagetable(unsigned lo
     3.4  
     3.5              if(pfn >= max_pfn) {
     3.6                  /* This "page table page" is probably not one; bail. */
     3.7 -                ERR("Frame number in type %lu page table is out of range: "
     3.8 +                ERROR("Frame number in type %lu page table is out of range: "
     3.9                      "i=%d pfn=0x%lx max_pfn=%lu",
    3.10                      type >> 28, i, pfn, max_pfn);
    3.11                  return 0;
    3.12 @@ -158,24 +158,24 @@ int xc_linux_restore(int xc_handle, int 
    3.13  
    3.14      if(!get_platform_info(xc_handle, dom,
    3.15                            &max_mfn, &hvirt_start, &pt_levels)) {
    3.16 -        ERR("Unable to get platform info.");
    3.17 +        ERROR("Unable to get platform info.");
    3.18          return 1;
    3.19      }
    3.20  
    3.21      if (mlock(&ctxt, sizeof(ctxt))) {
    3.22          /* needed for build domctl, but might as well do early */
    3.23 -        ERR("Unable to mlock ctxt");
    3.24 +        ERROR("Unable to mlock ctxt");
    3.25          return 1;
    3.26      }
    3.27  
    3.28      if (!(p2m_frame_list = malloc(P2M_FL_SIZE))) {
    3.29 -        ERR("Couldn't allocate p2m_frame_list array");
    3.30 +        ERROR("Couldn't allocate p2m_frame_list array");
    3.31          goto out;
    3.32      }
    3.33  
    3.34      /* Read first entry of P2M list, or extended-info signature (~0UL). */
    3.35      if (!read_exact(io_fd, p2m_frame_list, sizeof(long))) {
    3.36 -        ERR("read extended-info signature failed");
    3.37 +        ERROR("read extended-info signature failed");
    3.38          goto out;
    3.39      }
    3.40  
    3.41 @@ -184,7 +184,7 @@ int xc_linux_restore(int xc_handle, int 
    3.42  
    3.43          /* Next 4 bytes: total size of following extended info. */
    3.44          if (!read_exact(io_fd, &tot_bytes, sizeof(tot_bytes))) {
    3.45 -            ERR("read extended-info size failed");
    3.46 +            ERROR("read extended-info size failed");
    3.47              goto out;
    3.48          }
    3.49  
    3.50 @@ -195,7 +195,7 @@ int xc_linux_restore(int xc_handle, int 
    3.51              /* 4-character chunk signature + 4-byte remaining chunk size. */
    3.52              if (!read_exact(io_fd, chunk_sig, sizeof(chunk_sig)) ||
    3.53                  !read_exact(io_fd, &chunk_bytes, sizeof(chunk_bytes))) {
    3.54 -                ERR("read extended-info chunk signature failed");
    3.55 +                ERROR("read extended-info chunk signature failed");
    3.56                  goto out;
    3.57              }
    3.58              tot_bytes -= 8;
    3.59 @@ -203,7 +203,7 @@ int xc_linux_restore(int xc_handle, int 
    3.60              /* VCPU context structure? */
    3.61              if (!strncmp(chunk_sig, "vcpu", 4)) {
    3.62                  if (!read_exact(io_fd, &ctxt, sizeof(ctxt))) {
    3.63 -                    ERR("read extended-info vcpu context failed");
    3.64 +                    ERROR("read extended-info vcpu context failed");
    3.65                      goto out;
    3.66                  }
    3.67                  tot_bytes   -= sizeof(struct vcpu_guest_context);
    3.68 @@ -219,7 +219,7 @@ int xc_linux_restore(int xc_handle, int 
    3.69                  if ( sz > P2M_FL_SIZE )
    3.70                      sz = P2M_FL_SIZE;
    3.71                  if (!read_exact(io_fd, p2m_frame_list, sz)) {
    3.72 -                    ERR("read-and-discard extended-info chunk bytes failed");
    3.73 +                    ERROR("read-and-discard extended-info chunk bytes failed");
    3.74                      goto out;
    3.75                  }
    3.76                  chunk_bytes -= sz;
    3.77 @@ -229,14 +229,14 @@ int xc_linux_restore(int xc_handle, int 
    3.78  
    3.79          /* Now read the real first entry of P2M list. */
    3.80          if (!read_exact(io_fd, p2m_frame_list, sizeof(long))) {
    3.81 -            ERR("read first entry of p2m_frame_list failed");
    3.82 +            ERROR("read first entry of p2m_frame_list failed");
    3.83              goto out;
    3.84          }
    3.85      }
    3.86  
    3.87      /* First entry is already read into the p2m array. */
    3.88      if (!read_exact(io_fd, &p2m_frame_list[1], P2M_FL_SIZE - sizeof(long))) {
    3.89 -        ERR("read p2m_frame_list failed");
    3.90 +        ERROR("read p2m_frame_list failed");
    3.91          goto out;
    3.92      }
    3.93  
    3.94 @@ -246,13 +246,13 @@ int xc_linux_restore(int xc_handle, int 
    3.95      region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t));
    3.96  
    3.97      if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) {
    3.98 -        ERR("memory alloc failed");
    3.99 +        ERROR("memory alloc failed");
   3.100          errno = ENOMEM;
   3.101          goto out;
   3.102      }
   3.103  
   3.104      if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
   3.105 -        ERR("Could not mlock region_mfn");
   3.106 +        ERROR("Could not mlock region_mfn");
   3.107          goto out;
   3.108      }
   3.109  
   3.110 @@ -260,7 +260,7 @@ int xc_linux_restore(int xc_handle, int 
   3.111      domctl.cmd = XEN_DOMCTL_getdomaininfo;
   3.112      domctl.domain = (domid_t)dom;
   3.113      if (xc_domctl(xc_handle, &domctl) < 0) {
   3.114 -        ERR("Could not get information on new domain");
   3.115 +        ERROR("Could not get information on new domain");
   3.116          goto out;
   3.117      }
   3.118      shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
   3.119 @@ -272,7 +272,7 @@ int xc_linux_restore(int xc_handle, int 
   3.120  
   3.121      if(xc_domain_memory_increase_reservation(
   3.122             xc_handle, dom, max_pfn, 0, 0, NULL) != 0) {
   3.123 -        ERR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
   3.124 +        ERROR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
   3.125          errno = ENOMEM;
   3.126          goto out;
   3.127      }
   3.128 @@ -281,12 +281,12 @@ int xc_linux_restore(int xc_handle, int 
   3.129  
   3.130      /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
   3.131      if (xc_get_pfn_list(xc_handle, dom, p2m, max_pfn) != max_pfn) {
   3.132 -        ERR("Did not read correct number of frame numbers for new dom");
   3.133 +        ERROR("Did not read correct number of frame numbers for new dom");
   3.134          goto out;
   3.135      }
   3.136  
   3.137      if(!(mmu = xc_init_mmu_updates(xc_handle, dom))) {
   3.138 -        ERR("Could not initialise for MMU updates");
   3.139 +        ERROR("Could not initialise for MMU updates");
   3.140          goto out;
   3.141      }
   3.142  
   3.143 @@ -312,7 +312,7 @@ int xc_linux_restore(int xc_handle, int 
   3.144          }
   3.145  
   3.146          if (!read_exact(io_fd, &j, sizeof(int))) {
   3.147 -            ERR("Error when reading batch size");
   3.148 +            ERROR("Error when reading batch size");
   3.149              goto out;
   3.150          }
   3.151  
   3.152 @@ -328,12 +328,12 @@ int xc_linux_restore(int xc_handle, int 
   3.153              break;  /* our work here is done */
   3.154  
   3.155          if (j > MAX_BATCH_SIZE) {
   3.156 -            ERR("Max batch size exceeded. Giving up.");
   3.157 +            ERROR("Max batch size exceeded. Giving up.");
   3.158              goto out;
   3.159          }
   3.160  
   3.161          if (!read_exact(io_fd, region_pfn_type, j*sizeof(unsigned long))) {
   3.162 -            ERR("Error when reading region pfn types");
   3.163 +            ERROR("Error when reading region pfn types");
   3.164              goto out;
   3.165          }
   3.166  
   3.167 @@ -353,7 +353,7 @@ int xc_linux_restore(int xc_handle, int 
   3.168              xc_handle, dom, PROT_WRITE, region_mfn, j);
   3.169          if ( region_base == NULL )
   3.170          {
   3.171 -            ERR("map batch failed");
   3.172 +            ERROR("map batch failed");
   3.173              goto out;
   3.174          }
   3.175  
   3.176 @@ -371,7 +371,7 @@ int xc_linux_restore(int xc_handle, int 
   3.177  
   3.178              if ( pfn > max_pfn )
   3.179              {
   3.180 -                ERR("pfn out of range");
   3.181 +                ERROR("pfn out of range");
   3.182                  goto out;
   3.183              }
   3.184  
   3.185 @@ -383,7 +383,7 @@ int xc_linux_restore(int xc_handle, int 
   3.186              page = verify ? (void *)buf : (region_base + i*PAGE_SIZE);
   3.187  
   3.188              if (!read_exact(io_fd, page, PAGE_SIZE)) {
   3.189 -                ERR("Error when reading page (type was %lx)", pagetype);
   3.190 +                ERROR("Error when reading page (type was %lx)", pagetype);
   3.191                  goto out;
   3.192              }
   3.193  
   3.194 @@ -422,7 +422,7 @@ int xc_linux_restore(int xc_handle, int 
   3.195              }
   3.196              else if ( pagetype != XEN_DOMCTL_PFINFO_NOTAB )
   3.197              {
   3.198 -                ERR("Bogus page type %lx page table is out of range: "
   3.199 +                ERROR("Bogus page type %lx page table is out of range: "
   3.200                      "i=%d max_pfn=%lu", pagetype, i, max_pfn);
   3.201                  goto out;
   3.202  
   3.203 @@ -455,7 +455,7 @@ int xc_linux_restore(int xc_handle, int 
   3.204              if (xc_add_mmu_update(xc_handle, mmu,
   3.205                                    (((unsigned long long)mfn) << PAGE_SHIFT)
   3.206                                    | MMU_MACHPHYS_UPDATE, pfn)) {
   3.207 -                ERR("failed machpys update mfn=%lx pfn=%lx", mfn, pfn);
   3.208 +                ERROR("failed machpys update mfn=%lx pfn=%lx", mfn, pfn);
   3.209                  goto out;
   3.210              }
   3.211          } /* end of 'batch' for loop */
   3.212 @@ -469,7 +469,7 @@ int xc_linux_restore(int xc_handle, int 
   3.213       * reallocations below.
   3.214       */
   3.215      if (xc_finish_mmu_updates(xc_handle, mmu)) {
   3.216 -        ERR("Error doing finish_mmu_updates()");
   3.217 +        ERROR("Error doing finish_mmu_updates()");
   3.218          goto out;
   3.219      }
   3.220  
   3.221 @@ -512,7 +512,7 @@ int xc_linux_restore(int xc_handle, int 
   3.222                  munmap(l3tab, PAGE_SIZE);
   3.223  
   3.224                  if (!(new_mfn=xc_make_page_below_4G(xc_handle, dom, p2m[i]))) {
   3.225 -                    ERR("Couldn't get a page below 4GB :-(");
   3.226 +                    ERROR("Couldn't get a page below 4GB :-(");
   3.227                      goto out;
   3.228                  }
   3.229  
   3.230 @@ -521,7 +521,7 @@ int xc_linux_restore(int xc_handle, int 
   3.231                                        (((unsigned long long)new_mfn)
   3.232                                         << PAGE_SHIFT) |
   3.233                                        MMU_MACHPHYS_UPDATE, i)) {
   3.234 -                    ERR("Couldn't m2p on PAE root pgdir");
   3.235 +                    ERROR("Couldn't m2p on PAE root pgdir");
   3.236                      goto out;
   3.237                  }
   3.238  
   3.239 @@ -554,14 +554,14 @@ int xc_linux_restore(int xc_handle, int 
   3.240                  if (!(region_base = xc_map_foreign_batch(
   3.241                            xc_handle, dom, PROT_READ | PROT_WRITE,
   3.242                            region_mfn, j))) {
   3.243 -                    ERR("map batch failed");
   3.244 +                    ERROR("map batch failed");
   3.245                      goto out;
   3.246                  }
   3.247  
   3.248                  for(k = 0; k < j; k++) {
   3.249                      if(!uncanonicalize_pagetable(XEN_DOMCTL_PFINFO_L1TAB,
   3.250                                                   region_base + k*PAGE_SIZE)) {
   3.251 -                        ERR("failed uncanonicalize pt!");
   3.252 +                        ERROR("failed uncanonicalize pt!");
   3.253                          goto out;
   3.254                      }
   3.255                  }
   3.256 @@ -572,7 +572,7 @@ int xc_linux_restore(int xc_handle, int 
   3.257          }
   3.258  
   3.259          if (xc_finish_mmu_updates(xc_handle, mmu)) {
   3.260 -            ERR("Error doing finish_mmu_updates()");
   3.261 +            ERROR("Error doing finish_mmu_updates()");
   3.262              goto out;
   3.263          }
   3.264      }
   3.265 @@ -615,7 +615,7 @@ int xc_linux_restore(int xc_handle, int 
   3.266          /* Batch full? Then flush. */
   3.267          if (nr_pins == MAX_PIN_BATCH) {
   3.268              if (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) {
   3.269 -                ERR("Failed to pin batch of %d page tables", nr_pins);
   3.270 +                ERROR("Failed to pin batch of %d page tables", nr_pins);
   3.271                  goto out;
   3.272              }
   3.273              nr_pins = 0;
   3.274 @@ -624,7 +624,7 @@ int xc_linux_restore(int xc_handle, int 
   3.275  
   3.276      /* Flush final partial batch. */
   3.277      if ((nr_pins != 0) && (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0)) {
   3.278 -        ERR("Failed to pin batch of %d page tables", nr_pins);
   3.279 +        ERROR("Failed to pin batch of %d page tables", nr_pins);
   3.280          goto out;
   3.281      }
   3.282  
   3.283 @@ -638,17 +638,17 @@ int xc_linux_restore(int xc_handle, int 
   3.284          int rc;
   3.285  
   3.286          if (!read_exact(io_fd, &count, sizeof(count))) {
   3.287 -            ERR("Error when reading pfn count");
   3.288 +            ERROR("Error when reading pfn count");
   3.289              goto out;
   3.290          }
   3.291  
   3.292          if(!(pfntab = malloc(sizeof(unsigned long) * count))) {
   3.293 -            ERR("Out of memory");
   3.294 +            ERROR("Out of memory");
   3.295              goto out;
   3.296          }
   3.297  
   3.298          if (!read_exact(io_fd, pfntab, sizeof(unsigned long)*count)) {
   3.299 -            ERR("Error when reading pfntab");
   3.300 +            ERROR("Error when reading pfntab");
   3.301              goto out;
   3.302          }
   3.303  
   3.304 @@ -675,7 +675,7 @@ int xc_linux_restore(int xc_handle, int 
   3.305  
   3.306              if ((rc = xc_memory_op(xc_handle, XENMEM_decrease_reservation,
   3.307                                     &reservation)) != count) {
   3.308 -                ERR("Could not decrease reservation : %d", rc);
   3.309 +                ERROR("Could not decrease reservation : %d", rc);
   3.310                  goto out;
   3.311              } else
   3.312                  DPRINTF("Decreased reservation by %d pages\n", count);
   3.313 @@ -684,14 +684,14 @@ int xc_linux_restore(int xc_handle, int 
   3.314  
   3.315      if (!read_exact(io_fd, &ctxt, sizeof(ctxt)) ||
   3.316          !read_exact(io_fd, shared_info_page, PAGE_SIZE)) {
   3.317 -        ERR("Error when reading ctxt or shared info page");
   3.318 +        ERROR("Error when reading ctxt or shared info page");
   3.319          goto out;
   3.320      }
   3.321  
   3.322      /* Uncanonicalise the suspend-record frame number and poke resume rec. */
   3.323      pfn = ctxt.user_regs.edx;
   3.324      if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
   3.325 -        ERR("Suspend record frame number is bad");
   3.326 +        ERROR("Suspend record frame number is bad");
   3.327          goto out;
   3.328      }
   3.329      ctxt.user_regs.edx = mfn = p2m[pfn];
   3.330 @@ -709,14 +709,14 @@ int xc_linux_restore(int xc_handle, int 
   3.331  
   3.332      /* Uncanonicalise each GDT frame number. */
   3.333      if (ctxt.gdt_ents > 8192) {
   3.334 -        ERR("GDT entry count out of range");
   3.335 +        ERROR("GDT entry count out of range");
   3.336          goto out;
   3.337      }
   3.338  
   3.339      for (i = 0; i < ctxt.gdt_ents; i += 512) {
   3.340          pfn = ctxt.gdt_frames[i];
   3.341          if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
   3.342 -            ERR("GDT frame number is bad");
   3.343 +            ERROR("GDT frame number is bad");
   3.344              goto out;
   3.345          }
   3.346          ctxt.gdt_frames[i] = p2m[pfn];
   3.347 @@ -726,14 +726,14 @@ int xc_linux_restore(int xc_handle, int 
   3.348      pfn = xen_cr3_to_pfn(ctxt.ctrlreg[3]);
   3.349  
   3.350      if (pfn >= max_pfn) {
   3.351 -        ERR("PT base is bad: pfn=%lu max_pfn=%lu type=%08lx",
   3.352 +        ERROR("PT base is bad: pfn=%lu max_pfn=%lu type=%08lx",
   3.353              pfn, max_pfn, pfn_type[pfn]);
   3.354          goto out;
   3.355      }
   3.356  
   3.357      if ( (pfn_type[pfn] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) !=
   3.358           ((unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) {
   3.359 -        ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
   3.360 +        ERROR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
   3.361              pfn, max_pfn, pfn_type[pfn],
   3.362              (unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
   3.363          goto out;
   3.364 @@ -757,7 +757,7 @@ int xc_linux_restore(int xc_handle, int 
   3.365      for (i = 0; i < P2M_FL_ENTRIES; i++) {
   3.366          pfn = p2m_frame_list[i];
   3.367          if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
   3.368 -            ERR("PFN-to-MFN frame number is bad");
   3.369 +            ERROR("PFN-to-MFN frame number is bad");
   3.370              goto out;
   3.371          }
   3.372  
   3.373 @@ -767,7 +767,7 @@ int xc_linux_restore(int xc_handle, int 
   3.374      /* Copy the P2M we've constructed to the 'live' P2M */
   3.375      if (!(live_p2m = xc_map_foreign_batch(xc_handle, dom, PROT_WRITE,
   3.376                                            p2m_frame_list, P2M_FL_ENTRIES))) {
   3.377 -        ERR("Couldn't map p2m table");
   3.378 +        ERROR("Couldn't map p2m table");
   3.379          goto out;
   3.380      }
   3.381  
   3.382 @@ -803,7 +803,7 @@ int xc_linux_restore(int xc_handle, int 
   3.383          (ctxt.ldt_ents > 8192) ||
   3.384          (ctxt.ldt_base > hvirt_start) ||
   3.385          ((ctxt.ldt_base + ctxt.ldt_ents*8) > hvirt_start)) {
   3.386 -        ERR("Bad LDT base or size");
   3.387 +        ERROR("Bad LDT base or size");
   3.388          goto out;
   3.389      }
   3.390  
   3.391 @@ -816,7 +816,7 @@ int xc_linux_restore(int xc_handle, int 
   3.392      rc = xc_domctl(xc_handle, &domctl);
   3.393  
   3.394      if (rc != 0) {
   3.395 -        ERR("Couldn't build the domain");
   3.396 +        ERROR("Couldn't build the domain");
   3.397          goto out;
   3.398      }
   3.399  
     4.1 --- a/tools/libxc/xc_linux_save.c	Tue Oct 17 18:00:51 2006 +0100
     4.2 +++ b/tools/libxc/xc_linux_save.c	Tue Oct 17 18:05:42 2006 +0100
     4.3 @@ -363,19 +363,19 @@ static int suspend_and_state(int (*suspe
     4.4      int i = 0;
     4.5  
     4.6      if (!(*suspend)(dom)) {
     4.7 -        ERR("Suspend request failed");
     4.8 +        ERROR("Suspend request failed");
     4.9          return -1;
    4.10      }
    4.11  
    4.12   retry:
    4.13  
    4.14      if (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) {
    4.15 -        ERR("Could not get domain info");
    4.16 +        ERROR("Could not get domain info");
    4.17          return -1;
    4.18      }
    4.19  
    4.20      if ( xc_vcpu_getcontext(xc_handle, dom, 0 /* XXX */, ctxt))
    4.21 -        ERR("Could not get vcpu context");
    4.22 +        ERROR("Could not get vcpu context");
    4.23  
    4.24  
    4.25      if (info->shutdown && info->shutdown_reason == SHUTDOWN_suspend)
    4.26 @@ -385,7 +385,7 @@ static int suspend_and_state(int (*suspe
    4.27          // try unpausing domain, wait, and retest
    4.28          xc_domain_unpause( xc_handle, dom );
    4.29  
    4.30 -        ERR("Domain was paused. Wait and re-test.");
    4.31 +        ERROR("Domain was paused. Wait and re-test.");
    4.32          usleep(10000);  // 10ms
    4.33  
    4.34          goto retry;
    4.35 @@ -393,12 +393,12 @@ static int suspend_and_state(int (*suspe
    4.36  
    4.37  
    4.38      if( ++i < 100 ) {
    4.39 -        ERR("Retry suspend domain.");
    4.40 +        ERROR("Retry suspend domain.");
    4.41          usleep(10000);  // 10ms
    4.42          goto retry;
    4.43      }
    4.44  
    4.45 -    ERR("Unable to suspend domain.");
    4.46 +    ERROR("Unable to suspend domain.");
    4.47  
    4.48      return -1;
    4.49  }
    4.50 @@ -516,25 +516,25 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
    4.51  
    4.52      xmml.max_extents = m2p_chunks;
    4.53      if (!(extent_start = malloc(m2p_chunks * sizeof(xen_pfn_t)))) {
    4.54 -        ERR("failed to allocate space for m2p mfns");
    4.55 +        ERROR("failed to allocate space for m2p mfns");
    4.56          return NULL;
    4.57      }
    4.58      set_xen_guest_handle(xmml.extent_start, extent_start);
    4.59  
    4.60      if (xc_memory_op(xc_handle, XENMEM_machphys_mfn_list, &xmml) ||
    4.61          (xmml.nr_extents != m2p_chunks)) {
    4.62 -        ERR("xc_get_m2p_mfns");
    4.63 +        ERROR("xc_get_m2p_mfns");
    4.64          return NULL;
    4.65      }
    4.66  
    4.67      if ((m2p = mmap(NULL, m2p_size, prot,
    4.68                      MAP_SHARED, xc_handle, 0)) == MAP_FAILED) {
    4.69 -        ERR("failed to mmap m2p");
    4.70 +        ERROR("failed to mmap m2p");
    4.71          return NULL;
    4.72      }
    4.73  
    4.74      if (!(entries = malloc(m2p_chunks * sizeof(privcmd_mmap_entry_t)))) {
    4.75 -        ERR("failed to allocate space for mmap entries");
    4.76 +        ERROR("failed to allocate space for mmap entries");
    4.77          return NULL;
    4.78      }
    4.79  
    4.80 @@ -546,7 +546,7 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
    4.81  
    4.82      if ((rc = xc_map_foreign_ranges(xc_handle, DOMID_XEN,
    4.83          entries, m2p_chunks)) < 0) {
    4.84 -        ERR("xc_mmap_foreign_ranges failed (rc = %d)", rc);
    4.85 +        ERROR("xc_mmap_foreign_ranges failed (rc = %d)", rc);
    4.86          return NULL;
    4.87      }
    4.88  
    4.89 @@ -619,23 +619,23 @@ int xc_linux_save(int xc_handle, int io_
    4.90  
    4.91      if(!get_platform_info(xc_handle, dom,
    4.92                            &max_mfn, &hvirt_start, &pt_levels)) {
    4.93 -        ERR("Unable to get platform info.");
    4.94 +        ERROR("Unable to get platform info.");
    4.95          return 1;
    4.96      }
    4.97  
    4.98      if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
    4.99 -        ERR("Could not get domain info");
   4.100 +        ERROR("Could not get domain info");
   4.101          return 1;
   4.102      }
   4.103  
   4.104      if (mlock(&ctxt, sizeof(ctxt))) {
   4.105 -        ERR("Unable to mlock ctxt");
   4.106 +        ERROR("Unable to mlock ctxt");
   4.107          return 1;
   4.108      }
   4.109  
   4.110      /* Only have to worry about vcpu 0 even for SMP */
   4.111      if (xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt)) {
   4.112 -        ERR("Could not get vcpu context");
   4.113 +        ERROR("Could not get vcpu context");
   4.114          goto out;
   4.115      }
   4.116      shared_info_frame = info.shared_info_frame;
   4.117 @@ -643,13 +643,13 @@ int xc_linux_save(int xc_handle, int io_
   4.118      /* A cheesy test to see whether the domain contains valid state. */
   4.119      if (ctxt.ctrlreg[3] == 0)
   4.120      {
   4.121 -        ERR("Domain is not in a valid Linux guest OS state");
   4.122 +        ERROR("Domain is not in a valid Linux guest OS state");
   4.123          goto out;
   4.124      }
   4.125  
   4.126     /* cheesy sanity check */
   4.127      if ((info.max_memkb >> (PAGE_SHIFT - 10)) > max_mfn) {
   4.128 -        ERR("Invalid state record -- pfn count out of range: %lu",
   4.129 +        ERROR("Invalid state record -- pfn count out of range: %lu",
   4.130              (info.max_memkb >> (PAGE_SHIFT - 10)));
   4.131          goto out;
   4.132       }
   4.133 @@ -657,7 +657,7 @@ int xc_linux_save(int xc_handle, int io_
   4.134      /* Map the shared info frame */
   4.135      if(!(live_shinfo = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
   4.136                                              PROT_READ, shared_info_frame))) {
   4.137 -        ERR("Couldn't map live_shinfo");
   4.138 +        ERROR("Couldn't map live_shinfo");
   4.139          goto out;
   4.140      }
   4.141  
   4.142 @@ -668,7 +668,7 @@ int xc_linux_save(int xc_handle, int io_
   4.143                               live_shinfo->arch.pfn_to_mfn_frame_list_list);
   4.144  
   4.145      if (!live_p2m_frame_list_list) {
   4.146 -        ERR("Couldn't map p2m_frame_list_list (errno %d)", errno);
   4.147 +        ERROR("Couldn't map p2m_frame_list_list (errno %d)", errno);
   4.148          goto out;
   4.149      }
   4.150  
   4.151 @@ -678,7 +678,7 @@ int xc_linux_save(int xc_handle, int io_
   4.152                               P2M_FLL_ENTRIES);
   4.153  
   4.154      if (!live_p2m_frame_list) {
   4.155 -        ERR("Couldn't map p2m_frame_list");
   4.156 +        ERROR("Couldn't map p2m_frame_list");
   4.157          goto out;
   4.158      }
   4.159  
   4.160 @@ -692,20 +692,20 @@ int xc_linux_save(int xc_handle, int io_
   4.161                                      P2M_FL_ENTRIES);
   4.162  
   4.163      if (!live_p2m) {
   4.164 -        ERR("Couldn't map p2m table");
   4.165 +        ERROR("Couldn't map p2m table");
   4.166          goto out;
   4.167      }
   4.168  
   4.169      /* Setup the mfn_to_pfn table mapping */
   4.170      if(!(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ))) {
   4.171 -        ERR("Failed to map live M2P table");
   4.172 +        ERROR("Failed to map live M2P table");
   4.173          goto out;
   4.174      }
   4.175  
   4.176  
   4.177      /* Get a local copy of the live_P2M_frame_list */
   4.178      if(!(p2m_frame_list = malloc(P2M_FL_SIZE))) {
   4.179 -        ERR("Couldn't allocate p2m_frame_list array");
   4.180 +        ERROR("Couldn't allocate p2m_frame_list array");
   4.181          goto out;
   4.182      }
   4.183      memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE);
   4.184 @@ -713,8 +713,8 @@ int xc_linux_save(int xc_handle, int io_
   4.185      /* Canonicalise the pfn-to-mfn table frame-number list. */
   4.186      for (i = 0; i < max_pfn; i += fpp) {
   4.187          if (!translate_mfn_to_pfn(&p2m_frame_list[i/fpp])) {
   4.188 -            ERR("Frame# in pfn-to-mfn frame list is not in pseudophys");
   4.189 -            ERR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
   4.190 +            ERROR("Frame# in pfn-to-mfn frame list is not in pseudophys");
   4.191 +            ERROR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
   4.192                  (uint64_t)p2m_frame_list[i/fpp]);
   4.193              goto out;
   4.194          }
   4.195 @@ -726,7 +726,7 @@ int xc_linux_save(int xc_handle, int io_
   4.196          if (xc_shadow_control(xc_handle, dom,
   4.197                                XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
   4.198                                NULL, 0, NULL, 0, NULL) < 0) {
   4.199 -            ERR("Couldn't enable shadow mode");
   4.200 +            ERROR("Couldn't enable shadow mode");
   4.201              goto out;
   4.202          }
   4.203  
   4.204 @@ -740,7 +740,7 @@ int xc_linux_save(int xc_handle, int io_
   4.205          last_iter = 1;
   4.206  
   4.207          if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info, &ctxt)) {
   4.208 -            ERR("Domain appears not to have suspended");
   4.209 +            ERROR("Domain appears not to have suspended");
   4.210              goto out;
   4.211          }
   4.212  
   4.213 @@ -761,20 +761,20 @@ int xc_linux_save(int xc_handle, int io_
   4.214      to_skip = malloc(BITMAP_SIZE);
   4.215  
   4.216      if (!to_send || !to_fix || !to_skip) {
   4.217 -        ERR("Couldn't allocate to_send array");
   4.218 +        ERROR("Couldn't allocate to_send array");
   4.219          goto out;
   4.220      }
   4.221  
   4.222      memset(to_send, 0xff, BITMAP_SIZE);
   4.223  
   4.224      if (mlock(to_send, BITMAP_SIZE)) {
   4.225 -        ERR("Unable to mlock to_send");
   4.226 +        ERROR("Unable to mlock to_send");
   4.227          return 1;
   4.228      }
   4.229  
   4.230      /* (to fix is local only) */
   4.231      if (mlock(to_skip, BITMAP_SIZE)) {
   4.232 -        ERR("Unable to mlock to_skip");
   4.233 +        ERROR("Unable to mlock to_skip");
   4.234          return 1;
   4.235      }
   4.236  
   4.237 @@ -785,13 +785,13 @@ int xc_linux_save(int xc_handle, int io_
   4.238      pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
   4.239  
   4.240      if ((pfn_type == NULL) || (pfn_batch == NULL)) {
   4.241 -        ERR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
   4.242 +        ERROR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
   4.243          errno = ENOMEM;
   4.244          goto out;
   4.245      }
   4.246  
   4.247      if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
   4.248 -        ERR("Unable to mlock");
   4.249 +        ERROR("Unable to mlock");
   4.250          goto out;
   4.251      }
   4.252  
   4.253 @@ -817,7 +817,7 @@ int xc_linux_save(int xc_handle, int io_
   4.254      /* Start writing out the saved-domain record. */
   4.255  
   4.256      if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
   4.257 -        ERR("write: max_pfn");
   4.258 +        ERROR("write: max_pfn");
   4.259          goto out;
   4.260      }
   4.261  
   4.262 @@ -837,13 +837,13 @@ int xc_linux_save(int xc_handle, int io_
   4.263              !write_exact(io_fd, &chunk_sig, 4) ||
   4.264              !write_exact(io_fd, &chunk_sz,  sizeof(chunk_sz)) ||
   4.265              !write_exact(io_fd, &ctxt,      sizeof(ctxt))) {
   4.266 -            ERR("write: extended info");
   4.267 +            ERROR("write: extended info");
   4.268              goto out;
   4.269          }
   4.270      }
   4.271  
   4.272      if (!write_exact(io_fd, p2m_frame_list, P2M_FL_SIZE)) {
   4.273 -        ERR("write: p2m_frame_list");
   4.274 +        ERROR("write: p2m_frame_list");
   4.275          goto out;
   4.276      }
   4.277  
   4.278 @@ -877,7 +877,7 @@ int xc_linux_save(int xc_handle, int io_
   4.279              if (!last_iter && xc_shadow_control(
   4.280                      xc_handle, dom, XEN_DOMCTL_SHADOW_OP_PEEK,
   4.281                      to_skip, max_pfn, NULL, 0, NULL) != max_pfn) {
   4.282 -                ERR("Error peeking shadow bitmap");
   4.283 +                ERROR("Error peeking shadow bitmap");
   4.284                  goto out;
   4.285              }
   4.286  
   4.287 @@ -942,12 +942,12 @@ int xc_linux_save(int xc_handle, int io_
   4.288  
   4.289              if ((region_base = xc_map_foreign_batch(
   4.290                       xc_handle, dom, PROT_READ, pfn_type, batch)) == 0) {
   4.291 -                ERR("map batch failed");
   4.292 +                ERROR("map batch failed");
   4.293                  goto out;
   4.294              }
   4.295  
   4.296              if (xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type)) {
   4.297 -                ERR("get_pfn_type_batch failed");
   4.298 +                ERROR("get_pfn_type_batch failed");
   4.299                  goto out;
   4.300              }
   4.301  
   4.302 @@ -978,12 +978,12 @@ int xc_linux_save(int xc_handle, int io_
   4.303              }
   4.304  
   4.305              if(!write_exact(io_fd, &batch, sizeof(unsigned int))) {
   4.306 -                ERR("Error when writing to state file (2)");
   4.307 +                ERROR("Error when writing to state file (2)");
   4.308                  goto out;
   4.309              }
   4.310  
   4.311              if(!write_exact(io_fd, pfn_type, sizeof(unsigned long)*j)) {
   4.312 -                ERR("Error when writing to state file (3)");
   4.313 +                ERROR("Error when writing to state file (3)");
   4.314                  goto out;
   4.315              }
   4.316  
   4.317 @@ -1013,7 +1013,7 @@ int xc_linux_save(int xc_handle, int io_
   4.318                          goto out; 
   4.319  
   4.320                      if (ratewrite(io_fd, page, PAGE_SIZE) != PAGE_SIZE) {
   4.321 -                        ERR("Error when writing to state file (4)");
   4.322 +                        ERROR("Error when writing to state file (4)");
   4.323                          goto out;
   4.324                      }
   4.325  
   4.326 @@ -1021,7 +1021,7 @@ int xc_linux_save(int xc_handle, int io_
   4.327  
   4.328                      /* We have a normal page: just write it directly. */
   4.329                      if (ratewrite(io_fd, spage, PAGE_SIZE) != PAGE_SIZE) {
   4.330 -                        ERR("Error when writing to state file (5)");
   4.331 +                        ERROR("Error when writing to state file (5)");
   4.332                          goto out;
   4.333                      }
   4.334                  }
   4.335 @@ -1056,7 +1056,7 @@ int xc_linux_save(int xc_handle, int io_
   4.336  
   4.337              /* send "-1" to put receiver into debug mode */
   4.338              if(!write_exact(io_fd, &minusone, sizeof(int))) {
   4.339 -                ERR("Error when writing to state file (6)");
   4.340 +                ERROR("Error when writing to state file (6)");
   4.341                  goto out;
   4.342              }
   4.343  
   4.344 @@ -1079,7 +1079,7 @@ int xc_linux_save(int xc_handle, int io_
   4.345  
   4.346                  if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info,
   4.347                                        &ctxt)) {
   4.348 -                    ERR("Domain appears not to have suspended");
   4.349 +                    ERROR("Domain appears not to have suspended");
   4.350                      goto out;
   4.351                  }
   4.352  
   4.353 @@ -1092,7 +1092,7 @@ int xc_linux_save(int xc_handle, int io_
   4.354              if (xc_shadow_control(xc_handle, dom, 
   4.355                                    XEN_DOMCTL_SHADOW_OP_CLEAN, to_send, 
   4.356                                    max_pfn, NULL, 0, &stats) != max_pfn) {
   4.357 -                ERR("Error flushing shadow PT");
   4.358 +                ERROR("Error flushing shadow PT");
   4.359                  goto out;
   4.360              }
   4.361  
   4.362 @@ -1110,7 +1110,7 @@ int xc_linux_save(int xc_handle, int io_
   4.363      /* Zero terminate */
   4.364      i = 0;
   4.365      if (!write_exact(io_fd, &i, sizeof(int))) {
   4.366 -        ERR("Error when writing to state file (6)");
   4.367 +        ERROR("Error when writing to state file (6)");
   4.368          goto out;
   4.369      }
   4.370  
   4.371 @@ -1125,7 +1125,7 @@ int xc_linux_save(int xc_handle, int io_
   4.372          }
   4.373  
   4.374          if(!write_exact(io_fd, &j, sizeof(unsigned int))) {
   4.375 -            ERR("Error when writing to state file (6a)");
   4.376 +            ERROR("Error when writing to state file (6a)");
   4.377              goto out;
   4.378          }
   4.379  
   4.380 @@ -1137,7 +1137,7 @@ int xc_linux_save(int xc_handle, int io_
   4.381              i++;
   4.382              if (j == 1024 || i == max_pfn) {
   4.383                  if(!write_exact(io_fd, &pfntab, sizeof(unsigned long)*j)) {
   4.384 -                    ERR("Error when writing to state file (6b)");
   4.385 +                    ERROR("Error when writing to state file (6b)");
   4.386                      goto out;
   4.387                  }
   4.388                  j = 0;
   4.389 @@ -1148,21 +1148,21 @@ int xc_linux_save(int xc_handle, int io_
   4.390  
   4.391      /* Canonicalise the suspend-record frame number. */
   4.392      if ( !translate_mfn_to_pfn(&ctxt.user_regs.edx) ){
   4.393 -        ERR("Suspend record is not in range of pseudophys map");
   4.394 +        ERROR("Suspend record is not in range of pseudophys map");
   4.395          goto out;
   4.396      }
   4.397  
   4.398      /* Canonicalise each GDT frame number. */
   4.399      for ( i = 0; i < ctxt.gdt_ents; i += 512 ) {
   4.400          if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) {
   4.401 -            ERR("GDT frame is not in range of pseudophys map");
   4.402 +            ERROR("GDT frame is not in range of pseudophys map");
   4.403              goto out;
   4.404          }
   4.405      }
   4.406  
   4.407      /* Canonicalise the page table base pointer. */
   4.408      if ( !MFN_IS_IN_PSEUDOPHYS_MAP(xen_cr3_to_pfn(ctxt.ctrlreg[3])) ) {
   4.409 -        ERR("PT base is not in range of pseudophys map");
   4.410 +        ERROR("PT base is not in range of pseudophys map");
   4.411          goto out;
   4.412      }
   4.413      ctxt.ctrlreg[3] = 
   4.414 @@ -1170,7 +1170,7 @@ int xc_linux_save(int xc_handle, int io_
   4.415  
   4.416      if (!write_exact(io_fd, &ctxt, sizeof(ctxt)) ||
   4.417          !write_exact(io_fd, live_shinfo, PAGE_SIZE)) {
   4.418 -        ERR("Error when writing to state file (1)");
   4.419 +        ERROR("Error when writing to state file (1)");
   4.420          goto out;
   4.421      }
   4.422  
     5.1 --- a/tools/libxc/xc_private.h	Tue Oct 17 18:00:51 2006 +0100
     5.2 +++ b/tools/libxc/xc_private.h	Tue Oct 17 18:05:42 2006 +0100
     5.3 @@ -59,11 +59,6 @@
     5.4  #define PPRINTF(_f, _a...)
     5.5  #endif
     5.6  
     5.7 -#define ERR(_f, _a...) do {                     \
     5.8 -    DPRINTF(_f ": %d\n" , ## _a, errno);        \
     5.9 -    fflush(stderr); }                           \
    5.10 -while (0)
    5.11 -
    5.12  #define ERROR(_m, _a...)                        \
    5.13  do {                                            \
    5.14      int __saved_errno = errno;                  \