1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Kernel/Devices: Introduce the LoopDevice device

This device is a block device that allows a user to effectively treat an
Inode as a block device.

The static construction method is given an OpenFileDescription reference
but validates that:
- The description has a valid custody (so it's not some arbitrary file).
  Failing this requirement will yield EINVAL.
- The description custody points to an Inode which is a regular file, as
  we only support (seekable) regular files. Failing this requirement
  will yield ENOTSUP.

LoopDevice can be used to mount a regular file on the filesystem like
other supported types of (physical) block devices.
This commit is contained in:
Liav A 2024-02-23 17:11:48 +02:00 committed by Andrew Kaster
parent a9d240c647
commit 5dcf03ad9a
12 changed files with 254 additions and 4 deletions

View file

@ -143,6 +143,8 @@ enum IOCtlNumber {
VIRGL_IOCTL_TRANSFER_DATA,
KDSETMODE,
KDGETMODE,
DEVCTL_CREATE_LOOP_DEVICE,
DEVCTL_DESTROY_LOOP_DEVICE,
};
#define TIOCGPGRP TIOCGPGRP
@ -202,3 +204,5 @@ enum IOCtlNumber {
#define VIRGL_IOCTL_TRANSFER_DATA VIRGL_IOCTL_TRANSFER_DATA
#define KDSETMODE KDSETMODE
#define KDGETMODE KDGETMODE
#define DEVCTL_CREATE_LOOP_DEVICE DEVCTL_CREATE_LOOP_DEVICE
#define DEVCTL_DESTROY_LOOP_DEVICE DEVCTL_DESTROY_LOOP_DEVICE