* Lookup a driver by name. We match against the full device * name and unit, and against just the name. The latter gives * us a simple widlcarding by device name. On success return the * driver/hardware identifier; otherwise return -1. */
| 1055 | * driver/hardware identifier; otherwise return -1. |
| 1056 | */ |
| 1057 | int |
| 1058 | crypto_find_driver(const char *match) |
| 1059 | { |
| 1060 | struct cryptocap *cap; |
| 1061 | int i, len = strlen(match); |
| 1062 | |
| 1063 | CRYPTO_DRIVER_LOCK(); |
| 1064 | for (i = 0; i < crypto_drivers_size; i++) { |
| 1065 | if (crypto_drivers[i] == NULL) |
| 1066 | continue; |
| 1067 | cap = crypto_drivers[i]; |
| 1068 | if (strncmp(match, device_get_nameunit(cap->cc_dev), len) == 0 || |
| 1069 | strncmp(match, device_get_name(cap->cc_dev), len) == 0) { |
| 1070 | CRYPTO_DRIVER_UNLOCK(); |
| 1071 | return (i); |
| 1072 | } |
| 1073 | } |
| 1074 | CRYPTO_DRIVER_UNLOCK(); |
| 1075 | return (-1); |
| 1076 | } |
| 1077 | |
| 1078 | /* |
| 1079 | * Return the device_t for the specified driver or NULL |
no test coverage detected