summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/mfiutil/mfi_cmd.c4
-rw-r--r--usr.sbin/mfiutil/mfi_config.c15
-rw-r--r--usr.sbin/mfiutil/mfi_drive.c15
-rw-r--r--usr.sbin/mfiutil/mfi_evt.c5
-rw-r--r--usr.sbin/mfiutil/mfi_flash.c2
-rw-r--r--usr.sbin/mfiutil/mfi_patrol.c9
-rw-r--r--usr.sbin/mfiutil/mfi_show.c15
-rw-r--r--usr.sbin/mfiutil/mfi_volume.c7
-rw-r--r--usr.sbin/mfiutil/mfiutil.c2
-rw-r--r--usr.sbin/mfiutil/mfiutil.h2
10 files changed, 41 insertions, 35 deletions
diff --git a/usr.sbin/mfiutil/mfi_cmd.c b/usr.sbin/mfiutil/mfi_cmd.c
index 7fedfb6..3cf703a 100644
--- a/usr.sbin/mfiutil/mfi_cmd.c
+++ b/usr.sbin/mfiutil/mfi_cmd.c
@@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp)
}
int
-mfi_open(int unit)
+mfi_open(int unit, int acs)
{
char path[MAXPATHLEN];
snprintf(path, sizeof(path), "/dev/mfi%d", unit);
- return (open(path, O_RDWR));
+ return (open(path, acs));
}
void
diff --git a/usr.sbin/mfiutil/mfi_config.c b/usr.sbin/mfiutil/mfi_config.c
index feb285d..b3ac982 100644
--- a/usr.sbin/mfiutil/mfi_config.c
+++ b/usr.sbin/mfiutil/mfi_config.c
@@ -35,6 +35,7 @@
#endif
#include <err.h>
#include <errno.h>
+#include <fcntl.h>
#include <libutil.h>
#ifdef DEBUG
#include <stdint.h>
@@ -157,7 +158,7 @@ clear_config(int ac, char **av)
int ch, error, fd;
u_int i;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -575,7 +576,7 @@ create_volume(int ac, char **av)
narrays = 0;
error = 0;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -857,7 +858,7 @@ delete_volume(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -925,7 +926,7 @@ add_spare(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -1196,7 +1197,7 @@ debug_config(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -1233,7 +1234,7 @@ dump(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_drive.c b/usr.sbin/mfiutil/mfi_drive.c
index 231b070..d456289 100644
--- a/usr.sbin/mfiutil/mfi_drive.c
+++ b/usr.sbin/mfiutil/mfi_drive.c
@@ -33,6 +33,7 @@
#include <sys/errno.h>
#include <ctype.h>
#include <err.h>
+#include <fcntl.h>
#include <libutil.h>
#include <limits.h>
#include <stdio.h>
@@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo, uint16_t device_id, uint32_t def)
else
snprintf(buf, sizeof(buf), "%2u", device_id);
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
warn("mfi_open");
return (buf);
@@ -383,7 +384,7 @@ drive_set_state(char *drive, uint16_t new_state)
uint8_t mbox[6];
int error, fd;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -484,7 +485,7 @@ start_rebuild(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -541,7 +542,7 @@ abort_rebuild(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -597,7 +598,7 @@ drive_progress(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -663,7 +664,7 @@ drive_clear(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -723,7 +724,7 @@ drive_locate(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_evt.c b/usr.sbin/mfiutil/mfi_evt.c
index dbf8272..cddb673 100644
--- a/usr.sbin/mfiutil/mfi_evt.c
+++ b/usr.sbin/mfiutil/mfi_evt.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/errno.h>
#include <err.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -73,7 +74,7 @@ show_logstate(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -541,7 +542,7 @@ show_events(int ac, char **av)
int ch, error, fd, num_events, verbose;
u_int i;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_flash.c b/usr.sbin/mfiutil/mfi_flash.c
index 6d07cb0..2601025 100644
--- a/usr.sbin/mfiutil/mfi_flash.c
+++ b/usr.sbin/mfiutil/mfi_flash.c
@@ -150,7 +150,7 @@ flash_adapter(int ac, char **av)
goto error;
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_patrol.c b/usr.sbin/mfiutil/mfi_patrol.c
index dd348ad..74cd128 100644
--- a/usr.sbin/mfiutil/mfi_patrol.c
+++ b/usr.sbin/mfiutil/mfi_patrol.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/errno.h>
#include <err.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -86,7 +87,7 @@ show_patrol(int ac, char **av)
int error, fd;
u_int i;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -196,7 +197,7 @@ start_patrol(int ac, char **av)
{
int error, fd;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -222,7 +223,7 @@ stop_patrol(int ac, char **av)
{
int error, fd;
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -292,7 +293,7 @@ patrol_config(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c
index 8311f4b..db49202 100644
--- a/usr.sbin/mfiutil/mfi_show.c
+++ b/usr.sbin/mfiutil/mfi_show.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/errno.h>
#include <err.h>
+#include <fcntl.h>
#include <libutil.h>
#include <stdio.h>
#include <stdlib.h>
@@ -61,7 +62,7 @@ show_adapter(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -148,7 +149,7 @@ show_battery(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -320,7 +321,7 @@ show_config(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -421,7 +422,7 @@ show_volumes(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -504,7 +505,7 @@ show_drives(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -612,7 +613,7 @@ show_firmware(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -672,7 +673,7 @@ show_progress(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfi_volume.c b/usr.sbin/mfiutil/mfi_volume.c
index 836f045..49417d0 100644
--- a/usr.sbin/mfiutil/mfi_volume.c
+++ b/usr.sbin/mfiutil/mfi_volume.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/errno.h>
#include <err.h>
+#include <fcntl.h>
#include <libutil.h>
#include <stdio.h>
#include <stdlib.h>
@@ -294,7 +295,7 @@ volume_cache(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -402,7 +403,7 @@ volume_name(int ac, char **av)
return (ENOSPC);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDWR);
if (fd < 0) {
error = errno;
warn("mfi_open");
@@ -453,7 +454,7 @@ volume_progress(int ac, char **av)
return (EINVAL);
}
- fd = mfi_open(mfi_unit);
+ fd = mfi_open(mfi_unit, O_RDONLY);
if (fd < 0) {
error = errno;
warn("mfi_open");
diff --git a/usr.sbin/mfiutil/mfiutil.c b/usr.sbin/mfiutil/mfiutil.c
index 43bb6bb..f73b602 100644
--- a/usr.sbin/mfiutil/mfiutil.c
+++ b/usr.sbin/mfiutil/mfiutil.c
@@ -95,7 +95,7 @@ static int
version(int ac, char **av)
{
- printf("mfiutil version 1.0.13");
+ printf("mfiutil version 1.0.14");
#ifdef DEBUG
printf(" (DEBUG)");
#endif
diff --git a/usr.sbin/mfiutil/mfiutil.h b/usr.sbin/mfiutil/mfiutil.h
index 232831e..bb9366f 100644
--- a/usr.sbin/mfiutil/mfiutil.h
+++ b/usr.sbin/mfiutil/mfiutil.h
@@ -139,7 +139,7 @@ int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id);
int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
uint8_t *mbox, size_t mboxlen, uint8_t *statusp);
-int mfi_open(int unit);
+int mfi_open(int unit, int acs);
int mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
int mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
uint8_t *statusp);
OpenPOWER on IntegriCloud