mdev: check for "/block/" substring for block dev detection
function old new delta make_device 1294 1269 -25
This commit is contained in:
parent
d9860487e0
commit
a87045ce37
@ -96,13 +96,11 @@ static void make_device(char *path, int delete)
|
|||||||
/* Determine device name, type, major and minor */
|
/* Determine device name, type, major and minor */
|
||||||
device_name = bb_basename(path);
|
device_name = bb_basename(path);
|
||||||
/* http://kernel.org/doc/pending/hotplug.txt says that only
|
/* http://kernel.org/doc/pending/hotplug.txt says that only
|
||||||
* "/sys/block/..." is for block devices. "/sys/bus" etc is not!
|
* "/sys/block/..." is for block devices. "/sys/bus" etc is not.
|
||||||
* Since kernel 2.6.25 block devices are also in /sys/class/block. */
|
* But since 2.6.25 block devices are also in /sys/class/block.
|
||||||
/* TODO: would it be acceptable to just use strstr(path, "/block/")? */
|
* We use strstr("/block/") to forestall future surprises. */
|
||||||
if (strncmp(&path[5], "class/block/"+6, 6) != 0
|
type = S_IFCHR;
|
||||||
&& strncmp(&path[5], "class/block/", 12) != 0)
|
if (strstr(path, "/block/"))
|
||||||
type = S_IFCHR;
|
|
||||||
else
|
|
||||||
type = S_IFBLK;
|
type = S_IFBLK;
|
||||||
|
|
||||||
if (ENABLE_FEATURE_MDEV_CONF) {
|
if (ENABLE_FEATURE_MDEV_CONF) {
|
||||||
|
Loading…
Reference in New Issue
Block a user