Our team at Vates is collaborating on several Xen-related Rust projects, including the Xen Guest Agent and xcp-metrics. We're leveraging Rust's streng

Making Rust a first-class citizen for Xen

submited by
Style Pass
2024-11-26 14:00:04

Our team at Vates is collaborating on several Xen-related Rust projects, including the Xen Guest Agent and xcp-metrics. We're leveraging Rust's strengths in low-level systems like hypervisors and operating systems to build robust and high-performance components.

Xen provides low level libraries for C (often packaged as xen-libs or libxen-dev) with wrappers for OCaml and Python. As of now, there is no official wrapper for Rust. Some unofficial wrappers exist though (e.g xenstore-rs, xenctrl), but they inherit some of the issues of C libraries and incur significant complexity and packaging overhead as highlighted by Yann Dirson during Xen Summit 2024.

One approach that is often used for making use of a C library in Rust is to make the C functions usable from Rust (often named somelibrary-sys) and make a "safe" wrapper on top of it.

We can use bindgen which generates a "raw" interface for Rust from a C library header, providing us the C interface as-is, clunky to use directly (unsafe and pointers everywhere !). We build on top of that of nicer wrapper that tries to use the C interface properly and expose it in a better fashion.

Leave a Comment