ia64/xen-unstable

changeset 16371:dfca1120813f

libxc: Consistently print errno on write() error in domain_save code.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Sun Nov 11 18:28:57 2007 +0000 (2007-11-11)
parents f669bf5c6720
children 37be0bb60518
files tools/libxc/xc_domain_save.c
line diff
     1.1 --- a/tools/libxc/xc_domain_save.c	Sun Nov 11 18:22:33 2007 +0000
     1.2 +++ b/tools/libxc/xc_domain_save.c	Sun Nov 11 18:28:57 2007 +0000
     1.3 @@ -784,7 +784,7 @@ static xen_pfn_t *map_and_save_p2m_table
     1.4               write_exact(io_fd, "extv", 4) ||
     1.5               write_exact(io_fd, &chunk2_sz, sizeof(chunk2_sz)) )
     1.6          {
     1.7 -            ERROR("write: extended info");
     1.8 +            PERROR("write: extended info");
     1.9              goto out;
    1.10          }
    1.11      }
    1.12 @@ -792,9 +792,9 @@ static xen_pfn_t *map_and_save_p2m_table
    1.13      if ( write_exact(io_fd, p2m_frame_list, 
    1.14                       P2M_FL_ENTRIES * sizeof(xen_pfn_t)) )
    1.15      {
    1.16 -        ERROR("write: p2m_frame_list");
    1.17 +        PERROR("write: p2m_frame_list");
    1.18          goto out;
    1.19 -    }    
    1.20 +    }
    1.21  
    1.22      success = 1;
    1.23  
    1.24 @@ -1040,7 +1040,7 @@ int xc_domain_save(int xc_handle, int io
    1.25      /* Start writing out the saved-domain record. */
    1.26      if ( write_exact(io_fd, &p2m_size, sizeof(unsigned long)) )
    1.27      {
    1.28 -        ERROR("write: p2m_size");
    1.29 +        PERROR("write: p2m_size");
    1.30          goto out;
    1.31      }
    1.32  
    1.33 @@ -1245,15 +1245,13 @@ int xc_domain_save(int xc_handle, int io
    1.34  
    1.35              if ( write_exact(io_fd, &batch, sizeof(unsigned int)) )
    1.36              {
    1.37 -                ERROR("Error when writing to state file (2) (errno %d)",
    1.38 -                      errno);
    1.39 +                PERROR("Error when writing to state file (2)");
    1.40                  goto out;
    1.41              }
    1.42  
    1.43              if ( write_exact(io_fd, pfn_type, sizeof(unsigned long)*batch) )
    1.44              {
    1.45 -                ERROR("Error when writing to state file (3) (errno %d)",
    1.46 -                      errno);
    1.47 +                PERROR("Error when writing to state file (3)");
    1.48                  goto out;
    1.49              }
    1.50  
    1.51 @@ -1338,8 +1336,7 @@ int xc_domain_save(int xc_handle, int io
    1.52              /* send "-1" to put receiver into debug mode */
    1.53              if ( write_exact(io_fd, &minusone, sizeof(int)) )
    1.54              {
    1.55 -                ERROR("Error when writing to state file (6) (errno %d)",
    1.56 -                      errno);
    1.57 +                PERROR("Error when writing to state file (6)");
    1.58                  goto out;
    1.59              }
    1.60  
    1.61 @@ -1430,7 +1427,7 @@ int xc_domain_save(int xc_handle, int io
    1.62          chunk.vcpumap = vcpumap;
    1.63          if ( write_exact(io_fd, &chunk, sizeof(chunk)) )
    1.64          {
    1.65 -            ERROR("Error when writing to state file (errno %d)", errno);
    1.66 +            PERROR("Error when writing to state file");
    1.67              goto out;
    1.68          }
    1.69      }
    1.70 @@ -1439,7 +1436,7 @@ int xc_domain_save(int xc_handle, int io
    1.71      i = 0;
    1.72      if ( write_exact(io_fd, &i, sizeof(int)) )
    1.73      {
    1.74 -        ERROR("Error when writing to state file (6') (errno %d)", errno);
    1.75 +        PERROR("Error when writing to state file (6')");
    1.76          goto out;
    1.77      }
    1.78  
    1.79 @@ -1457,7 +1454,7 @@ int xc_domain_save(int xc_handle, int io
    1.80                           (unsigned long *)&magic_pfns[2]);
    1.81          if ( write_exact(io_fd, magic_pfns, sizeof(magic_pfns)) )
    1.82          {
    1.83 -            ERROR("Error when writing to state file (7)");
    1.84 +            PERROR("Error when writing to state file (7)");
    1.85              goto out;
    1.86          }
    1.87  
    1.88 @@ -1471,13 +1468,13 @@ int xc_domain_save(int xc_handle, int io
    1.89          
    1.90          if ( write_exact(io_fd, &rec_size, sizeof(uint32_t)) )
    1.91          {
    1.92 -            ERROR("error write hvm buffer size");
    1.93 +            PERROR("error write hvm buffer size");
    1.94              goto out;
    1.95          }
    1.96          
    1.97          if ( write_exact(io_fd, hvm_buf, rec_size) )
    1.98          {
    1.99 -            ERROR("write HVM info failed!\n");
   1.100 +            PERROR("write HVM info failed!\n");
   1.101              goto out;
   1.102          }
   1.103          
   1.104 @@ -1501,7 +1498,7 @@ int xc_domain_save(int xc_handle, int io
   1.105  
   1.106          if ( write_exact(io_fd, &j, sizeof(unsigned int)) )
   1.107          {
   1.108 -            ERROR("Error when writing to state file (6a) (errno %d)", errno);
   1.109 +            PERROR("Error when writing to state file (6a)");
   1.110              goto out;
   1.111          }
   1.112  
   1.113 @@ -1515,8 +1512,7 @@ int xc_domain_save(int xc_handle, int io
   1.114              {
   1.115                  if ( write_exact(io_fd, &pfntab, sizeof(unsigned long)*j) )
   1.116                  {
   1.117 -                    ERROR("Error when writing to state file (6b) (errno %d)",
   1.118 -                          errno);
   1.119 +                    PERROR("Error when writing to state file (6b)");
   1.120                      goto out;
   1.121                  }
   1.122                  j = 0;
   1.123 @@ -1594,7 +1590,7 @@ int xc_domain_save(int xc_handle, int io
   1.124                                          ? sizeof(ctxt.x64) 
   1.125                                          : sizeof(ctxt.x32))) )
   1.126          {
   1.127 -            ERROR("Error when writing to state file (1) (errno %d)", errno);
   1.128 +            PERROR("Error when writing to state file (1)");
   1.129              goto out;
   1.130          }
   1.131  
   1.132 @@ -1608,7 +1604,7 @@ int xc_domain_save(int xc_handle, int io
   1.133          }
   1.134          if ( write_exact(io_fd, &domctl.u.ext_vcpucontext, 128) )
   1.135          {
   1.136 -            ERROR("Error when writing to state file (2) (errno %d)", errno);
   1.137 +            PERROR("Error when writing to state file (2)");
   1.138              goto out;
   1.139          }
   1.140      }
   1.141 @@ -1621,7 +1617,7 @@ int xc_domain_save(int xc_handle, int io
   1.142                arch.pfn_to_mfn_frame_list_list, 0);
   1.143      if ( write_exact(io_fd, page, PAGE_SIZE) )
   1.144      {
   1.145 -        ERROR("Error when writing to state file (1) (errno %d)", errno);
   1.146 +        PERROR("Error when writing to state file (1)");
   1.147          goto out;
   1.148      }
   1.149