mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-09-20 05:44:56 +03:00
dhcp: coding style fixes
We place the opening bracket of a function on the same line as the function name. Let's do so in the DHCP sources too.
This commit is contained in:
@@ -112,9 +112,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_dhcp6_client*, sd_dhcp6_client_unref);
|
|||||||
|
|
||||||
static int client_start(sd_dhcp6_client *client, enum DHCP6State state);
|
static int client_start(sd_dhcp6_client *client, enum DHCP6State state);
|
||||||
|
|
||||||
int sd_dhcp6_client_set_callback(sd_dhcp6_client *client,
|
int sd_dhcp6_client_set_callback(sd_dhcp6_client *client, sd_dhcp6_client_cb_t cb, void *userdata) {
|
||||||
sd_dhcp6_client_cb_t cb, void *userdata)
|
|
||||||
{
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
|
|
||||||
client->cb = cb;
|
client->cb = cb;
|
||||||
@@ -123,8 +121,7 @@ int sd_dhcp6_client_set_callback(sd_dhcp6_client *client,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_set_index(sd_dhcp6_client *client, int interface_index)
|
int sd_dhcp6_client_set_index(sd_dhcp6_client *client, int interface_index) {
|
||||||
{
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
assert_return(interface_index >= -1, -EINVAL);
|
assert_return(interface_index >= -1, -EINVAL);
|
||||||
|
|
||||||
@@ -133,9 +130,11 @@ int sd_dhcp6_client_set_index(sd_dhcp6_client *client, int interface_index)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_set_mac(sd_dhcp6_client *client, const uint8_t *addr,
|
int sd_dhcp6_client_set_mac(
|
||||||
size_t addr_len, uint16_t arp_type)
|
sd_dhcp6_client *client,
|
||||||
{
|
const uint8_t *addr, size_t addr_len,
|
||||||
|
uint16_t arp_type) {
|
||||||
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
assert_return(addr, -EINVAL);
|
assert_return(addr, -EINVAL);
|
||||||
assert_return(addr_len > 0 && addr_len <= MAX_MAC_ADDR_LEN, -EINVAL);
|
assert_return(addr_len > 0 && addr_len <= MAX_MAC_ADDR_LEN, -EINVAL);
|
||||||
@@ -159,16 +158,17 @@ int sd_dhcp6_client_set_mac(sd_dhcp6_client *client, const uint8_t *addr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_ensure_duid(sd_dhcp6_client *client)
|
static int client_ensure_duid(sd_dhcp6_client *client) {
|
||||||
{
|
|
||||||
if (client->duid_len != 0)
|
if (client->duid_len != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return dhcp_identifier_set_duid_en(&client->duid, &client->duid_len);
|
return dhcp_identifier_set_duid_en(&client->duid, &client->duid_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_set_duid(sd_dhcp6_client *client, uint16_t type, uint8_t *duid,
|
int sd_dhcp6_client_set_duid(
|
||||||
size_t duid_len)
|
sd_dhcp6_client *client,
|
||||||
{
|
uint16_t type,
|
||||||
|
uint8_t *duid, size_t duid_len) {
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
assert_return(duid, -EINVAL);
|
assert_return(duid, -EINVAL);
|
||||||
assert_return(duid_len > 0 && duid_len <= MAX_DUID_LEN, -EINVAL);
|
assert_return(duid_len > 0 && duid_len <= MAX_DUID_LEN, -EINVAL);
|
||||||
@@ -202,8 +202,7 @@ int sd_dhcp6_client_set_duid(sd_dhcp6_client *client, uint16_t type, uint8_t *du
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client,
|
int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client, bool enabled) {
|
||||||
bool enabled) {
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
|
|
||||||
client->information_request = enabled;
|
client->information_request = enabled;
|
||||||
@@ -211,8 +210,7 @@ int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_get_information_request(sd_dhcp6_client *client,
|
int sd_dhcp6_client_get_information_request(sd_dhcp6_client *client, bool *enabled) {
|
||||||
bool *enabled) {
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
assert_return(enabled, -EINVAL);
|
assert_return(enabled, -EINVAL);
|
||||||
|
|
||||||
@@ -221,8 +219,7 @@ int sd_dhcp6_client_get_information_request(sd_dhcp6_client *client,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client,
|
int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option) {
|
||||||
uint16_t option) {
|
|
||||||
size_t t;
|
size_t t;
|
||||||
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
@@ -804,9 +801,7 @@ static int client_parse_message(sd_dhcp6_client *client,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_receive_reply(sd_dhcp6_client *client, DHCP6Message *reply,
|
static int client_receive_reply(sd_dhcp6_client *client, DHCP6Message *reply, size_t len) {
|
||||||
size_t len)
|
|
||||||
{
|
|
||||||
int r;
|
int r;
|
||||||
_cleanup_dhcp6_lease_free_ sd_dhcp6_lease *lease = NULL;
|
_cleanup_dhcp6_lease_free_ sd_dhcp6_lease *lease = NULL;
|
||||||
bool rapid_commit;
|
bool rapid_commit;
|
||||||
@@ -842,8 +837,7 @@ static int client_receive_reply(sd_dhcp6_client *client, DHCP6Message *reply,
|
|||||||
return DHCP6_STATE_BOUND;
|
return DHCP6_STATE_BOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_receive_advertise(sd_dhcp6_client *client,
|
static int client_receive_advertise(sd_dhcp6_client *client, DHCP6Message *advertise, size_t len) {
|
||||||
DHCP6Message *advertise, size_t len) {
|
|
||||||
int r;
|
int r;
|
||||||
_cleanup_dhcp6_lease_free_ sd_dhcp6_lease *lease = NULL;
|
_cleanup_dhcp6_lease_free_ sd_dhcp6_lease *lease = NULL;
|
||||||
uint8_t pref_advertise = 0, pref_lease = 0;
|
uint8_t pref_advertise = 0, pref_lease = 0;
|
||||||
@@ -878,8 +872,7 @@ static int client_receive_advertise(sd_dhcp6_client *client,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_receive_message(sd_event_source *s, int fd, uint32_t revents,
|
static int client_receive_message(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
||||||
void *userdata) {
|
|
||||||
sd_dhcp6_client *client = userdata;
|
sd_dhcp6_client *client = userdata;
|
||||||
DHCP6_CLIENT_DONT_DESTROY(client);
|
DHCP6_CLIENT_DONT_DESTROY(client);
|
||||||
_cleanup_free_ DHCP6Message *message;
|
_cleanup_free_ DHCP6Message *message;
|
||||||
@@ -990,8 +983,7 @@ static int client_receive_message(sd_event_source *s, int fd, uint32_t revents,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
|
static int client_start(sd_dhcp6_client *client, enum DHCP6State state) {
|
||||||
{
|
|
||||||
int r;
|
int r;
|
||||||
usec_t timeout, time_now;
|
usec_t timeout, time_now;
|
||||||
char time_string[FORMAT_TIMESPAN_MAX];
|
char time_string[FORMAT_TIMESPAN_MAX];
|
||||||
@@ -1120,15 +1112,13 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_stop(sd_dhcp6_client *client)
|
int sd_dhcp6_client_stop(sd_dhcp6_client *client) {
|
||||||
{
|
|
||||||
client_stop(client, DHCP6_EVENT_STOP);
|
client_stop(client, DHCP6_EVENT_STOP);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_start(sd_dhcp6_client *client)
|
int sd_dhcp6_client_start(sd_dhcp6_client *client) {
|
||||||
{
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
enum DHCP6State state = DHCP6_STATE_SOLICITATION;
|
enum DHCP6State state = DHCP6_STATE_SOLICITATION;
|
||||||
|
|
||||||
@@ -1184,9 +1174,7 @@ error:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_attach_event(sd_dhcp6_client *client, sd_event *event,
|
int sd_dhcp6_client_attach_event(sd_dhcp6_client *client, sd_event *event, int priority) {
|
||||||
int priority)
|
|
||||||
{
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
@@ -1253,8 +1241,7 @@ sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_new(sd_dhcp6_client **ret)
|
int sd_dhcp6_client_new(sd_dhcp6_client **ret) {
|
||||||
{
|
|
||||||
_cleanup_dhcp6_client_unref_ sd_dhcp6_client *client = NULL;
|
_cleanup_dhcp6_client_unref_ sd_dhcp6_client *client = NULL;
|
||||||
size_t t;
|
size_t t;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user