summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-11-26 20:15:06 +0530
committerAmit Shah <amit.shah@redhat.com>2009-11-26 20:15:06 +0530
commitf116a63eef78afec990b6d4a33fb62e745d15b4e (patch)
treed764d720cc3e1b91f2a3d3fb98bfa2461fbef135
parent3f621762b88f5c7130e4955f1d08bff674a74256 (diff)
downloadtest-virtserial-f116a63eef78afec990b6d4a33fb62e745d15b4e.tar.gz
test-virtserial-f116a63eef78afec990b6d4a33fb62e745d15b4e.tar.xz
test-virtserial-f116a63eef78afec990b6d4a33fb62e745d15b4e.zip
auto-test-guest: New locations for sysfs files
The sysfs files are now located in /dev/virtio-ports/vportNpn Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--auto-virtserial-guest.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/auto-virtserial-guest.c b/auto-virtserial-guest.c
index 645ce2e..29ddac3 100644
--- a/auto-virtserial-guest.c
+++ b/auto-virtserial-guest.c
@@ -34,7 +34,7 @@
#include <sys/wait.h>
#include "virtserial.h"
-#define CONTROL_PORT "/dev/vcon1"
+#define CONTROL_PORT "/dev/vport0p1"
/* The fd to work with for read / write requests. Set by the open message */
static int g_fd;
@@ -42,16 +42,16 @@ static int g_fd;
static int g_bigfile_fd;
/* The length to read / write. Set by the length message. Unset at close */
static int g_length;
-/* The 'name' field in the debugfs port info */
+/* The 'name' field in the sysfs port info */
static char g_sysfs_name[1024];
static char *get_port_dev(unsigned int nr)
{
char *buf;
- buf = malloc(strlen("/dev/vcon12") + 1);
+ buf = malloc(strlen("/dev/vport0p10") + 1);
if (!buf)
return NULL;
- sprintf(buf, "/dev/vcon%u", nr);
+ sprintf(buf, "/dev/vport0p%u", nr);
return buf;
}
@@ -191,6 +191,7 @@ static int save_bytestream(int val)
break;
}
free(buf);
+ close(g_bigfile_fd);
return ret;
}
@@ -226,10 +227,9 @@ static int send_csum(int nr)
static int check_sysfs(int nr)
{
char filename[1024];
- char *str;
int fd, ret;
- sprintf(filename, "/sys/kernel/debug/virtio-console/vcon%u", nr);
+ sprintf(filename, "/sys/class/virtio-ports/vport0p%u/name", nr);
fd = open(filename, O_RDONLY);
if (fd < 0)
return -errno;
@@ -239,11 +239,6 @@ static int check_sysfs(int nr)
ret = -errno;
goto out_close;
}
- str = strstr(g_sysfs_name, "name: ");
- if (!str) {
- ret = -ERANGE;
- goto out_close;
- }
ret = 0;
out_close:
@@ -257,19 +252,17 @@ static int check_udev(int nr)
char *str;
int ret, i;
- str = strstr(g_sysfs_name, "name: ");
- str += 6; /* Skip 'name: ' */
- for (i = 0; *str && *str != '\n'; i++, str++)
- buf[i] = *str;
+ str = strstr(g_sysfs_name, "\n");
+ if (str)
+ *str = 0;
- buf[i] = 0;
- sprintf(filename, "/dev/virtio-console/%s", buf);
+ sprintf(filename, "/dev/virtio-ports/%s", g_sysfs_name);
ret = readlink(filename, buf, 1024);
if (ret < 0) {
ret = -errno;
goto out;
}
- sprintf(filename, "../vcon%u", nr);
+ sprintf(filename, "../vport0p%u", nr);
for (i = 0; i < ret; i++) {
if (buf[i] != filename[i]) {
ret = -ERANGE;