Displaying 19 results from an estimated 19 matches for "from_raw".
Did you mean:
from_now
2019 Jul 30
1
Re: [PATCH] Rust bindings: Implement Event features
...nt::from_bitmask(event) {
> >+ Some(x) => x,
> >+ None => panic!("Failed to parse bitmask: {}", event),
> >+ };
> >+ let eh = EventHandle { eh: event_handle };
> >+ let buf = unsafe { slice::from_raw_parts(buf as *const u8,
> buf_len) };
> >+ let array = unsafe { slice::from_raw_parts(array, array_len)
> };
> >+
> >+ let callback_ptr = unsafe { &*(opaque as *const
> sync::Arc<C>) };
> >+ let callback = sync::Arc::clone(...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...+
+ let event = match guestfs::Event::from_bitmask(event) {
+ Some(x) => x,
+ None => panic!("Failed to parse bitmask: {}", event),
+ };
+ let eh = EventHandle { eh: event_handle };
+ let buf = unsafe { slice::from_raw_parts(buf as *const u8, buf_len) };
+ let array = unsafe { slice::from_raw_parts(array, array_len) };
+
+ let callback: &Box<dyn Fn(guestfs::Event, EventHandle, &[u8], &[u64])> =
+ Box::leak(unsafe { Box::from_raw(opaque as *mut _) });
+...
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
> > -
2013 Jul 23
12
node_aws installation problem
Hi everyone!
having a slight problem with the installing the cloud provisioning module
[code]
http://docs.puppetlabs.com/guides/cloud_pack_getting_started.html
[/code]
everything worked until I wanted to actually try to fire it up:
[code]
>puppet node_aws list
Error: Could not autoload puppet/face/node_aws/fingerprint: cannot load
such file -- guid
Error: Could not parse application
2019 Feb 08
0
[PATCH nbdkit] Add support for writing plugins in Rust.
...// data here as required.
+ _not_used: i32,
+}
+
+extern fn ramdisk_open (_readonly: c_int) -> *mut c_void {
+ let h = Handle {_not_used: 0};
+ let h = Box::new(h);
+ return Box::into_raw(h) as *mut c_void;
+}
+
+extern fn ramdisk_close (h: *mut c_void) {
+ let h = unsafe { Box::from_raw(h as *mut Handle) };
+ drop (h);
+}
+
+extern fn ramdisk_get_size (_h: *mut c_void) -> int64_t {
+ return DISK.lock().unwrap().capacity() as int64_t;
+}
+
+extern fn ramdisk_pread (_h: *mut c_void, buf: *mut c_char, count: uint32_t,
+ offset: uint64_t, _flags: uint3...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
....%s);\n" n;
+ indent 5;
+ pr "s.to_str()?.to_string()\n";
indent 4;
- pr "s.to_str().unwrap().to_string()\n";
- indent 3;
pr "},\n"
| n, FBuffer ->
pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
@@ -308,43 +380,129 @@ impl UUID {
| n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
pr "%s: (*raw).%s,\n" n n
| n, FOptPercent ->
- pr "%s: if (*raw).%s <...
2019 Feb 08
3
[PATCH nbdkit] Add support for writing plugins in Rust.
This adds very rough support for writing nbdkit plugins in Rust. This
is not very idiomatic -- essentially we're handling the direct C calls
from nbdkit in Rust. We have to use ‘unsafe’ in a few places because
there's no way to tell the Rust code that nbdkit satisfies guarantees
(eg. around thread safety, always returning leaked pointers back to
the close function, always doing bounds
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
....%s);\n" n;
+ indent 5;
+ pr "s.to_str()?.to_string()\n";
indent 4;
- pr "s.to_str().unwrap().to_string()\n";
- indent 3;
pr "},\n"
| n, FBuffer ->
pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
@@ -349,9 +380,14 @@ impl UUID {
| n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
pr "%s: (*raw).%s,\n" n n
| n, FOptPercent ->
- pr "%s: if (*raw).%s < 0...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...ot; n;
+ indent 5;
+ pr "let s = ffi::CStr::from_ptr((*raw).%s);\n" n;
+ indent 5;
+ pr "s.to_str()?.to_string()\n";
+ indent 4;
+ pr "},\n"
+ | n, FBuffer ->
+ pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
+ | n, FUUID ->
+ pr "%s: UUID::new((*raw).%s),\n" n n
+ | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
+ pr "%s: (*raw).%s,\n" n n
+ | n, FOptPerc...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
...+ pr "let s = ffi::CStr::from_ptr((*raw).%s);\n" n;
> + indent 5;
> + pr "s.to_str()?.to_string()\n";
> + indent 4;
> + pr "},\n"
> + | n, FBuffer ->
> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8,
> (*raw).%s_len).to_vec(),\n" n n n
> + | n, FUUID ->
> + pr "%s: UUID::new((*raw).%s),\n" n n
> + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
> + pr "%s: (*raw).%s,\n" n n...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...->
+ indent 4;
+ match x with
+ | n, FChar ->
+ pr "%s: (*raw).%s as i8,\n" n n;
+ | n, FString ->
+ pr "%s: char_ptr_to_string((*raw).%s)?,\n" n n;
+ | n, FBuffer ->
+ pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
+ | n, FUUID ->
+ pr "%s: UUID::new((*raw).%s),\n" n n
+ | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
+ pr "%s: (*raw).%s,\n" n n
+ | n, FOptPerc...
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
...->
+ indent 4;
+ match x with
+ | n, FChar ->
+ pr "%s: (*raw).%s as i8,\n" n n;
+ | n, FString ->
+ pr "%s: char_ptr_to_string((*raw).%s)?,\n" n n;
+ | n, FBuffer ->
+ pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
+ | n, FUUID ->
+ pr "%s: UUID::new((*raw).%s),\n" n n
+ | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
+ pr "%s: (*raw).%s,\n" n n
+ | n, FOptPerc...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...ot; n;
+ indent 5;
+ pr "let s = ffi::CStr::from_ptr((*raw).%s);\n" n;
+ indent 5;
+ pr "s.to_str()?.to_string()\n";
+ indent 4;
+ pr "},\n"
+ | n, FBuffer ->
+ pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n
+ | n, FUUID ->
+ pr "%s: UUID::new((*raw).%s),\n" n n
+ | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) ->
+ pr "%s: (*raw).%s,\n" n n
+ | n, FOptPerc...
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 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
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 +++++++++++++++++++