mirror of
https://github.com/systemd/systemd
synced 2026-03-11 15:44:47 +01:00
Compare commits
4 Commits
7f966edbda
...
f9b3afae96
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9b3afae96 | ||
|
|
6d18c13e79 | ||
|
|
6f50c94dfd | ||
|
|
5cdb3f70eb |
4
NEWS
4
NEWS
@ -224,7 +224,7 @@ CHANGES WITH 248:
|
|||||||
systemd.network files gained a new ActivationPolicy= setting which
|
systemd.network files gained a new ActivationPolicy= setting which
|
||||||
allows configuring how the UP state of an interface shall be managed,
|
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
|
i.e. whether the interface is always upped, always downed, or may be
|
||||||
upped/downed by the user using "ip dev".
|
upped/downed by the user using "ip link set dev".
|
||||||
|
|
||||||
* The default for the Broadcast= setting in .network files has slightly
|
* The default for the Broadcast= setting in .network files has slightly
|
||||||
changed: the broadcast address will not be configured for wireguard
|
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-
|
be restored for individual services with NoExecPaths=/dev (or by allow-
|
||||||
listing and excluding /dev from ExecPaths=).
|
listing and excluding /dev from ExecPaths=).
|
||||||
|
|
||||||
* Permissions for /dev/vsock are now set to 0o666, and /dev/vhost-vsock
|
* Permissions for /dev/vsock are now set to 0666, and /dev/vhost-vsock
|
||||||
and /dev/vhost-net are owned by the kvm group.
|
and /dev/vhost-net are owned by the kvm group.
|
||||||
|
|
||||||
* The hardware database has been extended with a list of fingerprint
|
* The hardware database has been extended with a list of fingerprint
|
||||||
|
|||||||
@ -2510,8 +2510,8 @@ static int link_up_down(int argc, char *argv[], void *userdata) {
|
|||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
char ifname[IF_NAMESIZE + 1];
|
char ifname[IF_NAMESIZE + 1];
|
||||||
|
|
||||||
return log_error_errno(r, "Failed to %s interface %s: %m",
|
return log_error_errno(r, "Failed to bring %s interface %s: %m",
|
||||||
argv[1], format_ifname_full(index, ifname, FORMAT_IFNAME_IFINDEX));
|
argv[0], format_ifname_full(index, ifname, FORMAT_IFNAME_IFINDEX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3977,6 +3977,40 @@ static int find_root(char **ret, int *ret_fd) {
|
|||||||
return log_error_errno(SYNTHETIC_ERRNO(ENODEV), "Failed to discover root block device.");
|
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) {
|
static int resize_backing_fd(const char *node, int *fd) {
|
||||||
char buf1[FORMAT_BYTES_MAX], buf2[FORMAT_BYTES_MAX];
|
char buf1[FORMAT_BYTES_MAX], buf2[FORMAT_BYTES_MAX];
|
||||||
_cleanup_close_ int writable_fd = -1;
|
_cleanup_close_ int writable_fd = -1;
|
||||||
@ -4029,6 +4063,10 @@ static int resize_backing_fd(const char *node, int *fd) {
|
|||||||
/* Fallback to truncation, if fallocate() is not supported. */
|
/* Fallback to truncation, if fallocate() is not supported. */
|
||||||
log_debug("Backing file system does not support fallocate(), falling back to ftruncate().");
|
log_debug("Backing file system does not support fallocate(), falling back to ftruncate().");
|
||||||
} else {
|
} else {
|
||||||
|
r = resize_pt(writable_fd);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
if (st.st_size == 0) /* Likely regular file just created by us */
|
if (st.st_size == 0) /* Likely regular file just created by us */
|
||||||
log_info("Allocated %s for '%s'.", buf2, node);
|
log_info("Allocated %s for '%s'.", buf2, node);
|
||||||
else
|
else
|
||||||
@ -4042,6 +4080,10 @@ 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",
|
return log_error_errno(errno, "Failed to grow '%s' from %s to %s by truncation: %m",
|
||||||
node, buf1, buf2);
|
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 */
|
if (st.st_size == 0) /* Likely regular file just created by us */
|
||||||
log_info("Sized '%s' to %s.", node, buf2);
|
log_info("Sized '%s' to %s.", node, buf2);
|
||||||
else
|
else
|
||||||
|
|||||||
@ -441,8 +441,6 @@ 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) {
|
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;
|
unsigned name_type = NET_NAME_UNKNOWN;
|
||||||
const char *new_name = NULL;
|
|
||||||
NamePolicy policy;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
@ -460,7 +458,8 @@ static int link_config_generate_new_name(const link_config_ctx *ctx, const link_
|
|||||||
|
|
||||||
if (ctx->enable_name_policy && config->name_policy)
|
if (ctx->enable_name_policy && config->name_policy)
|
||||||
for (NamePolicy *p = config->name_policy; *p != _NAMEPOLICY_INVALID; p++) {
|
for (NamePolicy *p = config->name_policy; *p != _NAMEPOLICY_INVALID; p++) {
|
||||||
policy = *p;
|
const char *new_name = NULL;
|
||||||
|
NamePolicy policy = *p;
|
||||||
|
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
case NAMEPOLICY_KERNEL:
|
case NAMEPOLICY_KERNEL:
|
||||||
@ -496,15 +495,12 @@ static int link_config_generate_new_name(const link_config_ctx *ctx, const link_
|
|||||||
default:
|
default:
|
||||||
assert_not_reached("invalid policy");
|
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);
|
log_device_debug(device, "Policy *%s* yields \"%s\".", name_policy_to_string(policy), new_name);
|
||||||
*ret_name = new_name;
|
*ret_name = new_name;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (config->name) {
|
if (config->name) {
|
||||||
log_device_debug(device, "Policies didn't yield a name, using specified Name=%s.", config->name);
|
log_device_debug(device, "Policies didn't yield a name, using specified Name=%s.", config->name);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user