mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
tree-wide: remove various unused functions
All found with "cppcheck --enable=unusedFunction".
This commit is contained in:
committed by
Yu Watanabe
parent
c26ae3013d
commit
5dd9527883
@@ -205,35 +205,3 @@ EFI_STATUS security_policy_install(void) {
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS security_policy_uninstall(void) {
|
||||
EFI_STATUS status;
|
||||
|
||||
if (esfas) {
|
||||
EFI_SECURITY_PROTOCOL *security_protocol;
|
||||
|
||||
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) &security_protocol_guid, NULL, (VOID**) &security_protocol);
|
||||
|
||||
if (status != EFI_SUCCESS)
|
||||
return status;
|
||||
|
||||
security_protocol->FileAuthenticationState = esfas;
|
||||
esfas = NULL;
|
||||
} else
|
||||
/* nothing installed */
|
||||
return EFI_NOT_STARTED;
|
||||
|
||||
if (es2fa) {
|
||||
EFI_SECURITY2_PROTOCOL *security2_protocol;
|
||||
|
||||
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) &security2_protocol_guid, NULL, (VOID**) &security2_protocol);
|
||||
|
||||
if (status != EFI_SUCCESS)
|
||||
return status;
|
||||
|
||||
security2_protocol->FileAuthentication = es2fa;
|
||||
es2fa = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -14,5 +14,3 @@ BOOLEAN shim_loaded(void);
|
||||
BOOLEAN secure_boot_enabled(void);
|
||||
|
||||
EFI_STATUS security_policy_install(void);
|
||||
|
||||
EFI_STATUS security_policy_uninstall(void);
|
||||
|
||||
@@ -286,35 +286,3 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
|
||||
|
||||
return specifier_printf(format, table, u, ret);
|
||||
}
|
||||
|
||||
int unit_full_printf_strv(Unit *u, char **l, char ***ret) {
|
||||
size_t n;
|
||||
char **r, **i, **j;
|
||||
int q;
|
||||
|
||||
/* Applies unit_full_printf to every entry in l */
|
||||
|
||||
assert(u);
|
||||
|
||||
n = strv_length(l);
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = l, j = r; *i; i++, j++) {
|
||||
q = unit_full_printf(u, *i, j);
|
||||
if (q < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*j = NULL;
|
||||
*ret = r;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
for (j--; j >= r; j--)
|
||||
free(*j);
|
||||
|
||||
free(r);
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -5,4 +5,3 @@
|
||||
|
||||
int unit_name_printf(Unit *u, const char* text, char **ret);
|
||||
int unit_full_printf(Unit *u, const char *text, char **ret);
|
||||
int unit_full_printf_strv(Unit *u, char **l, char ***ret);
|
||||
|
||||
@@ -151,26 +151,6 @@ bool service_name_is_valid(const char *p) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char* service_name_startswith(const char *a, const char *b) {
|
||||
const char *p;
|
||||
|
||||
if (!service_name_is_valid(a) ||
|
||||
!service_name_is_valid(b))
|
||||
return NULL;
|
||||
|
||||
p = startswith(a, b);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
if (*p == 0)
|
||||
return (char*) p;
|
||||
|
||||
if (*p == '.')
|
||||
return (char*) p + 1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool member_name_is_valid(const char *p) {
|
||||
const char *q;
|
||||
|
||||
|
||||
@@ -305,8 +305,6 @@ struct sd_bus {
|
||||
sd_bus **default_bus_ptr;
|
||||
pid_t tid;
|
||||
|
||||
char *cgroup_root;
|
||||
|
||||
char *description;
|
||||
char *patch_sender;
|
||||
|
||||
@@ -346,7 +344,6 @@ struct sd_bus {
|
||||
|
||||
bool interface_name_is_valid(const char *p) _pure_;
|
||||
bool service_name_is_valid(const char *p) _pure_;
|
||||
char* service_name_startswith(const char *a, const char *b);
|
||||
bool member_name_is_valid(const char *p) _pure_;
|
||||
bool object_path_is_valid(const char *p) _pure_;
|
||||
char *object_path_startswith(const char *a, const char *b) _pure_;
|
||||
@@ -397,8 +394,6 @@ int bus_set_address_user(sd_bus *bus);
|
||||
int bus_set_address_system_remote(sd_bus *b, const char *host);
|
||||
int bus_set_address_system_machine(sd_bus *b, const char *machine);
|
||||
|
||||
int bus_get_root_path(sd_bus *bus);
|
||||
|
||||
int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
|
||||
|
||||
#define bus_assert_return(expr, r, error) \
|
||||
|
||||
@@ -542,43 +542,6 @@ fail:
|
||||
return r;
|
||||
}
|
||||
|
||||
static int bus_match_find_compare_value(
|
||||
struct bus_match_node *where,
|
||||
enum bus_match_node_type t,
|
||||
uint8_t value_u8,
|
||||
const char *value_str,
|
||||
struct bus_match_node **ret) {
|
||||
|
||||
struct bus_match_node *c, *n;
|
||||
|
||||
assert(where);
|
||||
assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
|
||||
assert(BUS_MATCH_IS_COMPARE(t));
|
||||
assert(ret);
|
||||
|
||||
for (c = where->child; c && c->type != t; c = c->next)
|
||||
;
|
||||
|
||||
if (!c)
|
||||
return 0;
|
||||
|
||||
if (t == BUS_MATCH_MESSAGE_TYPE)
|
||||
n = hashmap_get(c->compare.children, UINT_TO_PTR(value_u8));
|
||||
else if (BUS_MATCH_CAN_HASH(t))
|
||||
n = hashmap_get(c->compare.children, value_str);
|
||||
else {
|
||||
for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next)
|
||||
;
|
||||
}
|
||||
|
||||
if (n) {
|
||||
*ret = n;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bus_match_add_leaf(
|
||||
struct bus_match_node *where,
|
||||
struct match_callback *callback) {
|
||||
@@ -607,34 +570,6 @@ static int bus_match_add_leaf(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int bus_match_find_leaf(
|
||||
struct bus_match_node *where,
|
||||
sd_bus_message_handler_t callback,
|
||||
void *userdata,
|
||||
struct bus_match_node **ret) {
|
||||
|
||||
struct bus_match_node *c;
|
||||
|
||||
assert(where);
|
||||
assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
|
||||
assert(ret);
|
||||
|
||||
for (c = where->child; c; c = c->next) {
|
||||
sd_bus_slot *s;
|
||||
|
||||
s = container_of(c->leaf.callback, sd_bus_slot, match_callback);
|
||||
|
||||
if (c->type == BUS_MATCH_LEAF &&
|
||||
c->leaf.callback->callback == callback &&
|
||||
s->userdata == userdata) {
|
||||
*ret = c;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n) {
|
||||
assert(k);
|
||||
|
||||
@@ -1014,43 +949,6 @@ int bus_match_remove(
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bus_match_find(
|
||||
struct bus_match_node *root,
|
||||
struct bus_match_component *components,
|
||||
unsigned n_components,
|
||||
sd_bus_message_handler_t callback,
|
||||
void *userdata,
|
||||
struct match_callback **ret) {
|
||||
|
||||
struct bus_match_node *n, **gc;
|
||||
unsigned i;
|
||||
int r;
|
||||
|
||||
assert(root);
|
||||
assert(ret);
|
||||
|
||||
gc = newa(struct bus_match_node*, n_components);
|
||||
|
||||
n = root;
|
||||
for (i = 0; i < n_components; i++) {
|
||||
r = bus_match_find_compare_value(
|
||||
n, components[i].type,
|
||||
components[i].value_u8, components[i].value_str,
|
||||
&n);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
gc[i] = n;
|
||||
}
|
||||
|
||||
r = bus_match_find_leaf(n, callback, userdata, &n);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
*ret = n->leaf.callback;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bus_match_free(struct bus_match_node *node) {
|
||||
struct bus_match_node *c;
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@ int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m);
|
||||
int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, struct match_callback *callback);
|
||||
int bus_match_remove(struct bus_match_node *root, struct match_callback *callback);
|
||||
|
||||
int bus_match_find(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, sd_bus_message_handler_t callback, void *userdata, struct match_callback **ret);
|
||||
|
||||
void bus_match_free(struct bus_match_node *node);
|
||||
|
||||
void bus_match_dump(struct bus_match_node *node, unsigned level);
|
||||
|
||||
@@ -5829,16 +5829,6 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bus_message_append_sender(sd_bus_message *m, const char *sender) {
|
||||
assert(m);
|
||||
assert(sender);
|
||||
|
||||
assert_return(!m->sealed, -EPERM);
|
||||
assert_return(!m->sender, -EPERM);
|
||||
|
||||
return message_append_field_string(m, BUS_MESSAGE_HEADER_SENDER, SD_BUS_TYPE_STRING, sender, &m->sender);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority) {
|
||||
assert_return(m, -EINVAL);
|
||||
assert_return(priority, -EINVAL);
|
||||
|
||||
@@ -209,7 +209,5 @@ int bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_e
|
||||
|
||||
int bus_message_remarshal(sd_bus *bus, sd_bus_message **m);
|
||||
|
||||
int bus_message_append_sender(sd_bus_message *m, const char *sender);
|
||||
|
||||
void bus_message_set_sender_driver(sd_bus *bus, sd_bus_message *m);
|
||||
void bus_message_set_sender_local(sd_bus *bus, sd_bus_message *m);
|
||||
|
||||
@@ -30,32 +30,6 @@ bool bus_type_is_valid(char c) {
|
||||
return !!memchr(valid, c, sizeof(valid));
|
||||
}
|
||||
|
||||
bool bus_type_is_valid_in_signature(char c) {
|
||||
static const char valid[] = {
|
||||
SD_BUS_TYPE_BYTE,
|
||||
SD_BUS_TYPE_BOOLEAN,
|
||||
SD_BUS_TYPE_INT16,
|
||||
SD_BUS_TYPE_UINT16,
|
||||
SD_BUS_TYPE_INT32,
|
||||
SD_BUS_TYPE_UINT32,
|
||||
SD_BUS_TYPE_INT64,
|
||||
SD_BUS_TYPE_UINT64,
|
||||
SD_BUS_TYPE_DOUBLE,
|
||||
SD_BUS_TYPE_STRING,
|
||||
SD_BUS_TYPE_OBJECT_PATH,
|
||||
SD_BUS_TYPE_SIGNATURE,
|
||||
SD_BUS_TYPE_ARRAY,
|
||||
SD_BUS_TYPE_VARIANT,
|
||||
SD_BUS_TYPE_STRUCT_BEGIN,
|
||||
SD_BUS_TYPE_STRUCT_END,
|
||||
SD_BUS_TYPE_DICT_ENTRY_BEGIN,
|
||||
SD_BUS_TYPE_DICT_ENTRY_END,
|
||||
SD_BUS_TYPE_UNIX_FD
|
||||
};
|
||||
|
||||
return !!memchr(valid, c, sizeof(valid));
|
||||
}
|
||||
|
||||
bool bus_type_is_basic(char c) {
|
||||
static const char valid[] = {
|
||||
SD_BUS_TYPE_BYTE,
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "macro.h"
|
||||
|
||||
bool bus_type_is_valid(char c) _const_;
|
||||
bool bus_type_is_valid_in_signature(char c) _const_;
|
||||
bool bus_type_is_basic(char c) _const_;
|
||||
/* "trivial" is systemd's term for what the D-Bus Specification calls
|
||||
* a "fixed type": that is, a basic type of fixed length */
|
||||
|
||||
@@ -194,7 +194,6 @@ static sd_bus* bus_free(sd_bus *b) {
|
||||
free(b->auth_buffer);
|
||||
free(b->address);
|
||||
free(b->machine);
|
||||
free(b->cgroup_root);
|
||||
free(b->description);
|
||||
free(b->patch_sender);
|
||||
|
||||
@@ -3929,24 +3928,6 @@ _public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bus_get_root_path(sd_bus *bus) {
|
||||
int r;
|
||||
|
||||
if (bus->cgroup_root)
|
||||
return 0;
|
||||
|
||||
r = cg_get_root_path(&bus->cgroup_root);
|
||||
if (r == -ENOENT) {
|
||||
bus->cgroup_root = strdup("/");
|
||||
if (!bus->cgroup_root)
|
||||
return -ENOMEM;
|
||||
|
||||
r = 0;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) {
|
||||
assert_return(bus, -EINVAL);
|
||||
assert_return(bus = bus_resolve(bus), -ENOPKG);
|
||||
|
||||
@@ -479,10 +479,6 @@ finish:
|
||||
return r;
|
||||
}
|
||||
|
||||
int fd_patch_uid(int fd, uid_t shift, uid_t range) {
|
||||
return fd_patch_uid_internal(fd, false, shift, range);
|
||||
}
|
||||
|
||||
int path_patch_uid(const char *path, uid_t shift, uid_t range) {
|
||||
int fd;
|
||||
|
||||
|
||||
@@ -4,5 +4,4 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int fd_patch_uid(int fd, uid_t shift, uid_t range);
|
||||
int path_patch_uid(const char *path, uid_t shift, uid_t range);
|
||||
|
||||
@@ -211,70 +211,6 @@ int dns_answer_match_key(DnsAnswer *a, const DnsResourceKey *key, DnsAnswerFlags
|
||||
return found;
|
||||
}
|
||||
|
||||
int dns_answer_contains_rr(DnsAnswer *a, DnsResourceRecord *rr, DnsAnswerFlags *ret_flags) {
|
||||
DnsAnswerFlags flags = 0, i_flags;
|
||||
DnsResourceRecord *i;
|
||||
bool found = false;
|
||||
int r;
|
||||
|
||||
assert(rr);
|
||||
|
||||
DNS_ANSWER_FOREACH_FLAGS(i, i_flags, a) {
|
||||
r = dns_resource_record_equal(i, rr);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
continue;
|
||||
|
||||
if (!ret_flags)
|
||||
return 1;
|
||||
|
||||
if (found)
|
||||
flags &= i_flags;
|
||||
else {
|
||||
flags = i_flags;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret_flags)
|
||||
*ret_flags = flags;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
int dns_answer_contains_key(DnsAnswer *a, const DnsResourceKey *key, DnsAnswerFlags *ret_flags) {
|
||||
DnsAnswerFlags flags = 0, i_flags;
|
||||
DnsResourceRecord *i;
|
||||
bool found = false;
|
||||
int r;
|
||||
|
||||
assert(key);
|
||||
|
||||
DNS_ANSWER_FOREACH_FLAGS(i, i_flags, a) {
|
||||
r = dns_resource_key_equal(i->key, key);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
continue;
|
||||
|
||||
if (!ret_flags)
|
||||
return true;
|
||||
|
||||
if (found)
|
||||
flags &= i_flags;
|
||||
else {
|
||||
flags = i_flags;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret_flags)
|
||||
*ret_flags = flags;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
int dns_answer_contains_nsec_or_nsec3(DnsAnswer *a) {
|
||||
DnsResourceRecord *i;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ int dns_answer_add_extend(DnsAnswer **a, DnsResourceRecord *rr, int ifindex, Dns
|
||||
int dns_answer_add_soa(DnsAnswer *a, const char *name, uint32_t ttl, int ifindex);
|
||||
|
||||
int dns_answer_match_key(DnsAnswer *a, const DnsResourceKey *key, DnsAnswerFlags *combined_flags);
|
||||
int dns_answer_contains_rr(DnsAnswer *a, DnsResourceRecord *rr, DnsAnswerFlags *combined_flags);
|
||||
int dns_answer_contains_key(DnsAnswer *a, const DnsResourceKey *key, DnsAnswerFlags *combined_flags);
|
||||
int dns_answer_contains_nsec_or_nsec3(DnsAnswer *a);
|
||||
int dns_answer_contains_zone_nsec3(DnsAnswer *answer, const char *zone);
|
||||
|
||||
|
||||
@@ -1237,44 +1237,6 @@ int bus_message_map_all_properties(
|
||||
return sd_bus_message_exit_container(m);
|
||||
}
|
||||
|
||||
int bus_message_map_properties_changed(
|
||||
sd_bus_message *m,
|
||||
const struct bus_properties_map *map,
|
||||
unsigned flags,
|
||||
sd_bus_error *error,
|
||||
void *userdata) {
|
||||
|
||||
const char *member;
|
||||
int r, invalidated, i;
|
||||
|
||||
assert(m);
|
||||
assert(map);
|
||||
|
||||
r = bus_message_map_all_properties(m, map, flags, error, userdata);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "s");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
invalidated = 0;
|
||||
while ((r = sd_bus_message_read_basic(m, SD_BUS_TYPE_STRING, &member)) > 0)
|
||||
for (i = 0; map[i].member; i++)
|
||||
if (streq(map[i].member, member)) {
|
||||
++invalidated;
|
||||
break;
|
||||
}
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return invalidated;
|
||||
}
|
||||
|
||||
int bus_map_all_properties(
|
||||
sd_bus *bus,
|
||||
const char *destination,
|
||||
|
||||
@@ -38,7 +38,6 @@ enum {
|
||||
int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
|
||||
|
||||
int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata);
|
||||
int bus_message_map_properties_changed(sd_bus_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata);
|
||||
int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map,
|
||||
unsigned flags, sd_bus_error *error, sd_bus_message **reply, void *userdata);
|
||||
|
||||
|
||||
@@ -277,26 +277,6 @@ int show_cgroup_and_extra(
|
||||
return show_extra_pids(controller, path, prefix, n_columns, extra_pids, n_extra_pids, flags);
|
||||
}
|
||||
|
||||
int show_cgroup_and_extra_by_spec(
|
||||
const char *spec,
|
||||
const char *prefix,
|
||||
unsigned n_columns,
|
||||
const pid_t extra_pids[],
|
||||
unsigned n_extra_pids,
|
||||
OutputFlags flags) {
|
||||
|
||||
_cleanup_free_ char *controller = NULL, *path = NULL;
|
||||
int r;
|
||||
|
||||
assert(spec);
|
||||
|
||||
r = cg_split_spec(spec, &controller, &path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return show_cgroup_and_extra(controller, path, prefix, n_columns, extra_pids, n_extra_pids, flags);
|
||||
}
|
||||
|
||||
int show_cgroup_get_unit_path_and_warn(
|
||||
sd_bus *bus,
|
||||
const char *unit,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user