diff options
| author | Warner Losh <imp@FreeBSD.org> | 2000-07-18 04:59:39 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2000-07-18 04:59:39 +0000 |
| commit | c3b5cba32f49632d12520b5f55c379da68b12166 (patch) | |
| tree | 032e82fe7c220008bb19edfff47909c42c035ce1 | |
| parent | dacc8db399c95c5c7e240c33809a9ddf424e31f0 (diff) | |
Notes
| -rw-r--r-- | usr.sbin/pccard/pccardd/cardd.c | 5 | ||||
| -rw-r--r-- | usr.sbin/pccard/pccardd/cardd.h | 1 | ||||
| -rw-r--r-- | usr.sbin/pccard/pccardd/file.c | 24 | ||||
| -rw-r--r-- | usr.sbin/pccard/pccardd/pccard.conf.5 | 17 |
4 files changed, 38 insertions, 9 deletions
diff --git a/usr.sbin/pccard/pccardd/cardd.c b/usr.sbin/pccard/pccardd/cardd.c index c8a57569837c..0f654601bc5c 100644 --- a/usr.sbin/pccard/pccardd/cardd.c +++ b/usr.sbin/pccard/pccardd/cardd.c @@ -188,6 +188,9 @@ card_removed(struct slot *sp) struct card *cp; int in_use = 0; + if (sp->config && sp->config->driver && sp->card) + logmsg("%s%d: %s removed.", sp->config->driver->kernel, + sp->config->driver->unit, sp->card->logstr); if (sp->cis) freecis(sp->cis); if (sp->config) { @@ -836,5 +839,7 @@ setup_slot(struct slot *sp) break; } } + logmsg("%s%d: %s inserted.", sp->config->driver->kernel, + sp->config->driver->unit, sp->card->logstr); return (1); } diff --git a/usr.sbin/pccard/pccardd/cardd.h b/usr.sbin/pccard/pccardd/cardd.h index 675cc5aac474..b6dde103aaba 100644 --- a/usr.sbin/pccard/pccardd/cardd.h +++ b/usr.sbin/pccard/pccardd/cardd.h @@ -77,6 +77,7 @@ struct card { struct card_config *config; /* List of configs */ struct cmd *insert; /* Insert commands */ struct cmd *remove; /* Remove commands */ + char *logstr; /* String for logger */ }; struct driver { diff --git a/usr.sbin/pccard/pccardd/file.c b/usr.sbin/pccard/pccardd/file.c index db96e62ef613..ec3010cd71ba 100644 --- a/usr.sbin/pccard/pccardd/file.c +++ b/usr.sbin/pccard/pccardd/file.c @@ -63,6 +63,7 @@ static char *keys[] = { "debuglevel", /* 13 */ "include", /* 14 */ "function", /* 15 */ + "logstr", /* 16 */ 0 }; @@ -81,6 +82,7 @@ static char *keys[] = { #define KWD_DEBUGLEVEL 13 #define KWD_INCLUDE 14 #define KWD_FUNCTION 15 +#define KWD_LOGSTR 16 /* for keyword compatibility with PAO/plain FreeBSD */ static struct { @@ -124,15 +126,12 @@ delete_card(struct card *cp) struct card_config *configp, *config_next; struct cmd *cmdp, *cmd_next; - /* free characters */ - if (cp->manuf != NULL) - free(cp->manuf); - if (cp->version != NULL) - free(cp->version); - if (cp->add_info1 != NULL) - free(cp->add_info1); - if (cp->add_info2 != NULL) - free(cp->add_info2); + /* free strings */ + free(cp->manuf); + free(cp->version); + free(cp->add_info1); + free(cp->add_info2); + free(cp->logstr); /* free structures */ for (etherp = cp->ether; etherp; etherp = ether_next) { @@ -434,11 +433,14 @@ parse_card(int deftype) } cp->manuf = man; cp->version = vers; + cp->logstr = NULL; + asprintf(&cp->logstr, "%s (%s)", man, vers); cp->func_id = 0; break; case DT_FUNC: cp->manuf = NULL; cp->version = NULL; + cp->logstr = NULL; cp->func_id = (u_char) func_tok(); break; default: @@ -542,6 +544,10 @@ parse_card(int deftype) } cp->iosize = iosize; break; + case KWD_LOGSTR: + free(cp->logstr); + cp->logstr = newstr(next_tok()); + break; default: pusht = 1; return; diff --git a/usr.sbin/pccard/pccardd/pccard.conf.5 b/usr.sbin/pccard/pccardd/pccard.conf.5 index 0f27bf263eaf..344ed50ee794 100644 --- a/usr.sbin/pccard/pccardd/pccard.conf.5 +++ b/usr.sbin/pccard/pccardd/pccard.conf.5 @@ -104,6 +104,13 @@ uses the .Xr system 3 subroutine to execute the command line. .Pp +.Xr pccardd 8 +will use syslog to annonce the insertion and removal of cards. +It uses either the string set by the +.Em logstr +command, or the manufacturer and card version strings if none has +been set. +.Pp Numeric values may be expressed as octal, hex or decimal. If a decimal number has .Em k @@ -146,6 +153,7 @@ The syntax for card identifiers is: .Dl ether Ar offset .Dl insert Ar command .Dl remove Ar command +.Dl logstr Ar string .Pp The first line is mandatory; the latter statements are optional and can appear in @@ -201,6 +209,15 @@ and .Em remove commands are allowed, and they are executed in the order they are listed. +.Pp +The +.Em logstr +command allows the user to set the string to be logged when this card is +inserted or removed. +If +.Em logstr +isn't specified, then the manufacturer and +card version strings from the CIS are used to synthesize the string issued. .Ss "Wildcard entries" Following two wildcard entries of card identifiers are available for generic type of the cards: |
