feature(PCI) 6 January 1993 feature(PCI) Name feature, feature_exists, feature_list - get features supported by a virtual drive Syntax #include <pcilib.h> #include <memmdl.h> char *feature_list(drive) int drive; char *feature(drive, token) int drive; char *token; int *feature_exists(drive, token, version) int drive; char *token, *version; Description featurelist() returns a pointer to a null-terminated string containing feature version information of the form: "token=version[,token=version...]" For example, the feature list could appear as: "F=1,PCI=3.2.0,LCSTBL=8859" feature() calls featurelist() as a subroutine, and returns a pointer to a null-terminated version string corresponding to a ``token=version'' pair in the string returned by featurelist(). featureexists() calls feature() as a subroutine and returns 1 if the specified token is paired with the specified version in the string returned by feature(); otherwise, it returns 0. If called with version set to NULL, featureexists() returns 1 if the specified token exists at all in the string returned by featurelist(). drive is the drive number of the host whose feature list is being requested. Drive letters and numbers correspond in the following way: A:= 1, B:= 2, and so forth. A value of 0 indicates the local bridge. In Version 3.2 or greater, the LCSTBL feature is present and returns the UNIX operating system code set associated with the virtual drive. The feature PCI or MERGE returns the or Merge version number of the local bridge. This can also be used to determine if an application is running under or Merge. Any other features not documented here are for internal use only. Diagnostics If the server specified does not support feature-version list swapping, featurelist() returns a pointer to a null string (""). If the drive specified does not refer to the local bridge device or a connected remote server, or if the local bridge does not support feature-version list swapping, featurelist() returns NULL. If the token specified cannot be found in the string returned by fea- turelist(), or if featurelist() returns NULL for the drive specified, feature() returns NULL. If feature() returns NULL for the drive and token specified, fea- tureexists() returns 0. Warning The return values of feature() and featurelist() point to internal data areas that should not be corrupted. Furthermore, these pointers should not be relied upon after subsequent calls to any of these routines. Example Using the sample program below, the following queries on a virtual drive connected to a system running 2.1 virtual drive connected to a system running 3.1 would display the responses shown: Query: feature d: PCI Response: Feature PCI is 3.2.0 Query: feature d: Response: Feature list of D: is F=1,PCI=3.2.0,LCSTBL=8859 Query: feature 0 MERGE Response: Feature MERGE does not exist Query: feature 0 PCI 3.2.0 Response: Feature PCI=3.2.0 exists Source code: #include <stdio.h> #include <ctype.h> #include <pcilib.h> main(argc, argv) int argc; char **argv; { char *res; int ires; int host; char *token; char *vers; if (argc < 2) { printf("usage: feature host [token [vers]]\n"); exit(1); } host = 0; token = NULL; vers = NULL; argv++; if (isdigit(**argv)) sscanf(*argv, "%d", &host); else host = tolower(**argv) - 'a' + 1; if (argc >= 3) token = *++argv; if (argc >= 4) { vers = *++argv; ires = feature_exists(host, token, vers); printf("Feature %s=%s %s\n", token, vers, ires ? "exists" : "does not exist"); exit(0); } if (argc == 3) { res = feature(host, token); if (res != NULL) printf("Feature %s is %s\n", token, res); else printf("Feature %s does not exist\n", token); } else { res = feature_list(host); if (res != NULL) printf("Feature list of %c: is %s\n", host+'@', res); else printf("Feature list does not exist on %c\n", host+'@'); } }