- apply patch from Stu Grossman <grossman@juniper.net> that changes

harddrv code to use off_t for file offsets.  If off_t is going to
  require a configure test, I'll add it later.
This commit is contained in:
Bryce Denney 2002-09-30 14:19:46 +00:00
parent 1387109e7b
commit d92ccf70ae
2 changed files with 17 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.76 2002-09-24 20:02:00 kevinlawton Exp $
// $Id: harddrv.cc,v 1.77 2002-09-30 14:19:45 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -162,7 +162,7 @@ bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
char string[5];
BX_HD_THIS devices = d;
BX_DEBUG(("Init $Id: harddrv.cc,v 1.76 2002-09-24 20:02:00 kevinlawton Exp $"));
BX_DEBUG(("Init $Id: harddrv.cc,v 1.77 2002-09-30 14:19:45 bdenney Exp $"));
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
if (bx_options.ata[channel].Opresent->get() == 1) {
@ -629,8 +629,8 @@ if ( quantumsMax == 0)
BX_SELECTED_CONTROLLER(channel).status.drq = 0;
}
else { /* read next one into controller buffer */
Bit32u logical_sector;
int ret;
off_t logical_sector;
off_t ret;
BX_SELECTED_CONTROLLER(channel).status.drq = 1;
BX_SELECTED_CONTROLLER(channel).status.seek_complete = 1;
@ -995,8 +995,8 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
#else
UNUSED(this_ptr);
#endif // !BX_USE_HD_SMF
Bit32u logical_sector;
int ret;
off_t logical_sector;
off_t ret;
Boolean prev_control_reset;
Bit8u channel = BX_MAX_ATA_CHANNEL;
@ -1115,8 +1115,8 @@ if ( quantumsMax == 0)
/* if buffer completely writtten */
if (BX_SELECTED_CONTROLLER(channel).buffer_index >= 512) {
Bit32u logical_sector;
int ret;
off_t logical_sector;
off_t ret;
#if TEST_WRITE_BEYOND_END==1
BX_SELECTED_CONTROLLER(channel).cylinder_no += 100000;
@ -2284,9 +2284,9 @@ bx_hard_drive_c::close_harddrive(void)
Boolean
bx_hard_drive_c::calculate_logical_address(Bit8u channel, Bit32u *sector)
bx_hard_drive_c::calculate_logical_address(Bit8u channel, off_t *sector)
{
Bit32u logical_sector;
off_t logical_sector;
if (BX_SELECTED_CONTROLLER(channel).lba_mode) {
//bx_printf ("disk: calculate: %d %d %d\n", ((Bit32u)BX_SELECTED_CONTROLLER(channel).head_no), ((Bit32u)BX_SELECTED_CONTROLLER(channel).cylinder_no), (Bit32u)BX_SELECTED_CONTROLLER(channel).sector_no);
@ -2315,7 +2315,7 @@ bx_hard_drive_c::increment_address(Bit8u channel)
BX_SELECTED_CONTROLLER(channel).sector_count--;
if (BX_SELECTED_CONTROLLER(channel).lba_mode) {
Bit32u current_address;
off_t current_address;
calculate_logical_address(channel, &current_address);
current_address++;
BX_SELECTED_CONTROLLER(channel).head_no = (current_address >> 24) & 0xf;
@ -3070,7 +3070,7 @@ int concat_image_t::open (const char* pathname0)
{
char *pathname = strdup (pathname0);
BX_DEBUG(("concat_image_t.open"));
ssize_t start_offset = 0;
off_t start_offset = 0;
for (int i=0; i<BX_CONCAT_MAX_IMAGES; i++) {
fd_table[i] = ::open(pathname, O_RDWR
#ifdef O_BINARY

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: harddrv.h,v 1.15 2002-09-24 20:02:00 kevinlawton Exp $
// $Id: harddrv.h,v 1.16 2002-09-30 14:19:46 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -118,8 +118,8 @@ class concat_image_t : public device_image_t
private:
#define BX_CONCAT_MAX_IMAGES 8
int fd_table[BX_CONCAT_MAX_IMAGES];
ssize_t start_offset_table[BX_CONCAT_MAX_IMAGES];
ssize_t length_table[BX_CONCAT_MAX_IMAGES];
off_t start_offset_table[BX_CONCAT_MAX_IMAGES];
off_t length_table[BX_CONCAT_MAX_IMAGES];
void increment_string (char *str);
int maxfd; // number of entries in tables that are valid
@ -133,7 +133,7 @@ class concat_image_t : public device_image_t
// the next read and write.
int index; // index into table
int fd; // fd to use for reads and writes
int thismin, thismax; // byte offset boundary of this image
off_t thismin, thismax; // byte offset boundary of this image
};
#endif /* BX_SPLIT_HD_SUPPORT */
@ -307,7 +307,7 @@ public:
private:
BX_HD_SMF Boolean calculate_logical_address(Bit8u channel, Bit32u *sector);
BX_HD_SMF Boolean calculate_logical_address(Bit8u channel, off_t *sector);
BX_HD_SMF void increment_address(Bit8u channel);
BX_HD_SMF void identify_drive(Bit8u channel);
BX_HD_SMF void identify_ATAPI_drive(Bit8u channel);