Compare commits

..

No commits in common. "6bae4b905ccf512aadb66e357a845079b8b41f53" and "96249bf8d66f2d3ea3235b9f927ccaa094a611fd" have entirely different histories.

37 changed files with 80 additions and 114 deletions

View File

@ -288,6 +288,10 @@ mouse:usb:v04b3p3107:name:*
mouse:usb:v047dp1020:*Kensington Expert Mouse*
ID_INPUT_TRACKBALL=1
# Kensington SlimBlade Trackball
mouse:usb:v047dp2041:name:Kensington Slimblade Trackball:
ID_INPUT_TRACKBALL=1
##########################################
# Lenovo
##########################################

View File

@ -335,6 +335,15 @@ basic_disabled_warnings = [
'-Wno-unused-result',
'-Wno-format-signedness',
]
if get_option('b_ndebug') == 'true'
# With asserts disabled with get a bunch of warnings about variables which
# are used only in the asserts. This is not useful at all, so let's just silence
# those warnings.
basic_disabled_warnings += [
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
]
endif
possible_cc_flags = [
'-Werror=undef',

View File

@ -2889,7 +2889,7 @@ int config_parse_syscall_filter(
void *userdata) {
ExecContext *c = data;
_unused_ const Unit *u = userdata;
const Unit *u = userdata;
bool invert = false;
const char *p;
int r;

View File

@ -1968,6 +1968,7 @@ int manager_load_unit_prepare(
int r;
assert(m);
assert(name || path);
assert(_ret);
/* This will prepare the unit for loading, but not actually
@ -1976,13 +1977,8 @@ int manager_load_unit_prepare(
if (path && !is_path(path))
return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path);
if (!name) {
/* 'name' and 'path' must not both be null. Check here 'path' using assert_se() to
* workaround a bug in gcc that generates a -Wnonnull warning when calling basename(),
* but this cannot be possible in any code path (See #6119). */
assert_se(path);
if (!name)
name = basename(path);
}
t = unit_name_to_type(name);

View File

@ -789,7 +789,7 @@ static const sd_bus_vtable manager_vtable[] = {
"h",
SD_BUS_PARAM(send_fd),
method_acquire_home,
SD_BUS_VTABLE_UNPRIVILEGED|SD_BUS_VTABLE_SENSITIVE),
SD_BUS_VTABLE_SENSITIVE),
SD_BUS_METHOD_WITH_NAMES("RefHome",
"sb",
SD_BUS_PARAM(user_name)

View File

@ -172,8 +172,8 @@ static int import_fs(int argc, char *argv[], void *userdata) {
progress.limit = (RateLimit) { 200*USEC_PER_MSEC, 1 };
/* Hook into SIGINT/SIGTERM, so that we can cancel things then */
assert_se(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0);
assert_se(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0);
assert(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0);
assert(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0);
r = btrfs_subvol_snapshot_fd_full(
fd,

View File

@ -60,7 +60,7 @@ static void mpi_export(void *buf, size_t buflen, const gcry_mpi_t x) {
static gcry_mpi_t mpi_import(const void *buf, size_t buflen) {
gcry_mpi_t h;
_unused_ unsigned len;
unsigned len;
assert_se(gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL) == 0);
len = (gcry_mpi_get_nbits(h) + 7) / 8;

View File

@ -283,7 +283,7 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *ret_mcast_gr
struct cmsghdr *cmsg;
cmsg = cmsg_find(&msg, SOL_NETLINK, NETLINK_PKTINFO, CMSG_LEN(sizeof(struct nl_pktinfo)));
if (cmsg)
if (ret_mcast_group)
*ret_mcast_group = ((struct nl_pktinfo*) CMSG_DATA(cmsg))->group;
else
*ret_mcast_group = 0;

View File

@ -2567,7 +2567,7 @@ static int method_can_reboot_parameter(
void *userdata,
sd_bus_error *error) {
_unused_ Manager *m = userdata;
Manager *m = userdata;
int r;
assert(message);
@ -2699,7 +2699,7 @@ static int method_can_reboot_to_firmware_setup(
void *userdata,
sd_bus_error *error) {
_unused_ Manager *m = userdata;
Manager *m = userdata;
int r;
assert(message);
@ -2888,7 +2888,7 @@ static int method_can_reboot_to_boot_loader_menu(
void *userdata,
sd_bus_error *error) {
_unused_ Manager *m = userdata;
Manager *m = userdata;
int r;
assert(message);
@ -3079,7 +3079,7 @@ static int method_can_reboot_to_boot_loader_entry(
void *userdata,
sd_bus_error *error) {
_unused_ Manager *m = userdata;
Manager *m = userdata;
int r;
assert(message);

View File

@ -112,7 +112,7 @@ static int method_get_machine(sd_bus_message *message, void *userdata, sd_bus_er
static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
_unused_ Manager *m = userdata;
Manager *m = userdata;
const char *name;
int r;
@ -471,7 +471,7 @@ static int method_get_machine_os_release(sd_bus_message *message, void *userdata
static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_hashmap_free_ Hashmap *images = NULL;
_unused_ Manager *m = userdata;
Manager *m = userdata;
Image *image;
Iterator i;
int r;

View File

@ -2233,7 +2233,7 @@ void manager_dirty(Manager *manager) {
}
static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
_unused_ Manager *manager = userdata;
Manager *manager = userdata;
const sd_bus_error *e;
assert(m);
@ -2279,7 +2279,7 @@ int manager_set_hostname(Manager *m, const char *hostname) {
}
static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
_unused_ Manager *manager = userdata;
Manager *manager = userdata;
const sd_bus_error *e;
assert(m);

View File

@ -1722,7 +1722,7 @@ static int context_dump_partition_bar(Context *context, const char *node) {
bool z = false;
size_t c, j = 0;
assert_se((c = columns()) >= 2);
assert((c = columns()) >= 2);
c -= 2; /* We do not use the leftmost and rightmost character cell */
bar = new0(Partition*, c);

View File

@ -9,9 +9,6 @@
#include "resolved-conf.h"
#include "resolved-dnssd.h"
#include "resolved-util.h"
#include "resolved-manager.h"
#include "resolved-dns-search-domain.h"
#include "dns-domain.h"
#include "specifier.h"
#include "string-table.h"
#include "string-util.h"

View File

@ -14,6 +14,7 @@ enum DnsStubListenerMode {
_DNS_STUB_LISTENER_MODE_INVALID = -1
};
#include "resolved-manager.h"
#include "resolved-dns-server.h"
int manager_parse_config_file(Manager *m);

View File

@ -10,8 +10,8 @@ typedef struct DnsQuery DnsQuery;
#include "resolved-dns-answer.h"
#include "resolved-dns-question.h"
#include "resolved-dns-stream.h"
#include "resolved-dns-search-domain.h"
#include "resolved-dns-transaction.h"
struct DnsQueryCandidate {
DnsQuery *query;

View File

@ -2,19 +2,18 @@
#pragma once
#include "list.h"
#include "ratelimit.h"
typedef struct DnsQueryCandidate DnsQueryCandidate;
typedef struct DnsScope DnsScope;
#include "resolved-dns-cache.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-query.h"
#include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h"
#include "resolved-dns-zone.h"
#include "resolved-link.h"
typedef enum DnsScopeMatch {
DNS_SCOPE_NO,

View File

@ -3,8 +3,6 @@
#include "alloc-util.h"
#include "dns-domain.h"
#include "resolved-dns-search-domain.h"
#include "resolved-link.h"
#include "resolved-manager.h"
int dns_search_domain_new(
Manager *m,

View File

@ -1,18 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "list.h"
#include "macro.h"
typedef struct DnsSearchDomain DnsSearchDomain;
typedef struct Link Link;
typedef struct Manager Manager;
typedef enum DnsSearchDomainType {
DNS_SEARCH_DOMAIN_SYSTEM,
DNS_SEARCH_DOMAIN_LINK,
} DnsSearchDomainType;
#include "resolved-link.h"
#include "resolved-manager.h"
struct DnsSearchDomain {
Manager *manager;

View File

@ -6,7 +6,6 @@
#include "resolved-bus.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stub.h"
#include "resolved-manager.h"
#include "resolved-resolv-conf.h"
#include "siphash24.h"
#include "string-table.h"

View File

@ -2,18 +2,8 @@
#pragma once
#include "in-addr-util.h"
#include "list.h"
#include "resolve-util.h"
#include "time-util.h"
typedef struct DnsScope DnsScope;
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsPacket DnsPacket;
typedef struct Link Link;
typedef struct Manager Manager;
#include "resolved-dnstls.h"
typedef enum DnsServerType {
DNS_SERVER_SYSTEM,
@ -45,6 +35,10 @@ typedef enum DnsServerFeatureLevel {
const char* dns_server_feature_level_to_string(int i) _const_;
int dns_server_feature_level_from_string(const char *s) _pure_;
#include "resolved-dnstls.h"
#include "resolved-link.h"
#include "resolved-manager.h"
struct DnsServer {
Manager *manager;

View File

@ -8,7 +8,6 @@
#include "io-util.h"
#include "missing_network.h"
#include "resolved-dns-stream.h"
#include "resolved-manager.h"
#define DNS_STREAM_TIMEOUT_USEC (10 * USEC_PER_SEC)
#define DNS_STREAMS_MAX 128

View File

@ -1,18 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-event.h"
#include "ordered-set.h"
#include "socket-util.h"
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsTransaction DnsTransaction;
typedef struct Manager Manager;
#include "resolved-dns-packet.h"
#include "resolved-dnstls.h"
typedef enum DnsStreamType {
DNS_STREAM_LOOKUP, /* Outgoing connection to a classic DNS server */
@ -23,6 +14,11 @@ typedef enum DnsStreamType {
_DNS_STREAM_TYPE_INVALID = -1,
} DnsStreamType;
#include "resolved-dns-packet.h"
#include "resolved-dns-transaction.h"
#include "resolved-dnstls.h"
#include "resolved-manager.h"
#define DNS_STREAM_WRITE_TLS_DATA 1
/* Streams are used by three subsystems:

View File

@ -1,18 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-event.h"
typedef struct DnsTransaction DnsTransaction;
typedef enum DnsTransactionState DnsTransactionState;
typedef enum DnsTransactionSource DnsTransactionSource;
#include "resolved-dns-answer.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-server.h"
enum DnsTransactionState {
DNS_TRANSACTION_NULL,
DNS_TRANSACTION_PENDING,
@ -45,6 +37,13 @@ enum DnsTransactionSource {
_DNS_TRANSACTION_SOURCE_INVALID = -1
};
#include "resolved-dns-answer.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-scope.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h"
struct DnsTransaction {
DnsScope *scope;

View File

@ -6,7 +6,6 @@
#include "resolved-dns-packet.h"
#include "resolved-dns-zone.h"
#include "resolved-dnssd.h"
#include "resolved-manager.h"
#include "string-util.h"
/* Never allow more than 1K entries */

View File

@ -6,7 +6,6 @@
#include "resolved-dnssd-bus.h"
#include "resolved-dnssd.h"
#include "resolved-link.h"
#include "resolved-manager.h"
#include "strv.h"
#include "user-util.h"

View File

@ -8,7 +8,6 @@
#include "resolved-dns-stream.h"
#include "resolved-dnstls.h"
#include "resolved-manager.h"
#define TLS_PROTOCOL_PRIORITY "NORMAL:-VERS-ALL:+VERS-TLS1.3:+VERS-TLS1.2"
DEFINE_TRIVIAL_CLEANUP_FUNC(gnutls_session_t, gnutls_deinit);

View File

@ -11,7 +11,6 @@
#include "io-util.h"
#include "resolved-dns-stream.h"
#include "resolved-dnstls.h"
#include "resolved-manager.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(SSL*, SSL_free);
DEFINE_TRIVIAL_CLEANUP_FUNC(BIO*, BIO_free);

View File

@ -3,14 +3,9 @@
#if ENABLE_DNS_OVER_TLS
#include <stdint.h>
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsTlsManagerData DnsTlsManagerData;
typedef struct DnsTlsServerData DnsTlsServerData;
typedef struct DnsTlsStreamData DnsTlsStreamData;
typedef struct Manager Manager;
#if DNS_OVER_TLS_USE_GNUTLS
#include "resolved-dnstls-gnutls.h"
@ -20,6 +15,10 @@ typedef struct Manager Manager;
#error Unknown dependency for supporting DNS-over-TLS
#endif
#include "resolved-dns-stream.h"
#include "resolved-dns-transaction.h"
#include "resolved-manager.h"
#define DNSTLS_STREAM_CLOSED 1
int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server);

View File

@ -5,7 +5,6 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#include <stddef.h>
#include "conf-parser.h"
#include "resolved-conf.h"
#include "resolved-manager.h"
%}
struct ConfigPerfItem;
%null_strings

View File

@ -1,8 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-netlink.h"
#include "in-addr-util.h"
#include "ratelimit.h"
#include "resolve-util.h"
@ -14,6 +12,7 @@ typedef struct LinkAddress LinkAddress;
#include "resolved-dns-scope.h"
#include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h"
#include "resolved-manager.h"
#define LINK_SEARCH_DOMAINS_MAX 256
#define LINK_DNS_SERVERS_MAX 256

View File

@ -15,8 +15,10 @@ typedef struct Manager Manager;
#include "resolved-conf.h"
#include "resolved-dns-query.h"
#include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h"
#include "resolved-dns-trust-anchor.h"
#include "resolved-dnstls.h"
#include "resolved-link.h"
#define MANAGER_SEARCH_DOMAINS_MAX 256

View File

@ -1013,14 +1013,10 @@ static int install_info_add(
int r;
assert(c);
assert(name || path);
if (!name) {
/* 'name' and 'path' must not both be null. Check here 'path' using assert_se() to
* workaround a bug in gcc that generates a -Wnonnull warning when calling basename(),
* but this cannot be possible in any code path (See #6119). */
assert_se(path);
if (!name)
name = basename(path);
}
if (!unit_name_is_valid(name, UNIT_NAME_ANY))
return -EINVAL;

View File

@ -15,6 +15,7 @@
int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
struct statfs sfs;
int r;
assert(fd >= 0);
@ -53,7 +54,8 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
sz -= sz % sfs.f_bsize;
xsprintf(args.name, "%" PRIu64, sz);
r = snprintf(args.name, sizeof(args.name), "%" PRIu64, sz);
assert((size_t) r < sizeof(args.name));
if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0)
return -errno;

View File

@ -340,30 +340,12 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
if (hr->disk_usage != UINT64_MAX) {
char buf[FORMAT_BYTES_MAX];
if (hr->disk_size != UINT64_MAX) {
unsigned permille;
permille = (unsigned) DIV_ROUND_UP(hr->disk_usage * 1000U, hr->disk_size); /* Round up! */
printf(" Disk Usage: %s (= %u.%01u%%)\n",
format_bytes(buf, sizeof(buf), hr->disk_usage),
permille / 10, permille % 10);
} else
printf(" Disk Usage: %s\n", format_bytes(buf, sizeof(buf), hr->disk_usage));
printf(" Disk Usage: %s\n", format_bytes(buf, sizeof(buf), hr->disk_usage));
}
if (hr->disk_free != UINT64_MAX) {
char buf[FORMAT_BYTES_MAX];
if (hr->disk_size != UINT64_MAX) {
unsigned permille;
permille = (unsigned) ((hr->disk_free * 1000U) / hr->disk_size); /* Round down! */
printf(" Disk Free: %s (= %u.%01u%%)\n",
format_bytes(buf, sizeof(buf), hr->disk_free),
permille / 10, permille % 10);
} else
printf(" Disk Free: %s\n", format_bytes(buf, sizeof(buf), hr->disk_free));
printf(" Disk Free: %s\n", format_bytes(buf, sizeof(buf), hr->disk_free));
}
if (hr->disk_floor != UINT64_MAX) {

View File

@ -99,13 +99,13 @@ static void test_bool_assign(void) {
g = cp; /* cast from pointer */
h = NULL; /* cast from pointer */
assert_se(b);
assert_se(c);
assert_se(d);
assert_se(e);
assert_se(!f);
assert_se(g);
assert_se(!h);
assert(b);
assert(c);
assert(d);
assert(e);
assert(!f);
assert(g);
assert(!h);
}
static int cleanup_counter = 0;

View File

@ -233,17 +233,17 @@ static void assert_equal_fd(int fd1, int fd2) {
ssize_t x, y;
x = read(fd1, a, sizeof(a));
assert_se(x >= 0);
assert(x >= 0);
y = read(fd2, b, sizeof(b));
assert_se(y >= 0);
assert(y >= 0);
assert_se(x == y);
assert(x == y);
if (x == 0)
break;
assert_se(memcmp(a, b, x) == 0);
assert(memcmp(a, b, x) == 0);
}
}

View File

@ -433,7 +433,7 @@ static void assert_similar(usec_t a, usec_t b) {
else
d = b - a;
assert_se(d < 10*USEC_PER_SEC);
assert(d < 10*USEC_PER_SEC);
}
static void test_usec_shift_clock(void) {