[Ocfs2-tools-devel] [PATCH] support /sys/block symlinks

Wim Coekaerts wim.coekaerts at oracle.com
Thu Jan 3 14:26:14 PST 2013


When running a kernel without SYSFS_DEPRECATED, /sys/block contains symlinks
This patch will follow symlinks, otherwise these devices get filtered out.
---
 libtools-internal/scandisk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libtools-internal/scandisk.c b/libtools-internal/scandisk.c
index b95f7bb..f531be8 100644
--- a/libtools-internal/scandisk.c
+++ b/libtools-internal/scandisk.c
@@ -677,7 +677,11 @@ static int scansysfs(struct devlisthead *devlisthead, const char *path, int leve
 
 			if (!lstat(newpath, &sb) && level)
 				if (S_ISLNK(sb.st_mode))
-					continue;
+				/* newer version of sysfs has symlinks - 
+				 * follow them */
+					if (!stat(newpath, &sb))
+						if (S_ISBLK(sb.st_mode))
+							continue;
 
 			has_holder = parent_holder;
 
-- 
1.5.6.5




More information about the Ocfs2-tools-devel mailing list