gfs2-utils: master - libgfs2: Move gfs2_query into gfs2_convert
Steven Whitehouse
swhiteho at fedoraproject.org
Fri Dec 3 16:58:27 UTC 2010
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=4e70727853794c5c6dbf93c98ee5a4e5015be868
Commit: 4e70727853794c5c6dbf93c98ee5a4e5015be868
Parent: d4df74e7f62f6d31f76e386352d6e5bd1d076ce2
Author: Steven Whitehouse <swhiteho at redhat.com>
AuthorDate: Fri Dec 3 16:54:36 2010 +0000
Committer: Steven Whitehouse <swhiteho at redhat.com>
CommitterDate: Fri Dec 3 16:54:36 2010 +0000
libgfs2: Move gfs2_query into gfs2_convert
The gfs2_query() function is used only by gfs2_convert() and
even then only called once. This moves it into gfs2_convert().
Signed-off-by: Steven Whitehouse <swhiteho at redhat.com>
---
gfs2/convert/gfs2_convert.c | 53 +++++++++++++++++++++++++++++++++++++++++++
gfs2/libgfs2/gfs2_log.c | 52 ------------------------------------------
gfs2/libgfs2/libgfs2.h | 4 ---
3 files changed, 53 insertions(+), 56 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 88674d9..b56eec2 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -2048,6 +2048,59 @@ static void copy_quotas(struct gfs2_sbd *sdp)
inode_put(&oq_ip);
}
+static int gfs2_query(int *setonabort, struct gfs2_options *opts,
+ const char *format, ...)
+{
+ va_list args;
+ char response;
+ int ret = 0;
+
+ *setonabort = 0;
+ if(opts->yes)
+ return 1;
+ if(opts->no)
+ return 0;
+
+ opts->query = TRUE;
+ while (1) {
+ va_start(args, format);
+ vprintf(format, args);
+ va_end(args);
+
+ /* Make sure query is printed out */
+ fflush(NULL);
+ response = gfs2_getch();
+
+ printf("\n");
+ fflush(NULL);
+ if (response == 0x3) { /* if interrupted, by ctrl-c */
+ response = generic_interrupt("Question", "response",
+ NULL,
+ "Do you want to abort " \
+ "or continue (a/c)?",
+ "ac");
+ if (response == 'a') {
+ ret = 0;
+ *setonabort = 1;
+ break;
+ }
+ printf("Continuing.\n");
+ } else if(tolower(response) == 'y') {
+ ret = 1;
+ break;
+ } else if (tolower(response) == 'n') {
+ ret = 0;
+ break;
+ } else {
+ printf("Bad response %d, please type 'y' or 'n'.\n",
+ response);
+ }
+ }
+
+ opts->query = FALSE;
+ return ret;
+}
+
/* ------------------------------------------------------------------------- */
/* main - mainline code */
/* ------------------------------------------------------------------------- */
diff --git a/gfs2/libgfs2/gfs2_log.c b/gfs2/libgfs2/gfs2_log.c
index c4ac665..aa5ca73 100644
--- a/gfs2/libgfs2/gfs2_log.c
+++ b/gfs2/libgfs2/gfs2_log.c
@@ -132,55 +132,3 @@ char generic_interrupt(const char *caller, const char *where,
return response;
}
-int gfs2_query(int *setonabort, struct gfs2_options *opts,
- const char *format, ...)
-{
- va_list args;
- char response;
- int ret = 0;
-
- *setonabort = 0;
- if(opts->yes)
- return 1;
- if(opts->no)
- return 0;
-
- opts->query = TRUE;
- while (1) {
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
-
- /* Make sure query is printed out */
- fflush(NULL);
- response = gfs2_getch();
-
- printf("\n");
- fflush(NULL);
- if (response == 0x3) { /* if interrupted, by ctrl-c */
- response = generic_interrupt("Question", "response",
- NULL,
- "Do you want to abort " \
- "or continue (a/c)?",
- "ac");
- if (response == 'a') {
- ret = 0;
- *setonabort = 1;
- break;
- }
- printf("Continuing.\n");
- } else if(tolower(response) == 'y') {
- ret = 1;
- break;
- } else if (tolower(response) == 'n') {
- ret = 0;
- break;
- } else {
- printf("Bad response %d, please type 'y' or 'n'.\n",
- response);
- }
- }
-
- opts->query = FALSE;
- return ret;
-}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ac415df..402a4f9 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -604,10 +604,6 @@ extern void print_fsck_log(int priority, const char *file, int line,
extern char generic_interrupt(const char *caller, const char *where,
const char *progress, const char *question,
const char *answers);
-extern int gfs2_query(int *setonabort, struct gfs2_options *opts,
- const char *format, ...)
- __attribute__((format(printf,3,4)));
-
/* misc.c */
extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
More information about the cluster-commits
mailing list