Diff for /qemu/block-qcow.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2018/04/24 16:37:52 version 1.1.1.2, 2018/04/24 16:38:18
Line 552  static int qcow_create(const char *filen Line 552  static int qcow_create(const char *filen
     header_size = sizeof(header);      header_size = sizeof(header);
     backing_filename_len = 0;      backing_filename_len = 0;
     if (backing_file) {      if (backing_file) {
         const char *p;          if (strcmp(backing_file, "fat:")) {
         /* XXX: this is a hack: we do not attempt to check for URL              const char *p;
            like syntax */              /* XXX: this is a hack: we do not attempt to check for URL
         p = strchr(backing_file, ':');                 like syntax */
         if (p && (p - backing_file) >= 2) {              p = strchr(backing_file, ':');
             /* URL like but exclude "c:" like filenames */              if (p && (p - backing_file) >= 2) {
             pstrcpy(backing_filename, sizeof(backing_filename),                  /* URL like but exclude "c:" like filenames */
                     backing_file);                  pstrcpy(backing_filename, sizeof(backing_filename),
         } else {                          backing_file);
             realpath(backing_file, backing_filename);              } else {
             if (stat(backing_filename, &st) != 0) {                  realpath(backing_file, backing_filename);
                 return -1;                  if (stat(backing_filename, &st) != 0) {
             }                      return -1;
         }                  }
               }
               header.backing_file_offset = cpu_to_be64(header_size);
               backing_filename_len = strlen(backing_filename);
               header.backing_file_size = cpu_to_be32(backing_filename_len);
               header_size += backing_filename_len;
           } else
               backing_file = NULL;
         header.mtime = cpu_to_be32(st.st_mtime);          header.mtime = cpu_to_be32(st.st_mtime);
         header.backing_file_offset = cpu_to_be64(header_size);  
         backing_filename_len = strlen(backing_filename);  
         header.backing_file_size = cpu_to_be32(backing_filename_len);  
         header_size += backing_filename_len;  
         header.cluster_bits = 9; /* 512 byte cluster to avoid copying          header.cluster_bits = 9; /* 512 byte cluster to avoid copying
                                     unmodifyed sectors */                                      unmodifyed sectors */
         header.l2_bits = 12; /* 32 KB L2 tables */          header.l2_bits = 12; /* 32 KB L2 tables */
Line 603  static int qcow_create(const char *filen Line 606  static int qcow_create(const char *filen
     return 0;      return 0;
 }  }
   
   int qcow_make_empty(BlockDriverState *bs)
   {
       BDRVQcowState *s = bs->opaque;
       uint32_t l1_length = s->l1_size * sizeof(uint64_t);
   
       memset(s->l1_table, 0, l1_length);
       lseek(s->fd, s->l1_table_offset, SEEK_SET);
       if (write(s->fd, s->l1_table, l1_length) < 0)
           return -1;
       ftruncate(s->fd, s->l1_table_offset + l1_length);
   
       memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t));
       memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t));
       memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t));
   
       return 0;
   }
   
 int qcow_get_cluster_size(BlockDriverState *bs)  int qcow_get_cluster_size(BlockDriverState *bs)
 {  {
     BDRVQcowState *s = bs->opaque;      BDRVQcowState *s = bs->opaque;
Line 683  BlockDriver bdrv_qcow = { Line 704  BlockDriver bdrv_qcow = {
     qcow_create,      qcow_create,
     qcow_is_allocated,      qcow_is_allocated,
     qcow_set_key,      qcow_set_key,
       qcow_make_empty
 };  };
   
   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


unix.superglobalmegacorp.com