You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: man/zram-generator.conf.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ This option thus has higher priority than the configuration files.
42
42
43
43
## OPTIONS
44
44
45
-
Each device is configured independently in its `[zramN]` section, where N is a nonnegative integer. Other sections are ignored.
45
+
Each device is configured independently in its `[zramN]` section, where N is a nonnegative integer. The global section may contain [DIRECTIVES]. Other sections are ignored.
46
46
47
47
Devices with the final size of *0* will be discarded.
48
48
@@ -57,6 +57,7 @@ Devices with the final size of *0* will be discarded.
57
57
*`zram-size`=
58
58
59
59
Sets the size of the zram device as a function of *MemTotal*, available as the `ram` variable.
60
+
Additional variables may be provided by [DIRECTIVES].
60
61
61
62
Arithmetic operators (^%/\*-+), e, π, SI suffixes, log(), int(), ceil(), floor(), round(), abs(), min(), max(), and trigonometric functions are supported.
62
63
@@ -66,7 +67,7 @@ Devices with the final size of *0* will be discarded.
66
67
67
68
Sets the maximum resident memory limit of the zram device (or *0* for no limit) as a function of *MemTotal*, available as the `ram` variable.
68
69
69
-
Same format as *zram-size*. Defaults to *0*.
70
+
Same format as `zram-size`. Defaults to *0*.
70
71
71
72
*`compression-algorithm`=
72
73
@@ -117,6 +118,17 @@ Devices with the final size of *0* will be discarded.
117
118
118
119
Defaults to *discard*.
119
120
121
+
## DIRECTIVES
122
+
123
+
The global section (before any section header) may contain directives in the following form:
124
+
125
+
*`set!`*variable*=*program*
126
+
127
+
*program* is executed by the shell as-if by system(3),
128
+
its standard output stream parsed as an arithmetic expression (like `zram-size`/`zram-resident-limit`),
129
+
then the result is remembered into *variable*,
130
+
usable in later `set!`s and `zram-size`s/`zram-resident-limit`s.
131
+
120
132
## ENVIRONMENT VARIABLES
121
133
122
134
Setting `ZRAM_GENERATOR_ROOT` during parsing will cause */proc/meminfo* to be read from *$ZRAM_GENERATOR_ROOT/proc/meminfo* instead,
0 commit comments