1
0
mirror of https://github.com/systemd/systemd synced 2026-03-11 15:44:47 +01:00

Compare commits

..

No commits in common. "f9b3afae96c72564cd4cd766555845f17e3c12a9" and "7f966edbda51e2e8e437d2f1a079c81f739bc0a7" have entirely different histories.

4 changed files with 15 additions and 53 deletions

4
NEWS
View File

@ -224,7 +224,7 @@ CHANGES WITH 248:
systemd.network files gained a new ActivationPolicy= setting which
allows configuring how the UP state of an interface shall be managed,
i.e. whether the interface is always upped, always downed, or may be
upped/downed by the user using "ip link set dev".
upped/downed by the user using "ip dev".
* The default for the Broadcast= setting in .network files has slightly
changed: the broadcast address will not be configured for wireguard
@ -251,7 +251,7 @@ CHANGES WITH 248:
be restored for individual services with NoExecPaths=/dev (or by allow-
listing and excluding /dev from ExecPaths=).
* Permissions for /dev/vsock are now set to 0666, and /dev/vhost-vsock
* Permissions for /dev/vsock are now set to 0o666, and /dev/vhost-vsock
and /dev/vhost-net are owned by the kvm group.
* The hardware database has been extended with a list of fingerprint

View File

@ -2510,8 +2510,8 @@ static int link_up_down(int argc, char *argv[], void *userdata) {
if (r < 0) {
char ifname[IF_NAMESIZE + 1];
return log_error_errno(r, "Failed to bring %s interface %s: %m",
argv[0], format_ifname_full(index, ifname, FORMAT_IFNAME_IFINDEX));
return log_error_errno(r, "Failed to %s interface %s: %m",
argv[1], format_ifname_full(index, ifname, FORMAT_IFNAME_IFINDEX));
}
}

View File

@ -3977,40 +3977,6 @@ static int find_root(char **ret, int *ret_fd) {
return log_error_errno(SYNTHETIC_ERRNO(ENODEV), "Failed to discover root block device.");
}
static int resize_pt(int fd) {
char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
_cleanup_(fdisk_unref_contextp) struct fdisk_context *c = NULL;
int r;
/* After resizing the backing file we need to resize the partition table itself too, so that it takes
* possession of the enlarged backing file. For this it suffices to open the device with libfdisk and
* immediately write it again, with no changes. */
c = fdisk_new_context();
if (!c)
return log_oom();
xsprintf(procfs_path, "/proc/self/fd/%i", fd);
r = fdisk_assign_device(c, procfs_path, 0);
if (r < 0)
return log_error_errno(r, "Failed to open device '%s': %m", procfs_path);
r = fdisk_has_label(c);
if (r < 0)
return log_error_errno(r, "Failed to determine whether disk '%s' has a disk label: %m", procfs_path);
if (r == 0) {
log_debug("Not resizing partition table, as there currently is none.");
return 0;
}
r = fdisk_write_disklabel(c);
if (r < 0)
return log_error_errno(r, "Failed to write resized partition table: %m");
log_info("Resized partition table.");
return 1;
}
static int resize_backing_fd(const char *node, int *fd) {
char buf1[FORMAT_BYTES_MAX], buf2[FORMAT_BYTES_MAX];
_cleanup_close_ int writable_fd = -1;
@ -4063,10 +4029,6 @@ static int resize_backing_fd(const char *node, int *fd) {
/* Fallback to truncation, if fallocate() is not supported. */
log_debug("Backing file system does not support fallocate(), falling back to ftruncate().");
} else {
r = resize_pt(writable_fd);
if (r < 0)
return r;
if (st.st_size == 0) /* Likely regular file just created by us */
log_info("Allocated %s for '%s'.", buf2, node);
else
@ -4080,10 +4042,6 @@ static int resize_backing_fd(const char *node, int *fd) {
return log_error_errno(errno, "Failed to grow '%s' from %s to %s by truncation: %m",
node, buf1, buf2);
r = resize_pt(writable_fd);
if (r < 0)
return r;
if (st.st_size == 0) /* Likely regular file just created by us */
log_info("Sized '%s' to %s.", node, buf2);
else

View File

@ -441,6 +441,8 @@ static int link_config_apply_rtnl_settings(sd_netlink **rtnl, const link_config
static int link_config_generate_new_name(const link_config_ctx *ctx, const link_config *config, sd_device *device, const char **ret_name) {
unsigned name_type = NET_NAME_UNKNOWN;
const char *new_name = NULL;
NamePolicy policy;
int r;
assert(ctx);
@ -458,8 +460,7 @@ static int link_config_generate_new_name(const link_config_ctx *ctx, const link_
if (ctx->enable_name_policy && config->name_policy)
for (NamePolicy *p = config->name_policy; *p != _NAMEPOLICY_INVALID; p++) {
const char *new_name = NULL;
NamePolicy policy = *p;
policy = *p;
switch (policy) {
case NAMEPOLICY_KERNEL:
@ -495,12 +496,15 @@ static int link_config_generate_new_name(const link_config_ctx *ctx, const link_
default:
assert_not_reached("invalid policy");
}
if (ifname_valid(new_name)) {
if (ifname_valid(new_name))
break;
}
if (new_name) {
log_device_debug(device, "Policy *%s* yields \"%s\".", name_policy_to_string(policy), new_name);
*ret_name = new_name;
return 0;
}
}
if (config->name) {
log_device_debug(device, "Policies didn't yield a name, using specified Name=%s.", config->name);