Skip to content

Module

Defined in: src/module.ts:142

  • AsyncDisposable

new Module(init): Module

Defined in: src/module.ts:190

Note this only sets the module up. Use init to actually load it.

ModuleInit

Module

protected readonly optional _exit?: (this) => void | Promise<void>

Defined in: src/module.ts:151

Module

void | Promise<void>


protected readonly optional _init?: (this) => void | Promise<void>

Defined in: src/module.ts:150

Module

void | Promise<void>


_refs: number = 0

Defined in: src/module.ts:180

Internal

The number of references held on this module.


readonly optional author?: string | string[]

Defined in: src/module.ts:148


readonly optional description?: string

Defined in: src/module.ts:147


readonly holders: Set<Module>

Defined in: src/module.ts:172

Modules that depend on this one


readonly kobject: ModuleKObject

Defined in: src/module.ts:164


readonly optional license?: string

Defined in: src/module.ts:146


readonly name: string

Defined in: src/module.ts:143


readonly params: Map<string, KernelParam<ParamValue>>

Defined in: src/module.ts:166


readonly optional srcversion?: string

Defined in: src/module.ts:145


readonly taints: Set<"P" | "F" | "C" | "E" | "O">

Defined in: src/module.ts:174


readonly uses: Set<Module>

Defined in: src/module.ts:169

Modules this one depends on


readonly optional version?: string

Defined in: src/module.ts:144

get flags(): string

Defined in: src/module.ts:248

The taint characters for a module, for example OE

string


get refcnt(): number

Defined in: src/module.ts:183

The number of references held on this module, including the ones held by holders

number


get state(): ModuleState

Defined in: src/module.ts:155

ModuleState

set state(value): void

Defined in: src/module.ts:159

ModuleState

void

[asyncDispose](): Promise<void>

Defined in: src/module.ts:327

Promise<void>

AsyncDisposable.[asyncDispose]


dispose(force?): Promise<void>

Defined in: src/module.ts:309

Unload a module, analogous to delete_module(2).

boolean = false

Unload even when the module is still referenced. This taints the module with F.

Promise<void>

EBUSY if the module isn’t live, or is still referenced and force isn’t set


init(): Promise<void>

Defined in: src/module.ts:227

Run init.

Unlike Linux’s init_module(2), this is async since a module may need to do something asynchronous (like fetching a resource) before it is ready. The module is init until then.

Promise<void>

Whatever init throws, after unloading the partially loaded module


param<T>(name): T | undefined

Defined in: src/module.ts:243

Shorthand for this.params.get(name)?.value

T extends ParamValue = ParamValue

string

T | undefined


ref(): void

Defined in: src/module.ts:263

Like try_ref, but throws instead of returning false

void


try_ref(): boolean

Defined in: src/module.ts:256

Take a reference on a module so it can’t be unloaded.

boolean

whether the reference was taken


protected unlink(): void

Defined in: src/module.ts:297

Remove from the list and tear down sysfs entries.

void


unref(): void

Defined in: src/module.ts:267

void


unuse(target): void

Defined in: src/module.ts:286

Undo use

Module

void


use(target): void

Defined in: src/module.ts:275

Depend on target. This takes a reference on target and adds a link in /sys/module/<target>/holders.

Module

void