eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

Use u16 for kernel patch version number #137

Closed zz85 closed 3 years ago

zz85 commented 3 years ago
eminence commented 3 years ago

Thanks, this fix looks fine to me. But what do you think about only changing patch: u16, instead of changing all 3 fields to u32?

zz85 commented 3 years ago

i personally prefer using u32s since i think it isn't much of a space trade off, and that u32s is referenced in the kernel code https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/tools/testing/selftests/bpf/prog_tests/core_extern.c#L12

but i'll make a change to unblock envs this crate is crashing on

eminence commented 3 years ago

True, but then it looks like the KERNEL_VERSION macro expects each field to be only u8, as it then packs everything into a single u32:

#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

But we can always revisit this later. Thanks for making this change!