Make mpsutil open the mpr devices when named mprutil

Make mprutil a hardlink to mpsutil

Sponsored by:	Gandi.net
This commit is contained in:
Baptiste Daroussin 2015-10-15 15:19:38 +00:00
parent 125c7a1e56
commit 48f31f4fef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/mpsutil/; revision=289364
5 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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));
}

View File

@ -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);

View File

@ -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':

View File

@ -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);