[c-host] linux: remove extra shm device name validation

This is now validated by the option validator callback
This commit is contained in:
Geoffrey McRae 2019-05-11 11:59:26 +10:00
parent cf030f6f0c
commit 522bacb1f0
2 changed files with 24 additions and 49 deletions

View File

@ -1 +1 @@
a12-176-g823164a924+1 a12-177-gcf030f6f0c+1

View File

@ -200,28 +200,7 @@ bool app_init()
{ {
const char * shmDevice = option_get_string("os", "shmDevice"); const char * shmDevice = option_get_string("os", "shmDevice");
// check the deice name
{
char * name = uioGetName(shmDevice);
if (!name)
{
DEBUG_ERROR("Failed to read the shmDevice name for: %s", shmDevice);
DEBUG_ERROR("Did you remmeber to modprobe the kvmfr module?");
return false;
}
if (strcmp(name, "KVMFR") != 0)
{
free(name);
DEBUG_ERROR("Device is not a KVMFR device \"%s\" reports as: %s", shmDevice, name);
return false;
}
free(name);
}
// get the device size // get the device size
{
int fd = uioOpenFile(shmDevice, "maps/map0/size"); int fd = uioOpenFile(shmDevice, "maps/map0/size");
if (fd < 0) if (fd < 0)
{ {
@ -242,20 +221,16 @@ bool app_init()
close(fd); close(fd);
app.shmSize = strtoul(size, NULL, 16); app.shmSize = strtoul(size, NULL, 16);
}
// open the device // open the device
{
app.shmFD = shmOpenDev(shmDevice); app.shmFD = shmOpenDev(shmDevice);
app.shmMap = MAP_FAILED; app.shmMap = MAP_FAILED;
if (app.shmFD < 0) if (app.shmFD < 0)
return false; return false;
DEBUG_INFO("KVMFR Device : %s", shmDevice); DEBUG_INFO("KVMFR Device : %s", shmDevice);
}
signal(SIGINT, sigHandler); signal(SIGINT, sigHandler);
return true; return true;
} }