- fixed type conflicts in hdimage lseek() methods. Now using always Bit64s for
the lseek() methods and off_t is only used for the lowlevel lseek() function. - fixed indent mode and removed unnecessary spaces
This commit is contained in:
parent
470e8d8309
commit
0a174516ff
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.cc,v 1.187 2006-09-20 18:24:17 vruppert Exp $
|
||||
// $Id: harddrv.cc,v 1.188 2006-11-18 11:51:07 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -146,7 +146,7 @@ void bx_hard_drive_c::init(void)
|
||||
char ata_name[20];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.187 2006-09-20 18:24:17 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.188 2006-11-18 11:51:07 vruppert Exp $"));
|
||||
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
sprintf(ata_name, "ata.%d.resources", channel);
|
||||
@ -1179,7 +1179,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
#endif // !BX_USE_HD_SMF
|
||||
off_t logical_sector;
|
||||
Bit64s logical_sector;
|
||||
bx_bool prev_control_reset;
|
||||
|
||||
Bit8u channel = BX_MAX_ATA_CHANNEL;
|
||||
@ -2582,9 +2582,9 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
|
||||
bx_bool BX_CPP_AttrRegparmN(2)
|
||||
bx_hard_drive_c::calculate_logical_address(Bit8u channel, off_t *sector)
|
||||
bx_hard_drive_c::calculate_logical_address(Bit8u channel, Bit64s *sector)
|
||||
{
|
||||
off_t logical_sector;
|
||||
Bit64s logical_sector;
|
||||
|
||||
if (BX_SELECTED_CONTROLLER(channel).lba_mode) {
|
||||
logical_sector = ((Bit32u)BX_SELECTED_CONTROLLER(channel).head_no) << 24 |
|
||||
@ -2615,7 +2615,7 @@ bx_hard_drive_c::increment_address(Bit8u channel)
|
||||
BX_SELECTED_CONTROLLER(channel).sector_count--;
|
||||
|
||||
if (BX_SELECTED_CONTROLLER(channel).lba_mode) {
|
||||
off_t current_address;
|
||||
Bit64s current_address;
|
||||
calculate_logical_address(channel, ¤t_address);
|
||||
current_address++;
|
||||
BX_SELECTED_CONTROLLER(channel).head_no = (Bit8u)((current_address >> 24) & 0xf);
|
||||
@ -3432,8 +3432,8 @@ void bx_hard_drive_c::set_signature(Bit8u channel, Bit8u id)
|
||||
|
||||
bx_bool bx_hard_drive_c::ide_read_sector(Bit8u channel, Bit8u *buffer, Bit32u buffer_size)
|
||||
{
|
||||
off_t logical_sector;
|
||||
off_t ret;
|
||||
Bit64s logical_sector;
|
||||
Bit64s ret;
|
||||
|
||||
int sector_count = (buffer_size / 512);
|
||||
Bit8u *bufptr = buffer;
|
||||
@ -3468,8 +3468,8 @@ bx_bool bx_hard_drive_c::ide_read_sector(Bit8u channel, Bit8u *buffer, Bit32u bu
|
||||
|
||||
bx_bool bx_hard_drive_c::ide_write_sector(Bit8u channel, Bit8u *buffer, Bit32u buffer_size)
|
||||
{
|
||||
off_t logical_sector;
|
||||
off_t ret;
|
||||
Bit64s logical_sector;
|
||||
Bit64s ret;
|
||||
|
||||
int sector_count = (buffer_size / 512);
|
||||
Bit8u *bufptr = buffer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.h,v 1.45 2006-09-16 14:47:40 vruppert Exp $
|
||||
// $Id: harddrv.h,v 1.46 2006-11-18 11:51:07 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -197,7 +197,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
BX_HD_SMF bx_bool calculate_logical_address(Bit8u channel, off_t *sector) BX_CPP_AttrRegparmN(2);
|
||||
BX_HD_SMF bx_bool calculate_logical_address(Bit8u channel, Bit64s *sector) BX_CPP_AttrRegparmN(2);
|
||||
BX_HD_SMF void increment_address(Bit8u channel) BX_CPP_AttrRegparmN(1);
|
||||
BX_HD_SMF void identify_drive(Bit8u channel);
|
||||
BX_HD_SMF void identify_ATAPI_drive(Bit8u channel);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: hdimage.cc,v 1.8 2006-06-16 08:56:13 vruppert Exp $
|
||||
// $Id: hdimage.cc,v 1.9 2006-11-18 11:51:07 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -87,9 +87,9 @@ void default_image_t::close()
|
||||
}
|
||||
}
|
||||
|
||||
off_t default_image_t::lseek(off_t offset, int whence)
|
||||
Bit64s default_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
return ::lseek(fd, offset, whence);
|
||||
return (Bit64s)::lseek(fd, (off_t)offset, whence);
|
||||
}
|
||||
|
||||
ssize_t default_image_t::read(void* buf, size_t count)
|
||||
@ -223,7 +223,7 @@ Bit64s concat_image_t::lseek(Bit64s offset, int whence)
|
||||
}
|
||||
|
||||
seek_was_last_op = 1;
|
||||
return ::lseek(fd, (off_t)offset, whence);
|
||||
return (Bit64s)::lseek(fd, (off_t)offset, whence);
|
||||
}
|
||||
|
||||
ssize_t concat_image_t::read(void* buf, size_t count)
|
||||
@ -461,7 +461,7 @@ void sparse_image_t::close()
|
||||
}
|
||||
}
|
||||
|
||||
off_t sparse_image_t::lseek (off_t offset, int whence)
|
||||
Bit64s sparse_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
//showpagetable(pagetable, header.numpages);
|
||||
|
||||
@ -486,10 +486,10 @@ off_t sparse_image_t::lseek (off_t offset, int whence)
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline off_t sparse_image_t::get_physical_offset()
|
||||
inline Bit64s sparse_image_t::get_physical_offset()
|
||||
{
|
||||
off_t physical_offset = data_start;
|
||||
physical_offset += ((off_t)position_physical_page << pagesize_shift);
|
||||
Bit64s physical_offset = data_start;
|
||||
physical_offset += ((Bit64s)position_physical_page << pagesize_shift);
|
||||
physical_offset += position_page_offset;
|
||||
|
||||
return physical_offset;
|
||||
@ -524,11 +524,11 @@ ssize_t sparse_image_t::read_page_fragment(Bit32u read_virtual_page, Bit32u read
|
||||
}
|
||||
else
|
||||
{
|
||||
off_t physical_offset = get_physical_offset();
|
||||
Bit64s physical_offset = get_physical_offset();
|
||||
|
||||
if (physical_offset != underlying_current_filepos)
|
||||
{
|
||||
off_t ret = ::lseek(fd, physical_offset, SEEK_SET);
|
||||
off_t ret = ::lseek(fd, (off_t)physical_offset, SEEK_SET);
|
||||
// underlying_current_filepos update deferred
|
||||
if (ret == -1)
|
||||
panic(strerror(errno));
|
||||
@ -628,7 +628,7 @@ ssize_t sparse_image_t::write (const void* buf, size_t count)
|
||||
// We just add on another page at the end of the file
|
||||
// Reclamation, compaction etc should currently be done off-line
|
||||
|
||||
off_t data_size = underlying_filesize - data_start;
|
||||
Bit64s data_size = underlying_filesize - data_start;
|
||||
BX_ASSERT((data_size % pagesize) == 0);
|
||||
|
||||
|
||||
@ -638,7 +638,7 @@ ssize_t sparse_image_t::write (const void* buf, size_t count)
|
||||
pagetable[position_virtual_page] = htod32(next_data_page);
|
||||
position_physical_page = next_data_page;
|
||||
|
||||
off_t page_file_start = data_start + ((off_t)position_physical_page << pagesize_shift);
|
||||
Bit64s page_file_start = data_start + ((Bit64s)position_physical_page << pagesize_shift);
|
||||
|
||||
if (parent_image != NULL)
|
||||
{
|
||||
@ -703,11 +703,11 @@ ssize_t sparse_image_t::write (const void* buf, size_t count)
|
||||
|
||||
BX_ASSERT(position_physical_page != SPARSE_PAGE_NOT_ALLOCATED);
|
||||
|
||||
off_t physical_offset = get_physical_offset();
|
||||
Bit64s physical_offset = get_physical_offset();
|
||||
|
||||
if (physical_offset != underlying_current_filepos)
|
||||
{
|
||||
off_t ret = ::lseek(fd, physical_offset, SEEK_SET);
|
||||
off_t ret = ::lseek(fd, (off_t)physical_offset, SEEK_SET);
|
||||
// underlying_current_filepos update deferred
|
||||
if (ret == -1)
|
||||
panic(strerror(errno));
|
||||
@ -828,9 +828,9 @@ void dll_image_t::close ()
|
||||
}
|
||||
}
|
||||
|
||||
off_t dll_image_t::lseek (off_t offset, int whence)
|
||||
Bit64s dll_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
vblk = offset >> 9;
|
||||
vblk = (int)(offset >> 9);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1109,7 +1109,7 @@ Bit64s redolog_t::lseek(Bit64s offset, int whence)
|
||||
BX_PANIC( ("redolog : lseek HD with whence not SEEK_SET"));
|
||||
return -1;
|
||||
}
|
||||
if (offset > (off_t)dtoh64(header.specific.disk))
|
||||
if (offset > (Bit64s)dtoh64(header.specific.disk))
|
||||
{
|
||||
BX_PANIC(("redolog : lseek to byte %ld failed", (long)offset));
|
||||
return -1;
|
||||
@ -1123,143 +1123,140 @@ Bit64s redolog_t::lseek(Bit64s offset, int whence)
|
||||
return offset;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
redolog_t::read (void* buf, size_t count)
|
||||
ssize_t redolog_t::read(void* buf, size_t count)
|
||||
{
|
||||
off_t bloc_offset, bitmap_offset;
|
||||
Bit64s bloc_offset, bitmap_offset;
|
||||
|
||||
if (count != 512)
|
||||
BX_PANIC( ("redolog : read HD with count not 512"));
|
||||
if (count != 512)
|
||||
BX_PANIC( ("redolog : read HD with count not 512"));
|
||||
|
||||
BX_DEBUG(("redolog : reading index %d, mapping to %d", extent_index, dtoh32(catalog[extent_index])));
|
||||
BX_DEBUG(("redolog : reading index %d, mapping to %d", extent_index, dtoh32(catalog[extent_index])));
|
||||
|
||||
if (dtoh32(catalog[extent_index]) == REDOLOG_PAGE_NOT_ALLOCATED)
|
||||
{
|
||||
// page not allocated
|
||||
return 0;
|
||||
}
|
||||
if (dtoh32(catalog[extent_index]) == REDOLOG_PAGE_NOT_ALLOCATED)
|
||||
{
|
||||
// page not allocated
|
||||
return 0;
|
||||
}
|
||||
|
||||
bitmap_offset = (off_t)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (off_t)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
bloc_offset = bitmap_offset + ((off_t)512 * (bitmap_blocs + extent_offset));
|
||||
bitmap_offset = (Bit64s)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (Bit64s)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
bloc_offset = bitmap_offset + ((Bit64s)512 * (bitmap_blocs + extent_offset));
|
||||
|
||||
BX_DEBUG(("redolog : bitmap offset is %x", (Bit32u)bitmap_offset));
|
||||
BX_DEBUG(("redolog : bloc offset is %x", (Bit32u)bloc_offset));
|
||||
BX_DEBUG(("redolog : bitmap offset is %x", (Bit32u)bitmap_offset));
|
||||
BX_DEBUG(("redolog : bloc offset is %x", (Bit32u)bloc_offset));
|
||||
|
||||
// FIXME if same extent_index as before we can skip bitmap read
|
||||
|
||||
// FIXME if same extent_index as before we can skip bitmap read
|
||||
::lseek(fd, (off_t)bitmap_offset, SEEK_SET);
|
||||
|
||||
::lseek(fd, bitmap_offset, SEEK_SET);
|
||||
if (::read(fd, bitmap, dtoh32(header.specific.bitmap)) != (ssize_t)dtoh32(header.specific.bitmap))
|
||||
{
|
||||
BX_PANIC(("redolog : failed to read bitmap for extent %d", extent_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (::read(fd, bitmap, dtoh32(header.specific.bitmap)) != (ssize_t)dtoh32(header.specific.bitmap))
|
||||
{
|
||||
BX_PANIC(("redolog : failed to read bitmap for extent %d", extent_index));
|
||||
return 0;
|
||||
}
|
||||
if ( ((bitmap[extent_offset/8] >> (extent_offset%8)) & 0x01) == 0x00 )
|
||||
{
|
||||
BX_DEBUG(("read not in redolog"));
|
||||
|
||||
if ( ((bitmap[extent_offset/8] >> (extent_offset%8)) & 0x01) == 0x00 )
|
||||
{
|
||||
BX_DEBUG(("read not in redolog"));
|
||||
// bitmap says bloc not in reloglog
|
||||
return 0;
|
||||
}
|
||||
|
||||
// bitmap says bloc not in reloglog
|
||||
return 0;
|
||||
}
|
||||
|
||||
::lseek(fd, bloc_offset, SEEK_SET);
|
||||
::lseek(fd, (off_t)bloc_offset, SEEK_SET);
|
||||
|
||||
return (::read(fd, buf, count));
|
||||
return (::read(fd, buf, count));
|
||||
}
|
||||
|
||||
ssize_t
|
||||
redolog_t::write (const void* buf, size_t count)
|
||||
ssize_t redolog_t::write(const void* buf, size_t count)
|
||||
{
|
||||
Bit32u i;
|
||||
off_t bloc_offset, bitmap_offset, catalog_offset;
|
||||
ssize_t written;
|
||||
bx_bool update_catalog = 0;
|
||||
Bit32u i;
|
||||
Bit64s bloc_offset, bitmap_offset, catalog_offset;
|
||||
ssize_t written;
|
||||
bx_bool update_catalog = 0;
|
||||
|
||||
if (count != 512)
|
||||
BX_PANIC( ("redolog : write HD with count not 512"));
|
||||
if (count != 512)
|
||||
BX_PANIC( ("redolog : write HD with count not 512"));
|
||||
|
||||
BX_DEBUG(("redolog : writing index %d, mapping to %d", extent_index, dtoh32(catalog[extent_index])));
|
||||
if (dtoh32(catalog[extent_index]) == REDOLOG_PAGE_NOT_ALLOCATED)
|
||||
{
|
||||
if(extent_next >= dtoh32(header.specific.catalog))
|
||||
{
|
||||
BX_PANIC(("redolog : can't allocate new extent... catalog is full"));
|
||||
return 0;
|
||||
}
|
||||
BX_DEBUG(("redolog : writing index %d, mapping to %d", extent_index, dtoh32(catalog[extent_index])));
|
||||
if (dtoh32(catalog[extent_index]) == REDOLOG_PAGE_NOT_ALLOCATED)
|
||||
{
|
||||
if (extent_next >= dtoh32(header.specific.catalog))
|
||||
{
|
||||
BX_PANIC(("redolog : can't allocate new extent... catalog is full"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
BX_DEBUG(("redolog : allocating new extent at %d", extent_next));
|
||||
BX_DEBUG(("redolog : allocating new extent at %d", extent_next));
|
||||
|
||||
// Extent not allocated, allocate new
|
||||
catalog[extent_index] = htod32(extent_next);
|
||||
|
||||
extent_next += 1;
|
||||
// Extent not allocated, allocate new
|
||||
catalog[extent_index] = htod32(extent_next);
|
||||
|
||||
char *zerobuffer = (char*)malloc(512);
|
||||
memset(zerobuffer, 0, 512);
|
||||
extent_next += 1;
|
||||
|
||||
// Write bitmap
|
||||
bitmap_offset = (off_t)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (off_t)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
::lseek(fd, bitmap_offset, SEEK_SET);
|
||||
for(i=0; i<bitmap_blocs; i++)
|
||||
{
|
||||
::write(fd, zerobuffer, 512);
|
||||
}
|
||||
// Write extent
|
||||
for(i=0; i<extent_blocs; i++)
|
||||
{
|
||||
::write(fd, zerobuffer, 512);
|
||||
}
|
||||
char *zerobuffer = (char*)malloc(512);
|
||||
memset(zerobuffer, 0, 512);
|
||||
|
||||
free(zerobuffer);
|
||||
// Write bitmap
|
||||
bitmap_offset = (Bit64s)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (Bit64s)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
::lseek(fd, (off_t)bitmap_offset, SEEK_SET);
|
||||
for (i=0; i<bitmap_blocs; i++)
|
||||
{
|
||||
::write(fd, zerobuffer, 512);
|
||||
}
|
||||
// Write extent
|
||||
for (i=0; i<extent_blocs; i++)
|
||||
{
|
||||
::write(fd, zerobuffer, 512);
|
||||
}
|
||||
|
||||
update_catalog = 1;
|
||||
}
|
||||
free(zerobuffer);
|
||||
|
||||
bitmap_offset = (off_t)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (off_t)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
bloc_offset = bitmap_offset + ((off_t)512 * (bitmap_blocs + extent_offset));
|
||||
update_catalog = 1;
|
||||
}
|
||||
|
||||
BX_DEBUG(("redolog : bitmap offset is %x", (Bit32u)bitmap_offset));
|
||||
BX_DEBUG(("redolog : bloc offset is %x", (Bit32u)bloc_offset));
|
||||
bitmap_offset = (Bit64s)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
|
||||
bitmap_offset += (Bit64s)512 * dtoh32(catalog[extent_index]) * (extent_blocs + bitmap_blocs);
|
||||
bloc_offset = bitmap_offset + ((Bit64s)512 * (bitmap_blocs + extent_offset));
|
||||
|
||||
// Write bloc
|
||||
::lseek(fd, bloc_offset, SEEK_SET);
|
||||
written = ::write(fd, buf, count);
|
||||
BX_DEBUG(("redolog : bitmap offset is %x", (Bit32u)bitmap_offset));
|
||||
BX_DEBUG(("redolog : bloc offset is %x", (Bit32u)bloc_offset));
|
||||
|
||||
// Write bitmap
|
||||
// FIXME if same extent_index as before we can skip bitmap read
|
||||
::lseek(fd, bitmap_offset, SEEK_SET);
|
||||
if (::read(fd, bitmap, dtoh32(header.specific.bitmap)) != (ssize_t)dtoh32(header.specific.bitmap))
|
||||
{
|
||||
BX_PANIC(("redolog : failed to read bitmap for extent %d", extent_index));
|
||||
return 0;
|
||||
}
|
||||
// Write bloc
|
||||
::lseek(fd, (off_t)bloc_offset, SEEK_SET);
|
||||
written = ::write(fd, buf, count);
|
||||
|
||||
// If bloc does not belong to extent yet
|
||||
if ( ((bitmap[extent_offset/8] >> (extent_offset%8)) & 0x01) == 0x00 )
|
||||
{
|
||||
bitmap[extent_offset/8] |= 1 << (extent_offset%8);
|
||||
::lseek(fd, bitmap_offset, SEEK_SET);
|
||||
::write(fd, bitmap, dtoh32(header.specific.bitmap));
|
||||
}
|
||||
// Write bitmap
|
||||
// FIXME if same extent_index as before we can skip bitmap read
|
||||
::lseek(fd, (off_t)bitmap_offset, SEEK_SET);
|
||||
if (::read(fd, bitmap, dtoh32(header.specific.bitmap)) != (ssize_t)dtoh32(header.specific.bitmap))
|
||||
{
|
||||
BX_PANIC(("redolog : failed to read bitmap for extent %d", extent_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Write catalog
|
||||
if (update_catalog)
|
||||
{
|
||||
// FIXME if mmap
|
||||
catalog_offset = (off_t)STANDARD_HEADER_SIZE + (extent_index * sizeof(Bit32u));
|
||||
// If bloc does not belong to extent yet
|
||||
if ( ((bitmap[extent_offset/8] >> (extent_offset%8)) & 0x01) == 0x00 )
|
||||
{
|
||||
bitmap[extent_offset/8] |= 1 << (extent_offset%8);
|
||||
::lseek(fd, (off_t)bitmap_offset, SEEK_SET);
|
||||
::write(fd, bitmap, dtoh32(header.specific.bitmap));
|
||||
}
|
||||
|
||||
BX_DEBUG(("redolog : writing catalog at offset %x", (Bit32u)catalog_offset));
|
||||
// Write catalog
|
||||
if (update_catalog)
|
||||
{
|
||||
// FIXME if mmap
|
||||
catalog_offset = (Bit64s)STANDARD_HEADER_SIZE + (extent_index * sizeof(Bit32u));
|
||||
|
||||
::lseek(fd, catalog_offset, SEEK_SET);
|
||||
::write(fd, &catalog[extent_index], sizeof(Bit32u));
|
||||
}
|
||||
BX_DEBUG(("redolog : writing catalog at offset %x", (Bit32u)catalog_offset));
|
||||
|
||||
return written;
|
||||
::lseek(fd, (off_t)catalog_offset, SEEK_SET);
|
||||
::write(fd, &catalog[extent_index], sizeof(Bit32u));
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
|
||||
@ -1370,7 +1367,7 @@ void undoable_image_t::close ()
|
||||
Bit64s undoable_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
redolog->lseek(offset, whence);
|
||||
return ro_disk->lseek((off_t)offset, whence);
|
||||
return ro_disk->lseek(offset, whence);
|
||||
}
|
||||
|
||||
ssize_t undoable_image_t::read(void* buf, size_t count)
|
||||
@ -1492,7 +1489,7 @@ ssize_t volatile_image_t::write(const void* buf, size_t count)
|
||||
|
||||
z_ro_image_t::z_ro_image_t()
|
||||
{
|
||||
offset = (off_t)0;
|
||||
offset = (Bit64s)0;
|
||||
}
|
||||
|
||||
int z_ro_image_t::open (const char* pathname)
|
||||
@ -1521,7 +1518,7 @@ void z_ro_image_t::close ()
|
||||
}
|
||||
}
|
||||
|
||||
off_t z_ro_image_t::lseek (off_t _offset, int whence)
|
||||
Bit64s z_ro_image_t::lseek(Bit64s _offset, int whence)
|
||||
{
|
||||
// Only SEEK_SET supported
|
||||
if (whence != SEEK_SET)
|
||||
@ -1610,7 +1607,7 @@ void z_undoable_image_t::close ()
|
||||
free(redolog_name);
|
||||
}
|
||||
|
||||
off_t z_undoable_image_t::lseek (off_t offset, int whence)
|
||||
Bit64s z_undoable_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
redolog->lseek(offset, whence);
|
||||
return ro_disk->lseek(offset, whence);
|
||||
@ -1711,7 +1708,7 @@ void z_volatile_image_t::close ()
|
||||
free(redolog_name);
|
||||
}
|
||||
|
||||
off_t z_volatile_image_t::lseek (off_t offset, int whence)
|
||||
Bit64s z_volatile_image_t::lseek(Bit64s offset, int whence)
|
||||
{
|
||||
redolog->lseek(offset, whence);
|
||||
return ro_disk->lseek(offset, whence);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: hdimage.h,v 1.6 2006-06-16 07:29:33 vruppert Exp $
|
||||
// $Id: hdimage.h,v 1.7 2006-11-18 11:51:07 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2005 MandrakeSoft S.A.
|
||||
@ -133,22 +133,22 @@ class device_image_t
|
||||
device_image_t();
|
||||
|
||||
// Open a image. Returns non-negative if successful.
|
||||
virtual int open (const char* pathname) = 0;
|
||||
virtual int open(const char* pathname) = 0;
|
||||
|
||||
// Close the image.
|
||||
virtual void close () = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
virtual off_t lseek (off_t offset, int whence) = 0;
|
||||
virtual Bit64s lseek(Bit64s offset, int whence) = 0;
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
virtual ssize_t read (void* buf, size_t count) = 0;
|
||||
virtual ssize_t read(void* buf, size_t count) = 0;
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
virtual ssize_t write (const void* buf, size_t count) = 0;
|
||||
virtual ssize_t write(const void* buf, size_t count) = 0;
|
||||
|
||||
unsigned cylinders;
|
||||
unsigned heads;
|
||||
@ -161,25 +161,25 @@ class default_image_t : public device_image_t
|
||||
{
|
||||
public:
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Open an image with specific flags. Returns non-negative if successful.
|
||||
int open (const char* pathname, int flags);
|
||||
int open(const char* pathname, int flags);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
int fd;
|
||||
@ -246,22 +246,22 @@ class sparse_image_t : public device_image_t
|
||||
sparse_image_t();
|
||||
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
int fd;
|
||||
@ -283,23 +283,23 @@ class sparse_image_t : public device_image_t
|
||||
int pagesize_shift;
|
||||
Bit32u pagesize_mask;
|
||||
|
||||
off_t data_start;
|
||||
off_t underlying_filesize;
|
||||
Bit64s data_start;
|
||||
Bit64s underlying_filesize;
|
||||
|
||||
char * pathname;
|
||||
|
||||
off_t position;
|
||||
Bit64s position;
|
||||
|
||||
Bit32u position_virtual_page;
|
||||
Bit32u position_physical_page;
|
||||
Bit32u position_page_offset;
|
||||
|
||||
off_t underlying_current_filepos;
|
||||
Bit64s underlying_current_filepos;
|
||||
|
||||
off_t total_size;
|
||||
Bit64s total_size;
|
||||
|
||||
void panic(const char * message);
|
||||
off_t get_physical_offset();
|
||||
Bit64s get_physical_offset();
|
||||
void set_virtual_page(Bit32u new_virtual_page);
|
||||
void read_header();
|
||||
ssize_t read_page_fragment(Bit32u read_virtual_page, Bit32u read_page_offset, size_t read_size, void * buf);
|
||||
@ -316,22 +316,22 @@ class dll_image_t : public device_image_t
|
||||
{
|
||||
public:
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
int vunit,vblk;
|
||||
@ -476,25 +476,25 @@ class z_ro_image_t : public device_image_t
|
||||
z_ro_image_t();
|
||||
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
off_t offset;
|
||||
Bit64s offset;
|
||||
int fd;
|
||||
gzFile gzfile;
|
||||
|
||||
@ -508,22 +508,22 @@ class z_undoable_image_t : public device_image_t
|
||||
z_undoable_image_t(Bit64u size, const char* redolog_name);
|
||||
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
redolog_t *redolog; // Redolog instance
|
||||
@ -540,22 +540,22 @@ class z_volatile_image_t : public device_image_t
|
||||
z_volatile_image_t(Bit64u size, const char* redolog_name);
|
||||
|
||||
// Open a image. Returns non-negative if successful.
|
||||
int open (const char* pathname);
|
||||
int open(const char* pathname);
|
||||
|
||||
// Close the image.
|
||||
void close ();
|
||||
void close();
|
||||
|
||||
// Position ourselves. Return the resulting offset from the
|
||||
// beginning of the file.
|
||||
off_t lseek (off_t offset, int whence);
|
||||
Bit64s lseek(Bit64s offset, int whence);
|
||||
|
||||
// Read count bytes to the buffer buf. Return the number of
|
||||
// bytes read (count).
|
||||
ssize_t read (void* buf, size_t count);
|
||||
ssize_t read(void* buf, size_t count);
|
||||
|
||||
// Write count bytes from buf. Return the number of bytes
|
||||
// written (count).
|
||||
ssize_t write (const void* buf, size_t count);
|
||||
ssize_t write(const void* buf, size_t count);
|
||||
|
||||
private:
|
||||
redolog_t *redolog; // Redolog instance
|
||||
|
Loading…
Reference in New Issue
Block a user