[Pkg-libvirt-commits] [libguestfs] 105/116: New API: guestfs_blockdev_setra: Adjust readahead for filesystems and devices.

Hilko Bengen bengen at moszumanska.debian.org
Wed Nov 26 22:05:33 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.

commit 350b6eec4d36884bf927bf0790c2044daec5c688
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sun Nov 23 14:31:43 2014 +0000

    New API: guestfs_blockdev_setra: Adjust readahead for filesystems and devices.
    
    This adds a binding for 'blockdev --setra', allowing you to adjust the
    readahead parameter for filesystems and devices.
---
 daemon/blockdev.c    | 10 ++++++++++
 generator/actions.ml | 14 ++++++++++++++
 src/MAX_PROC_NR      |  2 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/daemon/blockdev.c b/daemon/blockdev.c
index 2f240a9..6e8821d 100644
--- a/daemon/blockdev.c
+++ b/daemon/blockdev.c
@@ -89,6 +89,16 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
 }
 
 int
+do_blockdev_setra (const char *device, int sectors)
+{
+  if (sectors < 0) {
+    reply_with_error ("readahead sectors must be >= 0");
+    return -1;
+  }
+  return (int) call_blockdev (device, "--setra", sectors, 0);
+}
+
+int
 do_blockdev_setro (const char *device)
 {
   return (int) call_blockdev (device, "--setro", -1, 0);
diff --git a/generator/actions.ml b/generator/actions.ml
index fe492e6..baa7679 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12003,6 +12003,20 @@ This is the same as the C<lstat(2)> system call." };
     longdesc = "\
 This is the internal call which implements C<guestfs_lstatnslist>." };
 
+  { defaults with
+    name = "blockdev_setra";
+    style = RErr, [Device "device"; Int "sectors"], [];
+    proc_nr = Some 424;
+    tests = [
+      InitEmpty, Always, TestRun (
+        [["blockdev_setra"; "/dev/sda"; "1024" ]]), []
+    ];
+    shortdesc = "set readahead";
+    longdesc = "\
+Set readahead (in 512-byte sectors) for the device.
+
+This uses the L<blockdev(8)> command." };
+
 ]
 
 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 5721413..9524ef4 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-423
+424

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list