* [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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ 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; 19+ 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] 19+ messages in thread