Displaying 20 results from an estimated 23 matches for "apierror".
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...= Vec::new();
for x in NullTerminatedIter::new(l) {
- let s = unsafe { ffi::CStr::from_ptr(x) }.to_str().unwrap();
+ let s = unsafe { ffi::CStr::from_ptr(x) }.to_str()?;
v.push(s.to_string());
}
- v
+ Ok(v)
}
#[derive(Debug)]
-pub struct Error {
+pub struct APIError {
operation: &'static str,
message: String,
- errno: i32
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be
better to spend some time with git rebase -i trying to work this into
more coherent patches.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...et s = unsafe { ffi::CStr::from_ptr(x) }.to_str().unwrap();
+ let s = unsafe { ffi::CStr::from_ptr(x) }.to_str()?;
v.push(s.to_string());
}
- v
-}
-
-fn free_string_list(l: *const *const c_char) {
- // TODO
+ Ok(v)
}
#[derive(Debug)]
-pub struct Error {
+pub struct APIError {
operation: &'static str,
message: String,
- errno: i32
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
.../rust/src/error.rs
index e526121e8..ce444e199 100644
--- a/rust/src/error.rs
+++ b/rust/src/error.rs
@@ -20,6 +20,7 @@ use crate::base;
use crate::utils;
use std::convert;
use std::ffi;
+use std::io;
use std::os::raw::{c_char, c_int};
use std::str;
@@ -41,6 +42,7 @@ pub enum Error {
API(APIError),
IllegalString(ffi::NulError),
Utf8Error(str::Utf8Error),
+ UnixError(io::Error, &'static str),
Create,
}
@@ -56,6 +58,10 @@ impl convert::From<str::Utf8Error> for Error {
}
}
+pub(crate) fn unix_error(operation: &'static str) -> Error {
+ E...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...:convert;
+use std::ffi;
+use std::os::raw::{c_char, c_int};
+use std::str;
+
+#[link(name = "guestfs")]
+extern "C" {
+ fn guestfs_last_error(g: *mut guestfs_h) -> *const c_char;
+ fn guestfs_last_errno(g: *mut guestfs_h) -> c_int;
+}
+
+#[derive(Debug)]
+pub struct APIError {
+ operation: &'static str,
+ message: String,
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error: ffi::NulError)...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
...r, c_int};
> +use std::str;
> +
> +#[link(name = "guestfs")]
> +extern "C" {
> + fn guestfs_last_error(g: *mut guestfs_h) -> *const c_char;
> + fn guestfs_last_errno(g: *mut guestfs_h) -> c_int;
> +}
> +
> +#[derive(Debug)]
> +pub struct APIError {
> + operation: &'static str,
> + message: String,
> + errno: i32,
> +}
> +
> +#[derive(Debug)]
> +pub enum Error {
> + API(APIError),
> + IllegalString(ffi::NulError),
> + Utf8Error(str::Utf8Error),
> +}
> +
> +impl convert::From<...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...se std::ffi;
+use std::os::raw::{c_char, c_int};
+use std::str;
+
+#[link(name = "guestfs")]
+extern "C" {
+ fn guestfs_last_error(g: *mut base::guestfs_h) -> *const c_char;
+ fn guestfs_last_errno(g: *mut base::guestfs_h) -> c_int;
+}
+
+#[derive(Debug)]
+pub struct APIError {
+ operation: &'static str,
+ message: String,
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+ Create,
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error: f...
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
> Is this just trying if the guestfs can be linked with?
Yes. In OCaml bindings, there is the corresponding test(
https://github.com/libguestfs/libguestfs/blob/master/ocaml/t/guestfs_010_load.ml).
I just mimicked it. If it is not required, I will remove it.
divided the generated files and handmade files in rust/src/ directory. I'll
send this fixed patch to this mailing list.
I'm not
2019 Jul 08
2
Re: [PATCH] Add Rust bindings
On Mon, Jul 08, 2019 at 10:04:57AM +0100, Richard W.M. Jones wrote:
>On Mon, Jul 08, 2019 at 10:49:55AM +0200, Martin Kletzander wrote:
>> On Mon, Jul 08, 2019 at 10:10:10AM +0200, Pino Toscano wrote:
>> >On Saturday, 6 July 2019 13:03:24 CEST Martin Kletzander wrote:
>> >>Just one thing, the Cargo.toml includes a version under which the crate would be
>>
2019 Jul 29
1
Re: [PATCH] Rust bindings: Add Rust bindings
...se std::ffi;
+use std::os::raw::{c_char, c_int};
+use std::str;
+
+#[link(name = "guestfs")]
+extern "C" {
+ fn guestfs_last_error(g: *mut base::guestfs_h) -> *const c_char;
+ fn guestfs_last_errno(g: *mut base::guestfs_h) -> c_int;
+}
+
+#[derive(Debug)]
+pub struct APIError {
+ operation: &'static str,
+ message: String,
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+ Create,
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error: f...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...ing_list(l: *const *const c_char) -> Result<Vec<String>, Error> {
+ let mut v = Vec::new();
+ for x in NullTerminatedIter::new(l) {
+ let s = unsafe { ffi::CStr::from_ptr(x) }.to_str()?;
+ v.push(s.to_string());
+ }
+ Ok(v)
+}
+
+#[derive(Debug)]
+pub struct APIError {
+ operation: &'static str,
+ message: String,
+ errno: i32,
+}
+
+#[derive(Debug)]
+pub enum Error {
+ API(APIError),
+ IllegalString(ffi::NulError),
+ Utf8Error(str::Utf8Error),
+}
+
+impl convert::From<ffi::NulError> for Error {
+ fn from(error: ffi::NulError)...
2019 Jul 26
4
Re: [PATCH] Rust bindings: Add Rust bindings
Hi Hiroyuki,
sorry for the late reply.
Most of the work is definitely nice! There are few notes below,
although they are not big issues. I will check this patch once more
on monday, especially the rust parts.
Otherwise, I'd say that we are close to merging this :)
On Tuesday, 23 July 2019 10:37:17 CEST Hiroyuki Katsura wrote:
> From: Hiroyuki_Katsura
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
I fixed based on comments.
I'll send these two patches to this mailing list.
- Fix Handle -> Handle<'a>
- Add events
Regards,
Hiroyuki
2019年8月1日(木) 0:01 Pino Toscano <ptoscano@redhat.com>:
> Hi Hiroyuki,
>
> On Tuesday, 30 July 2019 07:51:37 CEST Hiroyuki Katsura wrote:
> > This patch includes:
> >
> > - Event callback handlers
> > -
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
...-> `Restored
+ | 3 -> `FromSnapshot
+ | 4 -> `Wakeup
+ | x -> `Unknown x (* newer libvirt *)
+ end
+
+ module Suspended = struct
+ type t = [
+ | `Paused
+ | `Migrated
+ | `IOError
+ | `Watchdog
+ | `Restored
+ | `FromSnapshot
+ | `APIError
+ | `Unknown of int (* newer libvirt *)
+ ]
+
+ let to_string = function
+ | `Paused -> "Paused"
+ | `Migrated -> "Migrated"
+ | `IOError -> "IOError"
+ | `Watchdog -> "Watchdog"
+ | `Restored -> "Restor...
2019 Dec 16
3
[v2v PATCH 0/2] Move libvirt-ocaml copy to v2v repo
libvirt-ocaml is used only by virt-v2v, so move it to this repository,
instead of having it around in the common submodule.
The removal from common will happen later.
Pino Toscano (2):
common: Bundle the libvirt-ocaml library for use by virt-v2v
build: switch embedded copy of libvirt-ocaml
.gitignore | 2 +
3rdparty/libvirt-ocaml/Makefile.am |
2019 Jul 02
16
[PATCH] Add Rust bindings
I fixed the patch I submitted before based on comments, and there are some
commits which are merged or divided. So, I will re-send all the patches.
Regards,
Hiroyuki Katsura
2018 Aug 30
8
[PATCH 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com>
---
Makefile.am | 4 ++++
configure.ac | 3 +++
generator/Makefile.am | 3 +++
generator/bindtests.ml | 3 +++
generator/bindtests.mli | 1 +
generator/main.ml | 5 +++++
generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++
generator/rust.mli | 19 +++++++++++++++++++
2018 Nov 27
8
[PATCH v2 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not
2019 Jan 30
8
[PATCH v3 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not