[OpenWrt-Devel] [PATCH v2 2/3] ext4_part_match: fix bug that prevented matching names
Josua Mayer
josua.mayer97 at gmail.com
Wed May 4 08:42:53 EDT 2016
Hi Ram,
Thanks for your comments. Now it appears I misunderstood what the code
is supposed to match.
So if there is a PARTNAME= line, it can be matched.
However on my system I dont have PARTNAME.
Here a real-life sample:
root at OpenWrt:/# cat /sys/block/mmcblk0/mmcblk0p3/uevent
MAJOR=179
MINOR=3
DEVNAME=mmcblk0p3
DEVTYPE=partition
<end>
What is partname and how can I set it? fdisk? filesystem label?
br
Josua Mayer
Am 29.04.2016 um 14:35 schrieb Ram Chandra Jangir:
> Thanks Josua Mayer.
>
> Devname and partname both are different. Devname is holding the device node(ex. mmcblkXpY) and given name(or partname) is the partition name(ex. rootfs or rootfs_data).
> For below uevent sysfs entries, it tries to populate the device node(mmcblkXpY) in devname variable and tries to match the given name with the PARTNAME(buf will have this value("PARTNAME=rootfs_data") at n'th iteration).
> If it is found then the loop will break, and we will get the given name's device node(/dev/mmcblkXpY) which will be mounted later.
>
> Example:
> root at OpenWrt:/# cat /sys/block/mmcblk0/mmcblk0p3/uevent
> MAJOR=179
> MINOR=3
> DEVNAME=mmcblk0p3 <-- device node: /dev/mmcblk0p3
> DEVTYPE=partition
> PARTN=3
> PARTNAME=rootfs_data
>
> This is required, because the emmc card may have multiple partitions too. So our aim is to get the device node from the given name's uevent file.
>
> Thanks,
> Ram
>
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org] On Behalf Of josua.mayer97 at gmail.com
> Sent: Thursday, April 28, 2016 11:50 PM
> To: openwrt-devel at lists.openwrt.org
> Cc: Josua Mayer <privacy at not.given>
> Subject: [OpenWrt-Devel] [PATCH v2 2/3] ext4_part_match: fix bug that prevented matching names
>
> From: Josua Mayer <privacy at not.given>
>
> Actually use the populated devname variable to compare against given name, instead of the buf variable, which incidentally contains either:
> MAJOR=xyz, MINOR=x, or DEVTYPE=partition, none of which ever match a name.
>
> Signed-off-by: Josua Mayer <josua.mayer97 at gmail.com>
> ---
> libfstools/ext4.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libfstools/ext4.c b/libfstools/ext4.c index f648aa8..b9401c3 100644
> --- a/libfstools/ext4.c
> +++ b/libfstools/ext4.c
> @@ -78,7 +78,7 @@ ext4_part_match(char *dev, char *name, char *filename)
> continue;
> }
> /* Match partition name */
> - if (strstr(buf, name)) {
> + if (strstr(devname, name)) {
> ret = 0;
> break;
> }
> --
> 2.6.6
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list