Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for minor issues #380

Merged
merged 12 commits into from
Jul 19, 2023
Merged
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project('netplan', 'c',
license: 'GPL3',
default_options: [
'c_std=c99',
'warning_level=1',
'warning_level=2',
'werror=true',
],
meson_version: '>= 0.61.0',
Expand Down
2 changes: 1 addition & 1 deletion src/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct netplan_net_definition {
} match;
gboolean has_match;
gboolean wake_on_lan;
NetplanWifiWowlanFlag wowlan;
gint wowlan;
gboolean emit_lldp;

/* these properties are only valid for NETPLAN_DEF_TYPE_WIFI */
Expand Down
12 changes: 6 additions & 6 deletions src/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ method_apply(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
}

static int
method_generate(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
method_generate(sd_bus_message *m, __unused void *userdata, sd_bus_error *ret_error)
{
g_autoptr(GError) err = NULL;
g_autofree gchar *stdout = NULL;
Expand Down Expand Up @@ -306,7 +306,7 @@ method_generate(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
}

static int
method_info(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
method_info(sd_bus_message *m, __unused void *userdata, __unused sd_bus_error *ret_error)
{
sd_bus_message *reply = NULL;
gint exit_status = 0;
Expand Down Expand Up @@ -434,7 +434,7 @@ method_set(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
}

static int
netplan_try_cancelled_cb(sd_event_source *es, const siginfo_t *si, void* userdata)
netplan_try_cancelled_cb(__unused sd_event_source *es, const siginfo_t *si, void* userdata)
{
NetplanData *d = userdata;
g_autofree gchar *state_dir = NULL;
Expand Down Expand Up @@ -518,7 +518,7 @@ method_try(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
if (seconds > 0)
poll_timeout = seconds * 100;
/* Timeout after up to 10 sec of waiting for the stamp file */
for (int i = 0; i < poll_timeout; i++) {
for (guint i = 0; i < poll_timeout; i++) {
struct timespec timeout = {
.tv_sec = 0,
.tv_nsec = 1000 * 1000 * 10, // 10 ms
Expand Down Expand Up @@ -778,15 +778,15 @@ static const sd_bus_vtable netplan_vtable[] = {
*/

static int
terminate_mainloop_cb(sd_event_source *es, const struct signalfd_siginfo *si, void* userdata) {
terminate_mainloop_cb(__unused sd_event_source *es, __unused const struct signalfd_siginfo *si, void* userdata) {
sd_event *event = userdata;
/* Gracefully terminate the mainloop, to write GCOV output */
sd_event_exit(event, 0);
return 0;
}

int
main(int argc, char *argv[])
main(__unused int argc, __unused char *argv[])
{
sd_bus_slot *slot = NULL;
sd_bus *bus = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ get_syntax_error_context(const NetplanParser* npp, const int line_num, const int
}

static char *
get_parser_error_context(const yaml_parser_t *parser, GError **error)
get_parser_error_context(const yaml_parser_t *parser, __unused GError **error)
{
GString *message = NULL;
unsigned char* line = parser->buffer.pointer;
Expand Down
4 changes: 2 additions & 2 deletions src/generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ static gboolean any_nm = FALSE;
static gchar* mapping_iface;

static GOptionEntry options[] = {
{"root-dir", 'r', 0, G_OPTION_ARG_FILENAME, &rootdir, "Search for and generate configuration files in this root directory instead of /"},
{"root-dir", 'r', 0, G_OPTION_ARG_FILENAME, &rootdir, "Search for and generate configuration files in this root directory instead of /", NULL},
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &files, "Read configuration from this/these file(s) instead of /etc/netplan/*.yaml", "[config file ..]"},
{"mapping", 0, 0, G_OPTION_ARG_STRING, &mapping_iface, "Only show the device to backend mapping for the specified interface."},
{"mapping", 0, 0, G_OPTION_ARG_STRING, &mapping_iface, "Only show the device to backend mapping for the specified interface.", NULL},
{NULL}
};

Expand Down
4 changes: 2 additions & 2 deletions src/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ NAME_FUNCTION_FLAGS(vxlan_extension);

#define ENUM_FUNCTION(_radical, _type) _type netplan_ ## _radical ## _from_name(const char* val) \
{ \
for (int i = 0; i < sizeof(netplan_ ## _radical ## _to_str); ++i) { \
for (size_t i = 0; i < sizeof(netplan_ ## _radical ## _to_str); ++i) { \
if (g_strcmp0(val, netplan_ ## _radical ## _to_str[i]) == 0) \
return i; \
} \
return -1; \
return NETPLAN_DEF_TYPE_NONE; \
}

ENUM_FUNCTION(def_type, NetplanDefType);
Expand Down
2 changes: 1 addition & 1 deletion src/networkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Append WiFi frequencies to wpa_supplicant's freq_list=
*/
static void
wifi_append_freq(gpointer key, gpointer value, gpointer user_data)
wifi_append_freq(__unused gpointer key, gpointer value, gpointer user_data)
{
GString* s = user_data;
g_string_append_printf(s, "%d ", GPOINTER_TO_INT(value));
Expand Down
8 changes: 4 additions & 4 deletions src/nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* This is done by checking for certain modem_params, which are only
* applicable to GSM connections.
*/
static const gboolean
static gboolean
modem_is_gsm(const NetplanNetDefinition* def)
{
if ( def->modem_params.apn
Expand Down Expand Up @@ -174,7 +174,7 @@ write_search_domains(const NetplanNetDefinition* def, const char* group, GKeyFil
}

static gboolean
write_routes(const NetplanNetDefinition* def, GKeyFile *kf, int family, GError** error)
write_routes(const NetplanNetDefinition* def, GKeyFile *kf, gint family, GError** error)
{
const gchar* group = NULL;
gchar* tmp_key = NULL;
Expand Down Expand Up @@ -949,7 +949,7 @@ write_nm_conf_access_point(const NetplanNetDefinition* def, const char* rootdir,
*/
gboolean
netplan_netdef_write_nm(
const NetplanState* np_state,
__unused const NetplanState* np_state,
const NetplanNetDefinition* netdef,
const char* rootdir,
gboolean* has_been_written,
Expand Down Expand Up @@ -997,7 +997,7 @@ gboolean
netplan_state_finish_nm_write(
const NetplanState* np_state,
const char* rootdir,
GError** error)
__unused GError** error)
{
GString* udev_rules = g_string_new(NULL);
GString *nm_conf = g_string_new(NULL);
Expand Down
8 changes: 4 additions & 4 deletions src/parse-nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* https://bugzilla.gnome.org/show_bug.cgi?id=696940
* https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/c36200a225aefb2a3919618e75682646899b82c0
*/
static const NetplanDefType
static NetplanDefType
type_from_str(const char* type_str)
{
if (!g_strcmp0(type_str, "ethernet") || !g_strcmp0(type_str, "802-3-ethernet"))
Expand All @@ -59,7 +59,7 @@ type_from_str(const char* type_str)
return NETPLAN_DEF_TYPE_NM;
}

static const NetplanWifiMode
static NetplanWifiMode
ap_type_from_str(const char* type_str)
{
if (!g_strcmp0(type_str, "infrastructure"))
Expand All @@ -72,7 +72,7 @@ ap_type_from_str(const char* type_str)
return NETPLAN_WIFI_MODE_OTHER;
}

static const NetplanTunnelMode
static NetplanTunnelMode
tunnel_mode_from_str(const char* type_str)
{
if (!g_strcmp0(type_str, "wireguard"))
Expand Down Expand Up @@ -244,7 +244,7 @@ parse_routes(GKeyFile* kf, const gchar* group, GArray** routes_arr)
*routes_arr = g_array_new(FALSE, TRUE, sizeof(NetplanIPRoute*));
route = g_new0(NetplanIPRoute, 1);
route->type = g_strdup("unicast");
route->family = G_MAXUINT; /* 0 is a valid family ID */
route->family = -1; /* 0 is a valid family ID */
route->metric = NETPLAN_METRIC_UNSPEC; /* 0 is a valid metric */
g_debug("%s: adding new route (kf)", key);

Expand Down
Loading
Loading