Diff for /qemu/block-vpc.c between versions 1.1.1.5 and 1.1.1.6

version 1.1.1.5, 2018/04/24 16:51:00 version 1.1.1.6, 2018/04/24 17:07:09
Line 433  static int vpc_write(BlockDriverState *b Line 433  static int vpc_write(BlockDriverState *b
  *   *
  * Note that the geometry doesn't always exactly match total_sectors but   * Note that the geometry doesn't always exactly match total_sectors but
  * may round it down.   * may round it down.
    *
    * Returns 0 on success, -EFBIG if the size is larger than 127 GB
  */   */
 static void calculate_geometry(int64_t total_sectors, uint16_t* cyls,  static int calculate_geometry(int64_t total_sectors, uint16_t* cyls,
     uint8_t* heads, uint8_t* secs_per_cyl)      uint8_t* heads, uint8_t* secs_per_cyl)
 {  {
     uint32_t cyls_times_heads;      uint32_t cyls_times_heads;
   
     if (total_sectors > 65535 * 16 * 255)      if (total_sectors > 65535 * 16 * 255)
         total_sectors = 65535 * 16 * 255;          return -EFBIG;
   
     if (total_sectors > 65535 * 16 * 63) {      if (total_sectors > 65535 * 16 * 63) {
         *secs_per_cyl = 255;          *secs_per_cyl = 255;
Line 470  static void calculate_geometry(int64_t t Line 472  static void calculate_geometry(int64_t t
     // Note: Rounding up deviates from the Virtual PC behaviour      // Note: Rounding up deviates from the Virtual PC behaviour
     // However, we need this to avoid truncating images in qemu-img convert      // However, we need this to avoid truncating images in qemu-img convert
     *cyls = (cyls_times_heads + *heads - 1) / *heads;      *cyls = (cyls_times_heads + *heads - 1) / *heads;
   
       return 0;
 }  }
   
 static int vpc_create(const char *filename, int64_t total_sectors,  static int vpc_create(const char *filename, int64_t total_sectors,
Line 493  static int vpc_create(const char *filena Line 497  static int vpc_create(const char *filena
         return -EIO;          return -EIO;
   
     // Calculate matching total_size and geometry      // Calculate matching total_size and geometry
     calculate_geometry(total_sectors, &cyls, &heads, &secs_per_cyl);      if (calculate_geometry(total_sectors, &cyls, &heads, &secs_per_cyl))
           return -EFBIG;
     total_sectors = (int64_t) cyls * heads * secs_per_cyl;      total_sectors = (int64_t) cyls * heads * secs_per_cyl;
   
     // Prepare the Hard Disk Footer      // Prepare the Hard Disk Footer

Removed from v.1.1.1.5  
changed lines
  Added in v.1.1.1.6


unix.superglobalmegacorp.com