linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] lscp: support opening mounted filesystem by directory pathname
@ 2011-03-02 10:13 dexen deVries
       [not found] ` <201103021113.32637.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: dexen deVries @ 2011-03-02 10:13 UTC (permalink / raw)
  To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA

The patch I've submited may be a wrong solution; perhaps instead the algorithm 
of nilfs_find_fs() (around lib/nilfs.c:179,211) should be improved.

Regards,
-- 
dexen deVries

[[[↓][→]]]

> how does a C compiler get to be that big? what is all that code doing?

iterators, string objects, and a full set of C macros that ensure
boundary conditions and improve interfaces.

ron minnich, in response to Charles Forsyth

http://9fans.net/archive/2011/02/90
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH] lscp: support opening mounted filesystem by directory pathname
@ 2011-03-02  9:56 dexen deVries
  0 siblings, 0 replies; 19+ messages in thread
From: dexen deVries @ 2011-03-02  9:56 UTC (permalink / raw)
  To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: Text/Plain, Size: 376 bytes --]

I wonder if submission as an attachment will work alright.

-- 
dexen deVries

[[[↓][→]]]

> how does a C compiler get to be that big? what is all that code doing?

iterators, string objects, and a full set of C macros that ensure
boundary conditions and improve interfaces.

ron minnich, in response to Charles Forsyth

http://9fans.net/archive/2011/02/90

[-- Attachment #2: 0001-lscp-support-opening-mounted-filesystem-by-directory.patch --]
[-- Type: text/x-patch, Size: 1716 bytes --]

From d680318225635932b633210a97d39dac09fe44ec Mon Sep 17 00:00:00 2001
From: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 2 Mar 2011 10:53:11 +0100
Subject: [PATCH] lscp: support opening mounted filesystem by directory pathname

---
 bin/lscp.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/bin/lscp.c b/bin/lscp.c
index df9a0af..44e9dcb 100644
--- a/bin/lscp.c
+++ b/bin/lscp.c
@@ -28,6 +28,14 @@
 #include "config.h"
 #endif	/* HAVE_CONFIG_H */
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif	/* HAVE_SYS_TYPES_H */
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif	/* HAVE_SYS_STAT_H */
+
 #include <stdio.h>
 
 #if HAVE_STDLIB_H
@@ -324,7 +332,8 @@ int main(int argc, char *argv[])
 {
 	struct nilfs *nilfs;
 	struct nilfs_cpstat cpstat;
-	char *dev, *progname;
+	struct stat statbuf;
+	char *pathname, *progname;
 	int c, mode, rvs, status, ret;
 #ifdef _GNU_SOURCE
 	int option_index;
@@ -384,15 +393,19 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "%s: too many arguments\n", progname);
 		exit(1);
 	} else if (optind == argc - 1) {
-		dev = argv[optind++];
+		pathname = argv[optind++];
 	} else {
-		dev = NULL;
+		pathname = NULL;
 	}
 
-	nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDONLY);
+	stat(pathname, &statbuf);
+	if (S_ISDIR(statbuf.st_mode))
+		nilfs = nilfs_open(NULL, pathname, NILFS_OPEN_RDONLY);
+	else
+		nilfs = nilfs_open(pathname, NULL, NILFS_OPEN_RDONLY);
 	if (nilfs == NULL) {
 		fprintf(stderr, "%s: %s: cannot open NILFS\n",
-			progname, dev);
+			progname, pathname);
 		exit(EXIT_FAILURE);
 	}
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-03-04 11:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 10:13 [PATCH] lscp: support opening mounted filesystem by directory pathname dexen deVries
     [not found] ` <201103021113.32637.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-02 11:23   ` Ryusuke Konishi
     [not found]     ` <20110302.202345.74569955.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-02 12:43       ` dexen deVries
     [not found]         ` <201103021343.54036.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-02 14:21           ` Ryusuke Konishi
     [not found]             ` <20110302.232110.169818198.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-03 12:47               ` [PATCH 1/8] " dexen deVries
     [not found]                 ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 12:47                   ` [PATCH 2/8] chcp: " dexen deVries
2011-03-03 12:47                   ` [PATCH 3/8] dumpseg: " dexen deVries
2011-03-03 12:47                   ` [PATCH 4/8] lssu: " dexen deVries
2011-03-03 12:47                   ` [PATCH 5/8] mkcp: " dexen deVries
2011-03-03 12:47                   ` [PATCH 6/8] rmcp: " dexen deVries
2011-03-03 12:47                   ` [PATCH 7/8] bin/*: update inline help to indicate possibility of accessing filesystem by mountpoint pathname dexen deVries
2011-03-03 12:47                   ` [PATCH 8/8] update manpages to indicate open-by-mountpoint dexen deVries
2011-03-03 16:15                   ` [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname Ryusuke Konishi
     [not found]                     ` <20110304.011511.83301246.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-03 16:23                       ` dexen deVries
     [not found]                         ` <201103031723.22583.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 17:16                           ` Ryusuke Konishi
     [not found]                             ` <20110304.021603.234305303.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-03 18:31                               ` dexen deVries
     [not found]                                 ` <201103031931.32310.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-04 10:26                                   ` Ryusuke Konishi
     [not found]                                     ` <20110304.192609.247659638.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-04 11:21                                       ` Ryusuke Konishi
  -- strict thread matches above, loose matches on Subject: below --
2011-03-02  9:56 [PATCH] " dexen deVries

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 NNTP newsgroup(s).