block.c (a36e69ddfe8452211bcf3ed94716c60bce5ccd8c) block.c (96b8f136f52ea2dc5948fe24f0bf4483251ac280)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 703 unchanged lines hidden (view full) ---

712 if (!drv->bdrv_getlength) {
713 /* legacy mode */
714 return bs->total_sectors * SECTOR_SIZE;
715 }
716 return drv->bdrv_getlength(bs);
717}
718
719/* return 0 as number of sectors if no device present or error */
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 703 unchanged lines hidden (view full) ---

712 if (!drv->bdrv_getlength) {
713 /* legacy mode */
714 return bs->total_sectors * SECTOR_SIZE;
715 }
716 return drv->bdrv_getlength(bs);
717}
718
719/* return 0 as number of sectors if no device present or error */
720void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr)
720void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr)
721{
722 int64_t length;
723 length = bdrv_getlength(bs);
724 if (length < 0)
725 length = 0;
726 else
727 length = length >> SECTOR_BITS;
728 *nb_sectors_ptr = length;

--- 668 unchanged lines hidden ---
721{
722 int64_t length;
723 length = bdrv_getlength(bs);
724 if (length < 0)
725 length = 0;
726 else
727 length = length >> SECTOR_BITS;
728 *nb_sectors_ptr = length;

--- 668 unchanged lines hidden ---