- fixed remaining type conflicts in vmware lseek() method and the bxcommit utility

- the bximage and bxcommit utilities depend on hdimage.h
- removed unnecessary spaces
This commit is contained in:
Volker Ruppert 2006-11-19 09:55:23 +00:00
parent 0a174516ff
commit bf0c76ee75
4 changed files with 28 additions and 28 deletions

View File

@ -235,10 +235,10 @@ niclist@EXE@: misc/niclist.o
@LINK_CONSOLE@ misc/niclist.o
# compile with console CXXFLAGS, not gui CXXFLAGS
misc/bximage.o: $(srcdir)/misc/bximage.c
misc/bximage.o: $(srcdir)/misc/bximage.c $(srcdir)/iodev/hdimage.h
$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/bximage.c @OFP@$@
misc/bxcommit.o: $(srcdir)/misc/bxcommit.c
misc/bxcommit.o: $(srcdir)/misc/bxcommit.c $(srcdir)/iodev/hdimage.h
$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/bxcommit.c @OFP@$@
misc/niclist.o: $(srcdir)/misc/niclist.c
@ -249,7 +249,7 @@ $(BX_OBJS): $(BX_INCLUDES)
bxversion.h:
$(RM) -f bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h
echo '// $$Id: Makefile.in,v 1.180 2006-11-05 10:41:56 vruppert Exp $$' >> bxversion.h
echo '// $$Id: Makefile.in,v 1.181 2006-11-19 09:55:21 vruppert Exp $$' >> bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h
echo '// This file is generated by "make bxversion.h"' >> bxversion.h
echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vmware3.cc,v 1.15 2006-06-15 09:44:37 vruppert Exp $
// $Id: vmware3.cc,v 1.16 2006-11-19 09:55:23 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
/*
@ -479,14 +479,14 @@ ssize_t vmware3_image_t::write(const void * buf, size_t count)
return total;
}
off_t vmware3_image_t::lseek(off_t offset, int whence)
Bit64s vmware3_image_t::lseek(Bit64s offset, int whence)
{
if(whence == SEEK_SET)
requested_offset = offset;
requested_offset = (off_t)offset;
else if (whence == SEEK_CUR)
requested_offset += offset;
requested_offset += (off_t)offset;
else if (whence == SEEK_END)
requested_offset = (off_t)(current->header.total_sectors_in_disk * 512) + offset;
requested_offset = (off_t)(current->header.total_sectors_in_disk * 512) + (off_t)offset;
else
{
BX_DEBUG(("unknown 'whence' value (%d) when trying to seek vmware3 COW image", whence));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vmware3.h,v 1.10 2006-04-27 15:11:45 sshwarts Exp $
// $Id: vmware3.h,v 1.11 2006-11-19 09:55:23 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
/*
@ -34,11 +34,11 @@ class vmware3_image_t : public device_image_t
public:
vmware3_image_t() : FL_SHIFT(25), FL_MASK(0xFE000000)
{ };
int open (const char* pathname);
int open(const char* pathname);
void close();
off_t lseek (off_t offset, int whence);
ssize_t read (void* buf, size_t count);
ssize_t write (const void* buf, size_t count);
Bit64s lseek(Bit64s offset, int whence);
ssize_t read(void* buf, size_t count);
ssize_t write(const void* buf, size_t count);
private:
static const off_t INVALID_OFFSET;

View File

@ -1,6 +1,6 @@
/*
* misc/bximage.c
* $Id: bxcommit.c,v 1.11 2005-11-06 11:07:01 vruppert Exp $
* $Id: bxcommit.c,v 1.12 2006-11-19 09:55:23 vruppert Exp $
*
* Commits a redolog file in a flat file for bochs images.
*
@ -49,7 +49,7 @@ int snprintf (char *s, size_t maxlen, const char *format, ...)
#include "../iodev/hdimage.h"
char *EOF_ERR = "ERROR: End of input";
char *rcsid = "$Id: bxcommit.c,v 1.11 2005-11-06 11:07:01 vruppert Exp $";
char *rcsid = "$Id: bxcommit.c,v 1.12 2006-11-19 09:55:23 vruppert Exp $";
char *divider = "========================================================================";
void myexit (int code)
@ -301,11 +301,11 @@ int commit_redolog (char *flatname, char *redologname )
if (dtoh32(catalog[i]) != REDOLOG_PAGE_NOT_ALLOCATED)
{
off_t bitmap_offset;
Bit64s bitmap_offset;
Bit32u bitmap_size, j;
bitmap_offset = (off_t)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
bitmap_offset += (off_t)512 * dtoh32(catalog[i]) * (extent_blocs + bitmap_blocs);
bitmap_offset = (Bit64s)STANDARD_HEADER_SIZE + (dtoh32(header.specific.catalog) * sizeof(Bit32u));
bitmap_offset += (Bit64s)512 * dtoh32(catalog[i]) * (extent_blocs + bitmap_blocs);
// Read bitmap
lseek(redologfd, bitmap_offset, SEEK_SET);
@ -322,19 +322,19 @@ int commit_redolog (char *flatname, char *redologname )
{
if ( (bitmap[j] & (1<<bit)) != 0)
{
off_t flat_offset, bloc_offset;
Bit64s flat_offset, bloc_offset;
bloc_offset = bitmap_offset + ((off_t)512 * (bitmap_blocs + ((j*8)+bit)));
bloc_offset = bitmap_offset + ((Bit64s)512 * (bitmap_blocs + ((j*8)+bit)));
lseek(redologfd, bloc_offset, SEEK_SET);
lseek(redologfd, (off_t)bloc_offset, SEEK_SET);
if (read(redologfd, buffer, 512) != 512)
fatal ("\nERROR: while reading bloc from redolog !");
flat_offset = (off_t)i * (dtoh32(header.specific.extent));
flat_offset += (off_t)512 * ((j * 8) + bit);
flat_offset = (Bit64s)i * (dtoh32(header.specific.extent));
flat_offset += (Bit64s)512 * ((j * 8) + bit);
lseek(flatfd, flat_offset, SEEK_SET);
lseek(flatfd, (off_t)flat_offset, SEEK_SET);
if (write(flatfd, buffer, 512) != 512)
fatal ("\nERROR: while writing bloc in flatfile !");
@ -359,19 +359,19 @@ int main()
char redologname[256];
int remove;
print_banner ();
print_banner();
filename[0] = 0;
redologname[0] = 0;
if (ask_string ("\nWhat is the flat image name?\n", "c.img", filename) < 0)
if (ask_string("\nWhat is the flat image name?\n", "c.img", filename) < 0)
fatal (EOF_ERR);
snprintf(tmplogname,256,"%s%s", filename, UNDOABLE_REDOLOG_EXTENSION);
if (ask_string ("\nWhat is the redolog name?\n", tmplogname, redologname) < 0)
if (ask_string("\nWhat is the redolog name?\n", tmplogname, redologname) < 0)
fatal (EOF_ERR);
if (ask_yn ("\nShall I remove the redolog afterwards?\n", 1, &remove) < 0)
if (ask_yn("\nShall I remove the redolog afterwards?\n", 1, &remove) < 0)
fatal (EOF_ERR);
commit_redolog(filename, redologname);