fstools: drop use of parent_dev

partname_volume_init() calls block_volume_format() passing the device
path.

Previously the parent path was passed typically leading to retrieve the
size of the parent device and not the device to be formatted.
Eventually, formatting the block device with mkfs.f2fs failed silently
when the block device is too small and created a ram overlayfs instead
of trying to format with ext4.

Patch was sent upstream for review in
https://patchwork.ozlabs.org/project/openwrt/patch/tencent_1BDE4F7AE014AD4D4FA835C5DFEAB35AFB06@qq.com/

Fixes: PCF-1893
Tracked-by: FEAT-29
Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
This commit is contained in:
Paul HENRYS 2025-11-27 19:25:04 +01:00 committed by Petr Štetiar
parent a48d2ad598
commit 7f072e24f0
No known key found for this signature in database
GPG Key ID: 58EE120F30CC02D3
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
Index: fstools-2024.07.14~408c2cc4/libfstools/partname.c
===================================================================
--- fstools-2024.07.14~408c2cc4.orig/libfstools/partname.c
+++ fstools-2024.07.14~408c2cc4/libfstools/partname.c
@@ -15,11 +15,6 @@ struct partname_volume {
char devpathstr[16];
struct devpath devpath;
} dev;
-
- union {
- char devpathstr[16];
- struct devpath devpath;
- } parent_dev;
};
static struct driver partname_driver;
@@ -56,7 +51,7 @@ static int partname_volume_init(struct v
v->size = volsize << 9; /* size is returned in sectors of 512 bytes */
v->blk = p->dev.devpathstr;
- return block_volume_format(v, 0, p->parent_dev.devpathstr);
+ return block_volume_format(v, 0, p->dev.devpathstr);
}
/* adapted from procd/utils.c -> should go to libubox */
@@ -182,14 +177,6 @@ static struct volume *partname_volume_fi
strncpy(p->dev.devpath.device, devname, sizeof(p->dev.devpath.device) - 1);
p->dev.devpath.device[sizeof(p->dev.devpath.device)-1] = '\0';
- memcpy(p->parent_dev.devpath.prefix, "/dev/", sizeof(p->parent_dev.devpath.prefix));
- if (rootdev)
- strncpy(p->parent_dev.devpath.device, rootdev, sizeof(p->parent_dev.devpath.device) - 1);
- else
- strncpy(p->parent_dev.devpath.device, rootdevname(devname), sizeof(p->parent_dev.devpath.device) - 1);
-
- p->parent_dev.devpath.device[sizeof(p->parent_dev.devpath.device)-1] = '\0';
-
p->v.drv = &partname_driver;
p->v.blk = p->dev.devpathstr;
p->v.name = name;

View File

@ -0,0 +1 @@
1001-libfstools-partname-drop-parent_dev.patch