serenity
serenity copied to clipboard
Kernel+Userland: Expose partition metadata in SysFS, add printed info in lsblk about that metadata
Relies on #14661. Another nice step towards building a udev-like program in Serenity :)
Looks good! I took a quick look through the code and nothing really stands out, though I'm not super familiar with kernel stuff, so maybe take that with a grain of salt. :^)
Looking ahead, to integrate this into a future PartitionEditor that does writes, we'll need a way to discover corresponding raw block device files. I would suggest adding a symlink that points to the device file in
/dev
, but that may be problematic since it'd be crossing a filesystem boundary and DevFS and SysFS could hypothetically be mounted to locations other than/dev
and/sys
respectively. Maybe we could just add a second block device file in/sys/devices/storage/physical/LUN/
with the same major and minor numbers instead?
The kernel can't assume where userspace wants to mount devtmpfs
nor sysfs
. Therefore, the only sane thing to do is to expose a node for the major number and another for the minor number in each /sys/devices/storage/physical/LUN/
directory. Device files should not be allowed to be created in the sysfs
at all.
Looks good! I took a quick look through the code and nothing really stands out, though I'm not super familiar with kernel stuff, so maybe take that with a grain of salt. :^)
Looking ahead, to integrate this into a future PartitionEditor that does writes, we'll need a way to discover corresponding raw block device files. I would suggest adding a symlink that points to the device file in
/dev
, but that may be problematic since it'd be crossing a filesystem boundary and DevFS and SysFS could hypothetically be mounted to locations other than/dev
and/sys
respectively. Maybe we could just add a second block device file in/sys/devices/storage/physical/LUN/
with the same major and minor numbers instead?
We could also (in relation to the previous comment of mine) just add a device_identifier
symbolic link in each /sys/devices/storage/physical/LUN/
to /sys/dev/block/DEVICE_DIRECTORY_SYMLINK
. It is not a problem because unless you go and try to resolve this link endlessly, you won't have to encounter the ELOOP
error...
This has conflicts
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!
Let's reopen this.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!