Diff for /qemu/block.c between versions 1.1.1.14 and 1.1.1.15

version 1.1.1.14, 2018/04/24 17:34:32 version 1.1.1.15, 2018/04/24 17:57:40
Line 691  int bdrv_pread(BlockDriverState *bs, int Line 691  int bdrv_pread(BlockDriverState *bs, int
     uint8_t tmp_buf[BDRV_SECTOR_SIZE];      uint8_t tmp_buf[BDRV_SECTOR_SIZE];
     int len, nb_sectors, count;      int len, nb_sectors, count;
     int64_t sector_num;      int64_t sector_num;
       int ret;
   
     count = count1;      count = count1;
     /* first read to align to sector start */      /* first read to align to sector start */
Line 699  int bdrv_pread(BlockDriverState *bs, int Line 700  int bdrv_pread(BlockDriverState *bs, int
         len = count;          len = count;
     sector_num = offset >> BDRV_SECTOR_BITS;      sector_num = offset >> BDRV_SECTOR_BITS;
     if (len > 0) {      if (len > 0) {
         if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_read(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
         memcpy(buf, tmp_buf + (offset & (BDRV_SECTOR_SIZE - 1)), len);          memcpy(buf, tmp_buf + (offset & (BDRV_SECTOR_SIZE - 1)), len);
         count -= len;          count -= len;
         if (count == 0)          if (count == 0)
Line 712  int bdrv_pread(BlockDriverState *bs, int Line 713  int bdrv_pread(BlockDriverState *bs, int
     /* read the sectors "in place" */      /* read the sectors "in place" */
     nb_sectors = count >> BDRV_SECTOR_BITS;      nb_sectors = count >> BDRV_SECTOR_BITS;
     if (nb_sectors > 0) {      if (nb_sectors > 0) {
         if (bdrv_read(bs, sector_num, buf, nb_sectors) < 0)          if ((ret = bdrv_read(bs, sector_num, buf, nb_sectors)) < 0)
             return -EIO;              return ret;
         sector_num += nb_sectors;          sector_num += nb_sectors;
         len = nb_sectors << BDRV_SECTOR_BITS;          len = nb_sectors << BDRV_SECTOR_BITS;
         buf += len;          buf += len;
Line 722  int bdrv_pread(BlockDriverState *bs, int Line 723  int bdrv_pread(BlockDriverState *bs, int
   
     /* add data from the last sector */      /* add data from the last sector */
     if (count > 0) {      if (count > 0) {
         if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_read(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
         memcpy(buf, tmp_buf, count);          memcpy(buf, tmp_buf, count);
     }      }
     return count1;      return count1;
Line 735  int bdrv_pwrite(BlockDriverState *bs, in Line 736  int bdrv_pwrite(BlockDriverState *bs, in
     uint8_t tmp_buf[BDRV_SECTOR_SIZE];      uint8_t tmp_buf[BDRV_SECTOR_SIZE];
     int len, nb_sectors, count;      int len, nb_sectors, count;
     int64_t sector_num;      int64_t sector_num;
       int ret;
   
     count = count1;      count = count1;
     /* first write to align to sector start */      /* first write to align to sector start */
Line 743  int bdrv_pwrite(BlockDriverState *bs, in Line 745  int bdrv_pwrite(BlockDriverState *bs, in
         len = count;          len = count;
     sector_num = offset >> BDRV_SECTOR_BITS;      sector_num = offset >> BDRV_SECTOR_BITS;
     if (len > 0) {      if (len > 0) {
         if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_read(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
         memcpy(tmp_buf + (offset & (BDRV_SECTOR_SIZE - 1)), buf, len);          memcpy(tmp_buf + (offset & (BDRV_SECTOR_SIZE - 1)), buf, len);
         if (bdrv_write(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_write(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
         count -= len;          count -= len;
         if (count == 0)          if (count == 0)
             return count1;              return count1;
Line 758  int bdrv_pwrite(BlockDriverState *bs, in Line 760  int bdrv_pwrite(BlockDriverState *bs, in
     /* write the sectors "in place" */      /* write the sectors "in place" */
     nb_sectors = count >> BDRV_SECTOR_BITS;      nb_sectors = count >> BDRV_SECTOR_BITS;
     if (nb_sectors > 0) {      if (nb_sectors > 0) {
         if (bdrv_write(bs, sector_num, buf, nb_sectors) < 0)          if ((ret = bdrv_write(bs, sector_num, buf, nb_sectors)) < 0)
             return -EIO;              return ret;
         sector_num += nb_sectors;          sector_num += nb_sectors;
         len = nb_sectors << BDRV_SECTOR_BITS;          len = nb_sectors << BDRV_SECTOR_BITS;
         buf += len;          buf += len;
Line 768  int bdrv_pwrite(BlockDriverState *bs, in Line 770  int bdrv_pwrite(BlockDriverState *bs, in
   
     /* add data from the last sector */      /* add data from the last sector */
     if (count > 0) {      if (count > 0) {
         if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_read(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
         memcpy(tmp_buf, buf, count);          memcpy(tmp_buf, buf, count);
         if (bdrv_write(bs, sector_num, tmp_buf, 1) < 0)          if ((ret = bdrv_write(bs, sector_num, tmp_buf, 1)) < 0)
             return -EIO;              return ret;
     }      }
     return count1;      return count1;
 }  }
Line 1607  static void multiwrite_user_cb(Multiwrit Line 1609  static void multiwrite_user_cb(Multiwrit
     for (i = 0; i < mcb->num_callbacks; i++) {      for (i = 0; i < mcb->num_callbacks; i++) {
         mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error);          mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error);
         qemu_free(mcb->callbacks[i].free_qiov);          qemu_free(mcb->callbacks[i].free_qiov);
         qemu_free(mcb->callbacks[i].free_buf);          qemu_vfree(mcb->callbacks[i].free_buf);
     }      }
 }  }
   

Removed from v.1.1.1.14  
changed lines
  Added in v.1.1.1.15


unix.superglobalmegacorp.com