Added support for unlocking disk images (locks leftover from previous Bochs

session) with the new command line argument '-unlock'.
This commit is contained in:
Volker Ruppert 2018-05-11 07:44:49 +00:00
parent 9e0a507726
commit 74d40805d1
5 changed files with 28 additions and 5 deletions

View File

@ -19,9 +19,14 @@ Changes after 2.6.9 release:
- I/O Devices
- PCI
Added basic support for the i440BX PCI/AGP chipset.
- Added basic support for the i440BX PCI/AGP chipset.
- Timers
- Implemented HPET emulation (ported from Qemu).
- Hard drive / HD image
- Added support for unlocking disk images (locks leftover from previous
Bochs session) with the new command line argument '-unlock'.
- Bugfix: undoable/volatile mode images now inherit the base image geometry
if present.
- Voodoo
- Voodoo1 emulation speedup with combined PCI / memory FIFO implementation
and multi-threading support (separate FIFO thread).

View File

@ -347,6 +347,12 @@ void bx_init_options()
"dumpstats mode",
"dump statistics period",
0, BX_MAX_BIT32U, 0);
// unlock disk images
new bx_param_bool_c(menu,
"unlock_images",
"Unlock disk images",
"Unlock disk images leftover previous from Bochs session",
0);
// subtree for setting up log actions by device in bochsrc
bx_list_c *logfn = new bx_list_c(menu, "logfn", "Logfunctions");

View File

@ -231,11 +231,18 @@ int hdimage_open_file(const char *pathname, int flags, Bit64u *fsize, FILETIME *
sprintf(lockfn, "%s.lock", pathname);
lockfd = ::open(lockfn, O_RDONLY);
if (lockfd >= 0) {
// Opening image must fail if lock file exists.
::close(lockfd);
if (SIM->get_param_bool(BXPN_UNLOCK_IMAGES)->get()) {
// Remove lock file if requested
if (access(lockfn, F_OK) == 0) {
unlink(lockfn);
}
} else {
// Opening image must fail if lock file exists.
BX_ERROR(("image locked: '%s'", pathname));
return -1;
}
}
#endif
int fd = ::open(pathname, flags

View File

@ -554,6 +554,7 @@ void print_usage(void)
#endif
" -r path restore the Bochs state from path\n"
" -log filename specify Bochs log file name\n"
" -unlock unlock Bochs images leftover from previous session\n"
#if BX_DEBUGGER
" -rc filename execute debugger commands stored in file\n"
" -dbglog filename specify Bochs internal debugger log file name\n"
@ -679,6 +680,9 @@ int bx_init_main(int argc, char *argv[])
if (++arg >= argc) BX_PANIC(("-log must be followed by a filename"));
else SIM->get_param_string(BXPN_LOG_FILENAME)->set(argv[arg]);
}
else if (!strcmp("-unlock", argv[arg])) {
SIM->get_param_bool(BXPN_UNLOCK_IMAGES)->set(1);
}
#if BX_DEBUGGER
else if (!strcmp("-dbglog", argv[arg])) {
if (++arg >= argc) BX_PANIC(("-dbglog must be followed by a filename"));

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2017 The Bochs Project
// Copyright (C) 2009-2018 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -34,6 +34,7 @@
#define BXPN_RESTORE_PATH "general.restore_path"
#define BXPN_DEBUG_RUNNING "general.debug_running"
#define BXPN_PLUGIN_CTRL "general.plugin_ctrl"
#define BXPN_UNLOCK_IMAGES "general.unlock_images"
#define BXPN_CPU_NPROCESSORS "cpu.n_processors"
#define BXPN_CPU_NCORES "cpu.n_cores"
#define BXPN_CPU_NTHREADS "cpu.n_threads"