xen/xenpaging.file_op-return-code.patch
Olaf Hering ee2be8156e - fate#310510 - fix xenpaging
This change reverses the task of xenpaging. Before this change a
  fixed number of pages was paged out. With this change the guest
  will not have access to more than the given number of pages at
  the same time.
  The xenpaging= config option is replaced by actmem=
  A new xm mem-swap-target is added.
  The xenpaging binary is moved to /usr/lib/xen/bin/
  xenpaging.HVMCOPY_gfn_paged_out.patch
  xenpaging.XEN_PAGING_DIR.patch
  xenpaging.add_evict_pages.patch
  xenpaging.bitmap_clear.patch
  xenpaging.cmdline-interface.patch
  xenpaging.encapsulate_domain_info.patch
  xenpaging.file_op-return-code.patch
  xenpaging.guest-memusage.patch
  xenpaging.install-to-libexec.patch
  xenpaging.low_target_policy_nomru.patch
  xenpaging.main-loop-exit-handling.patch
  xenpaging.misleading-comment.patch
  xenpaging.page_in-munmap-size.patch
  xenpaging.print-gfn.patch
  xenpaging.record-numer-paged-out-pages.patch
  xenpaging.reset-uncomsumed.patch
  xenpaging.stale-comments.patch
  xenpaging.target-tot_pages.patch
  xenpaging.use-PERROR.patch
  xenpaging.watch-target-tot_pages.patch
  xenpaging.watch_event-DPRINTF.patch
  xenpaging.xc_interface_open-comment.patch

- xen.spec: update filelist
  package /usr/lib*/xen with wildcard to pickup new files
  remove duplicate /usr/sbin/xen-list from filelist

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=157
2011-11-03 22:59:30 +00:00

86 lines
2.0 KiB
Diff

# HG changeset patch
# Parent 7a4a6935bfa145b24d5183cbf43ce8cc140d9183
xenpaging: simplify file_op
Use -1 as return value and let caller read errno.
Remove const casts from buffer pointers, the page is writeable.
Use wrapper for write() which matches the read() prototype.
Remove unused stdarg.h inclusion.
Remove unused macro.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/xenpaging/file_ops.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c
+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c
@@ -21,55 +21,44 @@
#include <unistd.h>
-#include <stdarg.h>
#include <xc_private.h>
-
-#define page_offset(_pfn) (((off_t)(_pfn)) << PAGE_SHIFT)
-
-
static int file_op(int fd, void *page, int i,
- ssize_t (*fn)(int, const void *, size_t))
+ ssize_t (*fn)(int, void *, size_t))
{
off_t seek_ret;
- int total;
+ int total = 0;
int bytes;
- int ret;
seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
+ if ( seek_ret == (off_t)-1 )
+ return -1;
- total = 0;
while ( total < PAGE_SIZE )
{
bytes = fn(fd, page + total, PAGE_SIZE - total);
if ( bytes <= 0 )
- {
- ret = -errno;
- goto err;
- }
+ return -1;
total += bytes;
}
return 0;
-
- err:
- return ret;
}
-static ssize_t my_read(int fd, const void *buf, size_t count)
+static ssize_t my_write(int fd, void *buf, size_t count)
{
- return read(fd, (void *)buf, count);
+ return write(fd, buf, count);
}
int read_page(int fd, void *page, int i)
{
- return file_op(fd, page, i, &my_read);
+ return file_op(fd, page, i, &read);
}
int write_page(int fd, void *page, int i)
{
- return file_op(fd, page, i, &write);
+ return file_op(fd, page, i, &my_write);
}