Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_bare_udp_iftype", "0") to ConfigParseBareUdpIftypeOptionValue() as OptionValueInformation,
Validator("config_parse_batadv_gateway_mode", "0") to ConfigParseBatadvGatewayModeOptionValue() as OptionValueInformation,
Validator("config_parse_batadv_routing_algorithm", "0") to ConfigParseBatadvRoutingAlgorithmOptionValue() as OptionValueInformation,
Validator("config_parse_bind_network_interface", "0") to ConfigParseBindNetworkInterfaceOptionValue() as OptionValueInformation,
Validator("config_parse_bond_ad_select", "0") to ConfigParseBondAdSelectOptionValue() as OptionValueInformation,
Validator("config_parse_bond_arp_all_targets", "0") to ConfigParseBondArpAllTargetsOptionValue() as OptionValueInformation,
Validator("config_parse_bond_arp_validate", "0") to ConfigParseBondArpValidateOptionValue() as OptionValueInformation,
Expand Down Expand Up @@ -55,6 +56,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_codel_bool", "QDISC_KIND_CODEL") to ConfigParseCodelBoolOptionValue() as OptionValueInformation,
Validator("config_parse_codel_u32", "QDISC_KIND_CODEL") to ConfigParseCodelU32OptionValue() as OptionValueInformation,
Validator("config_parse_collect_mode", "0") to ConfigParseCollectModeOptionValue() as OptionValueInformation,
Validator("config_parse_colon_separated_paths", "0") to ConfigParseColonSeparatedPathsOptionValue() as OptionValueInformation,
Validator("config_parse_cpu_quota", "0") to ConfigParseCpuQuotaOptionValue() as OptionValueInformation,
Validator("config_parse_cpuset_partition", "0") to ConfigParseCpusetPartitionOptionValue() as OptionValueInformation,
Validator("config_parse_delegate", "0") to ConfigParseDelegateOptionValue() as OptionValueInformation,
Expand All @@ -79,9 +81,12 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_erspan_index", "0") to ConfigParseErspanIndexOptionValue() as OptionValueInformation,
Validator("config_parse_erspan_version", "0") to ConfigParseErspanVersionOptionValue() as OptionValueInformation,
Validator("config_parse_ets_u8", "QDISC_KIND_ETS") to ConfigParseEtsU8OptionValue() as OptionValueInformation,
Validator("config_parse_exec_cpu_affinity", "0") to ConfigParseExecCpuAffinityOptionValue() as OptionValueInformation,
Validator("config_parse_exec_cpu_sched_prio", "0") to ConfigParseExecCpuSchedPrioOptionValue() as OptionValueInformation,
Validator("config_parse_exec_input", "0") to ConfigParseExecInputOptionValue() as OptionValueInformation,
Validator("config_parse_exec_input_text", "0") to ConfigParseExecInputTextOptionValue() as OptionValueInformation,
Validator("config_parse_exec_io_priority", "0") to ConfigParseExecIoPriorityOptionValue() as OptionValueInformation,
Validator("config_parse_exec_memory_thp", "0") to ConfigParseExecMemoryThpOptionValue() as OptionValueInformation,
Validator("config_parse_exec_mount_propagation_flag", "0") to ConfigParseExecMountPropagationFlagOptionValue() as OptionValueInformation,
Validator("config_parse_exec_nice", "0") to ConfigParseExecNiceOptionValue() as OptionValueInformation,
Validator("config_parse_exec_oom_score_adjust", "0") to ConfigParseExecOomScoreAdjustOptionValue() as OptionValueInformation,
Expand All @@ -93,6 +98,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_flow_label", "0") to ConfigParseFlowLabelOptionValue() as OptionValueInformation,
Validator("config_parse_fou_encap_type", "0") to ConfigParseFouEncapTypeOptionValue() as OptionValueInformation,
Validator("config_parse_fou_tunnel_address", "0") to ConfigParseFouTunnelAddressOptionValue() as OptionValueInformation,
Validator("config_parse_fq_codel_size", "QDISC_KIND_FQ_CODEL") to ConfigParseFqCodelSizeOptionValue() as OptionValueInformation,
Validator("config_parse_fq_pie_packet_limit", "QDISC_KIND_FQ_PIE") to ConfigParseFqPiePacketLimitOptionValue() as OptionValueInformation,
Validator("config_parse_geneve_df", "0") to ConfigParseGeneveDfOptionValue() as OptionValueInformation,
Validator("config_parse_geneve_flow_label", "0") to ConfigParseGeneveFlowLabelOptionValue() as OptionValueInformation,
Expand All @@ -102,6 +108,8 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_htb_class_size", "TCLASS_KIND_HTB") to ConfigParseHtbClassSizeOptionValue() as OptionValueInformation,
Validator("config_parse_iaid", "AF_INET6") to ConfigParseIaidOptionValue() as OptionValueInformation,
Validator("config_parse_iaid", "AF_INET") to ConfigParseIaidOptionValue() as OptionValueInformation,
Validator("config_parse_iec_size", "0") to ConfigParseIecSizeOptionValue() as OptionValueInformation,
Validator("config_parse_int", "0") to ConfigParseIntOptionValue() as OptionValueInformation,
Validator("config_parse_in_addr_non_null", "AF_INET") to ConfigParseInAddrNonNullOptionValue() as OptionValueInformation,
Validator("config_parse_ip_masquerade", "0") to ConfigParseIpMasqueradeOptionValue() as OptionValueInformation,
Validator("config_parse_ip_protocol", "true") to ConfigParseIpProtocolOptionValue() as OptionValueInformation,
Expand All @@ -112,6 +120,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_ipv6_privacy_extensions", "0") to ConfigParseIpv6PrivacyExtensionsOptionValue() as OptionValueInformation,
Validator("config_parse_ipvlan_flags", "0") to ConfigParseIpvlanFlagsOptionValue() as OptionValueInformation,
Validator("config_parse_ipvlan_mode", "0") to ConfigParseIpvlanModeOptionValue() as OptionValueInformation,
Validator("config_parse_job_mode", "0") to ConfigParseJobModeOptionValue() as OptionValueInformation,
Validator("config_parse_job_mode_isolate", "0") to ConfigParseJobModeIsolateOptionValue() as OptionValueInformation,
Validator("config_parse_keep_configuration", "0") to ConfigParseKeepConfigurationOptionValue() as OptionValueInformation,
Validator("config_parse_l2tp_encap_type", "0") to ConfigParseL2tpEncapTypeOptionValue() as OptionValueInformation,
Expand All @@ -130,6 +139,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_macvlan_mode", "0") to ConfigParseMacvlanModeOptionValue() as OptionValueInformation,
Validator("config_parse_managed_oom_mem_pressure_duration_sec", "0") to ConfigParseManagedOomMemPressureDurationSecOptionValue() as OptionValueInformation,
Validator("config_parse_managed_oom_mem_pressure_limit", "0") to ConfigParseManagedOomMemPressureLimitOptionValue() as OptionValueInformation,
Validator("config_parse_managed_oom_rules", "1") to ConfigParseManagedOomRulesOptionValue() as OptionValueInformation,
Validator("config_parse_mdi", "0") to ConfigParseMdiOptionValue() as OptionValueInformation,
Validator("config_parse_pressure_watch", "0") to ConfigParseMemoryPressureWatchOptionValue() as OptionValueInformation,
Validator("config_parse_mtu", "AF_INET6") to ConfigParseMtuOptionValue() as OptionValueInformation,
Expand All @@ -155,10 +165,13 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_prefix_metric", "0") to ConfigParsePrefixMetricOptionValue() as OptionValueInformation,
Validator("config_parse_private_pids", "0") to ConfigParsePrivatePidsOptionValue() as OptionValueInformation,
Validator("config_parse_private_tmp", "0") to ConfigParsePrivateTmpOptionValue() as OptionValueInformation,
Validator("config_parse_private_users", "0") to ConfigParsePrivateUsersOptionValue() as OptionValueInformation,
Validator("config_parse_protect_control_groups", "0") to ConfigParseProtectControlGroupsOptionValue() as OptionValueInformation,
Validator("config_parse_protect_home", "0") to ConfigParseProtectHomeOptionValue() as OptionValueInformation,
Validator("config_parse_protect_system", "0") to ConfigParseProtectSystemOptionValue() as OptionValueInformation,
Validator("config_parse_qfq_weight", "TCLASS_KIND_QFQ") to ConfigParseQfqWeightOptionValue() as OptionValueInformation,
Validator("config_parse_reboot_parameter", "0") to ConfigParseRebootParameterOptionValue() as OptionValueInformation,
Validator("config_parse_restrict_network_interfaces", "0") to ConfigParseRestrictNetworkInterfacesOptionValue() as OptionValueInformation,
Validator("config_parse_ring_buffer_or_channel", "0") to ConfigParseRingBufferOrChannelOptionValue() as OptionValueInformation,
Validator("config_parse_route_prefix_preference", "0") to ConfigParseRoutePrefixPreferenceOptionValue() as OptionValueInformation,
Validator("config_parse_route_section", "ROUTE_METRIC_FASTOPEN_NO_COOKIE") to ConfigParseRouteSectionOptionValue() as OptionValueInformation,
Expand All @@ -180,6 +193,7 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_sr_iov_uint32", "0") to ConfigParseSrIovUint32OptionValue() as OptionValueInformation,
Validator("config_parse_sr_iov_vlan_proto", "0") to ConfigParseSrIovVlanProtoOptionValue() as OptionValueInformation,
Validator("config_parse_swap_priority", "0") to ConfigParseSwapPriorityOptionValue() as OptionValueInformation,
Validator("config_parse_syscall_archs", "0") to ConfigParseSyscallArchsOptionValue() as OptionValueInformation,
Validator("config_parse_syscall_errno", "0") to ConfigParseSyscallErrnoOptionValue() as OptionValueInformation,
Validator("config_parse_tasks_max", "0") to ConfigParseTasksMaxOptionValue() as OptionValueInformation,
Validator("config_parse_tbf_size", "QDISC_KIND_TBF") to ConfigParseTbfSizeOptionValue() as OptionValueInformation,
Expand All @@ -192,12 +206,16 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_unit_condition_string", "CONDITION_CONTROL_GROUP_CONTROLLER") to ConfigParseUnitConditionStringOptionValue() as OptionValueInformation,
Validator("config_parse_unit_condition_string", "CONDITION_CPU_FEATURE") to ConfigParseUnitConditionStringOptionValue() as OptionValueInformation,
Validator("config_parse_unit_condition_string", "CONDITION_FIRST_BOOT") to ConfigParseUnitConditionStringOptionValue() as OptionValueInformation,
Validator("config_parse_unit_env_file", "0") to ConfigParseUnitEnvFileOptionValue() as OptionValueInformation,
Validator("config_parse_unit_mounts_for", "0") to ConfigParseUnitMountsForOptionValue() as OptionValueInformation,
Validator("config_parse_unit_slice", "0") to ConfigParseUnitSliceOptionValue() as OptionValueInformation,
Validator("config_parse_use_domains", "0") to ConfigParseUseDomainsOptionValue() as OptionValueInformation,
Validator("config_parse_user_group_strv_compat", "0") to ConfigParseUserGroupStrvCompatOptionValue() as OptionValueInformation,
Validator("config_parse_userns_chown", "0") to ConfigParseUsernsChownOptionValue() as OptionValueInformation,
Validator("config_parse_userns_ownership", "0") to ConfigParseUsernsOwnershipOptionValue() as OptionValueInformation,
Validator("config_parse_vlanid", "0") to ConfigParseVlanidOptionValue() as OptionValueInformation,
Validator("config_parse_vxlan_ttl", "0") to ConfigParseVxlanTtlOptionValue() as OptionValueInformation,
Validator("config_parse_working_directory", "0") to ConfigParseWorkingDirectoryOptionValue() as OptionValueInformation,
Validator("config_parse_wireguard_keepalive", "0") to ConfigParseWireguardKeepaliveOptionValue() as OptionValueInformation,
Validator("config_parse_wireguard_listen_port", "0") to ConfigParseWireguardListenPortOptionValue() as OptionValueInformation,
Validator("config_parse_wireguard_peer_route_priority", "0") to ConfigParseWireguardPeerRoutePriorityOptionValue() as OptionValueInformation,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for BindNetworkInterface=.
*
* C function: config_parse_bind_network_interface in src/core/load-fragment.c. After
* unit_full_printf specifier expansion, the result must pass ifname_valid_full(
* IFNAME_VALID_ALTERNATIVE) — same rules as RestrictNetworkInterfaces= entries but the value
* is a single interface name (no whitespace-separated list, no leading "~").
*/
class ConfigParseBindNetworkInterfaceOptionValue : SimpleGrammarOptionValues(
"config_parse_bind_network_interface",
SequenceCombinator(
RegexTerminal(
"(?!(?:all|default|\\.{1,2}|0[xX][0-9a-fA-F]+|[0-9]+)\\Z)[^\\s:/%]{1,127}",
"(?!(?:all|default|\\.{1,2}|0[xX][0-9a-fA-F]+|[0-9]+)\\Z)[^\\s:/%]{1,127}"
),
EOF()
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for ExecSearchPath= (and similar colon-separated path lists).
*
* C function: config_parse_colon_separated_paths in src/core/load-fragment.c. Tokenizes with
* extract_first_word using ":" as the separator (no coalescing), expands specifiers via
* unit_path_printf, then requires each path to be absolute via path_simplify_and_warn with
* PATH_CHECK_ABSOLUTE.
*
* Grammar matches one or more absolute paths (each starting with "/") separated by ":".
* Per-path content excludes ":" since that's the separator. "%X" specifiers are allowed
* inline since the C parser expands them before the absolute-path check.
*/
class ConfigParseColonSeparatedPathsOptionValue : SimpleGrammarOptionValues(
"config_parse_colon_separated_paths",
SequenceCombinator(
RegexTerminal("/[^\\s:]*", "/[^\\s:]*"),
ZeroOrMore(SequenceCombinator(
LiteralChoiceTerminal(":"),
RegexTerminal("/[^\\s:]*", "/[^\\s:]*")
)),
EOF()
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for CPUAffinity=.
*
* C function: config_parse_exec_cpu_affinity in src/core/load-fragment.c. Either the literal
* "numa" (use NUMA-derived CPU set) or a CPU set list parsed by the same code path as
* NUMAMask= / AllowedCPUs=: whitespace- or comma-separated integers and `N-M` ranges.
*
* The "numa" literal goes first explicitly; otherwise the CPU set grammar matches integers
* and ranges. Note the existing AllowedCpuSetOptionValue handles the same syntax for
* config_parse_unit_cpu_set — duplicated here as a grammar so it composes with the "numa"
* alternative.
*/
class ConfigParseExecCpuAffinityOptionValue : SimpleGrammarOptionValues(
"config_parse_exec_cpu_affinity",
SequenceCombinator(
AlternativeCombinator(
LiteralChoiceTerminal("numa"),
SequenceCombinator(
CPU_RANGE,
ZeroOrMore(SequenceCombinator(
AlternativeCombinator(WhitespaceTerminal(), LiteralChoiceTerminal(",")),
CPU_RANGE
))
)
),
EOF()
)
) {
companion object {
// `N` or `N-M` (each side a non-negative integer)
private val CPU_RANGE = RegexTerminal("[0-9]+(-[0-9]+)?", "[0-9]+(-[0-9]+)?")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for StandardInput=.
*
* C function: config_parse_exec_input in src/core/load-fragment.c. Accepts:
* - "fd:NAME" — fdname_is_valid name (alphanumerics-ish, specifier-aware)
* - "file:/PATH" — absolute path (specifier-aware)
* - one of the bare enum names from exec_input_table in src/core/execute.c:
* null, tty, tty-force, tty-fail, socket, data
* (fd / file appear as prefixes above; their bare form isn't accepted)
*
* The structured branches (fd:/file:) come before the enum so that a literal "fd"/"file"
* (which aren't in the enum table anyway) wouldn't accidentally match. Order also matters
* because LiteralChoiceTerminal does first-match-by-length.
*/
class ConfigParseExecInputOptionValue : SimpleGrammarOptionValues(
"config_parse_exec_input",
SequenceCombinator(
AlternativeCombinator(
// fd:NAME (NAME is allowed to be empty per the C code's isempty check)
SequenceCombinator(LiteralChoiceTerminal("fd:"), RegexTerminal("\\S*", "\\S*")),
// file:/PATH
SequenceCombinator(LiteralChoiceTerminal("file:"), RegexTerminal("/\\S*", "/\\S*")),
LiteralChoiceTerminal("null", "tty", "tty-force", "tty-fail", "socket", "data")
),
EOF()
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for MemoryTHP=.
*
* C function: config_parse_exec_memory_thp, expanded via DEFINE_CONFIG_PARSE_ENUM in
* src/core/load-fragment.c. Accepts exactly the entries of exec_memory_thp_table in
* src/core/execute.c.
*/
class ConfigParseExecMemoryThpOptionValue : SimpleGrammarOptionValues(
"config_parse_exec_memory_thp",
SequenceCombinator(
LiteralChoiceTerminal("inherit", "disable", "madvise", "system"),
EOF()
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for the [FairQueueingControlledDelay] size-style options: MemoryLimitBytes=,
* QuantumBytes= (and the deprecated MemoryLimit / Quantum aliases).
*
* C function: config_parse_fq_codel_size(QDISC_KIND_FQ_CODEL) in src/network/tc/fq-codel.c.
* After branching on the lvalue it calls parse_size(rvalue, 1024, &sz). Same IEC byte shape
* as the other parse_size-based validators.
*/
class ConfigParseFqCodelSizeOptionValue : SimpleGrammarOptionValues(
"config_parse_fq_codel_size",
SequenceCombinator(
OptionalWhitespacePrefix(BYTES),
EOF()
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/**
* Validator for generic IEC byte-size options parsed by config_parse_iec_size.
*
* C function: config_parse_iec_size in src/shared/conf-parser.c. Delegates to
* parse_size(rvalue, 1024, &v) and additionally requires the result to fit in a size_t.
* Same IEC byte syntax used by tbf_size / fq_size / htb_class_size.
*/
class ConfigParseIecSizeOptionValue : SimpleGrammarOptionValues(
"config_parse_iec_size",
SequenceCombinator(
OptionalWhitespacePrefix(BYTES),
EOF()
)
)
Loading
Loading