udev-builtin-net_setup_link.c revision c487c9cec012282273e16f3110734309934a1281
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Tom Gundersen
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "link-config.h"
#include "udev.h"
#include "log.h"
int r;
if (argc > 1) {
log_error("This program takes no arguments.");
return EXIT_FAILURE;
}
if (r >= 0)
if (r < 0) {
if (r == -ENOENT) {
log_debug("No matching link configuration found.");
return EXIT_SUCCESS;
} else {
log_error_errno(r, "Could not get link config: %m");
return EXIT_FAILURE;
}
}
if (r < 0) {
return EXIT_FAILURE;
}
if (name)
return EXIT_SUCCESS;
}
int r;
if (ctx)
return 0;
r = link_config_ctx_new(&ctx);
if (r < 0)
return r;
r = link_config_load(ctx);
if (r < 0)
return r;
log_debug("Created link configuration context.");
return 0;
}
log_debug("Unloaded link configuration context.");
}
log_debug("Check if link configuration needs reloading.");
if (!ctx)
return false;
return link_config_should_reload(ctx);
}
const struct udev_builtin udev_builtin_net_setup_link = {
.name = "net_setup_link",
.help = "configure network link",
.run_once = false,
};