search for: rawfd

Displaying 5 results from an estimated 5 matches for "rawfd".

2019 Jul 08
0
Re: [libnbd PATCH] RFC: Add bindings for Rust language
...;s a matter of personal preference but you can use multi-line string constants in OCaml which can be unlimited in length, so this: > + pr "#[allow(unused_imports)]\n"; > + pr "use std::os::raw::{c_char, c_int, c_uint, c_void};\n"; > + pr "use std::os::unix::io::RawFd;\n"; > + pr "use std::ffi::CStr;\n"; > + pr "use libnbd_sys::*;\n"; > + pr "use libc;\n"; > + pr "\n"; (etc) can be written as: pr "\ #[allow(unused_imports)] use std::os::raw::{c_char, c_int, c_uint, c_void}; use std::os::unix::...
2019 Jul 08
2
Re: [libnbd PATCH] RFC: Add bindings for Rust language
...nal preference but you can use multi-line string >constants in OCaml which can be unlimited in length, so this: > >> + pr "#[allow(unused_imports)]\n"; >> + pr "use std::os::raw::{c_char, c_int, c_uint, c_void};\n"; >> + pr "use std::os::unix::io::RawFd;\n"; >> + pr "use std::ffi::CStr;\n"; >> + pr "use libnbd_sys::*;\n"; >> + pr "use libc;\n"; >> + pr "\n"; >(etc) > >can be written as: > > pr "\ >#[allow(unused_imports)] >use std::os::raw::{c_char,...
2019 Jul 07
2
[libnbd PATCH] RFC: Add bindings for Rust language
...st_glue_rs () = + let print_wrapper (name, {args; ret; permitted_states; + is_locked; may_set_error}) = + let ret_rs_type = + let typ = + match ret with + | RBool -> "bool" + | RErr -> "()" + | RFd -> "RawFd" + | RInt -> "i32" + | RConstString -> "&'static str" + | RInt64 -> "i64" + | RString -> "String" in + if may_set_error then "Result<" ^ typ ^ ", NbdError>" else typ + in +...
2019 Jul 08
1
Re: [libnbd PATCH] RFC: Add bindings for Rust language
...ot; means in >this context. Do you mean actual string constants? > No, I mean the strings printed by the generator, e.g. the one from your example on how to use a multiline one: pr "\ #[allow(unused_imports)] use std::os::raw::{c_char, c_int, c_uint, c_void}; use std::os::unix::io::RawFd; [...] "; >Rich. > >-- >Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones >Read my programming and virtualization blog: http://rwmj.wordpress.com >virt-top is 'top' for virtual machines. Tiny program with many >powerful monitoring fea...
2019 Aug 31
1
[PATCH libnbd] Add bindings for Rust language
Still not working, but I took the latest patch and: - rebased it against libnbd 1.0 - fixed it so it handles new args and cbargs The generator now runs without warnings. This patch doesn't handle optargs at all. In C these are converted to non-optional parameter. Rust doesn't (AFAIK) have optional or labelled arguments unfortunately. Rich.