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@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:[email protected]] On Behalf 
Of [email protected]
Sent: Thursday, April 28, 2016 11:50 PM
To: [email protected]
Cc: Josua Mayer <[email protected]>
Subject: [OpenWrt-Devel] [PATCH v2 2/3] ext4_part_match: fix bug that prevented 
matching names

From: Josua Mayer <[email protected]>

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 <[email protected]>
---
 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
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to