ia64/xen-unstable

changeset 4661:0474fdc198e2

bitkeeper revision 1.1385.1.1 (426e50841dwkW8TPBgE1y4h3O71bsQ)

build when DEBUG=1 + whitespace fixes
author smh22@firebug.cl.cam.ac.uk
date Tue Apr 26 14:30:28 2005 +0000 (2005-04-26)
parents 97d3b54f6d13
children a6945f416cd0
files BitKeeper/etc/ignore tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c
line diff
     1.1 --- a/BitKeeper/etc/ignore	Tue Apr 26 09:31:16 2005 +0000
     1.2 +++ b/BitKeeper/etc/ignore	Tue Apr 26 14:30:28 2005 +0000
     1.3 @@ -140,3 +140,6 @@ xen/tools/figlet/figlet
     1.4  xen/xen
     1.5  xen/xen-syms
     1.6  xen/xen.*
     1.7 +linux-2.6.11-xen-sparse/include/asm-xen/multicall.h
     1.8 +tools/libxc/xc_linux_restore.c.SMH
     1.9 +tools/libxc/xc_linux_save.c.SMH
     2.1 --- a/tools/libxc/xc_linux_restore.c	Tue Apr 26 09:31:16 2005 +0000
     2.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Apr 26 14:30:28 2005 +0000
     2.3 @@ -170,13 +170,13 @@ int xc_linux_restore(int xc_handle, XcIO
     2.4      if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024),
     2.5                            -1, 1, &dom) )
     2.6      {
     2.7 -	xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB",
     2.8 -		   nr_pfns,nr_pfns * (PAGE_SIZE / 1024));
     2.9 +	xcio_error(ioctxt, "Could not create domain. pfns=%ld, %ldKB",
    2.10 +		   nr_pfns, nr_pfns * (PAGE_SIZE / 1024));
    2.11          goto out;
    2.12      }
    2.13      
    2.14      ioctxt->domain = dom;
    2.15 -    xcio_info(ioctxt, "Created domain %ld\n",dom);
    2.16 +    xcio_info(ioctxt, "Created domain %u\n", dom);
    2.17  
    2.18      /* Get the domain's shared-info frame. */
    2.19      op.cmd = DOM0_GETDOMAININFO;
    2.20 @@ -200,7 +200,8 @@ int xc_linux_restore(int xc_handle, XcIO
    2.21      }
    2.22  
    2.23      /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
    2.24 -    if ( xc_get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns )
    2.25 +    if ( xc_get_pfn_list(xc_handle, dom, 
    2.26 +                         pfn_to_mfn_table, nr_pfns) != nr_pfns )
    2.27      {
    2.28          xcio_error(ioctxt, "Did not read correct number of frame "
    2.29                     "numbers for new dom");
    2.30 @@ -657,7 +658,7 @@ int xc_linux_restore(int xc_handle, XcIO
    2.31      if ( rc == 0 )
    2.32      {
    2.33          /* Success: print the domain id. */
    2.34 -        xcio_info(ioctxt, "DOM=%lu\n", dom);
    2.35 +        xcio_info(ioctxt, "DOM=%u\n", dom);
    2.36          return 0;
    2.37      }
    2.38  
     3.1 --- a/tools/libxc/xc_linux_save.c	Tue Apr 26 09:31:16 2005 +0000
     3.2 +++ b/tools/libxc/xc_linux_save.c	Tue Apr 26 14:30:28 2005 +0000
     3.3 @@ -167,7 +167,8 @@ static int burst_time_us = -1;
     3.4  #define RATE_TO_BTU 781250
     3.5  #define BURST_TIME_US burst_time_us
     3.6  
     3.7 -static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n){
     3.8 +static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n)
     3.9 +{
    3.10      static int budget = 0;
    3.11      static struct timeval last_put = { 0 };
    3.12      struct timeval now;
    3.13 @@ -230,8 +231,8 @@ static int print_stats( int xc_handle, u
    3.14  
    3.15      gettimeofday(&wall_now, NULL);
    3.16  
    3.17 -    d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0, /* FIXME */ 0 )/1000;
    3.18 -    d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid, /* FIXME */ 0 )/1000;
    3.19 +    d0_cpu_now = xc_domain_get_cpu_usage(xc_handle, 0, /* FIXME */ 0)/1000;
    3.20 +    d1_cpu_now = xc_domain_get_cpu_usage(xc_handle, domid, /* FIXME */ 0)/1000;
    3.21  
    3.22      if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) ) 
    3.23          printf("ARRHHH!!\n");
    3.24 @@ -273,10 +274,13 @@ static int print_stats( int xc_handle, u
    3.25   * @param ioctxt i/o context
    3.26   * @return 0 on success, non-zero on error.
    3.27   */
    3.28 -static int write_vmconfig(XcIOContext *ioctxt){
    3.29 +static int write_vmconfig(XcIOContext *ioctxt)
    3.30 +{
    3.31      int err = -1;
    3.32 -    if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n))) goto exit;
    3.33 -    if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n)) goto exit;
    3.34 +    if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n))) 
    3.35 +        goto exit;
    3.36 +    if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n)) 
    3.37 +        goto exit;
    3.38      err = 0;
    3.39    exit:
    3.40      return err;
    3.41 @@ -329,7 +333,8 @@ int suspend_and_state(int xc_handle, XcI
    3.42  
    3.43  retry:
    3.44  
    3.45 -    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, info, ctxt) )
    3.46 +    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, 
    3.47 +                               info, ctxt) )
    3.48      {
    3.49  	xcio_error(ioctxt, "Could not get full domain info");
    3.50  	return -1;
    3.51 @@ -347,7 +352,7 @@ retry:
    3.52  	// try unpausing domain, wait, and retest	
    3.53  	xc_domain_unpause( xc_handle, ioctxt->domain );
    3.54  
    3.55 -	xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%lx)",
    3.56 +	xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%u)",
    3.57  		   info->flags);
    3.58  	usleep(10000);  // 10ms
    3.59  
    3.60 @@ -357,14 +362,12 @@ retry:
    3.61  
    3.62      if( ++i < 100 )
    3.63      {
    3.64 -	xcio_error(ioctxt, "Retry suspend domain (%lx)",
    3.65 -		   info->flags);
    3.66 +	xcio_error(ioctxt, "Retry suspend domain (%u)", info->flags);
    3.67  	usleep(10000);  // 10ms	
    3.68  	goto retry;
    3.69      }
    3.70  
    3.71 -    xcio_error(ioctxt, "Unable to suspend domain. (%lx)",
    3.72 -	       info->flags);
    3.73 +    xcio_error(ioctxt, "Unable to suspend domain. (%u)", info->flags);
    3.74  
    3.75      return -1;
    3.76  }
    3.77 @@ -442,7 +445,8 @@ int xc_linux_save(int xc_handle, XcIOCon
    3.78          return 1;
    3.79      }
    3.80  
    3.81 -    if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, &info, &ctxt) )
    3.82 +    if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, 
    3.83 +                                &info, &ctxt) )
    3.84      {
    3.85          xcio_error(ioctxt, "Could not get full domain info");
    3.86          goto out;
    3.87 @@ -459,7 +463,9 @@ int xc_linux_save(int xc_handle, XcIOCon
    3.88  
    3.89      /* cheesy sanity check */
    3.90      if ( nr_pfns > 1024*1024 ){
    3.91 -        xcio_error(ioctxt, "Invalid state record -- pfn count out of range: %lu", nr_pfns);
    3.92 +        xcio_error(ioctxt, 
    3.93 +                   "Invalid state record -- pfn count out of range: %lu", 
    3.94 +                   nr_pfns);
    3.95          goto out;
    3.96      }
    3.97  
    3.98 @@ -513,7 +519,8 @@ int xc_linux_save(int xc_handle, XcIOCon
    3.99  
   3.100      for ( i = 0; i < nr_pfns; i += 1024 ){
   3.101          if ( !translate_mfn_to_pfn(&pfn_to_mfn_frame_list[i/1024]) ){
   3.102 -            xcio_error(ioctxt, "Frame # in pfn-to-mfn frame list is not in pseudophys");
   3.103 +            xcio_error(ioctxt, 
   3.104 +                       "Frame# in pfn-to-mfn frame list is not in pseudophys");
   3.105              goto out;
   3.106          }
   3.107      }
   3.108 @@ -539,7 +546,7 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.109  
   3.110  	if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
   3.111  	{
   3.112 -	    xcio_error(ioctxt, "Domain appears not to have suspended: %lx",
   3.113 +	    xcio_error(ioctxt, "Domain appears not to have suspended: %u",
   3.114  		       info.flags);
   3.115  	    goto out;
   3.116  	}
   3.117 @@ -836,7 +843,8 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.118                      } /* end of page table rewrite for loop */
   3.119        
   3.120                      if ( xcio_ratewrite(ioctxt, page, PAGE_SIZE) ){
   3.121 -                        xcio_error(ioctxt, "Error when writing to state file (4)");
   3.122 +                        xcio_error(ioctxt, 
   3.123 +                                   "Error when writing to state file (4)");
   3.124                          goto out;
   3.125                      }
   3.126        
   3.127 @@ -844,7 +852,8 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.128  
   3.129                      if ( xcio_ratewrite(ioctxt, region_base + (PAGE_SIZE*j), 
   3.130                                       PAGE_SIZE) ){
   3.131 -                        xcio_error(ioctxt, "Error when writing to state file (5)");
   3.132 +                        xcio_error(ioctxt, 
   3.133 +                                   "Error when writing to state file (5)");
   3.134                          goto out;
   3.135                      }
   3.136                  }
   3.137 @@ -903,14 +912,15 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.138  
   3.139  		if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
   3.140  		{
   3.141 -		    xcio_error(ioctxt, "Domain appears not to have suspended: %lx",
   3.142 +		    xcio_error(ioctxt, 
   3.143 +                               "Domain appears not to have suspended: %u",
   3.144  			       info.flags);
   3.145  		    goto out;
   3.146  		}
   3.147  
   3.148  		xcio_info(ioctxt,
   3.149 -                          "SUSPEND flags %08lx shinfo %08lx eip %08lx "
   3.150 -                          "esi %08lx\n",info.flags,
   3.151 +                          "SUSPEND flags %08u shinfo %08lx eip %08u "
   3.152 +                          "esi %08u\n",info.flags,
   3.153                            info.shared_info_frame,
   3.154                            ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
   3.155              } 
   3.156 @@ -972,7 +982,8 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.157  	    {
   3.158  		if ( xcio_write(ioctxt, &pfntab, sizeof(unsigned long)*j) )
   3.159  		{
   3.160 -		    xcio_error(ioctxt, "Error when writing to state file (6b)");
   3.161 +		    xcio_error(ioctxt, 
   3.162 +                               "Error when writing to state file (6b)");
   3.163  		    goto out;
   3.164  		}	
   3.165  		j = 0;
   3.166 @@ -1027,14 +1038,24 @@ int xc_linux_save(int xc_handle, XcIOCon
   3.167  
   3.168   out:
   3.169  
   3.170 -    if ( live_shinfo )          munmap(live_shinfo, PAGE_SIZE);
   3.171 -    if ( p_srec )               munmap(p_srec, sizeof(*p_srec));
   3.172 -    if ( live_pfn_to_mfn_frame_list ) munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);
   3.173 -    if ( live_pfn_to_mfn_table ) munmap(live_pfn_to_mfn_table, nr_pfns*4 );
   3.174 -    if ( live_mfn_to_pfn_table ) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024 );
   3.175 +    if(live_shinfo)
   3.176 +        munmap(live_shinfo, PAGE_SIZE);
   3.177  
   3.178 -    if ( pfn_type != NULL ) free(pfn_type);
   3.179 +    if(p_srec) 
   3.180 +        munmap(p_srec, sizeof(*p_srec));
   3.181 +
   3.182 +    if(live_pfn_to_mfn_frame_list) 
   3.183 +        munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);
   3.184 +
   3.185 +    if(live_pfn_to_mfn_table) 
   3.186 +        munmap(live_pfn_to_mfn_table, nr_pfns*4);
   3.187 +
   3.188 +    if(live_mfn_to_pfn_table) 
   3.189 +        munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
   3.190 +
   3.191 +    if (pfn_type != NULL) 
   3.192 +        free(pfn_type);
   3.193 +
   3.194      DPRINTF("Save exit rc=%d\n",rc);
   3.195      return !!rc;
   3.196 -
   3.197  }