Example #1
0
void
identify(int argc, char *argv[])
{
	char	*target;

	if (argc < 2)
		identify_usage();

	while (getopt(argc, argv, "vx") != -1) ;

	/* Check that a controller or namespace was specified. */
	if (optind >= argc)
		identify_usage();

	target = argv[optind];

	optreset = 1;
	optind = 1;

	/*
	 * If device node contains "ns", we consider it a namespace,
	 *  otherwise, consider it a controller.
	 */
	if (strstr(target, NVME_NS_PREFIX) == NULL)
		identify_ctrlr(argc, argv);
	else
		identify_ns(argc, argv);
}
Example #2
0
static void
identify(int argc, char *argv[])
{
	char	*target;

	if (argc < 2)
		usage();

	while (getopt(argc, argv, "vx") != -1) ;

	target = argv[optind];

	/* Specified device node must have "nvme" in it. */
	if (strstr(argv[optind], "nvme") == NULL) {
		printf("Invalid device node '%s'.\n", argv[optind]);
		exit(EX_IOERR);
	}

	optreset = 1;
	optind = 1;

	/*
	 * If device node contains "ns", we consider it a namespace,
	 *  otherwise, consider it a controller.
	 */
	if (strstr(target, "ns") == NULL)
		identify_ctrlr(argc, argv);
	else
		identify_ns(argc, argv);
}