Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/mpsutil/mps_slot.c
Show All 25 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__RCSID("$FreeBSD$"); | __RCSID("$FreeBSD$"); | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/mman.h> | #include <sys/mman.h> | ||||
#include <sys/endian.h> | |||||
#include <errno.h> | #include <errno.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | slot_set(int argc, char **argv) | ||||
fd = mps_open(mps_unit); | fd = mps_open(mps_unit); | ||||
if (fd < 0) { | if (fd < 0) { | ||||
error = errno; | error = errno; | ||||
warn("mps_open"); | warn("mps_open"); | ||||
return (error); | return (error); | ||||
} | } | ||||
if (mps_set_slot_status(fd, handle, slot, status) != 0) { | if (mps_set_slot_status(fd, htole16(handle), htole16(slot), | ||||
htole32(status)) != 0) { | |||||
warnx("Failed to set status"); | warnx("Failed to set status"); | ||||
close(fd); | close(fd); | ||||
return (1); | return (1); | ||||
} | } | ||||
close(fd); | close(fd); | ||||
printf("Successfully set slot status\n"); | printf("Successfully set slot status\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
MPS_COMMAND(slot, set, slot_set, "status <enclosure handle> <slot number> " | MPS_COMMAND(slot, set, slot_set, "status <enclosure handle> <slot number> " | ||||
"<status>", "Set status of the slot in the directly attached enclosure"); | "<status>", "Set status of the slot in the directly attached enclosure"); |