mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
8e766630f0
This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
#pragma once
|
|
|
|
/***
|
|
This file is part of systemd.
|
|
|
|
Copyright 2017 Susant Sahani
|
|
***/
|
|
|
|
#include <inttypes.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "in-addr-util.h"
|
|
|
|
typedef struct AddressLabel AddressLabel;
|
|
|
|
#include "networkd-link.h"
|
|
#include "networkd-network.h"
|
|
|
|
typedef struct Network Network;
|
|
typedef struct Link Link;
|
|
typedef struct NetworkConfigSection NetworkConfigSection;
|
|
|
|
struct AddressLabel {
|
|
Network *network;
|
|
Link *link;
|
|
NetworkConfigSection *section;
|
|
|
|
unsigned char prefixlen;
|
|
uint32_t label;
|
|
|
|
union in_addr_union in_addr;
|
|
|
|
LIST_FIELDS(AddressLabel, labels);
|
|
};
|
|
|
|
int address_label_new(AddressLabel **ret);
|
|
void address_label_free(AddressLabel *label);
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(AddressLabel*, address_label_free);
|
|
|
|
int address_label_configure(AddressLabel *address, Link *link, sd_netlink_message_handler_t callback, bool update);
|
|
|
|
int config_parse_address_label(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
int config_parse_address_label_prefix(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|