public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: master - qdisk: allow scan of sysfs to dive into first level symlinks
Date: Mon, 18 Aug 2008 16:51:00 -0000	[thread overview]
Message-ID: <20080815153230.2A1ED12002B@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42
Commit:        f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42
Parent:        72299320730ffb6fa7a0af4694ff152dc501d656
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Fri Aug 15 17:23:59 2008 +0200
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Aug 15 17:32:22 2008 +0200

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 820f63e..0f4efa5 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -626,7 +626,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;
@@ -642,12 +642,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;
 
@@ -719,7 +721,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;
 


                 reply	other threads:[~2008-08-15 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080815153230.2A1ED12002B@lists.fedorahosted.org \
    --to=fabbione@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).