}
static int dump_unit_paths(int argc, char *argv[], void *userdata) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
char **p;
}
static bool validate_device(struct udev *udev, struct udev_device *device) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *enumerate = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
struct udev_device *parent;
const char *v, *subsystem;
first = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *other;
+ _cleanup_(udev_device_unrefp) struct udev_device *other;
struct udev_device *other_parent;
const char *other_subsystem;
}
int main(int argc, char *argv[]) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
_cleanup_free_ char *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL;
const char *sysname, *path_id, *ss, *saved;
unsigned max_brightness;
#if HAVE_BLKID
DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe);
-#define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep)
#endif
int make_lock_file_for(const char *p, int operation, LockFile *ret);
void release_lock_file(LockFile *f);
-#define _cleanup_release_lock_file_ _cleanup_(release_lock_file)
-
#define LOCK_FILE_INIT { .fd = -1, .path = NULL }
}
static void device_enumerate(Manager *m) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
const char *sysfs;
sysfs = udev_list_entry_get_name(item);
}
static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
Manager *m = userdata;
const char *action, *sysfs;
int r;
}
int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
struct stat st;
assert(m);
}
static int swap_load_devnode(Swap *s) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct stat st;
const char *p;
}
static int swap_process_new(Manager *m, const char *device, int prio, bool set_flags) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
const char *dn;
struct stat st;
}
static int loopback_list_get(MountPoint **head) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
int r;
assert(head);
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d;
+ _cleanup_(udev_device_unrefp) struct udev_device *d;
const char *dn;
_cleanup_free_ MountPoint *lb = NULL;
}
static int dm_list_get(MountPoint **head) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
int r;
assert(head);
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d;
+ _cleanup_(udev_device_unrefp) struct udev_device *d;
dev_t devnum;
const char *dn;
_cleanup_free_ MountPoint *m = NULL;
#endif
static int open_parent(dev_t devnum, int *ret) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
const char *name, *devtype, *node;
struct udev_device *parent;
dev_t pn;
Writer* writer_unref(Writer *w);
DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
-#define _cleanup_writer_unref_ _cleanup_(writer_unrefp)
int writer_write(Writer *s,
struct iovec_wrapper *iovw,
return 0;
}
-static int get_writer(RemoteServer *s, const char *host,
- Writer **writer) {
+static int get_writer(RemoteServer *s, const char *host, Writer **writer) {
+ _cleanup_(writer_unrefp) Writer *w = NULL;
const void *key;
- _cleanup_writer_unref_ Writer *w = NULL;
int r;
switch(arg_split_mode) {
static int add_matches_for_device(sd_journal *j, const char *devpath) {
int r;
- _cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
struct udev_device *d = NULL;
struct stat st;
int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_id) {
/* name is a pointer to memory in the udev_device struct, so must
have the same scope */
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
const char *name = NULL;
uint64_t id;
if (detect_container() <= 0) {
/* not in a container, udev will be around */
- _cleanup_udev_unref_ struct udev *udev;
+ _cleanup_(udev_unrefp) struct udev *udev;
char ifindex_str[2 + DECIMAL_STR_MAX(int)];
udev = udev_new();
}
DEFINE_TRIVIAL_CLEANUP_FUNC(DHCPRequest*, dhcp_request_free);
-#define _cleanup_dhcp_request_free_ _cleanup_(dhcp_request_freep)
static int ensure_sane_request(sd_dhcp_server *server, DHCPRequest *req, DHCPMessage *message) {
assert(req);
int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
size_t length) {
- _cleanup_dhcp_request_free_ DHCPRequest *req = NULL;
+ _cleanup_(dhcp_request_freep) DHCPRequest *req = NULL;
_cleanup_free_ char *error_message = NULL;
DHCPLease *existing_lease;
int type, r;
bool del, uid_t old_uid,
bool add, uid_t new_uid) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
_cleanup_set_free_free_ Set *nodes = NULL;
_cleanup_closedir_ DIR *dir = NULL;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
const char *node, *sn;
d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
}
static int manager_count_external_displays(Manager *m) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
int n = 0;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct udev_device *p;
const char *status, *enabled, *dash, *nn, *i;
bool external = false;
}
static int trigger_device(Manager *m, struct udev_device *d) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *first, *item;
int r;
}
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
_cleanup_free_ char *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
static int manager_enumerate_devices(Manager *m) {
struct udev_list_entry *item = NULL, *first = NULL;
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
int r;
assert(m);
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
int k;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
}
static int manager_enumerate_buttons(Manager *m) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
int k;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
}
static int manager_dispatch_seat_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
}
static int manager_dispatch_device_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
}
static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
const char *name;
}
static int manager_dispatch_button_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
max_width = n_columns;
while (*item) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct udev_list_entry *next, *lookahead;
const char *sn, *name, *sysfs, *subsystem, *sysname;
_cleanup_free_ char *k = NULL, *l = NULL;
if (path_startswith(lookahead_sysfs, sub) &&
!path_startswith(lookahead_sysfs, sysfs)) {
- _cleanup_udev_device_unref_ struct udev_device *lookahead_d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *lookahead_d = NULL;
lookahead_d = udev_device_new_from_syspath(udev, lookahead_sysfs);
if (lookahead_d) {
}
int show_sysfs(const char *seat, const char *prefix, unsigned n_columns, OutputFlags flags) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
struct udev_list_entry *first = NULL;
int r;
}
static int umount_by_device(sd_bus *bus, const char *what) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_strv_free_ char **list = NULL;
struct stat st;
const char *v;
}
static int discover_loop_backing_file(void) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_free_ char *loop_dev = NULL;
struct stat st;
const char *v;
}
static int discover_device(void) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
struct stat st;
const char *v;
int r;
[COLUMN_UUID] = "UUID"
};
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
size_t n_allocated = 0, n = 0, i;
size_t column_width[_COLUMN_MAX];
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d;
+ _cleanup_(udev_device_unrefp) struct udev_device *d;
struct item *j;
d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
/* callback for brige netdev's parameter set */
static int netdev_bridge_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_netdev_unref_ NetDev *netdev = userdata;
+ _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
int r;
assert(netdev);
/* callback for geneve netdev's created without a backing Link */
static int geneve_netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_netdev_unref_ NetDev *netdev = userdata;
+ _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
int r;
assert(netdev->state != _NETDEV_STATE_INVALID);
/* callback for netdev's created without a backing Link */
static int netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_netdev_unref_ NetDev *netdev = userdata;
+ _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
int r;
assert(netdev->state != _NETDEV_STATE_INVALID);
}
static int netdev_load_one(Manager *manager, const char *filename) {
- _cleanup_netdev_unref_ NetDev *netdev_raw = NULL, *netdev = NULL;
+ _cleanup_(netdev_unrefp) NetDev *netdev_raw = NULL, *netdev = NULL;
_cleanup_fclose_ FILE *file = NULL;
const char *dropin_dirname;
bool independent = false;
NetDev *netdev_ref(NetDev *netdev);
DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
-#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
int netdev_get(Manager *manager, const char *name, NetDev **ret);
int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
#include "socket-util.h"
int address_label_new(AddressLabel **ret) {
- _cleanup_address_label_free_ AddressLabel *addrlabel = NULL;
+ _cleanup_(address_label_freep) AddressLabel *addrlabel = NULL;
addrlabel = new0(AddressLabel, 1);
if (!addrlabel)
}
static int address_label_new_static(Network *network, const char *filename, unsigned section_line, AddressLabel **ret) {
- _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
- _cleanup_address_label_free_ AddressLabel *label = NULL;
+ _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+ _cleanup_(address_label_freep) AddressLabel *label = NULL;
int r;
assert(network);
void *data,
void *userdata) {
- _cleanup_address_label_free_ AddressLabel *n = NULL;
+ _cleanup_(address_label_freep) AddressLabel *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
- _cleanup_address_label_free_ AddressLabel *n = NULL;
+ _cleanup_(address_label_freep) AddressLabel *n = NULL;
Network *network = userdata;
uint32_t k;
int r;
void address_label_free(AddressLabel *label);
DEFINE_TRIVIAL_CLEANUP_FUNC(AddressLabel*, address_label_free);
-#define _cleanup_address_label_free_ _cleanup_(address_label_freep)
int address_label_configure(AddressLabel *address, Link *link, sd_netlink_message_handler_t callback, bool update);
#define STATIC_ADDRESSES_PER_NETWORK_MAX 1024U
int address_new(Address **ret) {
- _cleanup_address_free_ Address *address = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
address = new0(Address, 1);
if (!address)
}
int address_new_static(Network *network, const char *filename, unsigned section_line, Address **ret) {
- _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
- _cleanup_address_free_ Address *address = NULL;
+ _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
int r;
assert(network);
const union in_addr_union *in_addr,
unsigned char prefixlen,
Address **ret) {
- _cleanup_address_free_ Address *address = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
int r;
assert(link);
static int address_acquire(Link *link, Address *original, Address **ret) {
union in_addr_union in_addr = {};
struct in_addr broadcast = {};
- _cleanup_address_free_ Address *na = NULL;
+ _cleanup_(address_freep) Address *na = NULL;
int r;
assert(link);
void *userdata) {
Network *network = userdata;
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
int r;
assert(filename);
void *userdata) {
Network *network = userdata;
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
const char *address, *e;
union in_addr_union buffer;
int r, f;
void *data,
void *userdata) {
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
unsigned k;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
int r;
assert(filename);
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_address_free_ Address *n = NULL;
+ _cleanup_(address_freep) Address *n = NULL;
int r;
assert(filename);
bool address_is_ready(const Address *a);
DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
-#define _cleanup_address_free_ _cleanup_(address_freep)
int config_parse_address(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_broadcast(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);
static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
for (i = 0; i < n; i++) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
/* if the DHCP server returns both a Classless Static Routes option and a Static Routes option,
the DHCP client MUST ignore the Static Routes option. */
log_link_warning(link, "Classless static routes received from DHCP server: ignoring static-route option and router option");
if (r >= 0 && !classless_route) {
- _cleanup_route_free_ Route *route = NULL;
- _cleanup_route_free_ Route *route_gw = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
+ _cleanup_(route_freep) Route *route_gw = NULL;
r = route_new(&route);
if (r < 0)
}
static int dhcp_lease_lost(Link *link) {
- _cleanup_address_free_ Address *address = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
struct in_addr addr;
struct in_addr netmask;
struct in_addr gateway;
n = sd_dhcp_lease_get_routes(link->dhcp_lease, &routes);
if (n >= 0) {
for (i = 0; i < n; i++) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
r = route_new(&route);
if (r >= 0) {
if (r >= 0) {
r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway);
if (r >= 0) {
- _cleanup_route_free_ Route *route_gw = NULL;
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route_gw = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
r = route_new(&route_gw);
if (r >= 0) {
static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
struct in_addr *address,
struct in_addr *netmask,
uint32_t lifetime) {
- _cleanup_address_free_ Address *addr = NULL;
+ _cleanup_(address_freep) Address *addr = NULL;
unsigned prefixlen;
int r;
static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
uint32_t lifetime_preferred,
uint32_t lifetime_valid) {
- _cleanup_address_free_ Address *addr = NULL;
+ _cleanup_(address_freep) Address *addr = NULL;
char buffer[INET6_ADDRSTRLEN];
int r;
unsigned section,
FdbEntry **ret) {
- _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+ _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
struct ether_addr *mac_addr = NULL;
assert(network);
void *userdata) {
Network *network = userdata;
- _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+ _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
int r;
assert(filename);
void *userdata) {
Network *network = userdata;
- _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+ _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
int r;
assert(filename);
int fdb_entry_configure(Link *link, FdbEntry *fdb_entry);
DEFINE_TRIVIAL_CLEANUP_FUNC(FdbEntry*, fdb_entry_free);
-#define _cleanup_fdbentry_free_ _cleanup_(fdb_entry_freep)
int config_parse_fdb_hwaddr(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_fdb_vlan_id(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);
#include "networkd-link.h"
static int ipv4ll_address_lost(Link *link) {
- _cleanup_address_free_ Address *address = NULL;
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
struct in_addr addr;
int r;
}
static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
- _cleanup_address_free_ Address *ll_addr = NULL;
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(address_freep) Address *ll_addr = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
struct in_addr address;
int r;
}
static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
- _cleanup_link_unref_ Link *link = NULL;
+ _cleanup_(link_unrefp) Link *link = NULL;
uint16_t type;
const char *ifname, *kind = NULL;
int r, ifindex;
}
static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link->route_messages > 0);
}
int link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(m);
}
static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(rtnl);
}
static int address_label_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(rtnl);
}
int link_address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(m);
}
static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
log_link_debug(link, "Set link");
}
static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(m);
}
static int set_flags_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(m);
}
static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
static int link_initialized_and_synced(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
Network *network;
int r;
int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
Link *link;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
char ifindex_str[2 + DECIMAL_STR_MAX(int)];
int r;
int link_send_changed(Link *link, const char *property, ...) _sentinel_;
DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
-#define _cleanup_link_unref_ _cleanup_(link_unrefp)
/* Macros which append INTERFACE= to the message */
static int manager_dispatch_link_udev(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
Manager *m = userdata;
struct udev_monitor *monitor = m->udev_monitor;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
device = udev_monitor_receive_device(monitor);
if (!device)
};
int manager_new(Manager **ret, sd_event *event) {
- _cleanup_manager_free_ Manager *m = NULL;
+ _cleanup_(manager_freep) Manager *m = NULL;
int r;
m = new0(Manager, 1);
int manager_dhcp6_prefix_remove_all(Manager *m, Link *link);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
-#define _cleanup_manager_free_ _cleanup_(manager_freep)
#define NDISC_PREFIX_LFT_MIN 7200U
static int ndisc_netlink_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(link);
}
static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
struct in6_addr gateway;
uint16_t lifetime;
unsigned preference;
}
static void ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *rt) {
- _cleanup_address_free_ Address *address = NULL;
+ _cleanup_(address_freep) Address *address = NULL;
Address *existing_address;
uint32_t lifetime_valid, lifetime_preferred, lifetime_remaining;
usec_t time_now;
}
static void ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
usec_t time_now;
uint32_t lifetime;
unsigned prefixlen;
}
static void ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
struct in6_addr gateway;
uint32_t lifetime;
unsigned preference, prefixlen;
}
static int network_load_one(Manager *manager, const char *filename) {
- _cleanup_network_free_ Network *network = NULL;
+ _cleanup_(network_freep) Network *network = NULL;
_cleanup_fclose_ FILE *file = NULL;
char *d;
const char *dropin_dirname;
void network_config_section_free(NetworkConfigSection *network);
DEFINE_TRIVIAL_CLEANUP_FUNC(NetworkConfigSection*, network_config_section_free);
-#define _cleanup_network_config_section_free_ _cleanup_(network_config_section_freep)
typedef struct Manager Manager;
void network_free(Network *network);
DEFINE_TRIVIAL_CLEANUP_FUNC(Network*, network_free);
-#define _cleanup_network_free_ _cleanup_(network_freep)
int network_load(Manager *manager);
int prefix_new_static(Network *network, const char *filename,
unsigned section_line, Prefix **ret) {
- _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
- _cleanup_prefix_free_ Prefix *prefix = NULL;
+ _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+ _cleanup_(prefix_freep) Prefix *prefix = NULL;
int r;
assert(network);
void *userdata) {
Network *network = userdata;
- _cleanup_prefix_free_ Prefix *p = NULL;
+ _cleanup_(prefix_freep) Prefix *p = NULL;
uint8_t prefixlen = 64;
union in_addr_union in6addr;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_prefix_free_ Prefix *p = NULL;
+ _cleanup_(prefix_freep) Prefix *p = NULL;
int r, val;
assert(filename);
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_prefix_free_ Prefix *p = NULL;
+ _cleanup_(prefix_freep) Prefix *p = NULL;
usec_t usec;
int r;
Prefix **ret);
DEFINE_TRIVIAL_CLEANUP_FUNC(Prefix*, prefix_free);
-#define _cleanup_prefix_free_ _cleanup_(prefix_freep)
int config_parse_router_prefix_delegation(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_router_preference(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 route_new(Route **ret) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
route = new0(Route, 1);
if (!route)
}
int route_new_static(Network *network, const char *filename, unsigned section_line, Route **ret) {
- _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
int r;
assert(network);
uint32_t table,
Route **ret) {
- _cleanup_route_free_ Route *route = NULL;
+ _cleanup_(route_freep) Route *route = NULL;
int r;
assert(link);
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
union in_addr_union buffer;
int r, f;
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
union in_addr_union buffer;
int r, f;
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
union in_addr_union buffer;
unsigned char prefixlen;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
uint32_t k;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
int r;
assert(filename);
const char *rvalue,
void *data,
void *userdata) {
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
Network *network = userdata;
uint32_t k;
int r;
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
int r;
assert(filename);
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
int r;
r = route_new_static(network, filename, section_line, &n);
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
int r;
r = route_new_static(network, filename, section_line, &n);
void *data,
void *userdata) {
Network *network = userdata;
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
int r;
r = route_new_static(network, filename, section_line, &n);
const char *rvalue,
void *data,
void *userdata) {
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
Network *network = userdata;
uint64_t k;
int r;
const char *rvalue,
void *data,
void *userdata) {
- _cleanup_route_free_ Route *n = NULL;
+ _cleanup_(route_freep) Route *n = NULL;
Network *network = userdata;
int k, r;
int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
-#define _cleanup_route_free_ _cleanup_(route_freep)
int config_parse_gateway(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_preferred_src(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);
char *oif,
RoutingPolicyRule **ret) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
int r;
assert_return(rules, -EINVAL);
}
static int routing_policy_rule_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(m);
}
static int routing_policy_rule_new_static(Network *network, const char *filename, unsigned section_line, RoutingPolicyRule **ret) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
- _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
+ _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
int r;
assert(network);
}
int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
- _cleanup_link_unref_ Link *link = userdata;
+ _cleanup_(link_unrefp) Link *link = userdata;
int r;
assert(rtnl);
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
union in_addr_union buffer;
uint8_t prefixlen;
void *data,
void *userdata) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
return r;
STRV_FOREACH(i, l) {
- _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
+ _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
p = startswith(*i, "RULE=");
if (!p)
void routing_policy_rule_free(RoutingPolicyRule *rule);
DEFINE_TRIVIAL_CLEANUP_FUNC(RoutingPolicyRule*, routing_policy_rule_free);
-#define _cleanup_routing_policy_rule_free_ _cleanup_(routing_policy_rule_freep)
int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, sd_netlink_message_handler_t callback, bool update);
int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, sd_netlink_message_handler_t callback);
int main(int argc, char *argv[]) {
sd_event *event = NULL;
- _cleanup_manager_free_ Manager *m = NULL;
+ _cleanup_(manager_freep) Manager *m = NULL;
const char *user = "systemd-network";
uid_t uid;
gid_t gid;
}
static void test_address_equality(void) {
- _cleanup_address_free_ Address *a1 = NULL, *a2 = NULL;
+ _cleanup_(address_freep) Address *a1 = NULL, *a2 = NULL;
assert_se(address_new(&a1) >= 0);
assert_se(address_new(&a2) >= 0);
}
int main(void) {
- _cleanup_manager_free_ Manager *manager = NULL;
+ _cleanup_(manager_freep) Manager *manager = NULL;
_cleanup_(sd_event_unrefp) sd_event *event = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_udev_device_unref_ struct udev_device *loopback = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *loopback = NULL;
int r;
test_deserialize_in_addr();
}
int setup_bridge(const char *veth_name, const char *bridge_name, bool create) {
- _cleanup_release_lock_file_ LockFile bridge_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile bridge_lock = LOCK_FILE_INIT;
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
int r, bridge_ifi;
unsigned n = 0;
}
int remove_bridge(const char *bridge_name) {
- _cleanup_release_lock_file_ LockFile bridge_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile bridge_lock = LOCK_FILE_INIT;
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
const char *path;
int r;
}
static int parse_interface(struct udev *udev, const char *name) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
char ifi_str[2 + DECIMAL_STR_MAX(int)];
int ifi;
}
int move_network_interfaces(pid_t pid, char **ifaces) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
char **i;
int r;
}
int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
unsigned idx = 0;
char **i;
}
int setup_ipvlan(const char *machine_name, pid_t pid, char **ifaces) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
char **i;
int r;
for (;;) {
char lock_path[STRLEN("/run/systemd/nspawn-uid/") + DECIMAL_STR_MAX(uid_t) + 1];
- _cleanup_release_lock_file_ LockFile lf = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile lf = LOCK_FILE_INIT;
if (--n_tries <= 0)
return -EBUSY;
.sa_flags = SA_NOCLDSTOP|SA_RESTART,
};
- _cleanup_release_lock_file_ LockFile uid_shift_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile uid_shift_lock = LOCK_FILE_INIT;
_cleanup_close_ int etc_passwd_lock = -1;
_cleanup_close_pair_ int
kmsg_socket_pair[2] = { -1, -1 },
bool secondary = false, remove_directory = false, remove_image = false;
pid_t pid = 0;
union in_addr_union exposed = {};
- _cleanup_release_lock_file_ LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT;
bool interactive, veth_created = false, remove_tmprootdir = false;
char tmprootdir[] = "/tmp/nspawn-root-XXXXXX";
_cleanup_(loop_device_unrefp) LoopDevice *loop = NULL;
struct udev_device *device,
struct udev_device **ret) {
- _cleanup_udev_monitor_unref_ struct udev_monitor *monitor = NULL;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *monitor = NULL;
struct udev_device *d;
const char *sysname;
int watch_fd, r;
}
for (;;) {
- _cleanup_udev_device_unref_ struct udev_device *t = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *t = NULL;
r = fd_wait_for_event(watch_fd, POLLIN, EXIT_USEC);
if (r == -EINTR)
const struct rfkill_event *event,
char **ret) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
const char *path_id, *type;
char *state_file;
int r;
int main(int argc, char *argv[]) {
LIST_HEAD(write_queue_item, write_queue);
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_close_ int rfkill_fd = -1;
bool ready = false;
int r, n;
uint64_t *ret_psize,
sd_id128_t *ret_uuid) {
#if HAVE_BLKID
- _cleanup_blkid_free_probe_ blkid_probe b = NULL;
+ _cleanup_(blkid_free_probep) blkid_probe b = NULL;
char t[DEV_NUM_PATH_MAX];
const char *v;
#endif
* different error otherwise. */
#if HAVE_BLKID
- _cleanup_blkid_free_probe_ blkid_probe b = NULL;
+ _cleanup_(blkid_free_probep) blkid_probe b = NULL;
const char *fstype;
int r;
#if HAVE_BLKID
sd_id128_t root_uuid = SD_ID128_NULL, verity_uuid = SD_ID128_NULL;
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
bool is_gpt, is_mbr, generic_rw, multiple_generic = false;
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
- _cleanup_blkid_free_probe_ blkid_probe b = NULL;
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(blkid_free_probep) blkid_probe b = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
_cleanup_free_ char *generic_node = NULL;
sd_id128_t generic_uuid = SD_ID128_NULL;
const char *pttype = NULL;
n = 0;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *q;
+ _cleanup_(udev_device_unrefp) struct udev_device *q;
dev_t qn;
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *q;
+ _cleanup_(udev_device_unrefp) struct udev_device *q;
unsigned long long pflags;
blkid_partition pp;
const char *node;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
const char *config_path;
char **i;
int r;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
_cleanup_strv_free_ char **todo = NULL;
size_t n_todo = 0, n_allocated = 0;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_strv_free_ char **todo = NULL;
size_t n_todo = 0, n_allocated = 0;
const char *config_path;
unsigned *n_changes) {
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_strv_free_ char **todo = NULL;
size_t n_todo = 0, n_allocated = 0;
char **i;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
UnitFileInstallInfo *i, *target_info;
const char *config_path;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
const char *config_path;
UnitFileInstallInfo *i;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
const char *config_path;
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
UnitFileInstallInfo *i;
const char *new_path;
const char *root_dir,
char **name) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
UnitFileInstallInfo *i;
char *n;
const char *name,
UnitFileState *ret) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
assert(scope >= 0);
unsigned *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(presets_freep) Presets presets = {};
const char *config_path;
char **i;
unsigned *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(presets_freep) Presets presets = {};
const char *config_path = NULL;
char **i;
char **states,
char **patterns) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
char **i;
int r;
}
int image_remove(Image *i) {
- _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
_cleanup_strv_free_ char **settings = NULL;
_cleanup_free_ char *roothash = NULL;
char **j;
}
int image_rename(Image *i, const char *new_name) {
- _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT, name_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT, name_lock = LOCK_FILE_INIT;
_cleanup_free_ char *new_path = NULL, *nn = NULL, *roothash = NULL;
_cleanup_strv_free_ char **settings = NULL;
unsigned file_attr = 0;
}
int image_clone(Image *i, const char *new_name, bool read_only) {
- _cleanup_release_lock_file_ LockFile name_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile name_lock = LOCK_FILE_INIT;
_cleanup_strv_free_ char **settings = NULL;
_cleanup_free_ char *roothash = NULL;
const char *new_path;
}
int image_read_only(Image *i, bool b) {
- _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
int r;
assert(i);
}
int image_read_metadata(Image *i) {
- _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
int r;
assert(i);
}
int setup_machine_directory(uint64_t size, sd_bus_error *error) {
- _cleanup_release_lock_file_ LockFile lock_file = LOCK_FILE_INIT;
+ _cleanup_(release_lock_file) LockFile lock_file = LOCK_FILE_INIT;
struct loop_info64 info = {
.lo_flags = LO_FLAGS_AUTOCLEAR,
};
void lookup_paths_flush_generator(LookupPaths *p);
void lookup_paths_free(LookupPaths *p);
-#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
char **generator_binary_paths(UnitFileScope scope);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_msg*, udev_ctrl_msg_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_monitor*, udev_monitor_unref);
-#define _cleanup_udev_unref_ _cleanup_(udev_unrefp)
-#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp)
-#define _cleanup_udev_enumerate_unref_ _cleanup_(udev_enumerate_unrefp)
-#define _cleanup_udev_event_unref_ _cleanup_(udev_event_unrefp)
-#define _cleanup_udev_rules_unref_ _cleanup_(udev_rules_unrefp)
-#define _cleanup_udev_ctrl_unref_ _cleanup_(udev_ctrl_unrefp)
-#define _cleanup_udev_ctrl_connection_unref_ _cleanup_(udev_ctrl_connection_unrefp)
-#define _cleanup_udev_ctrl_msg_unref_ _cleanup_(udev_ctrl_msg_unrefp)
-#define _cleanup_udev_monitor_unref_ _cleanup_(udev_monitor_unrefp)
-#define _cleanup_udev_list_cleanup_ _cleanup_(udev_list_cleanup)
-
int udev_parse_config(void);
}
static int cat(int argc, char *argv[], void *userdata) {
- _cleanup_lookup_paths_free_ LookupPaths lp = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_strv_free_ char **names = NULL;
char **name;
sd_bus *bus;
int r = 0;
#if HAVE_SYSV_COMPAT
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_(lookup_paths_free) LookupPaths paths = {};
unsigned f = 0;
/* Processes all SysV units, and reshuffles the array so that afterwards only the native units remain */
if (STR_IN_SET(verb, "mask", "unmask")) {
char **name;
- _cleanup_lookup_paths_free_ LookupPaths lp = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
r = lookup_paths_init(&lp, arg_scope, 0, arg_root);
if (r < 0)
}
static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) {
- _cleanup_lookup_paths_free_ LookupPaths lp = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
char **name;
int r;
int main(int argc, char *argv[]) {
_cleanup_(free_sysvstub_hashmapp) Hashmap *all_services = NULL;
- _cleanup_lookup_paths_free_ LookupPaths lp = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
SysvStub *service;
Iterator j;
int r;
}
static void test_device(struct udev *udev, const char *syspath) {
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
log_info("looking at device: %s", syspath);
device = udev_device_new_from_syspath(udev, syspath);
}
static void test_device_parents(struct udev *udev, const char *syspath) {
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
struct udev_device *device_parent;
log_info("looking at device: %s", syspath);
static void test_device_devnum(struct udev *udev) {
dev_t devnum = makedev(1, 3);
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
log_info("looking up device: %u:%u", major(devnum), minor(devnum));
device = udev_device_new_from_devnum(udev, 'c', devnum);
}
static void test_device_subsys_name(struct udev *udev, const char *subsys, const char *dev) {
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
log_info("looking up device: '%s:%s'", subsys, dev);
device = udev_device_new_from_subsystem_sysname(udev, subsys, dev);
}
static void test_monitor(struct udev *udev) {
- _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor;
_cleanup_close_ int fd_ep;
int fd_udev;
struct epoll_event ep_udev = {
}
int main(int argc, char *argv[]) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
bool arg_monitor = false;
static const struct option options[] = {
{ "syspath", required_argument, NULL, 'p' },
static void test_paths(UnitFileScope scope) {
char template[] = "/tmp/test-path-lookup.XXXXXXX";
- _cleanup_lookup_paths_free_ LookupPaths lp_without_env = {};
- _cleanup_lookup_paths_free_ LookupPaths lp_with_env = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp_without_env = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp_with_env = {};
char *systemd_unit_path;
assert_se(mkdtemp(template));
}
static void test_user_and_global_paths(void) {
- _cleanup_lookup_paths_free_ LookupPaths lp_global = {}, lp_user = {};
+ _cleanup_(lookup_paths_free) LookupPaths lp_global = {}, lp_user = {};
char **u, **g, **p;
unsigned k = 0;
}
int main(int argc, char *argv[]) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_udev_event_unref_ struct udev_event *event = NULL;
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
- _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
+ _cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
+ _cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
char syspath[UTIL_PATH_SIZE];
const char *devpath;
const char *action;
return ret;
}
-int main(int argc, char *argv[])
-{
- _cleanup_udev_unref_ struct udev *udev = NULL;
+int main(int argc, char *argv[]) {
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
struct hd_driveid id;
union {
uint8_t byte[512];
return retval;
}
-int main(int argc, char **argv)
-{
- _cleanup_udev_unref_ struct udev *udev;
+int main(int argc, char **argv) {
+ _cleanup_(udev_unrefp) struct udev *udev;
int retval = 0;
char maj_min_dev[MAX_PATH_LEN];
int newargc;
int64_t offset = 0;
bool noraid = false;
_cleanup_close_ int fd = -1;
- _cleanup_blkid_free_probe_ blkid_probe pr = NULL;
+ _cleanup_(blkid_free_probep) blkid_probe pr = NULL;
const char *data;
const char *name;
int nvals;
const char *device = NULL;
const char *subsystem = NULL;
const char *prefix = NULL;
- _cleanup_udev_device_unref_ struct udev_device *srcdev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *srcdev = NULL;
if (!hwdb)
return EXIT_FAILURE;
size_t l;
char *s;
const char *attr, *port_name;
- _cleanup_udev_device_unref_ struct udev_device *pci = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *pci = NULL;
struct udev_device *hotplug_slot_dev;
char slots[PATH_MAX];
_cleanup_closedir_ DIR *dir = NULL;
static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) {
struct udev *udev;
struct udev_device *targetdev;
- _cleanup_udev_device_unref_ struct udev_device *fcdev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *fcdev = NULL;
const char *port;
_cleanup_free_ char *lun = NULL;
static struct udev_device *handle_scsi_sas_wide_port(struct udev_device *parent, char **path) {
struct udev *udev;
struct udev_device *targetdev, *target_parent;
- _cleanup_udev_device_unref_ struct udev_device *sasdev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *sasdev = NULL;
const char *sas_address;
_cleanup_free_ char *lun = NULL;
{
struct udev *udev;
struct udev_device *targetdev, *target_parent, *port, *expander;
- _cleanup_udev_device_unref_ struct udev_device
+ _cleanup_(udev_device_unrefp) struct udev_device
*target_sasdev = NULL, *expander_sasdev = NULL, *port_sasdev = NULL;
const char *sas_address = NULL;
const char *phy_id;
static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) {
struct udev *udev;
struct udev_device *transportdev;
- _cleanup_udev_device_unref_ struct udev_device
+ _cleanup_(udev_device_unrefp) struct udev_device
*sessiondev = NULL, *conndev = NULL;
const char *target, *connname, *addr, *port;
_cleanup_free_ char *lun = NULL;
static struct udev_device *handle_scsi_ata(struct udev_device *parent, char **path) {
struct udev *udev;
struct udev_device *targetdev, *target_parent;
- _cleanup_udev_device_unref_ struct udev_device *atadev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *atadev = NULL;
const char *port_no;
assert(parent);
}
static int adm_control(struct udev *udev, int argc, char *argv[]) {
- _cleanup_udev_ctrl_unref_ struct udev_ctrl *uctrl = NULL;
+ _cleanup_(udev_ctrl_unrefp) struct udev_ctrl *uctrl = NULL;
int timeout = 60;
int rc = 1, c;
}
static int export_devices(struct udev *udev) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *udev_enumerate;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *udev_enumerate;
struct udev_list_entry *list_entry;
udev_enumerate = udev_enumerate_new(udev);
udev_enumerate_scan_devices(udev_enumerate);
udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) {
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry));
if (device != NULL)
}
static int uinfo(struct udev *udev, int argc, char *argv[]) {
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
bool root = 0;
bool export = 0;
const char *export_prefix = NULL;
bool prop = false;
bool print_kernel = false;
bool print_udev = false;
- _cleanup_udev_list_cleanup_ struct udev_list subsystem_match_list;
- _cleanup_udev_list_cleanup_ struct udev_list tag_match_list;
- _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor = NULL;
- _cleanup_udev_monitor_unref_ struct udev_monitor *kernel_monitor = NULL;
+ _cleanup_(udev_list_cleanup) struct udev_list subsystem_match_list;
+ _cleanup_(udev_list_cleanup) struct udev_list tag_match_list;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *kernel_monitor = NULL;
_cleanup_close_ int fd_ep = -1;
int fd_kernel = -1, fd_udev = -1;
struct epoll_event ep_kernel, ep_udev;
const char *action = "add";
const char *syspath = NULL;
struct udev_list_entry *entry;
- _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
- _cleanup_udev_event_unref_ struct udev_event *event = NULL;
+ _cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
+ _cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
sigset_t mask, sigmask_orig;
int rc = 0, c;
TYPE_SUBSYSTEMS,
} device_type = TYPE_DEVICES;
const char *action = "change";
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *udev_enumerate = NULL;
- _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *udev_enumerate = NULL;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL;
_cleanup_close_ int fd_ep = -1;
int fd_udev = -1;
struct epoll_event ep_udev;
}
break;
case 'b': {
- _cleanup_udev_device_unref_ struct udev_device *dev;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev;
dev = find_device(udev, optarg, "/sys");
if (!dev) {
break;
case ARG_NAME: {
- _cleanup_udev_device_unref_ struct udev_device *dev;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev;
dev = find_device(udev, optarg, "/dev/");
if (!dev) {
}
for (; optind < argc; optind++) {
- _cleanup_udev_device_unref_ struct udev_device *dev;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev;
dev = find_device(udev, argv[optind], NULL);
if (!dev) {
for (i = 0; i < fdcount; i++) {
if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) {
- _cleanup_udev_device_unref_ struct udev_device *device;
+ _cleanup_(udev_device_unrefp) struct udev_device *device;
const char *syspath = NULL;
device = udev_monitor_receive_device(udev_monitor);
static void worker_spawn(Manager *manager, struct event *event) {
struct udev *udev = event->udev;
- _cleanup_udev_monitor_unref_ struct udev_monitor *worker_monitor = NULL;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *worker_monitor = NULL;
pid_t pid;
int r = 0;
/* receive the udevd message from userspace */
static int on_ctrl_msg(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
Manager *manager = userdata;
- _cleanup_udev_ctrl_connection_unref_ struct udev_ctrl_connection *ctrl_conn = NULL;
- _cleanup_udev_ctrl_msg_unref_ struct udev_ctrl_msg *ctrl_msg = NULL;
+ _cleanup_(udev_ctrl_connection_unrefp) struct udev_ctrl_connection *ctrl_conn = NULL;
+ _cleanup_(udev_ctrl_msg_unrefp) struct udev_ctrl_msg *ctrl_msg = NULL;
const char *str;
int i;
bool has_partitions = false;
int fd;
struct udev *udev = udev_device_get_udev(dev);
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item;
/*
return r;
udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!d)
write_string_file(filename, "change", WRITE_STRING_FILE_CREATE);
udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!d)
}
FOREACH_INOTIFY_EVENT(e, buffer, l) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
dev = udev_watch_lookup(manager->udev, e->wd);
if (!dev)
}
static int listen_fds(int *rctrl, int *rnetlink) {
- _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
int ctrl_fd = -1, netlink_fd = -1;
int fd, n, r;
}
if (ctrl_fd < 0) {
- _cleanup_udev_ctrl_unref_ struct udev_ctrl *ctrl = NULL;
+ _cleanup_(udev_ctrl_unrefp) struct udev_ctrl *ctrl = NULL;
udev = udev_new();
if (!udev)
}
if (netlink_fd < 0) {
- _cleanup_udev_monitor_unref_ struct udev_monitor *monitor = NULL;
+ _cleanup_(udev_monitor_unrefp) struct udev_monitor *monitor = NULL;
if (!udev) {
udev = udev_new();