/* search.c - search devices based on a file or a filesystem label */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/partition.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct cache_entry
{
char *key;
char *value;
};
void
{
int count = 0;
int is_cache = 0;
auto int iterate_device (const char *name);
{
int found = 0;
/* Skip floppy drives when requested. */
if (no_floppy &&
return 0;
#ifdef DO_SEARCH_FS_UUID
#else
#define compare_fn grub_strcmp
#endif
#ifdef DO_SEARCH_FILE
{
char *buf;
const char *tempkey;
tempkey++;
else
if (! buf)
return 1;
if (file)
{
found = 1;
}
}
#else
{
/* SEARCH_FS_UUID or SEARCH_LABEL */
char *quid;
if (dev)
{
#ifdef DO_SEARCH_FS_UUID
#else
#endif
{
{
found = 1;
}
}
}
}
#endif
{
if (cache_ent)
{
{
}
else
{
}
}
else
}
if (found)
{
count++;
if (var)
else
}
}
{
int ret;
if (! partition_name)
return 1;
if (!devname)
return 1;
return ret;
}
auto void try (void);
void try (void)
{
unsigned i;
break;
if (cache_ent)
{
is_cache = 1;
{
is_cache = 0;
return;
}
is_cache = 0;
/* Cache entry was outdated. Remove it. */
if (!count)
{
}
}
for (i = 0; i < nhints; i++)
{
char *end;
if (!hints[i][0])
continue;
if (*end == ',')
*end = 0;
if (iterate_device (hints[i]))
{
if (!*end)
*end = ',';
return;
}
if (!*end)
{
int ret;
if (!dev)
{
if (!*end)
*end = ',';
continue;
}
{
if (!*end)
*end = ',';
continue;
}
if (!*end)
*end = ',';
if (ret)
return;
}
}
}
/* First try without autoloading if we're setting variable. */
if (var)
{
try ();
/* Restore autoload hook. */
/* Retry with autoload if nothing found. */
try ();
}
else
try ();
}
static grub_err_t
char **args)
{
if (argc == 0)
return grub_errno;
}
#ifdef DO_SEARCH_FILE
#elif defined (DO_SEARCH_FS_UUID)
#else
#endif
{
cmd =
N_("NAME [VARIABLE] [HINTS]"),
}
#ifdef DO_SEARCH_FILE
#elif defined (DO_SEARCH_FS_UUID)
#else
#endif
{
}