Btrfs-progs: move ask_user() to utils.c
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Wed, 18 Sep 2013 08:27:35 +0000 (16:27 +0800)
committerChris Mason <chris.mason@fusionio.com>
Wed, 16 Oct 2013 12:22:26 +0000 (08:22 -0400)
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
chunk-recover.c
utils.c
utils.h

index 9af4887ca3e3dd33e6e8558d0ec5764c698a3e0a..e44ca72be5ecca10f8694d4d28dc17440525aab5 100644 (file)
@@ -1307,24 +1307,6 @@ fail_close_fd:
        return ret;
 }
 
-/*
- * This reads a line from the stdin and only returns non-zero if the
- * first whitespace delimited token is a case insensitive match with yes
- * or y.
- */
-static int ask_user(char *question)
-{
-       char buf[30] = {0,};
-       char *saveptr = NULL;
-       char *answer;
-
-       printf("%s [y/N]: ", question);
-
-       return fgets(buf, sizeof(buf) - 1, stdin) &&
-              (answer = strtok_r(buf, " \t\n\r", &saveptr)) &&
-              (!strcasecmp(answer, "yes") || !strcasecmp(answer, "y"));
-}
-
 static int btrfs_get_device_extents(u64 chunk_object,
                                    struct list_head *orphan_devexts,
                                    struct list_head *ret_list)
diff --git a/utils.c b/utils.c
index d365380ec21297e37014703348cef745c41362ad..5fa193b40ba817425c72f78076b1eb44be5beef6 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -1957,3 +1957,21 @@ int is_vol_small(char *file)
                return 0;
        }
 }
+
+/*
+ * This reads a line from the stdin and only returns non-zero if the
+ * first whitespace delimited token is a case insensitive match with yes
+ * or y.
+ */
+int ask_user(char *question)
+{
+       char buf[30] = {0,};
+       char *saveptr = NULL;
+       char *answer;
+
+       printf("%s [y/N]: ", question);
+
+       return fgets(buf, sizeof(buf) - 1, stdin) &&
+              (answer = strtok_r(buf, " \t\n\r", &saveptr)) &&
+              (!strcasecmp(answer, "yes") || !strcasecmp(answer, "y"));
+}
diff --git a/utils.h b/utils.h
index 6bf7880596feea0ada0ee48838fb91fa096bb5d2..fdef3f058892d4be7e4c465026ccedda15d437c0 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -80,4 +80,5 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 int is_vol_small(char *file);
 int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
                           int verify);
+int ask_user(char *question);
 #endif