summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2019-11-03 03:06:32 +0000
committerYousong Zhou <yszhou4tech@gmail.com>2019-11-03 04:01:40 +0000
commitf438552ec8e777c271f5c2ec6713d9567eafa5b6 (patch)
tree40eed6bfd74bdacf72ca8cdd65d46de6e45f2cda
parent2f2a09adbc148d7958be66b00b68ab0609043523 (diff)
downloadfstools-f438552ec8e777c271f5c2ec6713d9567eafa5b6.tar.gz
block: detect: use current mp as value of target option
Move down the function so that no declaration of find_mount_point() is not needed Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r--block.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/block.c b/block.c
index 1972c50..b6d49a8 100644
--- a/block.c
+++ b/block.c
@@ -575,23 +575,6 @@ static void cache_load(int mtd)
}
-static int print_block_uci(struct probe_info *pr)
-{
- if (!strcmp(pr->type, "swap")) {
- printf("config 'swap'\n");
- } else {
- printf("config 'mount'\n");
- printf("\toption\ttarget\t'/mnt/%s'\n", basename(pr->dev));
- }
- if (pr->uuid)
- printf("\toption\tuuid\t'%s'\n", pr->uuid);
- else
- printf("\toption\tdevice\t'%s'\n", pr->dev);
- printf("\toption\tenabled\t'0'\n\n");
-
- return 0;
-}
-
static struct device* find_block_device(char *uuid, char *label, char *path)
{
struct device *dev;
@@ -704,6 +687,30 @@ static char* find_mount_point(char *block)
return point;
}
+static int print_block_uci(struct probe_info *pr)
+{
+ if (!strcmp(pr->type, "swap")) {
+ printf("config 'swap'\n");
+ } else {
+ char *mp = find_mount_point(pr->dev);
+
+ printf("config 'mount'\n");
+ if (mp) {
+ printf("\toption\ttarget\t'%s'\n", mp);
+ free(mp);
+ } else {
+ printf("\toption\ttarget\t'/mnt/%s'\n", basename(pr->dev));
+ }
+ }
+ if (pr->uuid)
+ printf("\toption\tuuid\t'%s'\n", pr->uuid);
+ else
+ printf("\toption\tdevice\t'%s'\n", pr->dev);
+ printf("\toption\tenabled\t'0'\n\n");
+
+ return 0;
+}
+
static int print_block_info(struct probe_info *pr)
{
static char *mp;