From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NPFH3-0008TD-Rc for mharc-grub-devel@gnu.org; Mon, 28 Dec 2009 08:04:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NPFH2-0008T8-9s for grub-devel@gnu.org; Mon, 28 Dec 2009 08:04:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NPFGx-0008RG-MY for grub-devel@gnu.org; Mon, 28 Dec 2009 08:04:35 -0500 Received: from [199.232.76.173] (port=38414 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPFGx-0008RD-KF for grub-devel@gnu.org; Mon, 28 Dec 2009 08:04:31 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:53727) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NPFGx-0002S0-86 for grub-devel@gnu.org; Mon, 28 Dec 2009 08:04:31 -0500 Received: by bwz7 with SMTP id 7so7193692bwz.26 for ; Mon, 28 Dec 2009 05:04:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type; bh=DvV+xL//tRq+tD55QA66uYvXog7wYwoOoykC16ESj0k=; b=ZFb4t+QgG9LSOzLlHqw2KkE9A1rlyrPzGZ5uR9VtWLiQRpDhklsRCrjCewnTPvwy5S ULEBwlYFvCoIm5SEmoWuoIi+YYGuyzifZ+Lc86CgdTPAEXjdPA1EMQlCzhs2dVErxl5Y E6Gvw5Sva617FfwH3c9wx7RC7CIlgEcHfzXp0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=ZRkUDKB+R02/yosaLnmTylGnPp2UVzQkiXPlSzn4qar4XxGRB7WZzfaGtyxDeiiOot ilIywJxs+PQkQayupIFvVW8HEuXkwgQUbDX3D2+nwCDzVsSbQpFgQXfifYbQluDrA0ms gYgDMnBdNNOuDWTeL90yz/nkf/pTSgpXLq5sM= Received: by 10.204.13.215 with SMTP id d23mr6654719bka.18.1262005469015; Mon, 28 Dec 2009 05:04:29 -0800 (PST) Received: from debian.bg45.phnet (251-94.2-85.cust.bluewin.ch [85.2.94.251]) by mx.google.com with ESMTPS id 14sm3364863bwz.1.2009.12.28.05.04.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Dec 2009 05:04:28 -0800 (PST) Message-ID: <4B38ACD2.8030507@gmail.com> Date: Mon, 28 Dec 2009 14:04:18 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GRUB 2 X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig0FC3C6BD0F842F6AA887A856" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH] Search hinting support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 13:04:36 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0FC3C6BD0F842F6AA887A856 Content-Type: multipart/mixed; boundary="------------000608020003090301000408" This is a multi-part message in MIME format. --------------000608020003090301000408 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------000608020003090301000408 Content-Type: text/x-diff; name="hints.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="hints.diff" =3D=3D=3D modified file 'commands/search.c' --- commands/search.c 2009-12-25 23:50:59 +0000 +++ commands/search.c 2009-12-28 13:02:23 +0000 @@ -30,7 +30,8 @@ #include =20 void -FUNC_NAME (const char *key, const char *var, int no_floppy) +FUNC_NAME (const char *key, const char *var, int no_floppy, + const char **hints, unsigned nhints) { int count =3D 0; char *buf =3D NULL; @@ -118,22 +119,32 @@ return (found && var); } =20 + auto void try (void); + void try (void) =20 + { + unsigned i; + for (i =3D 0; i < nhints; i++) + if (iterate_device (hints[i])) + return; + grub_device_iterate (iterate_device); + } + /* First try without autoloading if we're setting variable. */ if (var) { saved_autoload =3D grub_fs_autoload_hook; grub_fs_autoload_hook =3D 0; - grub_device_iterate (iterate_device); + try (); =20 /* Restore autoload hook. */ grub_fs_autoload_hook =3D saved_autoload; =20 /* Retry with autoload if nothing found. */ if (grub_errno =3D=3D GRUB_ERR_NONE && count =3D=3D 0) - grub_device_iterate (iterate_device); + try (); } else - grub_device_iterate (iterate_device); + try (); =20 grub_free (buf); =20 @@ -148,7 +159,8 @@ if (argc =3D=3D 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified"); =20 - FUNC_NAME (args[0], argc =3D=3D 1 ? 0 : args[1], 0); + FUNC_NAME (args[0], argc =3D=3D 1 ? 0 : args[1], 0, (const char **) (a= rgs + 2), + argc > 2 ? argc - 2 : 0); =20 return grub_errno; } @@ -165,7 +177,7 @@ { cmd =3D grub_register_command (COMMAND_NAME, grub_cmd_do_search, - "NAME [VARIABLE]", + "NAME [VARIABLE] [HINTS]", "Search devices by " SEARCH_TARGET "." " If VARIABLE is specified, " "the first device found is set to a variable."); =3D=3D=3D modified file 'commands/search_wrap.c' --- commands/search_wrap.c 2009-12-25 22:06:52 +0000 +++ commands/search_wrap.c 2009-12-28 13:02:23 +0000 @@ -62,11 +62,14 @@ var =3D state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root"; =20 if (state[SEARCH_LABEL].set) - grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set); + grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set,=20 + (const char **) (args + 1), argc - 1); else if (state[SEARCH_FS_UUID].set) - grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set); + grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set, + (const char **) (args + 1), argc - 1); else if (state[SEARCH_FILE].set) - grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set); + grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set,=20 + (const char **) (args + 1), argc - 1); else return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search typ= e"); =20 @@ -80,7 +83,7 @@ cmd =3D grub_register_extcmd ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH, - N_("search [-f|-l|-u|-s|-n] NAME"), + N_("[-f|-l|-u|-s|-n] NAME [HINTS]"), N_("Search devices by file, filesystem label" " or filesystem UUID." " If --set is specified, the first device found is" =3D=3D=3D modified file 'include/grub/search.h' --- include/grub/search.h 2009-11-23 20:15:44 +0000 +++ include/grub/search.h 2009-12-28 13:02:23 +0000 @@ -19,8 +19,11 @@ #ifndef GRUB_SEARCH_HEADER #define GRUB_SEARCH_HEADER 1 =20 -void grub_search_fs_file (const char *key, const char *var, int no_flopp= y); -void grub_search_fs_uuid (const char *key, const char *var, int no_flopp= y); -void grub_search_label (const char *key, const char *var, int no_floppy)= ; +void grub_search_fs_file (const char *key, const char *var, int no_flopp= y, + const char **hints, unsigned nhints); +void grub_search_fs_uuid (const char *key, const char *var, int no_flopp= y, + const char **hints, unsigned nhints); +void grub_search_label (const char *key, const char *var, int no_floppy,= + const char **hints, unsigned nhints); =20 #endif --------------000608020003090301000408-- --------------enig0FC3C6BD0F842F6AA887A856 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAks4rNoACgkQNak7dOguQgmLhwD/ZRZ5ocZBjGM/wOwnGFMIRF6o HAo4/xFe08YhqsGysR4A/2Xkml0KX00J1FVnmHNxqbrT3IfxP2TxG8RZT+GigRUs =4SCh -----END PGP SIGNATURE----- --------------enig0FC3C6BD0F842F6AA887A856--