Make mpsutil open the mpr devices when named mprutil
Make mprutil a hardlink to mpsutil Sponsored by: Gandi.net
This commit is contained in:
parent
125c7a1e56
commit
48f31f4fef
@ -8,6 +8,7 @@ MAN= mpsutil.8
|
||||
WARNS?= 3
|
||||
|
||||
LIBADD= cam util
|
||||
LINKS= ${BINDIR}/mpsutil ${BINDIR}/mprutil
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../sys -I. -DUSE_MPT_IOCTLS -g
|
||||
|
||||
|
@ -621,7 +621,7 @@ mps_open(int unit)
|
||||
{
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/mps%d", unit);
|
||||
snprintf(path, sizeof(path), "/dev/mp%s%d", is_mps ? "s": "r", unit);
|
||||
return (open(path, O_RDWR));
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,8 @@ show_adapters(int ac, char **av)
|
||||
free(man0);
|
||||
return (EINVAL);
|
||||
}
|
||||
printf("/dev/mps%d\t%16s %16s %08x\n", unit,
|
||||
printf("/dev/mp%s%d\t%16s %16s %08x\n",
|
||||
is_mps ? "s": "r", unit,
|
||||
man0->ChipName, man0->BoardName, facts->FWVersion.Word);
|
||||
free(man0);
|
||||
free(facts);
|
||||
|
@ -44,6 +44,7 @@ SET_DECLARE(MPS_DATASET(top), struct mpsutil_command);
|
||||
SET_DECLARE(MPS_DATASET(usage), struct mpsutil_usage);
|
||||
|
||||
int mps_unit;
|
||||
int is_mps;
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
@ -51,7 +52,7 @@ usage(void)
|
||||
struct mpsutil_usage **cmd;
|
||||
const char *args, *desc;
|
||||
|
||||
fprintf(stderr, "usage: mpsutil [-u unit] <command> ...\n\n");
|
||||
fprintf(stderr, "usage: %s [-u unit] <command> ...\n\n", getprogname());
|
||||
fprintf(stderr, "Commands include:\n");
|
||||
SET_FOREACH(cmd, MPS_DATASET(usage)) {
|
||||
if (*cmd == NULL)
|
||||
@ -72,7 +73,7 @@ static int
|
||||
version(int ac, char **av)
|
||||
{
|
||||
|
||||
printf("mpsutil: version %s", MPSUTIL_VERSION);
|
||||
printf("%s: version %s", MPSUTIL_VERSION, getprogname());
|
||||
#ifdef DEBUG
|
||||
printf(" (DEBUG)");
|
||||
#endif
|
||||
@ -88,6 +89,8 @@ main(int ac, char **av)
|
||||
struct mpsutil_command **cmd;
|
||||
int ch;
|
||||
|
||||
is_mps = !strcmp(getprogname(), "mpsutil");
|
||||
|
||||
while ((ch = getopt(ac, av, "u:h?")) != -1) {
|
||||
switch (ch) {
|
||||
case 'u':
|
||||
|
@ -91,6 +91,7 @@ struct mpsutil_usage {
|
||||
_MPS_COMMAND(set, name, mpsutil_ ## name ## _table_handler)
|
||||
|
||||
extern int mps_unit;
|
||||
extern int is_mps;
|
||||
#define MPS_MAX_UNIT 10
|
||||
|
||||
void hexdump(const void *ptr, int length, const char *hdr, int flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user