1971 }
1972
1973 /*
1974 * Depending on the arguments given, we do one of the following:
1975 *
1976 * <none> Iterate through all pools and display information about
1977 * each one.
1978 *
1979 * -a Iterate through all pools and try to import each one.
1980 *
1981 * <id> Find the pool that corresponds to the given GUID/pool
1982 * name and import that one.
1983 *
1984 * -D Above options applies only to destroyed pools.
1985 */
1986 if (argc != 0) {
1987 char *endptr;
1988
1989 errno = 0;
1990 searchguid = strtoull(argv[0], &endptr, 10);
1991 if (errno != 0 || *endptr != '\0')
1992 searchname = argv[0];
1993 found_config = NULL;
1994
1995 /*
1996 * User specified a name or guid. Ensure it's unique.
1997 */
1998 idata.unique = B_TRUE;
1999 }
2000
2001
2002 idata.path = searchdirs;
2003 idata.paths = nsearch;
2004 idata.poolname = searchname;
2005 idata.guid = searchguid;
2006 idata.cachefile = cachefile;
2007
2008 pools = zpool_search_import(g_zfs, &idata);
2009
2010 if (pools != NULL && idata.exists &&
2011 (argc == 1 || strcmp(argv[0], argv[1]) == 0)) {
2012 (void) fprintf(stderr, gettext("cannot import '%s': "
|
1971 }
1972
1973 /*
1974 * Depending on the arguments given, we do one of the following:
1975 *
1976 * <none> Iterate through all pools and display information about
1977 * each one.
1978 *
1979 * -a Iterate through all pools and try to import each one.
1980 *
1981 * <id> Find the pool that corresponds to the given GUID/pool
1982 * name and import that one.
1983 *
1984 * -D Above options applies only to destroyed pools.
1985 */
1986 if (argc != 0) {
1987 char *endptr;
1988
1989 errno = 0;
1990 searchguid = strtoull(argv[0], &endptr, 10);
1991 if (errno != 0 || *endptr != '\0') {
1992 searchname = argv[0];
1993 searchguid = 0;
1994 }
1995 found_config = NULL;
1996
1997 /*
1998 * User specified a name or guid. Ensure it's unique.
1999 */
2000 idata.unique = B_TRUE;
2001 }
2002
2003
2004 idata.path = searchdirs;
2005 idata.paths = nsearch;
2006 idata.poolname = searchname;
2007 idata.guid = searchguid;
2008 idata.cachefile = cachefile;
2009
2010 pools = zpool_search_import(g_zfs, &idata);
2011
2012 if (pools != NULL && idata.exists &&
2013 (argc == 1 || strcmp(argv[0], argv[1]) == 0)) {
2014 (void) fprintf(stderr, gettext("cannot import '%s': "
|