Merge pull request #2717 from keszybz/networkctl-prettification
Networkctl prettification
This commit is contained in:
@@ -43,17 +43,6 @@ char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool ether_addr_is_null(const struct ether_addr *addr) {
|
||||
assert(addr);
|
||||
|
||||
return addr->ether_addr_octet[0] == 0 &&
|
||||
addr->ether_addr_octet[1] == 0 &&
|
||||
addr->ether_addr_octet[2] == 0 &&
|
||||
addr->ether_addr_octet[3] == 0 &&
|
||||
addr->ether_addr_octet[4] == 0 &&
|
||||
addr->ether_addr_octet[5] == 0;
|
||||
}
|
||||
|
||||
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
@@ -28,5 +28,10 @@
|
||||
#define ETHER_ADDR_TO_STRING_MAX (3*6)
|
||||
char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]);
|
||||
|
||||
bool ether_addr_is_null(const struct ether_addr *addr);
|
||||
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b);
|
||||
|
||||
#define ETHER_ADDR_NULL ((const struct ether_addr){})
|
||||
|
||||
static inline bool ether_addr_is_null(const struct ether_addr *addr) {
|
||||
return ether_addr_equal(addr, ÐER_ADDR_NULL);
|
||||
}
|
||||
|
||||
@@ -48,8 +48,9 @@ bool hostname_is_set(void) {
|
||||
char* gethostname_malloc(void) {
|
||||
struct utsname u;
|
||||
|
||||
/* This call tries to return something useful, either the actual hostname or it makes something up. The only
|
||||
* reason it might mail is OOM. It might even return "localhost" if that's set. */
|
||||
/* This call tries to return something useful, either the actual hostname
|
||||
* or it makes something up. The only reason it might fail is OOM.
|
||||
* It might even return "localhost" if that's set. */
|
||||
|
||||
assert_se(uname(&u) >= 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user