tpm: adapt sysfs cancel path for new TPM driver

This patch addresses BZ 1244895.

Adapt the sysfs TPM command cancel path for the TPM driver that
does not use a miscdevice anymore since Linux 4.0. Support old
and new paths and check their availability.

Add a mockup for the test cases to avoid the testing for
availability of the cancel path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger
2015-11-17 19:44:13 -05:00
committed by Cole Robinson
parent b6e19cf4cb
commit 5ed7afa9de
2 changed files with 33 additions and 3 deletions

View File

@@ -24,9 +24,13 @@
#include "virnuma.h"
#include "virmock.h"
#include "virutil.h"
#include "virstring.h"
#include "virtpm.h"
#include <time.h>
#include <unistd.h>
#define VIR_FROM_THIS VIR_FROM_NONE
long virGetSystemPageSize(void)
{
return 4096;
@@ -59,3 +63,14 @@ virNumaNodeIsAvailable(int node)
return node >= 0 && node <= virNumaGetMaxNode();
}
#endif /* WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET */
char *
virTPMCreateCancelPath(const char *devpath)
{
char *path;
(void)devpath;
ignore_value(VIR_STRDUP(path, "/sys/class/misc/tpm0/device/cancel"));
return path;
}