summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-09 11:26:48 -0200
committerRenato Botelho <renato@netgate.com>2017-02-09 11:26:48 -0200
commit4a05f5440acda223e6a0ec5157bc32ecc0f09ff9 (patch)
tree4c2ece480e5d4155ed35bec62996de40eb179f18 /sys/geom
parent681a482d8fc4bfc14a24f7a9d75cca6337f2a520 (diff)
parenta1e52233c91fd46e666297270ab655f1abff8535 (diff)
downloadFreeBSD-src-4a05f5440acda223e6a0ec5157bc32ecc0f09ff9.zip
FreeBSD-src-4a05f5440acda223e6a0ec5157bc32ecc0f09ff9.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_disk.c12
-rw-r--r--sys/geom/geom_disk.h5
-rw-r--r--sys/geom/multipath/g_multipath.c8
-rw-r--r--sys/geom/vinum/geom_vinum_state.c2
4 files changed, 16 insertions, 11 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index a0a357f..18402c4 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -589,12 +589,12 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
* special cases, and there's also a valid range.
*/
sbuf_printf(sb, "%s<rotationrate>", indent);
- if (dp->d_rotation_rate == 0) /* Old drives don't */
- sbuf_printf(sb, "unknown"); /* report RPM. */
- else if (dp->d_rotation_rate == 1) /* Since 0 is used */
- sbuf_printf(sb, "0"); /* above, SSDs use 1. */
- else if ((dp->d_rotation_rate >= 0x041) &&
- (dp->d_rotation_rate <= 0xfffe))
+ if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */
+ sbuf_printf(sb, "unknown"); /* don't report RPM. */
+ else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING)
+ sbuf_printf(sb, "0");
+ else if ((dp->d_rotation_rate >= DISK_RR_MIN) &&
+ (dp->d_rotation_rate <= DISK_RR_MAX))
sbuf_printf(sb, "%u", dp->d_rotation_rate);
else
sbuf_printf(sb, "invalid");
diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h
index 09194c0..948c664 100644
--- a/sys/geom/geom_disk.h
+++ b/sys/geom/geom_disk.h
@@ -113,6 +113,11 @@ struct disk {
#define DISKFLAG_DIRECT_COMPLETION 0x20
#define DISKFLAG_LACKS_ROTRATE 0x40
+#define DISK_RR_UNKNOWN 0
+#define DISK_RR_NON_ROTATING 1
+#define DISK_RR_MIN 0x0401
+#define DISK_RR_MAX 0xfffe
+
struct disk *disk_alloc(void);
void disk_create(struct disk *disk, int version);
void disk_destroy(struct disk *disk);
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index b461747..0c24cd3 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct g_class *mp,
struct g_provider *pp;
const char *mpname;
static const char devpf[6] = "/dev/";
+ int error;
g_topology_assert();
@@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct g_class *mp,
return;
}
- /*
- * Now add....
- */
- (void) g_multipath_add_disk(gp, pp);
+ error = g_multipath_add_disk(gp, pp);
+ if (error != 0)
+ gctl_error(req, "Provider addition error: %d", error);
}
static void
diff --git a/sys/geom/vinum/geom_vinum_state.c b/sys/geom/vinum/geom_vinum_state.c
index 568c784..67486da 100644
--- a/sys/geom/vinum/geom_vinum_state.c
+++ b/sys/geom/vinum/geom_vinum_state.c
@@ -183,7 +183,7 @@ gv_set_sd_state(struct gv_sd *s, int newstate, int flags)
* Only do this if we're forced, since it usually is done
* internally, and then we do use the force flag.
*/
- if (!flags & GV_SETSTATE_FORCE)
+ if (!(flags & GV_SETSTATE_FORCE))
return (GV_ERR_SETSTATE);
break;
OpenPOWER on IntegriCloud