]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friends
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Aug 2024 01:20:03 +0000 (10:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 Sep 2024 20:45:09 +0000 (05:45 +0900)
This makes the macros use log_syntax_parse_error(), hopefully which provides
more informative log message in general, and reduces binary size.

40 files changed:
src/core/load-fragment.c
src/core/main.c
src/coredump/coredump.c
src/home/homed-conf.c
src/journal-remote/journal-remote-main.c
src/journal/journald-server.c
src/login/logind-action.c
src/network/netdev/bareudp.c
src/network/netdev/batadv.c
src/network/netdev/bond.c
src/network/netdev/bridge.c
src/network/netdev/fou-tunnel.c
src/network/netdev/geneve.c
src/network/netdev/ipoib.c
src/network/netdev/ipvlan.c
src/network/netdev/l2tp-tunnel.c
src/network/netdev/macvlan.c
src/network/netdev/tunnel.c
src/network/netdev/vxlan.c
src/network/networkd-dhcp4.c
src/network/networkd-dhcp6.c
src/network/networkd-dns.c
src/network/networkd-ipv6ll.c
src/network/networkd-lldp-rx.c
src/network/networkd-ndisc.c
src/network/networkd-network.c
src/network/networkd-routing-policy-rule.c
src/network/networkd-sysctl.c
src/network/networkd-util.c
src/nspawn/nspawn-settings.c
src/partition/repart.c
src/pstore/pstore.c
src/resolve/resolved-conf.c
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/ethtool-util.c
src/shared/resolve-util.c
src/sysupdate/sysupdate-transfer.c
src/udev/net/link-config.c
src/udev/udevd.c

index 7633589b0d49fbf54af20c53424d2dac7aeb0f1f..cc6597dbb7b36fb4b3a385105903e486ffa79d9b 100644 (file)
@@ -126,38 +126,38 @@ int parse_confirm_spawn(const char *value, char **console) {
         return 0;
 }
 
-DEFINE_CONFIG_PARSE(config_parse_socket_protocol, parse_socket_protocol, "Failed to parse socket protocol");
-DEFINE_CONFIG_PARSE(config_parse_exec_secure_bits, secure_bits_from_string, "Failed to parse secure bits");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_collect_mode, collect_mode, CollectMode, "Failed to parse garbage collection mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_device_policy, cgroup_device_policy, CGroupDevicePolicy, "Failed to parse device policy");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_keyring_mode, exec_keyring_mode, ExecKeyringMode, "Failed to parse keyring mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_proc, protect_proc, ProtectProc, "Failed to parse /proc/ protection mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_proc_subset, proc_subset, ProcSubset, "Failed to parse /proc/ subset mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_private_tmp, private_tmp, PrivateTmp, "Failed to parse private tmp value");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_utmp_mode, exec_utmp_mode, ExecUtmpMode, "Failed to parse utmp mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_job_mode, job_mode, JobMode, "Failed to parse job mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, "Failed to parse notify access specifier");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_home, protect_home, ProtectHome, "Failed to parse protect home value");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_system, protect_system, ProtectSystem, "Failed to parse protect system value");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_preserve_mode, exec_preserve_mode, ExecPreserveMode, "Failed to parse resource preserve mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_type, service_type, ServiceType, "Failed to parse service type");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_exit_type, service_exit_type, ServiceExitType, "Failed to parse service exit type");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart, service_restart, ServiceRestart, "Failed to parse service restart specifier");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart_mode, service_restart_mode, ServiceRestartMode, "Failed to parse service restart mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_timeout_failure_mode, service_timeout_failure_mode, ServiceTimeoutFailureMode, "Failed to parse timeout failure mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_socket_bind, socket_address_bind_ipv6_only_or_bool, SocketAddressBindIPv6Only, "Failed to parse bind IPv6 only value");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_oom_policy, oom_policy, OOMPolicy, "Failed to parse OOM policy");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_managed_oom_preference, managed_oom_preference, ManagedOOMPreference, "Failed to parse ManagedOOMPreference=");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_memory_pressure_watch, cgroup_pressure_watch, CGroupPressureWatch, "Failed to parse memory pressure watch setting");
-DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_ip_tos, ip_tos, int, -1, "Failed to parse IP TOS value");
-DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t, "Invalid block IO weight");
-DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight");
-DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t, "Invalid CPU weight");
-static DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares_internal, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares");
-DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_propagation_flag, mount_propagation_flag_from_string, unsigned long, "Failed to parse mount propagation flag");
-DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1, "Invalid NUMA policy type");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat, "Failed to parse status unit format");
-DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping, "Failed to parse timestamping precision");
+DEFINE_CONFIG_PARSE(config_parse_socket_protocol, parse_socket_protocol);
+DEFINE_CONFIG_PARSE(config_parse_exec_secure_bits, secure_bits_from_string);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_collect_mode, collect_mode, CollectMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_device_policy, cgroup_device_policy, CGroupDevicePolicy);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_keyring_mode, exec_keyring_mode, ExecKeyringMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_proc, protect_proc, ProtectProc);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_proc_subset, proc_subset, ProcSubset);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_private_tmp, private_tmp, PrivateTmp);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_utmp_mode, exec_utmp_mode, ExecUtmpMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_job_mode, job_mode, JobMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_home, protect_home, ProtectHome);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_protect_system, protect_system, ProtectSystem);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_preserve_mode, exec_preserve_mode, ExecPreserveMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_service_type, service_type, ServiceType);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_service_exit_type, service_exit_type, ServiceExitType);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart, service_restart, ServiceRestart);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart_mode, service_restart_mode, ServiceRestartMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_service_timeout_failure_mode, service_timeout_failure_mode, ServiceTimeoutFailureMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_socket_bind, socket_address_bind_ipv6_only_or_bool, SocketAddressBindIPv6Only);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_oom_policy, oom_policy, OOMPolicy);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_managed_oom_preference, managed_oom_preference, ManagedOOMPreference);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_memory_pressure_watch, cgroup_pressure_watch, CGroupPressureWatch);
+DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_ip_tos, ip_tos, int, -1);
+DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t);
+DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t);
+DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t);
+static DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares_internal, cg_cpu_shares_parse, uint64_t);
+DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_propagation_flag, mount_propagation_flag_from_string, unsigned long);
+DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat);
+DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping);
 
 int config_parse_cpu_shares(
                 const char *unit,
index 14c124dc32c861d8eae233b16fecc898dd0cb9c9..b9dc4506366b5177bddac9f816ccdecf01cd58d1 100644 (file)
@@ -174,7 +174,7 @@ static const char* const crash_action_table[_CRASH_ACTION_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP(crash_action, CrashAction);
 
-static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_crash_action, crash_action, CrashAction, CRASH_FREEZE, "Invalid crash action");
+static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_crash_action, crash_action, CrashAction, CRASH_FREEZE);
 
 static int manager_find_user_config_paths(char ***ret_files, char ***ret_dirs) {
         _cleanup_free_ char *base = NULL;
index e751b67417b6b548e22f4a6422a1661fce0f1d58..d21ea680bd9abd42a752a6d1722ea558294889dd 100644 (file)
@@ -158,7 +158,7 @@ static const char* const coredump_storage_table[_COREDUMP_STORAGE_MAX] = {
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP(coredump_storage, CoredumpStorage);
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_storage, coredump_storage, CoredumpStorage, "Failed to parse storage setting");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_storage, coredump_storage, CoredumpStorage);
 
 static CoredumpStorage arg_storage = COREDUMP_STORAGE_EXTERNAL;
 static bool arg_compress = true;
index 3f74096b648c6d8778df10aee79fccba9cacae99..21cb5106881ca78fdd890aed819eaef2e8ec8a9a 100644 (file)
@@ -17,7 +17,7 @@ int manager_parse_config_file(Manager *m) {
                         m);
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_default_storage, user_storage, UserStorage, "Failed to parse default storage setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_default_storage, user_storage, UserStorage);
 
 int config_parse_default_file_system_type(
                 const char *unit,
index 1cc978d383eb1eaea919a4acd1404e4938303932..7156bc7727e7c525add5d20b1e281eba1167f7e3 100644 (file)
@@ -72,10 +72,7 @@ static const char* const journal_write_split_mode_table[_JOURNAL_WRITE_SPLIT_MAX
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP(journal_write_split_mode, JournalWriteSplitMode);
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_write_split_mode,
-                                journal_write_split_mode,
-                                JournalWriteSplitMode,
-                                "Failed to parse split mode setting");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_write_split_mode, journal_write_split_mode, JournalWriteSplitMode);
 
 /**********************************************************************
  **********************************************************************
index 09b80881b3330f342b08a2b158c565feca0441b4..66f09e49453a245828e57f5a122c5b09eebc4eed 100644 (file)
@@ -2953,7 +2953,7 @@ static const char* const storage_table[_STORAGE_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(storage, Storage);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_storage, storage, Storage, "Failed to parse storage setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_storage, storage, Storage);
 
 static const char* const split_mode_table[_SPLIT_MAX] = {
         [SPLIT_LOGIN] = "login",
@@ -2962,7 +2962,7 @@ static const char* const split_mode_table[_SPLIT_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(split_mode, SplitMode);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_split_mode, split_mode, SplitMode, "Failed to parse split mode setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_split_mode, split_mode, SplitMode);
 
 int config_parse_line_max(
                 const char* unit,
index 2a7766841f427580a2bbf081c913473bba688b13..db9a0e1bbae3313dba50465a8b2884c2f7ea9cdc 100644 (file)
@@ -438,7 +438,7 @@ static const char* const handle_action_table[_HANDLE_ACTION_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(handle_action, HandleAction);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_handle_action, handle_action, HandleAction, "Failed to parse handle action setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_handle_action, handle_action, HandleAction);
 
 int config_parse_handle_action_sleep(
                 const char *unit,
index fdde8815208dcc13cd6fa80b96d4f7b876eba66d..b2a161ee7a3a53acad0b356e247668c17bc8d2a9 100644 (file)
@@ -17,8 +17,7 @@ static const char* const bare_udp_protocol_table[_BARE_UDP_PROTOCOL_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(bare_udp_protocol, BareUDPProtocol);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bare_udp_iftype, bare_udp_protocol, BareUDPProtocol,
-                         "Failed to parse EtherType=");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bare_udp_iftype, bare_udp_protocol, BareUDPProtocol);
 
 static int netdev_bare_udp_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
         assert(m);
index 26da0231d45996149adb0ca2ade6b7f81d28ca33..e600727c20095a6f0536367c2bec0f8a38a57000 100644 (file)
@@ -47,12 +47,10 @@ static const char* const batadv_routing_algorithm_kernel_table[_BATADV_ROUTING_A
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(batadv_gateway_mode, BatadvGatewayModes);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_batadv_gateway_mode, batadv_gateway_mode, BatadvGatewayModes,
-                         "Failed to parse GatewayMode=");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_batadv_gateway_mode, batadv_gateway_mode, BatadvGatewayModes);
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(batadv_routing_algorithm, BatadvRoutingAlgorithm);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_batadv_routing_algorithm, batadv_routing_algorithm, BatadvRoutingAlgorithm,
-                         "Failed to parse RoutingAlgorithm=");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_batadv_routing_algorithm, batadv_routing_algorithm, BatadvRoutingAlgorithm);
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(batadv_routing_algorithm_kernel, BatadvRoutingAlgorithm);
 
index 52a7f126b6db2430c66bac672850d47693e2b768..de122f8eb382b5fe9fb6845ee24bd487b98b6f1a 100644 (file)
 #define GRATUITOUS_ARP_MAX        255
 #define GRATUITOUS_ARP_DEFAULT    1
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_mode, bond_mode, BondMode, "Failed to parse bond mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_mode, bond_mode, BondMode);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_xmit_hash_policy,
                          bond_xmit_hash_policy,
-                         BondXmitHashPolicy,
-                         "Failed to parse bond transmit hash policy");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_lacp_rate, bond_lacp_rate, BondLacpRate, "Failed to parse bond lacp rate");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_ad_select, bond_ad_select, BondAdSelect, "Failed to parse bond AD select");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_fail_over_mac, bond_fail_over_mac, BondFailOverMac, "Failed to parse bond fail over MAC");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_validate, bond_arp_validate, BondArpValidate, "Failed to parse bond arp validate");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_all_targets, bond_arp_all_targets, BondArpAllTargets, "Failed to parse bond Arp all targets");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_primary_reselect, bond_primary_reselect, BondPrimaryReselect, "Failed to parse bond primary reselect");
+                         BondXmitHashPolicy);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_lacp_rate, bond_lacp_rate, BondLacpRate);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_ad_select, bond_ad_select, BondAdSelect);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_fail_over_mac, bond_fail_over_mac, BondFailOverMac);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_validate, bond_arp_validate, BondArpValidate);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_all_targets, bond_arp_all_targets, BondArpAllTargets);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_primary_reselect, bond_primary_reselect, BondPrimaryReselect);
 
 static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
         assert(!link);
index 27f39164767ccff94cee133fc8f0a126b4c226b1..25b0f81aa07b42f5a824475cd99b3da2eda100e7 100644 (file)
@@ -25,8 +25,7 @@ static const char* const multicast_router_table[_MULTICAST_ROUTER_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(multicast_router, MulticastRouter, _MULTICAST_ROUTER_INVALID);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_multicast_router, multicast_router, MulticastRouter,
-                         "Failed to parse bridge multicast router setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_multicast_router, multicast_router, MulticastRouter);
 
 /* callback for bridge netdev's parameter set */
 static int netdev_bridge_set_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
index 969a4e6de648129e3836e83965cbe2ee434aa10a..e962c6c64beb0456b2a3c74025fe6527ec43bc42 100644 (file)
@@ -21,8 +21,7 @@ static const char* const fou_encap_type_table[_NETDEV_FOO_OVER_UDP_ENCAP_MAX] =
 };
 
 DEFINE_STRING_TABLE_LOOKUP(fou_encap_type, FooOverUDPEncapType);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_fou_encap_type, fou_encap_type, FooOverUDPEncapType,
-                         "Failed to parse Encapsulation=");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_fou_encap_type, fou_encap_type, FooOverUDPEncapType);
 
 static int netdev_fill_fou_tunnel_message(NetDev *netdev, sd_netlink_message *m) {
         FouTunnel *t = FOU(netdev);
index 22c2b00e1b700634719b02ba5bf2da8c8885b630..493edcc42a58edf429eb9de4c6a1d2b6f6c741a4 100644 (file)
@@ -26,7 +26,7 @@ static const char* const geneve_df_table[_NETDEV_GENEVE_DF_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(geneve_df, GeneveDF, NETDEV_GENEVE_DF_YES);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_geneve_df, geneve_df, GeneveDF, "Failed to parse Geneve IPDoNotFragment= setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_geneve_df, geneve_df, GeneveDF);
 
 static int netdev_geneve_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
         assert(m);
index d5fe299b7b43d0f1a8605a9094609f5ff1cdf40b..e2f879e72205a6017860aabaf7d6550fff4dab53 100644 (file)
@@ -94,7 +94,7 @@ static const char * const ipoib_mode_table[_IP_OVER_INFINIBAND_MODE_MAX] = {
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(ipoib_mode, IPoIBMode);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ipoib_mode, ipoib_mode, IPoIBMode, "Failed to parse IPoIB mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ipoib_mode, ipoib_mode, IPoIBMode);
 
 int config_parse_ipoib_pkey(
                 const char *unit,
index 51ae64341db2c9c1d984b03143ad6fb0a9079873..892678b4addbca17211802e03ac11679453ef2ca 100644 (file)
@@ -11,8 +11,8 @@
 #include "networkd-link.h"
 #include "string-util.h"
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_flags, ipvlan_flags, IPVlanFlags, "Failed to parse ipvlan flags");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_flags, ipvlan_flags, IPVlanFlags);
 
 static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
         assert(netdev);
index 4f9e7189d17411813668fa818db5b176e5374bf8..3194f3f785c856096d4bce6bf656af92f04cc7cd 100644 (file)
@@ -29,7 +29,7 @@ static const char* const l2tp_encap_type_table[_NETDEV_L2TP_ENCAPTYPE_MAX] = {
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(l2tp_encap_type, L2tpEncapType);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_l2tp_encap_type, l2tp_encap_type, L2tpEncapType, "Failed to parse L2TP Encapsulation Type");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_l2tp_encap_type, l2tp_encap_type, L2tpEncapType);
 
 static const char* const l2tp_local_address_type_table[_NETDEV_L2TP_LOCAL_ADDRESS_MAX] = {
          [NETDEV_L2TP_LOCAL_ADDRESS_AUTO]    = "auto",
index 21933d3970a13e24170a22e4e2eea1d68f5db756..1537d868b5f15a13bee3f3abc3dbe414e4848e7c 100644 (file)
@@ -16,7 +16,7 @@ typedef enum BCQueueThreshold {
         BC_QUEUE_THRESHOLD_DISABLE = -1,
 } BCQueueThreshold;
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode);
 
 static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
         assert(netdev);
index db84e7cf6eeb8070188ab577224876ffaf29583f..2bf58086b2ffce9e53d6b81fdfd5386a6b12173f 100644 (file)
@@ -30,7 +30,7 @@ static const char* const ip6tnl_mode_table[_NETDEV_IP6_TNL_MODE_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(ip6tnl_mode, Ip6TnlMode);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ip6tnl_mode, ip6tnl_mode, Ip6TnlMode, "Failed to parse ip6 tunnel Mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ip6tnl_mode, ip6tnl_mode, Ip6TnlMode);
 
 #define HASH_KEY SD_ID128_MAKE(74,c4,de,12,f3,d9,41,34,bb,3d,c1,a4,42,93,50,87)
 
index 37f65967a6bd5b352b8065939c10364feecd82bc..e928b20d8392d59355c22b75aa77a0734dac1453 100644 (file)
@@ -21,7 +21,7 @@ static const char* const df_table[_NETDEV_VXLAN_DF_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(df, VxLanDF, NETDEV_VXLAN_DF_YES);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_df, df, VxLanDF, "Failed to parse VXLAN IPDoNotFragment= setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_df, df, VxLanDF);
 
 static int vxlan_get_local_address(VxLan *v, Link *link, int *ret_family, union in_addr_union *ret_address) {
         assert(v);
index 4a9459f00687532c5b06417bdbf9865d1023746a..0a784553d03b770a1ad24b29862d89065d2e2345 100644 (file)
@@ -2018,5 +2018,4 @@ static const char* const dhcp_client_identifier_table[_DHCP_CLIENT_ID_MAX] = {
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_client_identifier, DHCPClientIdentifier);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_client_identifier, dhcp_client_identifier, DHCPClientIdentifier,
-                         "Failed to parse client identifier type");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_client_identifier, dhcp_client_identifier, DHCPClientIdentifier);
index 852987bd865b4ad382ad0071ec5d9acabe6390c4..3f773cbb9933d07a1b1cafd34367de7622ee2b32 100644 (file)
@@ -878,8 +878,7 @@ int config_parse_dhcp6_pd_prefix_hint(
         return 0;
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp6_client_start_mode, dhcp6_client_start_mode, DHCP6ClientStartMode,
-                         "Failed to parse WithoutRA= setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp6_client_start_mode, dhcp6_client_start_mode, DHCP6ClientStartMode);
 
 static const char* const dhcp6_client_start_mode_table[_DHCP6_CLIENT_START_MODE_MAX] = {
         [DHCP6_CLIENT_START_MODE_NO]                  = "no",
index 7078419d3750765095319d030a21b4fcb67f5974..74a371b6d7decb899bc1c05b96ee1c11af053d64 100644 (file)
@@ -291,4 +291,4 @@ static const char* const use_domains_table[_USE_DOMAINS_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(use_domains, UseDomains, USE_DOMAINS_YES);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_use_domains, use_domains, UseDomains, "Failed to parse UseDomains=")
+DEFINE_CONFIG_PARSE_ENUM(config_parse_use_domains, use_domains, UseDomains);
index 32229a3fc70e84877d960a2e3a57bb5615d5c729..cd23cc94aa1a39ebed5cee643c25f1f807b079e9 100644 (file)
@@ -243,5 +243,4 @@ DEFINE_STRING_TABLE_LOOKUP(ipv6_link_local_address_gen_mode, IPv6LinkLocalAddres
 DEFINE_CONFIG_PARSE_ENUM(
         config_parse_ipv6_link_local_address_gen_mode,
         ipv6_link_local_address_gen_mode,
-        IPv6LinkLocalAddressGenMode,
-        "Failed to parse IPv6 link-local address generation mode");
+        IPv6LinkLocalAddressGenMode);
index f74485488eb91c4bee95c5f322137c1fc0c46e73..6ba198282e7a1b320be9cffc30ccdf1fb5157f6d 100644 (file)
@@ -17,7 +17,7 @@
 #include "strv.h"
 #include "tmpfile-util.h"
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_lldp_mode, lldp_mode, LLDPMode, "Failed to parse LLDP= setting.");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_lldp_mode, lldp_mode, LLDPMode);
 
 static const char* const lldp_mode_table[_LLDP_MODE_MAX] = {
         [LLDP_MODE_NO] = "no",
index 21b76fafc4516d854cc824ecb6d9c773c309e766..f44f03365c3c2b9d86149a7ecbf7981f66b383a0 100644 (file)
@@ -2525,5 +2525,4 @@ static const char* const ndisc_start_dhcp6_client_table[_IPV6_ACCEPT_RA_START_DH
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(ndisc_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client, IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES);
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ndisc_start_dhcp6_client, ndisc_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client,
-                         "Failed to parse DHCPv6Client= setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ndisc_start_dhcp6_client, ndisc_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client);
index 94666c2bdd03edd8ed67ee6171c4c6bc99d1aacd..56cf52bbe68be069a2859599c26f2df9b4fdcc61 100644 (file)
@@ -1056,11 +1056,8 @@ int config_parse_ignore_carrier_loss(
         return 0;
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_required_family_for_online, link_required_address_family, AddressFamily,
-                         "Failed to parse RequiredFamilyForOnline= setting");
-
-DEFINE_CONFIG_PARSE_ENUM(config_parse_keep_configuration, keep_configuration, KeepConfiguration,
-                         "Failed to parse KeepConfiguration= setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_required_family_for_online, link_required_address_family, AddressFamily);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_keep_configuration, keep_configuration, KeepConfiguration);
 
 static const char* const keep_configuration_table[_KEEP_CONFIGURATION_MAX] = {
         [KEEP_CONFIGURATION_NO]           = "no",
@@ -1082,4 +1079,4 @@ static const char* const activation_policy_table[_ACTIVATION_POLICY_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(activation_policy, ActivationPolicy);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_activation_policy, activation_policy, ActivationPolicy, "Failed to parse activation policy");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_activation_policy, activation_policy, ActivationPolicy);
index 75b4224c8add70d94899e4c41d27f24c533e7ab5..1efb2bff943315d9c88454ca28914bfe922c063b 100644 (file)
@@ -1637,8 +1637,7 @@ static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(
                 config_parse_routing_policy_rule_family,
                 routing_policy_rule_address_family,
                 AddressFamily,
-                ADDRESS_FAMILY_NO,
-                "Invalid family");
+                ADDRESS_FAMILY_NO);
 
 typedef struct RoutingPolicyRuleConfParser {
         ConfigParserCallback parser;
index a454322fd0ec50bc0e0a9fab62eae8fab135bfef..2027a29f2766682fe1ad26c0f9b06d497c38bbe7 100644 (file)
@@ -458,8 +458,7 @@ static const char* const ipv6_privacy_extensions_table[_IPV6_PRIVACY_EXTENSIONS_
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(ipv6_privacy_extensions, IPv6PrivacyExtensions,
                                         IPV6_PRIVACY_EXTENSIONS_YES);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ipv6_privacy_extensions, ipv6_privacy_extensions, IPv6PrivacyExtensions,
-                         "Failed to parse IPv6 privacy extensions option");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ipv6_privacy_extensions, ipv6_privacy_extensions, IPv6PrivacyExtensions);
 
 static const char* const ip_reverse_path_filter_table[_IP_REVERSE_PATH_FILTER_MAX] = {
         [IP_REVERSE_PATH_FILTER_NO]     = "no",
@@ -468,8 +467,7 @@ static const char* const ip_reverse_path_filter_table[_IP_REVERSE_PATH_FILTER_MA
 };
 
 DEFINE_STRING_TABLE_LOOKUP(ip_reverse_path_filter, IPReversePathFilter);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_ip_reverse_path_filter, ip_reverse_path_filter, IPReversePathFilter,
-                         "Failed to parse IP reverse path filter option");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_ip_reverse_path_filter, ip_reverse_path_filter, IPReversePathFilter);
 
 int config_parse_ip_forward_deprecated(
                 const char* unit,
index 46f90088790e0203ddb75489952d12bf9f9fdeab..8d6df6d2c11a859699e79fed028258b320aa13c7 100644 (file)
@@ -110,8 +110,7 @@ AddressFamily link_local_address_family_from_string(const char *s) {
 DEFINE_STRING_TABLE_LOOKUP(routing_policy_rule_address_family, AddressFamily);
 DEFINE_STRING_TABLE_LOOKUP(nexthop_address_family, AddressFamily);
 DEFINE_STRING_TABLE_LOOKUP(duplicate_address_detection_address_family, AddressFamily);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_link_local_address_family, link_local_address_family,
-                         AddressFamily, "Failed to parse option");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_link_local_address_family, link_local_address_family, AddressFamily);
 DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_deprecated_address_family, AddressFamily);
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(ip_masquerade_address_family, AddressFamily);
 DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_server_type, sd_dhcp_lease_server_type_t);
index 132a54338f740b0dd40801329c05874f266af0c7..587da92cb27c334ab59d831cb6b8cfdf14d1f25c 100644 (file)
@@ -232,7 +232,7 @@ int settings_allocate_properties(Settings *s) {
         return 0;
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_volatile_mode, volatile_mode, VolatileMode, "Failed to parse volatile mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_volatile_mode, volatile_mode, VolatileMode);
 
 int config_parse_expose_port(
                 const char *unit,
@@ -832,7 +832,7 @@ int config_parse_cpu_affinity(
         return parse_cpu_set_extend(rvalue, &settings->cpu_set, true, unit, filename, line, lvalue);
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_resolv_conf, resolv_conf_mode, ResolvConfMode, "Failed to parse resolv.conf mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_resolv_conf, resolv_conf_mode, ResolvConfMode);
 
 static const char *const resolv_conf_mode_table[_RESOLV_CONF_MODE_MAX] = {
         [RESOLV_CONF_OFF]            = "off",
@@ -914,7 +914,7 @@ int config_parse_link_journal(
         return 0;
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_timezone_mode, timezone_mode, TimezoneMode, "Failed to parse timezone mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_timezone_mode, timezone_mode, TimezoneMode);
 
 static const char *const timezone_mode_table[_TIMEZONE_MODE_MAX] = {
         [TIMEZONE_OFF]     = "off",
@@ -927,7 +927,7 @@ static const char *const timezone_mode_table[_TIMEZONE_MODE_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(timezone_mode, TimezoneMode, TIMEZONE_AUTO);
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_userns_ownership, user_namespace_ownership, UserNamespaceOwnership, "Failed to parse user namespace ownership mode");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_userns_ownership, user_namespace_ownership, UserNamespaceOwnership);
 
 static const char *const user_namespace_ownership_table[_USER_NAMESPACE_OWNERSHIP_MAX] = {
         [USER_NAMESPACE_OWNERSHIP_OFF]   = "off",
index 48b3b430137af9f506cf788879a6624958165fc7..427762a8f62212179745f5cf8bc8fd69668ab52c 100644 (file)
@@ -1712,7 +1712,7 @@ static int config_parse_default_subvolume(
         return free_and_replace(*subvol, p);
 }
 
-static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_encrypt, encrypt_mode, EncryptMode, ENCRYPT_OFF, "Invalid encryption mode");
+static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_encrypt, encrypt_mode, EncryptMode, ENCRYPT_OFF);
 
 static int config_parse_gpt_flags(
                 const char *unit,
@@ -1899,8 +1899,8 @@ static int config_parse_encrypted_volume(
         return 0;
 }
 
-static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_verity, verity_mode, VerityMode, VERITY_OFF, "Invalid verity mode");
-static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_minimize, minimize_mode, MinimizeMode, MINIMIZE_OFF, "Invalid minimize mode");
+static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_verity, verity_mode, VerityMode, VERITY_OFF);
+static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_minimize, minimize_mode, MinimizeMode, MINIMIZE_OFF);
 
 static int partition_finalize_fstype(Partition *p, const char *path) {
         _cleanup_free_ char *e = NULL, *upper = NULL;
index e2dfc4d1a1ef7437587b24315e55dc3ba9ca0deb..0addaa6df6a4fd789f1b5371f08f6cc3f9f5cbe1 100644 (file)
@@ -62,7 +62,7 @@ static const char* const pstore_storage_table[_PSTORE_STORAGE_MAX] = {
 };
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP(pstore_storage, PStoreStorage);
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_pstore_storage, pstore_storage, PStoreStorage, "Failed to parse storage setting");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_pstore_storage, pstore_storage, PStoreStorage);
 
 static PStoreStorage arg_storage = PSTORE_STORAGE_EXTERNAL;
 
index 4441ee27c803cb2026494574292061743d10d9bf..65a5611d091169175dd465401af40492541744f6 100644 (file)
@@ -21,7 +21,7 @@
 #include "strv.h"
 #include "utf8.h"
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_stub_listener_mode, dns_stub_listener_mode, DnsStubListenerMode, "Failed to parse DNS stub listener mode setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_stub_listener_mode, dns_stub_listener_mode, DnsStubListenerMode);
 
 static int manager_add_dns_server_by_string(Manager *m, DnsServerType type, const char *word) {
         _cleanup_free_ char *server_name = NULL;
index d9ceb4508fbb624d463ff2d5f37e657be60e3eb4..dab51c40cdb6576c69f1d17363ea67bbfafe76cd 100644 (file)
@@ -852,7 +852,7 @@ int _hashmap_by_section_find_unused_line(
 }
 
 #define DEFINE_PARSER(type, vartype, conv_func)                         \
-        DEFINE_CONFIG_PARSE_PTR(config_parse_##type, conv_func, vartype, "Failed to parse " #type " value")
+        DEFINE_CONFIG_PARSE_PTR(config_parse_##type, conv_func, vartype)
 
 DEFINE_PARSER(int, int, safe_atoi);
 DEFINE_PARSER(long, long, safe_atoli);
@@ -2054,9 +2054,9 @@ int config_parse_calendar(
         return 0;
 }
 
-DEFINE_CONFIG_PARSE(config_parse_percent, parse_percent, "Failed to parse percent value");
-DEFINE_CONFIG_PARSE(config_parse_permyriad, parse_permyriad, "Failed to parse permyriad value");
-DEFINE_CONFIG_PARSE_PTR(config_parse_sec_fix_0, parse_sec_fix_0, usec_t, "Failed to parse time value");
+DEFINE_CONFIG_PARSE(config_parse_percent, parse_percent);
+DEFINE_CONFIG_PARSE(config_parse_permyriad, parse_permyriad);
+DEFINE_CONFIG_PARSE_PTR(config_parse_sec_fix_0, parse_sec_fix_0, usec_t);
 
 int config_parse_timezone(
                 const char *unit,
index 937bdc73ed6dbb81adbce4a908d6086a239dcb3d..3e00666e775f16a060be5702ee614ee11aed45bc 100644 (file)
@@ -305,7 +305,7 @@ typedef enum ConfigParseStringFlags {
         CONFIG_PARSE_STRING_SAFE_AND_ASCII = CONFIG_PARSE_STRING_SAFE | CONFIG_PARSE_STRING_ASCII,
 } ConfigParseStringFlags;
 
-#define DEFINE_CONFIG_PARSE(function, parser, msg)                      \
+#define DEFINE_CONFIG_PARSE(function, parser)                           \
         CONFIG_PARSER_PROTOTYPE(function) {                             \
                 int *i = data, r;                                       \
                                                                         \
@@ -315,17 +315,14 @@ typedef enum ConfigParseStringFlags {
                 assert(data);                                           \
                                                                         \
                 r = parser(rvalue);                                     \
-                if (r < 0) {                                            \
-                        log_syntax(unit, LOG_WARNING, filename, line, r, \
-                                   msg ", ignoring: %s", rvalue);       \
-                        return 0;                                       \
-                }                                                       \
+                if (r < 0)                                              \
+                        return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
                                                                         \
                 *i = r;                                                 \
                 return 1;                                               \
         }
 
-#define DEFINE_CONFIG_PARSE_PTR(function, parser, type, msg)            \
+#define DEFINE_CONFIG_PARSE_PTR(function, parser, type)                 \
         CONFIG_PARSER_PROTOTYPE(function) {                             \
                 type *i = ASSERT_PTR(data);                             \
                 int r;                                                  \
@@ -336,13 +333,12 @@ typedef enum ConfigParseStringFlags {
                                                                         \
                 r = parser(rvalue, i);                                  \
                 if (r < 0)                                              \
-                        log_syntax(unit, LOG_WARNING, filename, line, r, \
-                                   msg ", ignoring: %s", rvalue);       \
+                        return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
                                                                         \
                 return 1;                                               \
         }
 
-#define DEFINE_CONFIG_PARSE_ENUM_FULL(function, from_string, type, msg) \
+#define DEFINE_CONFIG_PARSE_ENUM_FULL(function, from_string, type)      \
         CONFIG_PARSER_PROTOTYPE(function) {                             \
                 type *i = data, x;                                      \
                                                                         \
@@ -352,20 +348,17 @@ typedef enum ConfigParseStringFlags {
                 assert(data);                                           \
                                                                         \
                 x = from_string(rvalue);                                \
-                if (x < 0) {                                            \
-                        log_syntax(unit, LOG_WARNING, filename, line, x, \
-                                   msg ", ignoring: %s", rvalue);       \
-                        return 0;                                       \
-                }                                                       \
+                if (x < 0)                                              \
+                        return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue); \
                                                                         \
                 *i = x;                                                 \
                 return 1;                                               \
         }
 
-#define DEFINE_CONFIG_PARSE_ENUM(function, name, type, msg)             \
-        DEFINE_CONFIG_PARSE_ENUM_FULL(function, name##_from_string, type, msg)
+#define DEFINE_CONFIG_PARSE_ENUM(function, name, type)                  \
+        DEFINE_CONFIG_PARSE_ENUM_FULL(function, name##_from_string, type)
 
-#define DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(function, name, type, default_value, msg) \
+#define DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(function, name, type, default_value) \
         CONFIG_PARSER_PROTOTYPE(function) {                             \
                 type *i = data, x;                                      \
                                                                         \
@@ -380,17 +373,14 @@ typedef enum ConfigParseStringFlags {
                 }                                                       \
                                                                         \
                 x = name##_from_string(rvalue);                         \
-                if (x < 0) {                                            \
-                        log_syntax(unit, LOG_WARNING, filename, line, x, \
-                                   msg ", ignoring: %s", rvalue);       \
-                        return 0;                                       \
-                }                                                       \
+                if (x < 0)                                              \
+                        return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue); \
                                                                         \
                 *i = x;                                                 \
                 return 1;                                               \
         }
 
-#define DEFINE_CONFIG_PARSE_ENUMV(function, name, type, invalid, msg)          \
+#define DEFINE_CONFIG_PARSE_ENUMV(function, name, type, invalid)               \
         CONFIG_PARSER_PROTOTYPE(function) {                                    \
                 type **enums = ASSERT_PTR(data);                               \
                 _cleanup_free_ type *xs = NULL;                                \
@@ -412,28 +402,24 @@ typedef enum ConfigParseStringFlags {
                         type x, *new_xs;                                       \
                                                                                \
                         r = extract_first_word(&p, &en, NULL, 0);              \
-                        if (r == -ENOMEM)                                      \
-                                return log_oom();                              \
-                        if (r < 0) {                                           \
-                                log_syntax(unit, LOG_WARNING, filename, line, r, \
-                                           msg ", ignoring: %s", en);          \
-                                return 0;                                      \
-                        }                                                      \
+                        if (r < 0)                                             \
+                                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
                         if (r == 0)                                            \
                                 break;                                         \
                                                                                \
                         x = name##_from_string(en);                            \
                         if (x < 0) {                                           \
                                 log_syntax(unit, LOG_WARNING, filename, line, x, \
-                                           msg ", ignoring: %s", en);          \
+                                           "Failed to parse %s in %s=, ignoring.", \
+                                           en, lvalue);                        \
                                 continue;                                      \
                         }                                                      \
                                                                                \
-                        for (type *ys = xs; x != invalid && *ys != invalid; ys++)       \
-                                if (*ys == x) {                                         \
+                        for (type *ys = xs; x != invalid && *ys != invalid; ys++) \
+                                if (*ys == x) {                                \
                                         log_syntax(unit, LOG_NOTICE, filename, line, 0, \
-                                                   "Duplicate entry, ignoring: %s",     \
-                                                   en);                        \
+                                                   "Duplicate entry %s in %s=, ignoring.", \
+                                                   en, lvalue);                \
                                         x = invalid;                           \
                                 }                                              \
                                                                                \
index 1e100c35ef530299230d767df15b7e99c4e7fe9c..174614a43208f8be2e576837f79d30f16c51111b 100644 (file)
@@ -23,7 +23,7 @@ static const char* const duplex_table[_DUP_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(duplex, Duplex);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_duplex, duplex, Duplex, "Failed to parse duplex setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_duplex, duplex, Duplex);
 
 static const struct {
         uint32_t opt;
@@ -72,7 +72,7 @@ static const char* const port_table[] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(port, NetDevPort);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_port, port, NetDevPort, "Failed to parse Port setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_port, port, NetDevPort);
 
 static const char* const mdi_table[] = {
         [ETH_TP_MDI_INVALID]  = "unknown",
index 820f9bb5305c5bfbf41e816551446c2084b0c7b8..e01578fbcb030813810ef7705d9f89ea3c78899e 100644 (file)
@@ -4,9 +4,9 @@
 #include "resolve-util.h"
 #include "string-table.h"
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_resolve_support, resolve_support, ResolveSupport, "Failed to parse resolve support setting");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dnssec_mode, dnssec_mode, DnssecMode, "Failed to parse DNSSEC mode setting");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_over_tls_mode, dns_over_tls_mode, DnsOverTlsMode, "Failed to parse DNS-over-TLS mode setting");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_resolve_support, resolve_support, ResolveSupport);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dnssec_mode, dnssec_mode, DnssecMode);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_over_tls_mode, dns_over_tls_mode, DnsOverTlsMode);
 
 static const char* const resolve_support_table[_RESOLVE_SUPPORT_MAX] = {
         [RESOLVE_SUPPORT_NO] = "no",
@@ -42,7 +42,7 @@ bool dns_server_address_valid(int family, const union in_addr_union *sa) {
         return true;
 }
 
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_cache_mode, dns_cache_mode, DnsCacheMode, "Failed to parse DNS cache mode setting")
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_cache_mode, dns_cache_mode, DnsCacheMode);
 
 static const char* const dns_cache_mode_table[_DNS_CACHE_MODE_MAX] = {
         [DNS_CACHE_MODE_YES] = "yes",
index f7d9a043fc68e84aae7d26de324431eca8fd6cba..d12687ac040635ff5c99e6035c5173dc42a07e77 100644 (file)
@@ -377,10 +377,10 @@ static int config_parse_resource_path(
         return free_and_replace(rr->path, resolved);
 }
 
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_resource_type, resource_type, ResourceType, "Invalid resource type");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_resource_type, resource_type, ResourceType);
 
 static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_resource_path_relto, path_relative_to, PathRelativeTo,
-                                             PATH_RELATIVE_TO_ROOT, "Invalid PathRelativeTo= value");
+                                             PATH_RELATIVE_TO_ROOT);
 
 static int config_parse_resource_ptype(
                 const char *unit,
index 647cdeeb9dba604f9aa2cad9490f0fca923c7519..645c7f840a90db801091603dcffd1c58ae44ca30 100644 (file)
@@ -1446,13 +1446,10 @@ DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(
         config_parse_mac_address_policy,
         mac_address_policy,
         MACAddressPolicy,
-        MAC_ADDRESS_POLICY_NONE,
-        "Failed to parse MAC address policy");
+        MAC_ADDRESS_POLICY_NONE);
 
 DEFINE_CONFIG_PARSE_ENUMV(config_parse_name_policy, name_policy, NamePolicy,
-                          _NAMEPOLICY_INVALID,
-                          "Failed to parse interface name policy");
+                          _NAMEPOLICY_INVALID);
 
 DEFINE_CONFIG_PARSE_ENUMV(config_parse_alternative_names_policy, alternative_names_policy, NamePolicy,
-                          _NAMEPOLICY_INVALID,
-                          "Failed to parse alternative names policy");
+                          _NAMEPOLICY_INVALID);
index 5018541661d1e131943d0955560a49f524ea0c8a..c46fcaa03826058196eaaebf75cb10ad9d1dce1d 100644 (file)
@@ -65,7 +65,7 @@ static int listen_fds(int *ret_ctrl, int *ret_netlink) {
         return 0;
 }
 
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_resolve_name_timing, resolve_name_timing, ResolveNameTiming, "Failed to parse resolve name timing");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_resolve_name_timing, resolve_name_timing, ResolveNameTiming);
 
 static int manager_parse_udev_config(Manager *manager) {
         int r, log_val = -1;