提交 3aed6728 编写于 作者: D Daniel P. Berrange

Use lseek+saferead/write for pci.c & dont link to qemu driver for nodedevxml2xmltest

上级 61796bdb
Tue Mar 3 16:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Mingw32 portability fixes
* src/pci.c: Use lseek+read/write instead of pread/pwrite
to avoid mingw compile break
* test/nodedevxml2xmltest.c: Don't link to QEMU driver, since
its not required and breaks build when QEMU is turned off
Tue Mar 3 16:43:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Explicitly track static declared vs dynamically generated
......
......@@ -156,7 +156,8 @@ pciRead(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (pciOpenConfig(dev) < 0)
return -1;
if (pread(dev->fd, buf, buflen, pos) < 0) {
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
saferead(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
VIR_WARN(_("Failed to read from '%s' : %s"), dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));
......@@ -195,7 +196,8 @@ pciWrite(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (pciOpenConfig(dev) < 0)
return -1;
if (pwrite(dev->fd, buf, buflen, pos) < 0) {
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
safewrite(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
VIR_WARN(_("Failed to write to '%s' : %s"), dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));
......
......@@ -185,7 +185,7 @@ endif
nodedevxml2xmltest_SOURCES = \
nodedevxml2xmltest.c \
testutils.c testutils.h
nodedevxml2xmltest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
nodedevxml2xmltest_LDADD = $(LDADDS)
virshtest_SOURCES = \
virshtest.c \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册