svn commit: r346504 - stable/12/stand/uboot/common
Ian Lepore
ian at FreeBSD.org
Tue Sep 3 14:08:11 UTC 2019
Author: ian
Date: Sun Apr 21 22:28:50 2019
New Revision: 346504
URL: https://svnweb.freebsd.org/changeset/base/346504
Log:
MFC r344254-r344255
r344254:
Use DEV_TYP_NONE instead of -1 to indicate no device was specified.
DEV_TYP_NONE has a value of zero, which makes more sense since the device
type is a bunch of bits describing the device, crammed into an int.
r344255:
Fix more places to use DEV_TYP_NONE instead of -1 to indicate 'no device'.
Modified:
stable/12/stand/uboot/common/main.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/stand/uboot/common/main.c
==============================================================================
--- stable/12/stand/uboot/common/main.c Sun Apr 21 22:26:27 2019 (r346503)
+++ stable/12/stand/uboot/common/main.c Sun Apr 21 22:28:50 2019 (r346504)
@@ -156,7 +156,7 @@ get_device_type(const char *devstr, int *devtype)
printf("Unknown device type '%s'\n", devstr);
}
- *devtype = -1;
+ *devtype = DEV_TYP_NONE;
return (NULL);
}
@@ -211,7 +211,7 @@ get_load_device(int *type, int *unit, int *slice, int
const char *p;
char *endp;
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
*partition = -1;
@@ -250,13 +250,13 @@ get_load_device(int *type, int *unit, int *slice, int
p++;
/* Unknown device name, or a known name without unit number. */
- if ((*type == -1) || (*p == '\0')) {
+ if ((*type == DEV_TYP_NONE) || (*p == '\0')) {
return;
}
/* Malformed unit number. */
if (!isdigit(*p)) {
- *type = -1;
+ *type = DEV_TYP_NONE;
return;
}
@@ -271,7 +271,7 @@ get_load_device(int *type, int *unit, int *slice, int
/* Device string is malformed beyond unit number. */
if (*p != ':') {
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
return;
}
@@ -284,7 +284,7 @@ get_load_device(int *type, int *unit, int *slice, int
/* Only DEV_TYP_STOR devices can have a slice specification. */
if (!(*type & DEV_TYP_STOR)) {
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
return;
}
@@ -293,7 +293,7 @@ get_load_device(int *type, int *unit, int *slice, int
/* Malformed slice number. */
if (p == endp) {
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
return;
@@ -307,7 +307,7 @@ get_load_device(int *type, int *unit, int *slice, int
/* Device string is malformed beyond slice number. */
if (*p != '.') {
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
return;
@@ -327,7 +327,7 @@ get_load_device(int *type, int *unit, int *slice, int
return;
/* Junk beyond partition number. */
- *type = -1;
+ *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
*partition = -1;
@@ -496,14 +496,14 @@ main(int argc, char **argv)
currdev.dd.d_dev = devsw[i];
currdev.dd.d_unit = 0;
- if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
+ if ((load_type == DEV_TYP_NONE || (load_type & DEV_TYP_STOR)) &&
strcmp(devsw[i]->dv_name, "disk") == 0) {
if (probe_disks(i, load_type, load_unit, load_slice,
load_partition) == 0)
break;
}
- if ((load_type == -1 || (load_type & DEV_TYP_NET)) &&
+ if ((load_type == DEV_TYP_NONE || (load_type & DEV_TYP_NET)) &&
strcmp(devsw[i]->dv_name, "net") == 0)
break;
}
More information about the svn-src-all
mailing list