diff options
author | Ian Lepore <ian@FreeBSD.org> | 2019-03-24 18:51:52 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2019-03-24 18:51:52 +0000 |
commit | 14243f8de746e756ad3466aa6920a80e39157d9c (patch) | |
tree | 3936c489d95157660582dd99004d341945278634 /stand/uboot | |
parent | 6d51c0fe72565473d709b19e12229517804d521e (diff) | |
download | src-test2-14243f8de746e756ad3466aa6920a80e39157d9c.tar.gz src-test2-14243f8de746e756ad3466aa6920a80e39157d9c.zip |
Notes
Diffstat (limited to 'stand/uboot')
-rw-r--r-- | stand/uboot/common/main.c | 29 | ||||
-rw-r--r-- | stand/uboot/lib/disk.c | 4 |
2 files changed, 19 insertions, 14 deletions
diff --git a/stand/uboot/common/main.c b/stand/uboot/common/main.c index df53097c2a79..b8bd1cf05089 100644 --- a/stand/uboot/common/main.c +++ b/stand/uboot/common/main.c @@ -213,8 +213,8 @@ get_load_device(int *type, int *unit, int *slice, int *partition) *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; - *partition = -1; + *slice = D_SLICEWILD; + *partition = D_PARTWILD; devstr = ub_env_get("loaderdev"); if (devstr == NULL) { @@ -295,7 +295,7 @@ get_load_device(int *type, int *unit, int *slice, int *partition) if (p == endp) { *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; + *slice = D_SLICEWILD; return; } @@ -309,7 +309,7 @@ get_load_device(int *type, int *unit, int *slice, int *partition) if (*p != '.') { *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; + *slice = D_SLICEWILD; return; } @@ -329,8 +329,8 @@ get_load_device(int *type, int *unit, int *slice, int *partition) /* Junk beyond partition number. */ *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; - *partition = -1; + *slice = D_SLICEWILD; + *partition = D_PARTWILD; } static void @@ -339,15 +339,20 @@ print_disk_probe_info() char slice[32]; char partition[32]; - if (currdev.d_disk.d_slice > 0) - sprintf(slice, "%d", currdev.d_disk.d_slice); + if (currdev.d_disk.d_slice == D_SLICENONE) + strlcpy(slice, "<none>", sizeof(slice)); + else if (currdev.d_disk.d_slice == D_SLICEWILD) + strlcpy(slice, "<auto>", sizeof(slice)); else - strcpy(slice, "<auto>"); + snprintf(slice, sizeof(slice), "%d", currdev.d_disk.d_slice); - if (currdev.d_disk.d_partition >= 0) - sprintf(partition, "%d", currdev.d_disk.d_partition); + if (currdev.d_disk.d_partition == D_PARTNONE) + strlcpy(partition, "<none>", sizeof(partition)); + else if (currdev.d_disk.d_partition == D_PARTWILD) + strlcpy(partition, "<auto>", sizeof(partition)); else - strcpy(partition, "<auto>"); + snprintf(partition, sizeof(partition), "%d", + currdev.d_disk.d_partition); printf(" Checking unit=%d slice=%s partition=%s...", currdev.dd.d_unit, slice, partition); diff --git a/stand/uboot/lib/disk.c b/stand/uboot/lib/disk.c index bf07d04f7e36..70dcfdcc8863 100644 --- a/stand/uboot/lib/disk.c +++ b/stand/uboot/lib/disk.c @@ -254,8 +254,8 @@ stor_print(int verbose) for (i = 0; i < stor_info_no; i++) { dev.dd.d_dev = &uboot_storage; dev.dd.d_unit = i; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, ub_stor_type(SI(&dev).type)); if ((ret = pager_output(line)) != 0) |