mirror of
http://cgit.git.savannah.gnu.org/git/grub.git
synced 2026-04-28 06:33:17 +00:00
Compare commits
5 Commits
eaa3b8f0f9
...
ce6f2b57f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce6f2b57f5 | ||
|
|
9f4a586f12 | ||
|
|
b71ae6db28 | ||
|
|
675d858103 | ||
|
|
170221b355 |
@@ -409,7 +409,7 @@ badram_iter (grub_uint64_t addr, grub_uint64_t size,
|
||||
*/
|
||||
while (high - low > 1)
|
||||
{
|
||||
cur = (low + high) / 2;
|
||||
cur = low + (high - low) / 2;
|
||||
if (fill_mask (entry, cur) >= addr)
|
||||
high = cur;
|
||||
else
|
||||
|
||||
@@ -488,8 +488,11 @@ check_hba_identifiers (const char *sysfs_path, int *vendor, int *device_id)
|
||||
static void
|
||||
check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||
{
|
||||
char *ed = strstr (sysfs_path, "end_device");
|
||||
char *p, *q, *path;
|
||||
const char *ed = strstr (sysfs_path, "end_device");
|
||||
int p_len;
|
||||
int ed_len;
|
||||
const char *q;
|
||||
char *path;
|
||||
char phy[21];
|
||||
int fd;
|
||||
size_t path_size;
|
||||
@@ -498,20 +501,16 @@ check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||
return;
|
||||
|
||||
/* SAS devices are identified using disk@$PHY_ID */
|
||||
p = xstrdup (sysfs_path);
|
||||
ed = strstr(p, "end_device");
|
||||
if (!ed)
|
||||
return;
|
||||
|
||||
q = ed;
|
||||
while (*q && *q != '/')
|
||||
q++;
|
||||
*q = '\0';
|
||||
p_len = (int) (q - sysfs_path);
|
||||
ed_len = (int) (q - ed);
|
||||
|
||||
path_size = (strlen (p) + strlen (ed)
|
||||
+ sizeof ("%s/sas_device/%s/phy_identifier"));
|
||||
path_size = (p_len + ed_len + sizeof ("/sas_device//phy_identifier"));
|
||||
path = xmalloc (path_size);
|
||||
snprintf (path, path_size, "%s/sas_device/%s/phy_identifier", p, ed);
|
||||
snprintf (path, path_size, "%.*s/sas_device/%.*s/phy_identifier", p_len,
|
||||
sysfs_path, ed_len, ed);
|
||||
fd = open (path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
||||
@@ -524,7 +523,8 @@ check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||
|
||||
sscanf (phy, "%d", tgt);
|
||||
|
||||
snprintf (path, path_size, "%s/sas_device/%s/sas_address", p, ed);
|
||||
snprintf (path, path_size, "%.*s/sas_device/%.*s/sas_address", p_len,
|
||||
sysfs_path, ed_len, ed);
|
||||
fd = open (path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
||||
@@ -535,7 +535,6 @@ check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||
sscanf (phy, "%lx", sas_address);
|
||||
|
||||
free (path);
|
||||
free (p);
|
||||
close (fd);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ char *
|
||||
grub_util_guess_bios_drive (const char *orig_path)
|
||||
{
|
||||
char *canon;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
canon = grub_canonicalize_file_name (orig_path);
|
||||
if (!canon)
|
||||
return NULL;
|
||||
@@ -99,7 +99,7 @@ char *
|
||||
grub_util_guess_efi_drive (const char *orig_path)
|
||||
{
|
||||
char *canon;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
canon = grub_canonicalize_file_name (orig_path);
|
||||
if (!canon)
|
||||
return NULL;
|
||||
@@ -128,7 +128,7 @@ char *
|
||||
grub_util_guess_baremetal_drive (const char *orig_path)
|
||||
{
|
||||
char *canon;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
canon = grub_canonicalize_file_name (orig_path);
|
||||
if (!canon)
|
||||
return NULL;
|
||||
|
||||
@@ -138,12 +138,12 @@ read_dep_list (FILE *fp)
|
||||
static char *
|
||||
get_module_name (const char *str)
|
||||
{
|
||||
char *base;
|
||||
char *ext;
|
||||
const char *base;
|
||||
const char *ext;
|
||||
|
||||
base = strrchr (str, '/');
|
||||
if (! base)
|
||||
base = (char *) str;
|
||||
base = str;
|
||||
else
|
||||
base++;
|
||||
|
||||
@@ -164,9 +164,9 @@ get_module_name (const char *str)
|
||||
static char *
|
||||
get_module_path (const char *prefix, const char *str)
|
||||
{
|
||||
char *dir;
|
||||
const char *dir;
|
||||
char *base;
|
||||
char *ext;
|
||||
const char *ext;
|
||||
char *ret;
|
||||
|
||||
ext = strrchr (str, '.');
|
||||
|
||||
Reference in New Issue
Block a user