Added static variable 'vvfat_count' for generating a unique FAT ID.

This commit is contained in:
Volker Ruppert 2015-07-12 14:46:00 +00:00
parent 16358f9c54
commit 9b0af67606

View File

@ -6,7 +6,7 @@
// ported from QEMU block driver with some additions (see below)
//
// Copyright (c) 2004,2005 Johannes E. Schindelin
// Copyright (C) 2010-2014 The Bochs Project
// Copyright (C) 2010-2015 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -59,6 +59,8 @@
#define VVFAT_BOOT "vvfat_boot.bin"
#define VVFAT_ATTR "vvfat_attr.cfg"
static int vvfat_count = 0;
// portable mkdir / rmdir
static int bx_mkdir(const char *path)
{
@ -1047,7 +1049,7 @@ int vvfat_image_t::init_directories(const char* dirname)
if (fat_type != 32) {
bootsector->u.fat16.drive_number = (fat_type == 12) ? 0:0x80; // assume this is hda (TODO)
bootsector->u.fat16.signature = 0x29;
bootsector->u.fat16.id = htod32(0xfabe1afd);
bootsector->u.fat16.id = htod32(0xfabe1afd + vvfat_count);
memcpy(bootsector->u.fat16.volume_label, "BOCHS VVFAT", 11);
memcpy(bootsector->u.fat16.fat_type, (fat_type==12) ? "FAT12 ":"FAT16 ", 8);
} else {
@ -1057,7 +1059,7 @@ int vvfat_image_t::init_directories(const char* dirname)
bootsector->u.fat32.backup_boot_sector = htod16(6);
bootsector->u.fat32.drive_number = 0x80; // assume this is hda (TODO)
bootsector->u.fat32.signature = 0x29;
bootsector->u.fat32.id = htod32(0xfabe1afd);
bootsector->u.fat32.id = htod32(0xfabe1afd + vvfat_count);
memcpy(bootsector->u.fat32.volume_label, "BOCHS VVFAT", 11);
memcpy(bootsector->u.fat32.fat_type, "FAT32 ", 8);
}
@ -1364,6 +1366,7 @@ int vvfat_image_t::open(const char* dirname, int flags)
#endif
vvfat_modified = 0;
vvfat_count++;
BX_INFO(("'vvfat' disk opened: directory is '%s', redolog is '%s'", dirname, redolog_temp));