GenDisk
Defined in: src/fs/block_dev.ts:360
A disk, i.e. struct gendisk.
Adding one publishes it as /dev/<name> and /sys/block/<name>.
Partitions of it get device numbers counting up from the disk’s own.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GenDisk(
init):GenDisk
Defined in: src/fs/block_dev.ts:397
Parameters
Section titled “Parameters”Returns
Section titled “Returns”GenDisk
Properties
Section titled “Properties”attrs:
Record<string,DeviceAttribute> ={}
Defined in: src/fs/block_dev.ts:386
Attributes the driver adds to the disk in sysfs, on top of the ones every disk gets
diskseq
Section titled “diskseq”
readonlydiskseq:number
Defined in: src/fs/block_dev.ts:389
A number that is never reused, so a disk can be told apart from one that replaced it
first_minor
Section titled “first_minor”
readonlyfirst_minor:number=0
Defined in: src/fs/block_dev.ts:366
The disk’s own minor, which its partitions count up from
hidden?
Section titled “hidden?”
optionalhidden?:boolean
Defined in: src/fs/block_dev.ts:375
Hidden disks exist but are not meant to be used directly, so udev ignores them
readonlymajor:number
Defined in: src/fs/block_dev.ts:361
minors
Section titled “minors”
readonlyminors:number=0
Defined in: src/fs/block_dev.ts:369
How many minors are reserved for the disk and its partitions. 0 means partitions are numbered elsewhere.
readonlyname:string
Defined in: src/fs/block_dev.ts:362
no_part?
Section titled “no_part?”
optionalno_part?:boolean
Defined in: src/fs/block_dev.ts:378
Whether the disk can be partitioned at all
readonlyops:BlockDeviceOperations
Defined in: src/fs/block_dev.ts:363
owner?
Section titled “owner?”
optionalowner?:Module
Defined in: src/fs/block_dev.ts:380
parent?
Section titled “parent?”
optionalparent?:Device<unknown>
Defined in: src/fs/block_dev.ts:383
The device this disk hangs off, e.g. its controller. Disks without one are virtual.
readonlypart0:BlockDevice
Defined in: src/fs/block_dev.ts:392
The whole disk, i.e. part0
readonlyparts:Map<number,BlockDevice>
Defined in: src/fs/block_dev.ts:395
Partitions, by partition number
read_only?
Section titled “read_only?”
optionalread_only?:boolean
Defined in: src/fs/block_dev.ts:372
removable?
Section titled “removable?”
optionalremovable?:boolean
Defined in: src/fs/block_dev.ts:371
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get added():
boolean
Defined in: src/fs/block_dev.ts:426
Whether the disk is currently in sysfs
Returns
Section titled “Returns”boolean
capacity
Section titled “capacity”Get Signature
Section titled “Get Signature”get capacity():
number
Defined in: src/fs/block_dev.ts:417
How big the disk is, in sectors
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set capacity(
sectors):void
Defined in: src/fs/block_dev.ts:421
Parameters
Section titled “Parameters”sectors
Section titled “sectors”number
Returns
Section titled “Returns”void
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/fs/block_dev.ts:490
Returns
Section titled “Returns”void
add():
void
Defined in: src/fs/block_dev.ts:434
Publish the disk, i.e. add_disk.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”EBUSY if the disk is already added, or something has its device number
add_partition()
Section titled “add_partition()”add_partition(
part_no,start,count):BlockDevice
Defined in: src/fs/block_dev.ts:460
Add a partition of the disk.
Parameters
Section titled “Parameters”part_no
Section titled “part_no”number
number
where the partition starts, in sectors
number
how long the partition is, in sectors
Returns
Section titled “Returns”Throws
Section titled “Throws”EINVAL if the disk can’t be partitioned, or the partition doesn’t fit on it
Throws
Section titled “Throws”EBUSY if there is already a partition with this number
del():
void
Defined in: src/fs/block_dev.ts:444
Remove the disk and every partition of it, i.e. del_gendisk.
Returns
Section titled “Returns”void
del_partition()
Section titled “del_partition()”del_partition(
part_no):void
Defined in: src/fs/block_dev.ts:482
Remove a partition. Does nothing if there isn’t one with this number.
Parameters
Section titled “Parameters”part_no
Section titled “part_no”number
Returns
Section titled “Returns”void