bytecodealliance / bytecodealliance/rustix

About `statfs.f_fsid`

Aperta
#1,392 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Rust
Stelle
2.1k
Fork
294
Merge medio
6g 22h
PR unite (30g)
4

Descrizione

`statfs` in rustix 0.38 returned the raw linux-raw-sys `statfs64` struct. rustix 1.0 changed this to a rustix `StatFs` struct that uses a `Fsid` struct for the `f_fsid` field. For the `libc` backend this is a alias to `libc::fsid_t`, the `linux_raw` backend defines the `Fsid` struct by itself.

The problem is that this struct is completely useless. Although this is also (kind of) true at the kernel level:

> Nobody knows what `f_fsid` is supposed to contain (but see below).

, the situation in rustix is even more useless.

While you can not be rely on the meaning and ABI of `f_fsid` across different operating systems, you can use it within one operating system where it has the same meaning and ABI. However this is not really possible with rustix because there are no methods to access the value or do basic operations on it like compare for equality.

Ideas on getting out of this:
- derive `PartialEq` in `linux_raw` (for `libc` backend this is already derived if `extra_traits` is used) to support comparing of two `Fsid` instances.
- This does not fix the problem that you can not create a `Fsid` without `transmute_copy` (which should be same because of `repr(C)` with `Copy`).
- add a function to expose "the raw value" (for all(?) operating systems "the raw value" can be transmuted to an `u64`?).
- Likely impossible for `libc` backend without `transmute(_copy)`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Esamina le rappresentazioni StatFs e Fsid di rustix 1.0, inclusi i backend libc e linux_raw. Confronta gli approcci proposti per l’uguaglianza e l’accesso ai valori grezzi con i vincoli ABI tra sistemi operativi indicati; il lavoro è completato quando viene concordata un’API coerente e utilizzabile e il suo comportamento è coperto per entrambi i backend.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
backend-api-design, operating-systems
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.