* 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; 18+ 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] 18+ messages in thread
* Re: [PATCH] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-02 11:23 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
Hi,
On Wed, 2 Mar 2011 11:13:32 +0100, dexen deVries wrote:
> 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,
Well, allowing directory pathname for nilfs commands seems a good idea
to me. Why not apply it to other commands except nilfs_cleanerd ?
I think you can simply the callsite of nilfs_open() just like follows:
char *dev = NULL, *dir = NULL;
...
stat(pathname, &statbuf);
if (S_ISDIR(statbuf.st_mode))
dir = pathname;
else
dev = pathname;
nilfs = nilfs_open(dev, dir, NILFS_OPEN_RDONLY);
...
Thanks,
Ryusuke Konishi
> --
> 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
--
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] 18+ messages in thread
* Re: [PATCH] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: dexen deVries @ 2011-03-02 12:43 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Wednesday 02 of March 2011 12:23:45 you wrote:
> Hi,
>
> On Wed, 2 Mar 2011 11:13:32 +0100, dexen deVries wrote:
> > 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,
>
> Well, allowing directory pathname for nilfs commands seems a good idea
> to me. Why not apply it to other commands except nilfs_cleanerd ?
>
Goot point, I'm on it right now.
Reading through sbin/cleanerd/cleanerd.c, it seems it doesn't make any
distinction between dev and dir, just supplies program's argument as both dev
and dir arguments to nilfs_open(). In my understanding, that'd be the cleanest
way of using it.
However, the current behavior of nilfs_open() (or more exactly, of
nilfs_find_fs()) doesn't support that semantics -- if dev is passed, it kind of
ignores the dir argument. Perhaps I should try to fix nilfs_find_fs() rather
than put stat() and S_ISDIR() in every program?
--
dexen deVries
[[[↓][→]]]
47. As Will Rogers would have said, "There is no such thing as a free
variable."
(Alan Perlis, `Epigrams on Programming')
--
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] 18+ messages in thread
* Re: [PATCH] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-02 14:21 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Wed, 2 Mar 2011 13:43:53 +0100, dexen deVries wrote:
> On Wednesday 02 of March 2011 12:23:45 you wrote:
> > Hi,
> >
> > On Wed, 2 Mar 2011 11:13:32 +0100, dexen deVries wrote:
> > > 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,
> >
> > Well, allowing directory pathname for nilfs commands seems a good idea
> > to me. Why not apply it to other commands except nilfs_cleanerd ?
> >
>
> Goot point, I'm on it right now.
>
> Reading through sbin/cleanerd/cleanerd.c, it seems it doesn't make any
> distinction between dev and dir, just supplies program's argument as both dev
> and dir arguments to nilfs_open(). In my understanding, that'd be the cleanest
> way of using it.
>
> However, the current behavior of nilfs_open() (or more exactly, of
> nilfs_find_fs()) doesn't support that semantics -- if dev is passed, it kind of
> ignores the dir argument.
No, nilfs_find_fs() compares both dev and dir arguments if both are
given. Actually nilfs_cleanerd needs the dir argument because two
writable mounts can coexist on the same device when bind mounts are
used, and cleanerd has to be attached on exactly the same mount point.
> Perhaps I should try to fix nilfs_find_fs() rather
> than put stat() and S_ISDIR() in every program?
I'd like to avoid changing interface of nilfs_open. You can add a
wrapper function to libnilfs if you don't prefer to insert stat() and
S_ISDIR() in every program.
Thanks,
Ryusuke Konishi
> --
> dexen deVries
>
> [[[↓][→]]]
>
> 47. As Will Rogers would have said, "There is no such thing as a free
> variable."
>
> (Alan Perlis, `Epigrams on Programming')
> --
> 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
--
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] 18+ messages in thread
* [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[not found] ` <20110302.232110.169818198.ryusuke-sG5X7nlA6pw@public.gmane.org>
@ 2011-03-03 12:47 ` dexen deVries
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/lscp.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/bin/lscp.c b/bin/lscp.c
index df9a0af..a9be26e 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,12 +332,14 @@ int main(int argc, char *argv[])
{
struct nilfs *nilfs;
struct nilfs_cpstat cpstat;
- char *dev, *progname;
+ struct stat statbuf;
+ char *dev, *dir, *pathname, *progname;
int c, mode, rvs, status, ret;
#ifdef _GNU_SOURCE
int option_index;
#endif /* _GNU_SOURCE */
+ dev = dir = NULL;
mode = NILFS_CHECKPOINT;
rvs = 0;
opterr = 0; /* prevent error message */
@@ -384,15 +394,27 @@ 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);
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, 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
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 2/8] chcp: support opening mounted filesystem by directory pathname
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-03-03 12:47 ` dexen deVries
2011-03-03 12:47 ` [PATCH 3/8] dumpseg: " dexen deVries
` (6 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/chcp.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/bin/chcp.c b/bin/chcp.c
index a66e437..28a66ea 100644
--- a/bin/chcp.c
+++ b/bin/chcp.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
@@ -76,13 +84,15 @@ int main(int argc, char *argv[])
{
struct nilfs *nilfs;
nilfs_cno_t cno;
- char *dev, *modestr, *progname, *endptr;
- int c, mode, status;
+ struct stat statbuf;
+ char *dev, *dir, *pathname, *modestr, *progname, *endptr;
+ int c, mode, status, ret;
unsigned long val;
#ifdef _GNU_SOURCE
int option_index;
#endif /* _GNU_SOURCE */
+ dev = dir = NULL;
opterr = 0;
if ((progname = strrchr(argv[0], '/')) == NULL)
@@ -117,14 +127,14 @@ int main(int argc, char *argv[])
exit(1);
} else if (optind == argc - 2) {
modestr = argv[optind++];
- dev = NULL;
+ pathname = NULL;
} else {
modestr = argv[optind++];
val = strtoul(argv[optind], &endptr, CHCP_BASE);
if (*endptr == '\0')
- dev = NULL;
+ pathname = NULL;
else
- dev = argv[optind++];
+ pathname = argv[optind++];
}
if (strcmp(modestr, CHCP_MODE_CP) == 0)
@@ -137,7 +147,20 @@ int main(int argc, char *argv[])
exit(1);
}
- nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR);
+
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, NILFS_OPEN_RDWR);
if (nilfs == NULL) {
fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev);
exit(1);
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 3/8] dumpseg: support opening mounted filesystem by directory pathname
[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 ` dexen deVries
2011-03-03 12:47 ` [PATCH 4/8] lssu: " dexen deVries
` (5 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/dumpseg.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/bin/dumpseg.c b/bin/dumpseg.c
index 0ee6aee..1910296 100644
--- a/bin/dumpseg.c
+++ b/bin/dumpseg.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
@@ -169,17 +177,19 @@ static void dumpseg_print_segment(struct nilfs *nilfs,
int main(int argc, char *argv[])
{
struct nilfs *nilfs;
+ struct stat statbuf;
__u64 segnum;
- char *dev, *endptr, *progname;
+ char *dev, *dir, *pathname, *endptr, *progname;
void *seg;
ssize_t segsize;
- int c, i, status;
+ int c, i, status, ret;
unsigned long val;
#ifdef _GNU_SOURCE
int option_index;
#endif /* _GNU_SOURCE */
opterr = 0;
+ dev = dir = NULL;
if ((progname = strrchr(argv[0], '/')) == NULL)
progname = argv[0];
@@ -214,14 +224,27 @@ int main(int argc, char *argv[])
} else {
val = strtoul(argv[optind], &endptr, DUMPSEG_BASE);
if (*endptr == '\0')
- dev = NULL;
+ pathname = NULL;
else
- dev = argv[optind++];
+ pathname = argv[optind++];
}
- nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RAW);
+
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, NILFS_OPEN_RAW);
if (nilfs == NULL) {
- fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev);
+ fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, pathname);
exit(1);
}
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 4/8] lssu: support opening mounted filesystem by directory pathname
[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 ` dexen deVries
2011-03-03 12:47 ` [PATCH 5/8] mkcp: " dexen deVries
` (4 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/lssu.c | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/bin/lssu.c b/bin/lssu.c
index c5cd519..e8dccc3 100644
--- a/bin/lssu.c
+++ b/bin/lssu.c
@@ -27,6 +27,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
@@ -138,14 +146,16 @@ static int lssu_list_suinfo(struct nilfs *nilfs, int all)
int main(int argc, char *argv[])
{
struct nilfs *nilfs;
- char *dev, *progname;
- int c, all, status;
+ struct stat statbuf;
+ char *dev, *dir, *pathname, *progname;
+ int c, all, status, ret;
#ifdef _GNU_SOURCE
int option_index;
#endif /* _GNU_SOURCE */
all = 0;
opterr = 0;
+ dev = dir = NULL;
progname = strrchr(argv[0], '/');
if (progname == NULL)
progname = argv[0];
@@ -184,18 +194,30 @@ int main(int argc, char *argv[])
}
if (optind > argc - 1) {
- dev = NULL;
+ pathname = NULL;
} else if (optind == argc - 1) {
- dev = argv[optind++];
+ pathname = argv[optind++];
} else {
fprintf(stderr, "%s: too many arguments\n", progname);
exit(1);
}
- nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDONLY);
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, NILFS_OPEN_RDONLY);
if (nilfs == NULL) {
fprintf(stderr, "%s: %s: cannot open NILFS\n",
- progname, dev);
+ progname, pathname);
exit(1);
}
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 5/8] mkcp: support opening mounted filesystem by directory pathname
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2011-03-03 12:47 ` [PATCH 4/8] lssu: " dexen deVries
@ 2011-03-03 12:47 ` dexen deVries
2011-03-03 12:47 ` [PATCH 6/8] rmcp: " dexen deVries
` (3 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/mkcp.c | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/bin/mkcp.c b/bin/mkcp.c
index 716b809..d2f45e9 100644
--- a/bin/mkcp.c
+++ b/bin/mkcp.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
@@ -68,15 +76,17 @@ const static struct option long_option[] = {
int main(int argc, char *argv[])
{
struct nilfs *nilfs;
+ struct stat statbuf;
nilfs_cno_t cno;
- char *dev, *progname;
- int ss, c, status;
+ char *dev, *dir, *pathname, *progname;
+ int ss, c, status, ret;
#ifdef _GNU_SOURCE
int option_index;
#endif /* _GNU_SOURCE */
ss = 0;
opterr = 0;
+ dev = dir = NULL;
if ((progname = strrchr(argv[0], '/')) == NULL)
progname = argv[0];
else
@@ -111,13 +121,25 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s: too many arguments\n", progname);
exit(1);
} else if (optind > argc - 1)
- dev = NULL;
+ pathname = NULL;
else
- dev = argv[optind];
-
- nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR);
+ pathname = argv[optind];
+
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, NILFS_OPEN_RDWR);
if (nilfs == NULL) {
- fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev);
+ fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, pathname);
exit(1);
}
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 6/8] rmcp: support opening mounted filesystem by directory pathname
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2011-03-03 12:47 ` [PATCH 5/8] mkcp: " dexen deVries
@ 2011-03-03 12:47 ` 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
` (2 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/rmcp.c | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/bin/rmcp.c b/bin/rmcp.c
index 9b72f9d..91ddf60 100644
--- a/bin/rmcp.c
+++ b/bin/rmcp.c
@@ -27,6 +27,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
@@ -129,9 +137,10 @@ static int rmcp_remove_range(struct nilfs *nilfs,
int main(int argc, char *argv[])
{
- char *dev;
+ char *dev, *dir, *pathname;
struct nilfs *nilfs;
struct nilfs_cpstat cpstat;
+ struct stat statbuf;
nilfs_cno_t start, end, oldest;
size_t nsnapshots, nss, ndel;
int c, status, ret;
@@ -140,6 +149,7 @@ int main(int argc, char *argv[])
#endif /* _GNU_SOURCE */
opterr = 0;
+ dev = dir = NULL;
if ((progname = strrchr(argv[0], '/')) == NULL)
progname = argv[0];
else
@@ -179,24 +189,36 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s: too few arguments\n", progname);
exit(1);
} else if (optind == argc - 1) {
- dev = NULL;
+ pathname = NULL;
} else {
if (nilfs_parse_cno_range(argv[optind], &start, &end,
RMCP_BASE) < 0)
- dev = argv[optind++];
+ pathname = argv[optind++];
else
- dev = NULL;
+ pathname = NULL;
}
- nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR);
+ if (pathname) {
+ ret = stat(pathname, &statbuf);
+ if (ret == -1) {
+ fprintf(stderr, "%s: cannot open %s: %s\n",
+ progname, pathname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (S_ISDIR(statbuf.st_mode))
+ dir = pathname;
+ else
+ dev = pathname;
+ }
+ nilfs = nilfs_open(dev, dir, NILFS_OPEN_RDWR);
if (nilfs == NULL) {
- fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev);
+ fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, pathname);
exit(1);
}
if (nilfs_get_cpstat(nilfs, &cpstat) < 0) {
fprintf(stderr, "%s: %s: cannot get checkpoint status: %s\n",
- progname, dev, strerror(errno));
+ progname, pathname, strerror(errno));
exit(1);
}
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 7/8] bin/*: update inline help to indicate possibility of accessing filesystem by mountpoint pathname
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (4 preceding siblings ...)
2011-03-03 12:47 ` [PATCH 6/8] rmcp: " dexen deVries
@ 2011-03-03 12:47 ` 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
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
bin/chcp.c | 2 +-
bin/dumpseg.c | 2 +-
bin/lscp.c | 2 +-
bin/lssu.c | 2 +-
bin/mkcp.c | 2 +-
bin/rmcp.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bin/chcp.c b/bin/chcp.c
index 28a66ea..a13abc0 100644
--- a/bin/chcp.c
+++ b/bin/chcp.c
@@ -71,7 +71,7 @@ const static struct option long_option[] = {
};
#define CHCP_USAGE \
- "Usage: %s [OPTION]... " CHCP_MODE_CP "|" CHCP_MODE_SS" [DEVICE] CNO...\n" \
+ "Usage: %s [OPTION]... " CHCP_MODE_CP "|" CHCP_MODE_SS" [DEVICE|MOUNTPOINT] CNO...\n" \
" -h, --help\t\tdisplay this help and exit\n" \
" -V, --version\t\tdisplay version and exit\n"
#else /* !_GNU_SOURCE */
diff --git a/bin/dumpseg.c b/bin/dumpseg.c
index 1910296..2d8de79 100644
--- a/bin/dumpseg.c
+++ b/bin/dumpseg.c
@@ -66,7 +66,7 @@ const static struct option long_option[] = {
};
#define DUMPSEG_USAGE \
- "Usage: %s [OPTION]... [DEVICE] SEGNUM...\n" \
+ "Usage: %s [OPTION]... [DEVICE|MOUNTPOINT] SEGNUM...\n" \
" -h, --help\t\tdisplay this help and exit\n" \
" -V, --version\t\tdisplay version and exit\n"
#else /* !_GNU_SOURCE */
diff --git a/bin/lscp.c b/bin/lscp.c
index a9be26e..fad5f09 100644
--- a/bin/lscp.c
+++ b/bin/lscp.c
@@ -72,7 +72,7 @@ const static struct option long_option[] = {
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};
-#define LSCP_USAGE "Usage: %s [OPTION]... [DEVICE]\n" \
+#define LSCP_USAGE "Usage: %s [OPTION]... [DEVICE|MOUNTPOINT]\n" \
" -b, --show-block-count\t\tshow block count\n"\
" -g, --show-increment\t\tshow increment count\n"\
" -r, --reverse\t\treverse order\n" \
diff --git a/bin/lssu.c b/bin/lssu.c
index e8dccc3..b4e834c 100644
--- a/bin/lssu.c
+++ b/bin/lssu.c
@@ -63,7 +63,7 @@ const static struct option long_option[] = {
{NULL, 0, NULL, 0}
};
-#define LSSU_USAGE "Usage: %s [OPTION]... [DEVICE]\n" \
+#define LSSU_USAGE "Usage: %s [OPTION]... [DEVICE|MOUNTPOINT]\n" \
" -a, --all\t\tdo not hide clean segments\n" \
" -i, --index\t\tstart index\n" \
" -n, --lines\t\toutput lines\n" \
diff --git a/bin/mkcp.c b/bin/mkcp.c
index d2f45e9..92aaad8 100644
--- a/bin/mkcp.c
+++ b/bin/mkcp.c
@@ -64,7 +64,7 @@ const static struct option long_option[] = {
{NULL, 0, NULL, 0}
};
-#define MKCP_USAGE "Usage: %s [OPTION] [DEVICE]\n" \
+#define MKCP_USAGE "Usage: %s [OPTION] [DEVICE|MOUNTPOINT]\n" \
" -s, --snapshot\tcreate a snapshot\n" \
" -h, --help\t\tdisplay this help and exit\n" \
" -V, --version\t\tdisplay version and exit\n"
diff --git a/bin/rmcp.c b/bin/rmcp.c
index 91ddf60..455818b 100644
--- a/bin/rmcp.c
+++ b/bin/rmcp.c
@@ -69,7 +69,7 @@ const static struct option long_options[] = {
{NULL, 0, NULL, 0}
};
#define RMCP_USAGE \
- "Usage: %s [OPTION]... [DEVICE] CNO...\n" \
+ "Usage: %s [OPTION]... [DEVICE|MOUNTPOINT] CNO...\n" \
" -f, --force\t\tignore snapshots or nonexistent checkpoints\n" \
" -i, --interactive\tprompt before any removal\n" \
" -h, --help\t\tdisplay this help and exit\n" \
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* [PATCH 8/8] update manpages to indicate open-by-mountpoint
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (5 preceding siblings ...)
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 ` dexen deVries
2011-03-03 16:15 ` [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname Ryusuke Konishi
7 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2011-03-03 12:47 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
---
man/chcp.8 | 8 +++++---
man/dumpseg.8 | 14 +++++++-------
man/lscp.1 | 8 ++++----
man/lssu.1 | 10 +++++-----
man/mkcp.8 | 8 ++++----
man/rmcp.8 | 10 +++++-----
6 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/man/chcp.8 b/man/chcp.8
index 7f50784..d0b795a 100644
--- a/man/chcp.8
+++ b/man/chcp.8
@@ -6,11 +6,12 @@
chcp \- change mode of NILFS2 checkpoints
.SH SYNOPSIS
.B chcp
-[\fIoptions\fP] \fBcp\fP | \fBss\fP [\fIdevice\fP] \fIcheckpoint-number\fP ...
+[\fIoptions\fP] \fBcp\fP | \fBss\fP [\fIdevice\fP | \fImountpoint\fP]
+\fIcheckpoint-number\fP ...
.SH DESCRIPTION
.B chcp
is a utility to change the mode of the given checkpoints for the NILFS2
-file system found in \fIdevice\fP.
+file system found in \fIdevice\fP or mounted at \fImountpoint\fP.
.B chcp
changes checkpoints to snapshots, or vice versa. The target
checkpoints are specified with one or more checkpoint numbers. When
@@ -18,7 +19,8 @@ checkpoints are specified with one or more checkpoint numbers. When
\fI/proc/mounts\fP.
.PP
This command is valid only for mounted NILFS2 file systems, and
-will fail if the \fIdevice\fP has no active mounts.
+will fail if the \fIdevice\fP has no active mounts and \fImountpoint\fP
+is not a mounted NILFS2 filesystem.
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
diff --git a/man/dumpseg.8 b/man/dumpseg.8
index c0da6b5..8953dd9 100644
--- a/man/dumpseg.8
+++ b/man/dumpseg.8
@@ -9,16 +9,16 @@ dumpseg \- print segment information of NILFS2
[\fB\-hV\fP]
.sp
.B dumpseg
-[\fIdevice\fP] \fIsegment-number\fP ...
+[\fIdevice\fP | \fImountpoint\fP] \fIsegment-number\fP ...
.SH DESCRIPTION
The
.B dumpseg
-program is an analysis tool for on-disk logs of a NILFS2 file system
-found in \fIdevice\fP. It displays the configuration of every log
-stored in the segments specified by one or more \fIsegment-numbers\fP.
-The term segment here means a contiguous lump of disk blocks giving an
-allocation unit of NILFS2 disk space. When \fIdevice\fP is omitted,
-it tries to find an active NILFS2 file system from \fI/proc/mounts\fP.
+program is an analysis tool for on-disk logs of a NILFS2 file system found in
+\fIdevice\fP or mounted at \fImountpoint\fP. It displays the configuration of
+every log stored in the segments specified by one or more
+\fIsegment-numbers\fP. The term segment here means a contiguous lump of disk
+blocks giving an allocation unit of NILFS2 disk space. When \fIdevice\fP is
+omitted, it tries to find an active NILFS2 file system from \fI/proc/mounts\fP.
.PP
.B dumpseg
is a tool for debugging rather than administration. To list a summary
diff --git a/man/lscp.1 b/man/lscp.1
index b5a553b..7f302ac 100644
--- a/man/lscp.1
+++ b/man/lscp.1
@@ -6,12 +6,12 @@
lscp \- list NILFS2 checkpoints
.SH SYNOPSIS
.B lscp
-[\fIoptions\fP] [\fIdevice\fP]
+[\fIoptions\fP] [\fIdevice\fP | \fImountpoint\fP]
.SH DESCRIPTION
.B lscp
-is a utility for displaying checkpoints or snapshots of the NILFS2
-file system found in \fIdevice\fP. When \fIdevice\fP is omitted,
-\fI/proc/mounts\fP is examined to find a NILFS2 file system.
+is a utility for displaying checkpoints or snapshots of the NILFS2 file system
+found in \fIdevice\fP or mounted at \fImountpoint\fP. When \fIdevice\fP is
+omitted, \fI/proc/mounts\fP is examined to find a NILFS2 file system.
.PP
This command will fail if the \fIdevice\fP has no active mounts of a
NILFS2 file system.
diff --git a/man/lssu.1 b/man/lssu.1
index ec71158..6d51336 100644
--- a/man/lssu.1
+++ b/man/lssu.1
@@ -6,13 +6,13 @@
lssu \- list usage state of NILFS2 segments
.SH SYNOPSIS
.B lssu
-[\fIoptions\fP] [\fIdevice\fP]
+[\fIoptions\fP] [\fIdevice\fP | \fImountpoint\fP]
.SH DESCRIPTION
.B lssu
-is a utility for displaying usage state of NILFS2 segments in
-\fIdevice\fP, where a segment is contiguous lump of disk blocks and
-an allocation unit of NILFS2 disk space. When \fIdevice\fP is
-omitted, \fI/proc/mounts\fP is examined to find a NILFS2 file system.
+is a utility for displaying usage state of NILFS2 segments in \fIdevice\fP or
+mounted at \fImountpoint\fP, where a segment is contiguous lump of disk blocks
+and an allocation unit of NILFS2 disk space. When \fIdevice\fP is omitted,
+\fI/proc/mounts\fP is examined to find a NILFS2 file system.
.PP
This command will fail if the \fIdevice\fP has no active mounts of a
NILFS2 file system.
diff --git a/man/mkcp.8 b/man/mkcp.8
index 53b3a9e..fe6739c 100644
--- a/man/mkcp.8
+++ b/man/mkcp.8
@@ -6,12 +6,12 @@
mkcp \- make a NILFS2 checkpoint
.SH SYNOPSIS
.B mkcp
-[\fIoptions\fP] [\fIdevice\fP]
+[\fIoptions\fP] [\fIdevice\fP | \fImountpoint\fP]
.SH DESCRIPTION
.B mkcp
-is a utility for making a checkpoint or snapshot for the NILFS2 file
-system found in \fIdevice\fP. When \fIdevice\fP is omitted, it tries
-to find a NILFS2 file system from \fI/proc/mounts\fP.
+is a utility for making a checkpoint or snapshot for the NILFS2 file system
+found in \fIdevice\fP or mounted at \fImountpoint\fP. When \fIdevice\fP is
+omitted, it tries to find a NILFS2 file system from \fI/proc/mounts\fP.
.PP
This command is valid only for mounted NILFS2 file systems, and
will fail if the \fIdevice\fP has no active mounts.
diff --git a/man/rmcp.8 b/man/rmcp.8
index 11e5c07..05f7e56 100644
--- a/man/rmcp.8
+++ b/man/rmcp.8
@@ -6,13 +6,13 @@
rmcp \- remove NILFS2 checkpoints
.SH SYNOPSIS
.B rmcp
-[\fIoptions\fP] [\fIdevice\fP] \fIcheckpoint-range\fP ...
+[\fIoptions\fP] [\fIdevice\fP | \fImountpoint\fP] \fIcheckpoint-range\fP ...
.SH DESCRIPTION
.B rmcp
-is a utility for removing checkpoints from the NILFS2 file system
-found in \fIdevice\fP. The checkpoints which user wants to remove are
-specified with one or more \fIcheckpoint-ranges\fP. When \fIdevice\fP
-is omitted, rmcp tries to find a NILFS2 file system from
+is a utility for removing checkpoints from the NILFS2 file system found in
+\fIdevice\fP or mounted at \fImountpoint\fP. The checkpoints which user wants
+to remove are specified with one or more \fIcheckpoint-ranges\fP. When
+\fIdevice\fP is omitted, rmcp tries to find a NILFS2 file system from
\fI/proc/mounts\fP.
.PP
The \fIcheckpoint-range\fP must be provided with one or two integers
--
1.7.4.1
--
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 related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[not found] ` <1299156472-4707-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (6 preceding siblings ...)
2011-03-03 12:47 ` [PATCH 8/8] update manpages to indicate open-by-mountpoint dexen deVries
@ 2011-03-03 16:15 ` Ryusuke Konishi
[not found] ` <20110304.011511.83301246.ryusuke-sG5X7nlA6pw@public.gmane.org>
7 siblings, 1 reply; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-03 16:15 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
Hi,
Thank you for posting this series. I'll queue it up in
nilfs-utils-devel tree.
By the way, may I add your "Signed-off-by:" line to these patches?
FYI, you can do it yourself as follows:
1) Register E-mail address and user name to ~/.gitconfig:
$ git config --global --add user.name "dexen deVries"
$ git config --global --add user.email "dexen.devries@..."
2) Convert the series to separate patches
$ git format-patch -o <work-directory> <branch-base>..<branch-head>
3) Apply the series with sign option
$ git checkout -b <new-branch-name> <branch-base>
$ git am -s <work-directory>/*.patch
Usually, we add a sob line with "git commit -s" when committing each
patch.
Thanks,
Ryusuke Konishi
On Thu, 3 Mar 2011 13:47:45 +0100, dexen deVries wrote:
> ---
> bin/lscp.c | 32 +++++++++++++++++++++++++++-----
> 1 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/bin/lscp.c b/bin/lscp.c
> index df9a0af..a9be26e 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,12 +332,14 @@ int main(int argc, char *argv[])
> {
> struct nilfs *nilfs;
> struct nilfs_cpstat cpstat;
> - char *dev, *progname;
> + struct stat statbuf;
> + char *dev, *dir, *pathname, *progname;
> int c, mode, rvs, status, ret;
> #ifdef _GNU_SOURCE
> int option_index;
> #endif /* _GNU_SOURCE */
>
> + dev = dir = NULL;
> mode = NILFS_CHECKPOINT;
> rvs = 0;
> opterr = 0; /* prevent error message */
> @@ -384,15 +394,27 @@ 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);
> + if (pathname) {
> + ret = stat(pathname, &statbuf);
> + if (ret == -1) {
> + fprintf(stderr, "%s: cannot open %s: %s\n",
> + progname, pathname, strerror(errno));
> + exit(EXIT_FAILURE);
> + }
> + if (S_ISDIR(statbuf.st_mode))
> + dir = pathname;
> + else
> + dev = pathname;
> + }
> + nilfs = nilfs_open(dev, dir, 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
>
> --
> 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
--
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] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: dexen deVries @ 2011-03-03 16:23 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
Hi,
On Thursday 03 of March 2011 17:15:11 you wrote:
> Thank you for posting this series. I'll queue it up in
> nilfs-utils-devel tree.
>
> By the way, may I add your "Signed-off-by:" line to these patches?
Sure.
I'll fix that in my clone and push out to Github. Will it be enough if I sent a
Pull Request from Github to the list rather than submit individual patches as
mails?
It's the first time I'm trying to contribute to opensource; thanks for being
patient :-)
Regards,
--
dexen deVries
[[[↓][→]]]
47. As Will Rogers would have said, "There is no such thing as a free
variable."
(Alan Perlis, `Epigrams on Programming')
--
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] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-03 17:16 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Thu, 3 Mar 2011 17:23:22 +0100, dexen deVries wrote:
> Hi,
>
>
> On Thursday 03 of March 2011 17:15:11 you wrote:
> > Thank you for posting this series. I'll queue it up in
> > nilfs-utils-devel tree.
> >
> > By the way, may I add your "Signed-off-by:" line to these patches?
>
> Sure.
>
>
> I'll fix that in my clone and push out to Github. Will it be enough if I sent a
> Pull Request from Github to the list rather than submit individual patches as
> mails?
Usually we post every patch to the list every time we modified the
series for convenience of reference and review. But, I think a pull
request is enough if just adding a sob line.
By the way, can you enhance the series so that the directory argument
works for any directories in the filesystem rather than just a mount
point?
We know the directory argument of "df" command works like that.
$ cd; df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 .... ... .. ... /
This semantics seems more convenient especially for snapshot tools.
Any idea?
> It's the first time I'm trying to contribute to opensource; thanks for being
> patient :-)
It's my pleasure. Keep it coming :)
Thanks,
Ryusuke Konishi
> Regards,
> --
> dexen deVries
>
> [[[↓][→]]]
>
> 47. As Will Rogers would have said, "There is no such thing as a free
> variable."
>
> (Alan Perlis, `Epigrams on Programming')
> --
> 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
--
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] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: dexen deVries @ 2011-03-03 18:31 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Thursday 03 of March 2011 18:16:03 you wrote:
> By the way, can you enhance the series so that the directory argument
> works for any directories in the filesystem rather than just a mount
> point?
That actually was aim at some point -- to let indicate filesystem by any object
on it. However, I can't find a reliable way. If you can hint one, I'll gladly
implement.
First idea was to use stat's (struct stat).st_dev, but it seems there is no
standard way of translating (minor, major) into filesystem from userspace.
There's a kernel function for that, but not exposed through syscall. There is
a custom library function by HP, but it doesn't feel very reasonable to rely
on it.
Second idea was to process pathname by combination of realpath() and stripping
segments -- but it turns out dot-dot semantics are broken in POSIX OSes [1]
making that way unreliable.
One caveat is that a device would not indicate the filesystem it belongs to,
but a filesystem on a partition/device it addresses.
Another caveat is that processing a NILFS2 stored in a file (say, a HDD image)
would require some specialized syntax.
While those may not sound very serious for interactive use, I believe that our
tools would become too unreliable for scripts in some edge cases.
Thus I gave up ;-)
A minimalistic version -- only lstat() [sic] with S_ISDIR() -- would work, but
that's not very much of a progress to me.
[1] http://doc.cat-v.org/plan_9/4th_edition/papers/lexnames
--
dexen deVries
``One can't proceed from the informal to the formal by formal means.''
--
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] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[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>
0 siblings, 1 reply; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-04 10:26 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Thu, 3 Mar 2011 19:31:32 +0100, dexen deVries wrote:
> On Thursday 03 of March 2011 18:16:03 you wrote:
> > By the way, can you enhance the series so that the directory argument
> > works for any directories in the filesystem rather than just a mount
> > point?
>
>
> That actually was aim at some point -- to let indicate filesystem by any object
> on it. However, I can't find a reliable way. If you can hint one, I'll gladly
> implement.
>
> First idea was to use stat's (struct stat).st_dev, but it seems there is no
> standard way of translating (minor, major) into filesystem from userspace.
> There's a kernel function for that, but not exposed through syscall. There is
> a custom library function by HP, but it doesn't feel very reasonable to rely
> on it.
>
> Second idea was to process pathname by combination of realpath() and stripping
> segments -- but it turns out dot-dot semantics are broken in POSIX OSes [1]
> making that way unreliable.
>
> One caveat is that a device would not indicate the filesystem it belongs to,
> but a filesystem on a partition/device it addresses.
>
> Another caveat is that processing a NILFS2 stored in a file (say, a HDD image)
> would require some specialized syntax.
>
> While those may not sound very serious for interactive use, I believe that our
> tools would become too unreliable for scripts in some edge cases.
>
> Thus I gave up ;-)
>
> A minimalistic version -- only lstat() [sic] with S_ISDIR() -- would work, but
> that's not very much of a progress to me.
>
>
> [1] http://doc.cat-v.org/plan_9/4th_edition/papers/lexnames
I understood your point.
IMO, you don't worry about the ".." semantics breakage so serious.
The current nilfs tools are comparing pathnames using canonicalized
paths. If we really attend to the issue, all tools and libraries in
nilfs-utils should be rethought together.
So, let's go ahead.
> One caveat is that a device would not indicate the filesystem it belongs to,
> but a filesystem on a partition/device it addresses.
In the new directory semantics, we needs to decide if a given
directory argument belongs to a mount point in the mtab entries.
This matching check needs to know whether the given directory crosses
over a filesystem boundary starting from each mount point. And, this
needs testing if each intermediate directory is a mount point or not.
"mountpoint" command judges this by comparing device ids and inode
numbers for each directory with its parent.
Since tools doesn't know existing mount points unless they parse
/proc/mounts individually, I think it's better to extend
nilfs_find_fs() and nilfs_open() to allow the new semantics.
You may as well add an extra open flag to nilfs_open (for instance,
NILFS_OPEN_ALLOW_SUBDIRS) which changes the meaning of the directory
argument slightly so that the mount point to which the given directory
belongs is selected.
Any thoughts?
Thanks,
Ryusuke Konishi
--
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] 18+ messages in thread
* Re: [PATCH 1/8] lscp: support opening mounted filesystem by directory pathname
[not found] ` <20110304.192609.247659638.ryusuke-sG5X7nlA6pw@public.gmane.org>
@ 2011-03-04 11:21 ` Ryusuke Konishi
0 siblings, 0 replies; 18+ messages in thread
From: Ryusuke Konishi @ 2011-03-04 11:21 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs
2011/3/4 Ryusuke Konishi <ryusuke-sG5X7nlA6pw@public.gmane.org>:
> In the new directory semantics, we needs to decide if a given
> directory argument belongs to a mount point in the mtab entries.
>
> This matching check needs to know whether the given directory crosses
> over a filesystem boundary starting from each mount point. And, this
> needs testing if each intermediate directory is a mount point or not.
>
> "mountpoint" command judges this by comparing device ids and inode
> numbers for each directory with its parent.
BTW, we can test if a given nilfs2 directory is a mount point or not
with its inode number. The nilfs2 mount point always has
inode number 2 (=NILFS_ROOT_INO) and no other directories
have this inode number.
Thanks,
Ryusuke Konishi
--
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] 18+ messages in thread
end of thread, other threads:[~2011-03-04 11:21 UTC | newest]
Thread overview: 18+ 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
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).