Skip to content

Commit

Permalink
. 改进uuid/vol函数,支持10个以上分区。
Browse files Browse the repository at this point in the history
  • Loading branch information
yaya2007 committed Feb 26, 2024
1 parent fcaebed commit 6b489ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ChangeLog_chenall.txt
@@ -1,4 +1,7 @@
更新说明:
2024-02-26 (yaya)
改进uuid/vol函数,支持10个以上分区。

2023-11-27 (yaya)
修正碎片插槽计算。
修正cdrom解析。issues #431
Expand Down
15 changes: 11 additions & 4 deletions stage2/builtins.c
Expand Up @@ -6848,8 +6848,8 @@ uuid_func (char *argument, int flags)
unsigned long part = 0xFFFFFF;
unsigned long long start, len, offset;
unsigned long type, entry1, ext_offset1;
int bsd_part;
int pc_slice;
int bsd_part = 0xff;
int pc_slice = 0xff;

// if ((drive > 10 && drive < 0x80) || (drive > (*((char *)0x475) + 0x80) && drive < 0x9f))
// continue;
Expand Down Expand Up @@ -6920,14 +6920,21 @@ uuid_func (char *argument, int flags)
}
if (! *arg)
{
grub_printf ("(%s%d%c%c%c%c):", ((drive<0x80)?"fd":(drive>=0x9f)?"":"hd"),((drive<0x80 || drive>=0x9f)?drive:(drive-0x80)), ((pc_slice==0xff)?'\0':','),((pc_slice==0xff)?'\0' :(pc_slice + '0')), ((bsd_part == 0xFF) ? '\0' : ','), ((bsd_part == 0xFF) ? '\0' : (bsd_part + 'a')));
if (drive < 0x9f)
grub_printf ("(%s%d%c%d%c%c):", ((drive<0x80)?"fd":"hd"),((drive<0x80)?drive:(drive-0x80)), ((pc_slice==0xff)?'\0':','),((pc_slice==0xff)? '\0' :pc_slice), ((bsd_part == 0xFF) ? '\0' : ','), ((bsd_part == 0xFF) ? '\0' : (bsd_part + 'a')));//2024-01-12 支持10个以上的分区
else
grub_printf ("(0x%x):", drive);

if (*uuid_found || debug)
grub_printf("%s%s is \"%s\".\n\t", ((drive<0x80)?" ":(drive>=0x9f)?" ":" "), p, ((*uuid_found) ? uuid_found : "(unsupported)"));
print_fsys_type();
}
else if (substring((char*)uuid_found,arg,1) == 0)
{
grub_sprintf(root_found,"(%s%d%c%c%c%c)", ((drive<0x80)?"fd":(drive>=0x9f)?"":"hd"),((drive<0x80 || drive>=0x9f)?drive:(drive-0x80)), ((pc_slice==0xff)?'\0':','),((pc_slice==0xff)?'\0' :(pc_slice + '0')), ((bsd_part == 0xFF) ? '\0' : ','), ((bsd_part == 0xFF) ? '\0' : (bsd_part + 'a')));
if (drive < 0x9f)
grub_sprintf(root_found,"(%s%d%c%d%c%c)", ((drive<0x80)?"fd":"hd"),((drive<0x80)?drive:(drive-0x80)), ((pc_slice==0xff)?'\0':','),((pc_slice==0xff)? '\0' :pc_slice), ((bsd_part == 0xFF) ? '\0' : ','), ((bsd_part == 0xFF) ? '\0' : (bsd_part + 'a')));//2024-01-12 支持10个以上的分区
else
grub_sprintf(root_found, "(0x%x):", drive);
goto found;
}
}
Expand Down
5 changes: 3 additions & 2 deletions stage2/fsys_ntfs.c
Expand Up @@ -1388,13 +1388,14 @@ int ntfs_mount (void)

if (valueat(mmft,0x16,unsigned short) != 0)
return 0;

#if 0
//使用'Macrorit Partition Expert'格式化,BPB的0x18、0x1A,0x1C为零! 2024-02-19
if ((unsigned short)(valueat(mmft,0x18,unsigned short) - 1) > 62)
return 0;

if ((unsigned short)(valueat(mmft,0x1A,unsigned short) - 1) > 255)
return 0;

#endif
if (valueat(mmft,0x20,unsigned long) != 0)
return 0;

Expand Down

0 comments on commit 6b489ae

Please sign in to comment.