public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - qdisk: allow scan of sysfs to dive into first level symlinks
@ 2008-09-05 17:13 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2008-09-05 17:13 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=61fe6ce54bb67fd0693a9342a70bbc4913a2c204
Commit:        61fe6ce54bb67fd0693a9342a70bbc4913a2c204
Parent:        c5b80c6b677a8368092144ab0608cb7675367707
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Fri Aug 15 17:23:59 2008 +0200
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Sep 5 10:59:35 2008 -0400

qdisk: allow scan of sysfs to dive into first level symlinks

Some kernels populate /sys/block with symlinks when others don't.

Allow sysfs to dive into symlinks at the top level to handle both.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/qdisk/scandisk.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index ee7ce7f..ac06661 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -631,7 +631,7 @@ static int sysfs_is_disk(char *path)
  * -1 on generic error
  * -2 -ENOMEM
  */
-static int scansysfs(struct devlisthead *devlisthead, char *path)
+static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
 {
 	struct devnode *startnode;
 	int i, n, maj, min;
@@ -647,12 +647,14 @@ static int scansysfs(struct devlisthead *devlisthead, char *path)
 		if (namelist[n]->d_name[0] != '.') {
 			snprintf(newpath, sizeof(newpath),
 				 "%s/%s", path, namelist[n]->d_name);
-			if (!lstat(newpath, &sb)) {
 
+			if (!stat(newpath, &sb) && !level)
 				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath) < 0)
+					if (scansysfs(devlisthead, newpath, 1) < 0)
 						return -1;
 
+			if (!lstat(newpath, &sb)) {
+
 				if (S_ISLNK(sb.st_mode))
 					continue;
 
@@ -724,7 +726,7 @@ struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
 	/* it's important we check those 3 errors and abort in case
 	 * as it means that we are running out of mem,
 	 */
-	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH);
+	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0);
 	if (res < -1)
 		goto emergencyout;
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-05 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-05 17:13 RHEL5 - qdisk: allow scan of sysfs to dive into first level symlinks Lon Hohberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).