repart: support erofs
So, i think "erofs" is probably the better, more modern alternative to "squashfs". Many of the benefits don't matter too much to us I guess, but there's one thing that stands out: erofs has a UUID in the superblock, squashfs has not. Having an UUID in the superblock matters if the file systems are used in an overlayfs stack, as overlayfs uses the UUIDs to robustly and persistently reference inodes on layers in case of metadata copy-up. Since we probably want to allow such uses in overlayfs as emplyoed by sysext (and the future syscfg) we probably should ramp up our erofs game early on. Hence let's natively support erofs, test it, and in fact mention it in the docs before squashfs even.
This commit is contained in:
committed by
Luca Boccassi
parent
5e5fce3e91
commit
09e917ea4d
@@ -335,6 +335,14 @@ int make_filesystem(
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mksquashfs binary not available.");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine whether mksquashfs binary exists: %m");
|
||||
|
||||
} else if (streq(fstype, "erofs")) {
|
||||
r = find_executable("mkfs.erofs", &mkfs);
|
||||
if (r == -ENOENT)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mkfs.erofs binary not available.");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine whether mkfs.erofs binary exists: %m");
|
||||
|
||||
} else if (fstype_is_ro(fstype)) {
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||
"Don't know how to create read-only file system '%s', refusing.",
|
||||
@@ -501,6 +509,12 @@ int make_filesystem(
|
||||
root, node,
|
||||
"-quiet",
|
||||
"-noappend");
|
||||
|
||||
else if (streq(fstype, "erofs"))
|
||||
|
||||
argv = strv_new(mkfs,
|
||||
"-U", vol_id,
|
||||
node, root);
|
||||
else
|
||||
/* Generic fallback for all other file systems */
|
||||
argv = strv_new(mkfs, node);
|
||||
@@ -539,6 +553,9 @@ int make_filesystem(
|
||||
if (STR_IN_SET(fstype, "ext2", "ext3", "ext4", "btrfs", "f2fs", "xfs", "vfat", "swap"))
|
||||
log_info("%s successfully formatted as %s (label \"%s\", uuid %s)",
|
||||
node, fstype, label, vol_id);
|
||||
else if (streq(fstype, "erofs"))
|
||||
log_info("%s successfully formatted as %s (uuid %s, no label)",
|
||||
node, fstype, vol_id);
|
||||
else
|
||||
log_info("%s successfully formatted as %s (no label or uuid specified)",
|
||||
node, fstype);
|
||||
|
||||
Reference in New Issue
Block a user