Questions about util-linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



**As my first post on this mailing list, please advise if "this is NOT the way..."**

Hi,

I am developing a personal project in Rust for which I need to probe block
devices, create, and mount partitions; `libblkid`, `libfdisk`, and `libmount`
fit the bill perfectly.

So, I am writing Rust bindings for `util-linux-2.39` (published on `crates.io`):
- `rsblkid`: [crate](https://crates.io/crates/rsblkid)  [docs](https://docs.rs/rsblkid/latest/rsblkid/)
- `rsfdisk`: [crate](https://crates.io/crates/rsfdisk)  [docs](https://docs.rs/rsfdisk/latest/rsfdisk/)
- `rsmount`: [crate](https://crates.io/crates/rsmount)  [docs](https://docs.rs/rsmount/latest/rsmount/)

They are first drafts with APIs that are still in flux, with low test coverage,
and some C functions are still missing their Rust equivalents.

Even after going through:
- the source code of each C library,
- their documentation pages,
- the manpages of `blkid`,  `fdisk`, `mount`,
- and searching the net for as much information as I could find,

the docs of each crate still reflects my limited knowledge of `util-linux`.

So, I do have a few questions I hope experts on this list may be able to
answer (see further down). **Warning:** It's a long read!

Thank you for your help! (´ ˘ `ㅅ)

Nick

## How are questions structured?

Most questions follow the pattern described below:

```
<id> "-" <question>"?"
<context>
{<url>
<quote>};


<id> = <capital-letter><seq-num>;
<capital-letter> = "G" | "B" | "F" | "M";
<seq-num> = <digit>, {<digit>};
<digit> = "0" | "1" | "2" | "3" | "4" | 5 | "6" | 7 | "8" | "9";
```

- `<id>`: unique ID for each question.
- `<question>`: text describing the question.
- `<context>`: text describing the issue that prompted the question.
- `<url>`: link to a source file/documentation page of a function cited in
  `<context>`.
- `<quote>`: excerpt from documentation/source code at `<url>`.

About `<id>`:
-`<capital-letter>`: can be one of
  + `G` for a general question about `util-linux`
  + `B` for a specific question about `libblkid`
  + `F` for a specific question about `libfdisk`
  + `M` for a specific question about `libmount`
- `<seq-num>`: a sequence number.

Please mention the ID of the question you are answering, or are seeking
clarifications for. It will make the conversation easier to follow.

Thanks! (^-^)b

## General questions

G1 - Would it be possible to provide a way to define a destructor for functions
registering callbacks, long-lived or otherwise?

Interoperating with C, and registering callback functions requires Rust to
allocate state data on the heap.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux