Index: lib/libcam/cam.3 =================================================================== --- lib/libcam/cam.3 (revision 213542) +++ lib/libcam/cam.3 (working copy) @@ -190,12 +190,6 @@ Once the device name and unit number are determined, a lookup is performed to determine the passthrough device that corresponds to the given device. -.Fn cam_open_device -is rather simple to use, but it is not really suitable for general use -because its behavior is not necessarily deterministic. -Programmers writing -new applications should make the extra effort to use one of the other open -routines documented below. .Pp .Fn cam_open_spec_device opens the @@ -351,22 +345,17 @@ .Fa unit , respectively. .Fn cam_get_device -can handle strings of the following forms, at least: +can handle strings of the following forms: .Pp .Bl -tag -width 1234 -compact -.It /dev/foo0a -.It /dev/foo1s2c +.It /dev/foo1 .It foo0 -.It foo0a -.It nfoo0 .El .Pp .Fn cam_get_device is provided as a convenience function for applications that need to provide functionality similar to .Fn cam_open_device . -Programmers are encouraged to use more deterministic methods of obtaining -device names and unit numbers if possible. .Sh RETURN VALUES .Fn cam_open_device , .Fn cam_open_spec_device , Index: lib/libcam/camlib.c =================================================================== --- lib/libcam/camlib.c (revision 213542) +++ lib/libcam/camlib.c (working copy) @@ -102,15 +102,9 @@ /* * Take a device name or path passed in by the user, and attempt to figure - * out the device name and unit number. Some possible device name formats are: - * /dev/foo0a - * /dev/rfoo0a - * /dev/rfoos2c + * out the device name and unit number. Possible device name formats are: + * /dev/foo0 * foo0 - * foo0a - * rfoo0 - * rfoo0a - * nrfoo0 * * If the caller passes in an old style device name like 'sd' or 'st', * it will be converted to the new style device name based upon devmatchtable @@ -163,65 +157,10 @@ } /* - * Check to see whether the user has given us a nonrewound tape - * device. + * We should have just a device name and unit number. + * That means there must be at least 2 characters. + * If we only have 1, we don't have a valid device name. */ - if (*tmpstr == 'n') - tmpstr++; - - if (*tmpstr == '\0') { - sprintf(cam_errbuf, "%s: no text after leading 'n'", func_name); - free(newpath); - return(-1); - } - - /* - * See if the user has given us a character device. - */ - if (*tmpstr == 'r') - tmpstr++; - - if (*tmpstr == '\0') { - sprintf(cam_errbuf, "%s: no text after leading 'r'", func_name); - free(newpath); - return(-1); - } - - /* - * Try to get rid of any trailing white space or partition letters. - */ - tmpstr2 = &tmpstr[strlen(tmpstr) - 1]; - - while ((*tmpstr2 != '\0') && (tmpstr2 > tmpstr) &&(!isdigit(*tmpstr2))){ - *tmpstr2 = '\0'; - tmpstr2--; - } - - /* - * Check to see whether we have been given a partition with a slice - * name. If so, get rid of the slice name/number. - */ - if (strlen(tmpstr) > 3) { - /* - * Basically, we're looking for a string that ends in the - * following general manner: 1s1 -- a number, the letter - * s, and then another number. This indicates that the - * user has given us a slice. We substitute nulls for the - * s and the slice number. - */ - if ((isdigit(tmpstr[strlen(tmpstr) - 1])) - && (tmpstr[strlen(tmpstr) - 2] == 's') - && (isdigit(tmpstr[strlen(tmpstr) - 3]))) { - tmpstr[strlen(tmpstr) - 1] = '\0'; - tmpstr[strlen(tmpstr) - 1] = '\0'; - } - } - - /* - * After we nuke off the slice, we should have just a device name - * and unit number. That means there must be at least 2 - * characters. If we only have 1, we don't have a valid device name. - */ if (strlen(tmpstr) < 2) { sprintf(cam_errbuf, "%s: must have both device name and unit number",