Chameleon

Chameleon Commit Details

Date:2010-08-22 05:12:35 (10 years 3 months ago)
Author:Azimutz
Commit:418
Parents: 417
Message:Trunk it, revs 413 --> 416.
Changes:
A/branches/azimutz/CleanCut/i386/libsaio/disk.h
A/branches/azimutz/Chazileon/i386/libsaio/disk.h
M/branches/azimutz/Chazileon/i386/libsaio/xml.c
M/branches/azimutz/CleanCut/i386/libsaio/sys.c
M/branches/azimutz/CleanCut/i386/libsaio/ntfs.h
M/branches/azimutz/Chazileon/doc/BootHelp.txt
M/branches/azimutz/Chazileon/i386/libsaio/xml.h
M/branches/azimutz/CleanCut/i386/libsaio/saio_types.h
M/branches/azimutz/Chazileon/i386/libsaio/ntfs_private.h
M/branches/azimutz/Chazileon/i386/libsaio/ntfs.c
M/branches/azimutz/CleanCut/i386/libsaio/disk.c
M/branches/azimutz/Chazileon/i386/libsaio/sys.c
M/branches/azimutz/Chazileon/i386/libsaio/ntfs.h
M/branches/azimutz/CleanCut/i386/boot2/options.c
M/branches/azimutz/CleanCut/i386/libsaio/xml.c
M/branches/azimutz/Chazileon/i386/libsaio/saio_types.h
M/branches/azimutz/CleanCut/doc/BootHelp.txt
M/branches/azimutz/CleanCut/i386/libsaio/xml.h
M/branches/azimutz/Chazileon/i386/libsaio/disk.c
M/branches/azimutz/CleanCut/i386/libsaio/ntfs_private.h
M/branches/azimutz/CleanCut/i386/libsaio/ntfs.c
M/branches/azimutz/Chazileon/i386/boot2/options.c

File differences

branches/azimutz/Chazileon/doc/BootHelp.txt
5555
5656
5757
58
59
58
59
60
6061
61
62
63
6264
6365
64
66
67
68
6569
6670
6771
Instant Menu=Yes Force displaying the partition selection menu.
Default Partition Sets the default boot partition,
=hd(x,y)| where 'x' & 'y' are the disk and partition numbers
=<UUID> or specify the selected volume UUID string.
=hd(x,y)|UUID|"Label" Specified as a disk/partition pair, an UUID, or a
label enclosed in quotes.
Hide Partition Remove unwanted partition(s) from the boot menu.
=hd(x,y) [hd(m,n)] only non mac osx boot partitions can be hidden.
=partition Specified, possibly multiple times, as hd(x,y), an
[;partition2 ...] UUID or label enclosed in quotes.
Rename Partition Rename partition(s) for the boot menu.
=hd(x,y) <alias> [;hd(m,n) <alias2> ...]
=partition <alias> Where partition is hd(x,y), UUID or label enclosed
[;partition2 <alias2> in quotes. The alias can optionally be quoted too.
...]
GUI=No Disable the GUI (enabled by default).
Boot Banner=Yes|No Show boot banner in GUI mode (enabled by default).
branches/azimutz/Chazileon/i386/libsaio/xml.c
110110
111111
112112
113
113114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
114171
115172
116173
return 0;
}
/* Function for basic XML character entities parsing */
char*
XMLDecode(const char* src)
{
typedef const struct XMLEntity {
const char* name;
size_t nameLen;
char value;
} XMLEntity;
/* This is ugly, but better than specifying the lengths by hand */
#define _e(str,c) {str,sizeof(str)-1,c}
const XMLEntity ents[] = {
_e("quot;",'"'), _e("apos;",'\''),
_e("lt;", '<'), _e("gt;", '>'),
_e("amp;", '&')
};
size_t len;
const char *s;
char *out, *o;
if ( !src || !(len = strlen(src)) || !(out = malloc(len+1)) )
return 0;
o = out;
s = src;
while (s <= src+len) /* Make sure the terminator is also copied */
{
if ( *s == '&' )
{
bool entFound = false;
int i;
s++;
for ( i = 0; i < sizeof(ents); i++)
{
if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 )
{
entFound = true;
break;
}
}
if ( entFound )
{
*o++ = ents[i].value;
s += ents[i].nameLen;
continue;
}
}
*o++ = *s++;
}
return out;
}
#if UNUSED
//==========================================================================
// XMLParseFile
branches/azimutz/Chazileon/i386/libsaio/xml.h
7373
7474
7575
76
7677
7778
7879
TagPtr XMLGetProperty( TagPtr dict, const char * key );
long XMLParseNextTag(char *buffer, TagPtr *tag);
void XMLFreeTag(TagPtr tag);
char* XMLDecode(const char *in);
//==========================================================================
// XMLParseFile
// Expects to see one dictionary in the XML file.
branches/azimutz/Chazileon/i386/libsaio/ntfs_private.h
275275
276276
277277
278
279
278
279
280
281
280282
281283
282284
cn_t bf_mftmirrcn;/* $MFTMirr cn */
u_int8_t bf_mftrecsz;/* MFT record size (clust) */
/* 0xF6 inducates 1/4 */
u_int32_t bf_ibsz;/* index buffer size */
u_int32_t bf_volsn;/* volume ser. num. */
u_int8_t reserved5[3];
u_int8_t bf_ibsz;/* index buffer size */
u_int8_t reserved6[3];
u_int64_t bf_volsn;/* volume ser. num. */
};
/*
branches/azimutz/Chazileon/i386/libsaio/ntfs.c
295295
296296
297297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
298333
299334
300335
......
307342
308343
309344
310
311
return;
}
long NTFSGetUUID(CICell ih, char *uuidStr)
{
bool NTFSProbe(const void*);
struct bootfile *boot;
void *buf = malloc(MAX_BLOCK_SIZE);
if ( !buf )
return -1;
/*
* Read the boot sector, check signatures, and do some minimal
* sanity checking. NOTE: the size of the read below is intended
* to be a multiple of all supported block sizes, so we don't
* have to determine or change the device's block size.
*/
Seek(ih, 0);
Read(ih, (long)buf, MAX_BLOCK_SIZE);
boot = (struct bootfile *) buf;
// Check for NTFS signature
if ( memcmp((void*)boot->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) != 0 )
return -1;
// Check for non-null volume serial number
if( !boot->bf_volsn )
return -1;
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X",(unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
(unsigned short)boot->bf_volsn & 0xFFFF);
return 0;
}
bool NTFSProbe(const void * buffer)
{
bool result = false;
return result;
}
branches/azimutz/Chazileon/i386/libsaio/sys.c
6363
6464
6565
66
6667
68
6769
6870
6971
......
822824
823825
824826
825
827
826828
827829
828830
829831
830
831
832
832
833
834
835
836
837
838
839
840
841
833842
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853843
854844
855845
856846
857847
858848
859
860849
861850
862851
......
10781067
10791068
10801069
1070
10811071
10821072
1083
1084
1073
1074
1075
10851076
10861077
10871078
10881079
1089
1080
1081
1082
1083
10901084
1091
1092
1093
1085
1086
10941087
10951088
1096
1089
10971090
#include "libsaio.h"
#include "boot.h"
#include "bootstruct.h"
#include "disk.h"
#include "ramdisk.h"
#include "xml.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
# include <Kernel/libkern/crypto/md5.h>
#else
return bvr;
/*
* Checking "Default Partition" key in system configuration - use format: hd(x,y) or the volume UUID -
* Checking "Default Partition" key in system configuration - use format: hd(x,y), the volume UUID or label -
* to override the default selection.
* We accept only kBVFlagSystemVolume or kBVFlagForeignBoot volumes.
*/
const char * val;
char testStr[64];
int cnt;
char *val = XMLDecode(getStringForKey(kDefaultPartitionKey, &bootInfo->bootConfig));
if (val) {
for ( bvr = chain; bvr; bvr = bvr->next ) {
if (matchVolumeToString(bvr, val, false)) {
free(val);
return bvr;
}
}
free(val);
}
if (getValueForKey(kDefaultPartitionKey, &val, &cnt, &bootInfo->bootConfig) && cnt >= 7 && filteredChain)
{
for ( bvr = chain; bvr; bvr = bvr->next )
{
if ( bvr->biosdev >= 0x80 && bvr->biosdev < 0x100
&& ( bvr->flags & ( kBVFlagSystemVolume|kBVFlagForeignBoot ) ) )
{
// Trying to match hd(x,y) format.
sprintf(testStr, "hd(%d,%d)", bvr->biosdev - 0x80, bvr->part_no);
if (strcmp(testStr, val) == 0)
return bvr;
// Trying to match volume UUID.
if (bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0 && strcmp(testStr, val) == 0)
return bvr;
}
}
}
/*
* Scannig the volume chain backwards and trying to find
* a HFS+ volume with valid boot record signature.
* If not found any active partition then we will
* select this volume as the boot volume.
*/
for ( bvr = chain; bvr; bvr = bvr->next )
{
if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) foundPrimary = true;
//==========================================================================
// getDeviceDescription() - Extracts unit number and partition number
// from bvr structure into "dw(u,p)" format.
// Returns length of the out string
int getDeviceDescription(BVRef bvr, char *str)
{
const struct devsw *dp;
if(!str)
return 0;
*str = '\0';
if (bvr)
{
for (dp = devsw; dp->name && bvr->biosdev >= dp->biosdev; dp++);
const struct devsw *dp = devsw;
while(dp->name && bvr->biosdev >= dp->biosdev)
dp++;
dp--;
if (dp->name) sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
return true;
if (dp->name)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
return false;
return 0;
}
branches/azimutz/Chazileon/i386/libsaio/ntfs.h
2222
2323
2424
25
25
extern void NTFSGetDescription(CICell ih, char *str, long strMaxLen);
extern bool NTFSProbe (const void *buf);
extern long NTFSGetUUID(CICell ih, char *uuidStr);
branches/azimutz/Chazileon/i386/libsaio/disk.c
6767
6868
6969
70
71
72
7073
7174
7275
......
874877
875878
876879
877
880
881
878882
879883
880884
......
15481552
15491553
15501554
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1555
1556
1557
1558
16111559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
16121630
1613
1614
1615
1616
1617
1618
1631
1632
1633
1634
1635
1636
16191637
16201638
1621
1622
1639
1640
1641
1642
16231643
16241644
16251645
......
16691689
16701690
16711691
1672
1673
1692
16741693
1675
1676
1677
1678
1694
16791695
1680
1696
1697
1698
1699
16811700
1682
1683
1701
1702
16841703
1685
1686
1687
1688
1704
1705
16891706
1690
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
16911750
16921751
1693
1752
1753
16941754
1695
1696
1697
1698
1699
1700
1701
1702
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
17031819
1820
1821
1822
1823
17041824
1705
1706
1707
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
17081836
1709
1710
1837
1838
1839
1840
1841
1842
1843
1844
17111845
1846
1847
1848
1849
1850
1851
1852
17121853
17131854
17141855
17151856
17161857
1717
1718
1719
1858
1859
1860
17201861
1721
1722
1723
17241862
17251863
1726
1727
1728
1729
1730
1731
1732
1733
1734
1864
1865
1866
1867
1868
1869
1870
1871
1872
17351873
1736
1737
1738
1874
17391875
1740
1876
17411877
17421878
17431879
#include "msdos.h"
#include "ext2fs.h"
#include "xml.h"
#include "disk.h"
#include <limits.h>
#include <IOKit/storage/IOApplePartitionScheme.h>
#include <IOKit/storage/IOGUIDPartitionScheme.h>
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
NTFSGetUUID,
NTFSGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count)
{
BVRef chain = NULL;
BVRef bvr = NULL;
BVRef newBVR = NULL;
BVRef prevBVR = NULL;
struct DiskBVMap * map = NULL;
int bvCount = 0;
const char *val;
char devsw[12];
int len;
// Traverse gDISKBVmap to get references for
// individual bvr chains of each drive.
for (map = gDiskBVMap; map; map = map->next)
{
for (bvr = map->bvr; bvr; bvr = bvr->next)
{
// Save the last bvr.
if (newBVR) prevBVR = newBVR;
// Allocate and copy the matched bvr entry into a new one.
newBVR = (BVRef) malloc(sizeof(*newBVR));
bcopy(bvr, newBVR, sizeof(*newBVR));
// Adjust the new bvr's fields.
newBVR->next = NULL;
newBVR->filtered = true;
if ((!allowFlags || newBVR->flags & allowFlags) &&
(!denyFlags || !(newBVR->flags & denyFlags) ) &&
(newBVR->biosdev >= minBIOSDev && newBVR->biosdev <= maxBIOSDev))
{
newBVR->visible = true;
}
// Looking for "Hide Partition" entries in "hd(x,y) hd(n,m)" format
// to be able to hide foreign partitions from the boot menu.
if ((newBVR->flags & kBVFlagForeignBoot) &&
getValueForKey(kHidePartitionKey, &val, &len, &bootInfo->bootConfig))
{
sprintf(devsw, "hd(%d,%d)", BIOS_DEV_UNIT(newBVR), newBVR->part_no);
if (strstr(val, devsw) != NULL)
{
newBVR->visible = false;
}
}
// Use the first bvr entry as the starting chain pointer.
if (!chain)
chain = newBVR;
// Update the previous bvr's link pointer to use the new memory area.
if (prevBVR)
prevBVR->next = newBVR;
if (newBVR->visible)
bvCount++;
}
}
BVRef chain = NULL;
BVRef bvr = NULL;
BVRef newBVR = NULL;
BVRef prevBVR = NULL;
struct DiskBVMap * map = NULL;
int bvCount = 0;
const char *raw = 0;
char* val = 0;
int len;
getValueForKey(kHidePartitionKey, &raw, &len, &bootInfo->bootConfig);
if(raw)
{
val = XMLDecode(raw);
}
/*
* Traverse gDISKBVmap to get references for
* individual bvr chains of each drive.
*/
for (map = gDiskBVMap; map; map = map->next)
{
for (bvr = map->bvr; bvr; bvr = bvr->next)
{
/*
* Save the last bvr.
*/
if (newBVR) prevBVR = newBVR;
/*
* Allocate and copy the matched bvr entry into a new one.
*/
newBVR = (BVRef) malloc(sizeof(*newBVR));
bcopy(bvr, newBVR, sizeof(*newBVR));
/*
* Adjust the new bvr's fields.
*/
newBVR->next = NULL;
newBVR->filtered = true;
if ( (!allowFlags || newBVR->flags & allowFlags)
&& (!denyFlags || !(newBVR->flags & denyFlags) )
&& (newBVR->biosdev >= minBIOSDev && newBVR->biosdev <= maxBIOSDev)
)
newBVR->visible = true;
/* Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format
* to be able to hide foreign partitions from the boot menu.
*/
if ( (newBVR->flags & kBVFlagForeignBoot) )
{
if(val && matchVolumeToString(newBVR, val, true))
newBVR->visible = false;
}
/*
* Use the first bvr entry as the starting chain pointer.
*/
if (!chain)
chain = newBVR;
/*
* Update the previous bvr's link pointer to use the new memory area.
*/
if (prevBVR)
prevBVR->next = newBVR;
if (newBVR->visible)
bvCount++;
}
}
#if DEBUG
for (bvr = chain; bvr; bvr = bvr->next)
{
printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible);
}
printf("count: %d\n", bvCount);
getc();
for (bvr = chain; bvr; bvr = bvr->next)
{
printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible);
}
printf("count: %d\n", bvCount);
getc();
#endif
*count = bvCount;
return chain;
*count = bvCount;
free(val);
return chain;
}
int freeFilteredBVChain(const BVRef chain)
//==========================================================================
/* If Rename Partition has defined an alias, then extract it for description purpose */
static const char * getVolumeLabelAlias( BVRef bvr, const char * str, long strMaxLen)
static char * matchStrings(const char * str1, const char * str2, bool matchPartial)
{
const int MAX_ALIAS_SIZE=31;
static char szAlias[MAX_ALIAS_SIZE+1];
char *q=szAlias;
const char * szAliases = getStringForKey(kRenamePartitionKey, &bootInfo->bootConfig);
char * ret = NULL;
if (!str || !*str || !szAliases) return 0; // no renaming wanted
if (matchPartial)
ret = strstr(str1, str2);
else if (!strcmp(str1, str2))
ret = (char *)str1;
const char * p = strstr(szAliases, str);
if(!p || !(*p)) return 0; // this volume must not be renamed, or option is malformed
if(ret)
ret += strlen(str2);
p+= strlen(str); // skip the "hd(n,m) " field
// multiple aliases can be found separated by a semicolon.
while(*p && *p != ';' && q<(szAlias+MAX_ALIAS_SIZE)) *q++=*p++;
*q='\0';
return ret;
}
return szAlias;
char * matchVolumeToString(BVRef bvr, const char * match, bool matchPartial)
{
char testStr[128];
char tempStr[128];
char * ret = NULL;
int len = 0;
*tempStr = '\0';
if ( !bvr || !match || !*match)
return NULL;
if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100
|| !(bvr->flags & (kBVFlagSystemVolume|kBVFlagForeignBoot)) )
return NULL;
// Try to match hd(x,y) first.
sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
// Try to match volume UUID.
if ( bvr->fs_getuuid && !(bvr->fs_getuuid(bvr, testStr)) )
{
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
}
// Try to match volume label (always quoted).
if (bvr->description)
{
// Gather volume label into tempStr.
bvr->description(bvr, tempStr, sizeof(tempStr) - 1);
len = strlen(tempStr);
if (len == 0)
return NULL;
sprintf(testStr, "\"%s\"", tempStr);
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
}
return NULL;
}
void getBootVolumeDescription( BVRef bvr, char * str, long strMaxLen, bool verbose )
/* If Rename Partition has defined an alias, then extract it for description purpose */
bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen)
{
unsigned char type = (unsigned char) bvr->part_type;
char *p;
p = str;
if (verbose) {
getDeviceDescription(bvr, str);
strcat(str, " ");
for (; strMaxLen > 0 && *p != '\0'; p++, strMaxLen--);
/* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
*/
char *aliasList, *next;
if ( !str || strMaxLen <= 0)
return false;
aliasList = XMLDecode(getStringForKey(kRenamePartitionKey, &bootInfo->bootConfig));
if ( !aliasList )
return false;
next = aliasList;
while ( next && *next )
{
char *start, *aliasStart, *aliasEnd;
char *ret;
start = aliasStart = (char*)matchVolumeToString(bvr, next, true);
if ( !start || !*start )
break;
/* Find and delimit the current entry's end */
next = strstr(start, ";");
if ( next )
{
/* Not enough characters for a successful match: we'd need at least
* one space and another char. before the semicolon
*/
if ( next-start < 2 ) {
next++;
continue;
}
*next = '\0';
next++;
}
/* Check for at least one space, but ignore the rest of them */
while ( isspace(*aliasStart) )
aliasStart++;
if ( start == aliasStart )
continue;
switch ( *aliasStart )
{
case '\0':
break;
case '"':
/* If a starting quote is found, skip it, then find the ending one,
* and replace it for a string terminator.
*/
aliasStart++;
aliasEnd = strstr(aliasStart, "\"");
if ( !aliasEnd || aliasStart == aliasEnd )
break;
*aliasEnd = '\0';
default:
ret = strncpy(str, aliasStart, strMaxLen);
free(aliasList);
return ret != 0;
}
}
free(aliasList);
return false;
}
// See if we should get the renamed alias name for this partion:
const char * szAliasName = getVolumeLabelAlias(bvr, str, strMaxLen);
if (szAliasName && *szAliasName)
void getBootVolumeDescription( BVRef bvr, char * str, long strMaxLen, bool useDeviceDescription )
{
unsigned char type;
char *p = str;
if(!bvr || !p || strMaxLen <= 0)
return;
type = (unsigned char) bvr->part_type;
if (useDeviceDescription)
{
strncpy(bvr->label, szAliasName, strMaxLen);
return; // we're done here no need to seek for real name
int len = getDeviceDescription(bvr, str);
if(len >= strMaxLen)
return;
strcpy(str + len, " ");
len++;
strMaxLen -= len;
p += len;
}
/* See if a partition rename is preferred */
if(getVolumeLabelAlias(bvr, p, strMaxLen)) {
verbose("Renamed: %s\n", p);
strncpy(bvr->label, p, sizeof(bvr->label) - 1);
return; // we're done here no need to seek for real name
}
//
// Get the volume label using filesystem specific functions
// or use the alternate volume label if available.
//
if (*bvr->altlabel == '\0')
{
if (bvr->description)
if (*bvr->altlabel != '\0')
strncpy(p, bvr->altlabel, strMaxLen);
else if (bvr->description)
bvr->description(bvr, p, strMaxLen);
}
else
strncpy(p, bvr->altlabel, strMaxLen);
if (*p == '\0') {
const char * name = getNameForValue( fdiskTypes, type );
if (name == NULL) {
name = bvr->type_name;
}
if (name == NULL) {
sprintf(p, "TYPE %02x", type);
} else {
strncpy(p, name, strMaxLen);
}
const char * name = getNameForValue( fdiskTypes, type );
if (name == NULL) {
name = bvr->type_name;
}
if (name == NULL) {
sprintf(p, "TYPE %02x", type);
} else {
strncpy(p, name, strMaxLen);
}
}
/* See if a partion rename is wanted: */
// Set the devices label
sprintf(bvr->label, p);
strncpy(bvr->label, p, sizeof(bvr->label)-1);
}
//==========================================================================
branches/azimutz/Chazileon/i386/libsaio/disk.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
* disk.h
* Chameleon
*
* Created by Daniel Miranda on 27/07/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#ifndef __LIBSAIO_DISK_H
#define __LIBSAIO_DISK_H
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
#endif /* __LIBSAIO_DISK_H */
branches/azimutz/Chazileon/i386/libsaio/saio_types.h
136136
137137
138138
139
139
140140
141141
142142
typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
char ** name, long * flags, long * time,
FinderInfo * finderInfo, long * infoValid);
typedef long (* FSGetUUID)(CICell ih, char *uuidStr);
typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
// Can be just pointed to free or a special free function
typedef void (*BVFree)(CICell ih);
branches/azimutz/Chazileon/i386/boot2/options.c
117117
118118
119119
120
120
121121
122122
123123
......
787787
788788
789789
790
790
791791
792792
793793
......
864864
865865
866866
867
867
868868
869869
870870
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, 80, true );
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
strlcpy(prompt, val, cnt);
} else {
name = malloc(80);
getBootVolumeDescription(gBootVolume, name, 80, false);
getBootVolumeDescription(gBootVolume, name, sizeof(name) - 1, false);
prompt = malloc(256);
sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name);
free(name);
// Associate a menu item for each BVRef.
for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) {
if (bvr->visible) {
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[0].name) - 1, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;
branches/azimutz/CleanCut/doc/BootHelp.txt
5151
5252
5353
54
55
54
55
56
5657
57
58
59
5860
5961
60
62
63
64
6165
6266
6367
Instant Menu=Yes Force displaying the partition selection menu.
Default Partition Sets the default boot partition,
=hd(x,y)| where 'x' & 'y' are the disk and partition numbers
=<UUID> or specify the selected volume UUID string.
=hd(x,y)|UUID|"Label" Specified as a disk/partition pair, an UUID, or a
label enclosed in quotes.
Hide Partition Remove unwanted partition(s) from the boot menu.
=hd(x,y) [hd(m,n)] only non mac osx boot partitions can be hidden.
=partition Specified, possibly multiple times, as hd(x,y), an
[;partition2 ...] UUID or label enclosed in quotes.
Rename Partition Rename partition(s) for the boot menu.
=hd(x,y) <alias> [;hd(m,n) <alias2> ...]
=partition <alias> Where partition is hd(x,y), UUID or label enclosed
[;partition2 <alias2> in quotes. The alias can optionally be quoted too.
...]
GUI=No Disable the GUI (enabled by default).
Boot Banner=Yes|No Show boot banner in GUI mode (enabled by default).
branches/azimutz/CleanCut/i386/libsaio/xml.c
110110
111111
112112
113
113114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
114171
115172
116173
return 0;
}
/* Function for basic XML character entities parsing */
char*
XMLDecode(const char* src)
{
typedef const struct XMLEntity {
const char* name;
size_t nameLen;
char value;
} XMLEntity;
/* This is ugly, but better than specifying the lengths by hand */
#define _e(str,c) {str,sizeof(str)-1,c}
const XMLEntity ents[] = {
_e("quot;",'"'), _e("apos;",'\''),
_e("lt;", '<'), _e("gt;", '>'),
_e("amp;", '&')
};
size_t len;
const char *s;
char *out, *o;
if ( !src || !(len = strlen(src)) || !(out = malloc(len+1)) )
return 0;
o = out;
s = src;
while (s <= src+len) /* Make sure the terminator is also copied */
{
if ( *s == '&' )
{
bool entFound = false;
int i;
s++;
for ( i = 0; i < sizeof(ents); i++)
{
if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 )
{
entFound = true;
break;
}
}
if ( entFound )
{
*o++ = ents[i].value;
s += ents[i].nameLen;
continue;
}
}
*o++ = *s++;
}
return out;
}
#if UNUSED
//==========================================================================
// XMLParseFile
branches/azimutz/CleanCut/i386/libsaio/xml.h
7373
7474
7575
76
7677
7778
7879
TagPtr XMLGetProperty( TagPtr dict, const char * key );
long XMLParseNextTag(char *buffer, TagPtr *tag);
void XMLFreeTag(TagPtr tag);
char* XMLDecode(const char *in);
//==========================================================================
// XMLParseFile
// Expects to see one dictionary in the XML file.
branches/azimutz/CleanCut/i386/libsaio/ntfs_private.h
275275
276276
277277
278
279
278
279
280
281
280282
281283
282284
cn_t bf_mftmirrcn;/* $MFTMirr cn */
u_int8_t bf_mftrecsz;/* MFT record size (clust) */
/* 0xF6 inducates 1/4 */
u_int32_t bf_ibsz;/* index buffer size */
u_int32_t bf_volsn;/* volume ser. num. */
u_int8_t reserved5[3];
u_int8_t bf_ibsz;/* index buffer size */
u_int8_t reserved6[3];
u_int64_t bf_volsn;/* volume ser. num. */
};
/*
branches/azimutz/CleanCut/i386/libsaio/ntfs.c
295295
296296
297297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
298333
299334
300335
......
307342
308343
309344
310
311
return;
}
long NTFSGetUUID(CICell ih, char *uuidStr)
{
bool NTFSProbe(const void*);
struct bootfile *boot;
void *buf = malloc(MAX_BLOCK_SIZE);
if ( !buf )
return -1;
/*
* Read the boot sector, check signatures, and do some minimal
* sanity checking. NOTE: the size of the read below is intended
* to be a multiple of all supported block sizes, so we don't
* have to determine or change the device's block size.
*/
Seek(ih, 0);
Read(ih, (long)buf, MAX_BLOCK_SIZE);
boot = (struct bootfile *) buf;
// Check for NTFS signature
if ( memcmp((void*)boot->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) != 0 )
return -1;
// Check for non-null volume serial number
if( !boot->bf_volsn )
return -1;
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X",(unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
(unsigned short)boot->bf_volsn & 0xFFFF);
return 0;
}
bool NTFSProbe(const void * buffer)
{
bool result = false;
return result;
}
branches/azimutz/CleanCut/i386/libsaio/sys.c
6363
6464
6565
66
6667
68
6769
6870
6971
......
819821
820822
821823
822
824
823825
824826
825827
826
827
828
828
829
830
831
832
833
834
835
836
837
829838
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849839
850840
851841
......
10751065
10761066
10771067
1068
10781069
10791070
1080
1081
1071
1072
1073
10821074
10831075
10841076
10851077
1086
1078
1079
1080
1081
10871082
1088
1089
1090
1083
1084
10911085
10921086
1093
1087
10941088
#include "libsaio.h"
#include "boot.h"
#include "bootstruct.h"
#include "disk.h"
#include "ramdisk.h"
#include "xml.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
# include <Kernel/libkern/crypto/md5.h>
#else
return bvr;
/*
* Checking "Default Partition" key in system configuration - use format: hd(x,y) or the volume UUID -
* Checking "Default Partition" key in system configuration - use format: hd(x,y), the volume UUID or label -
* to override the default selection.
* We accept only kBVFlagSystemVolume or kBVFlagForeignBoot volumes.
*/
const char * val;
char testStr[64];
int cnt;
char *val = XMLDecode(getStringForKey(kDefaultPartition, &bootInfo->bootConfig));
if (val) {
for ( bvr = chain; bvr; bvr = bvr->next ) {
if (matchVolumeToString(bvr, val, false)) {
free(val);
return bvr;
}
}
free(val);
}
if (getValueForKey(kDefaultPartition, &val, &cnt, &bootInfo->bootConfig) && cnt >= 7 && filteredChain)
{
for ( bvr = chain; bvr; bvr = bvr->next )
{
if ( bvr->biosdev >= 0x80 && bvr->biosdev < 0x100
&& ( bvr->flags & ( kBVFlagSystemVolume|kBVFlagForeignBoot ) ) )
{
// Trying to match hd(x,y) format.
sprintf(testStr, "hd(%d,%d)", bvr->biosdev - 0x80, bvr->part_no);
if (strcmp(testStr, val) == 0)
return bvr;
// Trying to match volume UUID.
if (bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0 && strcmp(testStr, val) == 0)
return bvr;
}
}
}
/*
* Scannig the volume chain backwards and trying to find
* a HFS+ volume with valid boot record signature.
//==========================================================================
// getDeviceDescription() - Extracts unit number and partition number
// from bvr structure into "dw(u,p)" format.
// Returns length of the out string
int getDeviceDescription(BVRef bvr, char *str)
{
const struct devsw *dp;
if(!str)
return 0;
*str = '\0';
if (bvr)
{
for (dp = devsw; dp->name && bvr->biosdev >= dp->biosdev; dp++);
const struct devsw *dp = devsw;
while(dp->name && bvr->biosdev >= dp->biosdev)
dp++;
dp--;
if (dp->name) sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
return true;
if (dp->name)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
return false;
return 0;
}
branches/azimutz/CleanCut/i386/libsaio/ntfs.h
2222
2323
2424
25
25
extern void NTFSGetDescription(CICell ih, char *str, long strMaxLen);
extern bool NTFSProbe (const void *buf);
extern long NTFSGetUUID(CICell ih, char *uuidStr);
branches/azimutz/CleanCut/i386/libsaio/disk.c
6767
6868
6969
70
71
72
7073
7174
7275
......
874877
875878
876879
877
880
881
878882
879883
880884
......
12561260
12571261
12581262
1259
1263
12601264
12611265
12621266
......
15561560
15571561
15581562
1559
1560
1563
1564
15611565
1566
1567
1568
1569
1570
1571
15621572
15631573
15641574
......
15911601
15921602
15931603
1594
1595
1604
15961605
15971606
1598
1599
1600
1601
1602
1603
1604
1605
1607
1608
1609
1610
1611
16061612
16071613
16081614
......
16311637
16321638
16331639
1640
1641
16341642
16351643
16361644
......
16811689
16821690
16831691
1684
1685
1692
16861693
1687
1688
1689
1690
1694
16911695
1692
1696
1697
1698
1699
16931700
1694
1695
1701
1702
16961703
1697
1698
1699
1700
1704
1705
17011706
1702
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
17031750
17041751
1705
1752
1753
17061754
1707
1708
1709
1710
1711
1712
1713
1714
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
17151819
1820
1821
1822
1823
17161824
1717
1718
1719
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
17201836
1721
1722
1837
1838
1839
1840
1841
1842
1843
1844
17231845
1846
1847
1848
1849
1850
1851
1852
17241853
17251854
17261855
17271856
17281857
1729
1730
1731
1858
1859
1860
17321861
1733
1734
1735
17361862
17371863
1738
1739
1740
1741
1742
1743
1744
1745
1746
1864
1865
1866
1867
1868
1869
1870
1871
1872
17471873
1748
1749
1750
1874
17511875
1752
1876
17531877
17541878
17551879
#include "msdos.h"
#include "ext2fs.h"
#include "xml.h"
#include "disk.h"
#include <limits.h>
#include <IOKit/storage/IOApplePartitionScheme.h>
#include <IOKit/storage/IOGUIDPartitionScheme.h>
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
NTFSGetUUID,
NTFSGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
// NOTE: EFI_GUID's are in LE and we know we're on an x86.
// The IOGUIDPartitionScheme.cpp code uses byte-based UUIDs, we don't.
if(isPartitionUsed(gptMap))
if (isPartitionUsed(gptMap))
{
char stringuuid[100];
efi_guid_unparse_upper((EFI_GUID*)gptMap->ent_type, stringuuid);
struct DiskBVMap * map = NULL;
int bvCount = 0;
const char *val;
char devsw[12];
const char *raw = 0;
char* val = 0;
int len;
getValueForKey(kHidePartition, &raw, &len, &bootInfo->bootConfig);
if(raw)
{
val = XMLDecode(raw);
}
/*
* Traverse gDISKBVmap to get references for
)
newBVR->visible = true;
/*
* Looking for "Hide Partition" entries in "hd(x,y) hd(n,m)" format
/* Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format
* to be able to hide foreign partitions from the boot menu.
*/
if ( (newBVR->flags & kBVFlagForeignBoot)
&& getValueForKey(kHidePartition, &val, &len, &bootInfo->bootConfig)
)
{
sprintf(devsw, "hd(%d,%d)", BIOS_DEV_UNIT(newBVR), newBVR->part_no);
if (strstr(val, devsw) != NULL)
newBVR->visible = false;
}
if ( (newBVR->flags & kBVFlagForeignBoot) )
{
if(val && matchVolumeToString(newBVR, val, true))
newBVR->visible = false;
}
/*
* Use the first bvr entry as the starting chain pointer.
#endif
*count = bvCount;
free(val);
return chain;
}
//==========================================================================
/* If Rename Partition has defined an alias, then extract it for description purpose */
static const char * getVolumeLabelAlias( BVRef bvr, const char * str, long strMaxLen)
static char * matchStrings(const char * str1, const char * str2, bool matchPartial)
{
const int MAX_ALIAS_SIZE=31;
static char szAlias[MAX_ALIAS_SIZE+1];
char *q=szAlias;
const char * szAliases = getStringForKey(kRenamePartition, &bootInfo->bootConfig);
char * ret = NULL;
if (!str || !*str || !szAliases) return 0; // no renaming wanted
if (matchPartial)
ret = strstr(str1, str2);
else if (!strcmp(str1, str2))
ret = (char *)str1;
const char * p = strstr(szAliases, str);
if(!p || !(*p)) return 0; // this volume must not be renamed, or option is malformed
if(ret)
ret += strlen(str2);
p+= strlen(str); // skip the "hd(n,m) " field
// multiple aliases can be found separated by a semicolon.
while(*p && *p != ';' && q<(szAlias+MAX_ALIAS_SIZE)) *q++=*p++;
*q='\0';
return ret;
}
return szAlias;
char * matchVolumeToString(BVRef bvr, const char * match, bool matchPartial)
{
char testStr[128];
char tempStr[128];
char * ret = NULL;
int len = 0;
*tempStr = '\0';
if ( !bvr || !match || !*match)
return NULL;
if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100
|| !(bvr->flags & (kBVFlagSystemVolume|kBVFlagForeignBoot)) )
return NULL;
// Try to match hd(x,y) first.
sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
// Try to match volume UUID.
if ( bvr->fs_getuuid && !(bvr->fs_getuuid(bvr, testStr)) )
{
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
}
// Try to match volume label (always quoted).
if (bvr->description)
{
// Gather volume label into tempStr.
bvr->description(bvr, tempStr, sizeof(tempStr) - 1);
len = strlen(tempStr);
if (len == 0)
return NULL;
sprintf(testStr, "\"%s\"", tempStr);
if (ret = matchStrings(match, testStr, matchPartial))
return ret;
}
return NULL;
}
void getBootVolumeDescription( BVRef bvr, char * str, long strMaxLen, bool verbose )
/* If Rename Partition has defined an alias, then extract it for description purpose */
bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen)
{
unsigned char type = (unsigned char) bvr->part_type;
char *p;
p = str;
if (verbose) {
getDeviceDescription(bvr, str);
strcat(str, " ");
for (; strMaxLen > 0 && *p != '\0'; p++, strMaxLen--);
/* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
*/
char *aliasList, *next;
if ( !str || strMaxLen <= 0)
return false;
aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->bootConfig));
if ( !aliasList )
return false;
next = aliasList;
while ( next && *next )
{
char *start, *aliasStart, *aliasEnd;
char *ret;
start = aliasStart = (char*)matchVolumeToString(bvr, next, true);
if ( !start || !*start )
break;
/* Find and delimit the current entry's end */
next = strstr(start, ";");
if ( next )
{
/* Not enough characters for a successful match: we'd need at least
* one space and another char. before the semicolon
*/
if ( next-start < 2 ) {
next++;
continue;
}
*next = '\0';
next++;
}
/* Check for at least one space, but ignore the rest of them */
while ( isspace(*aliasStart) )
aliasStart++;
if ( start == aliasStart )
continue;
switch ( *aliasStart )
{
case '\0':
break;
case '"':
/* If a starting quote is found, skip it, then find the ending one,
* and replace it for a string terminator.
*/
aliasStart++;
aliasEnd = strstr(aliasStart, "\"");
if ( !aliasEnd || aliasStart == aliasEnd )
break;
*aliasEnd = '\0';
default:
ret = strncpy(str, aliasStart, strMaxLen);
free(aliasList);
return ret != 0;
}
}
free(aliasList);
return false;
}
// See if we should get the renamed alias name for this partion:
const char * szAliasName = getVolumeLabelAlias(bvr, str, strMaxLen);
if (szAliasName && *szAliasName)
void getBootVolumeDescription( BVRef bvr, char * str, long strMaxLen, bool useDeviceDescription )
{
unsigned char type;
char *p = str;
if(!bvr || !p || strMaxLen <= 0)
return;
type = (unsigned char) bvr->part_type;
if (useDeviceDescription)
{
strncpy(bvr->label, szAliasName, strMaxLen);
return; // we're done here no need to seek for real name
int len = getDeviceDescription(bvr, str);
if(len >= strMaxLen)
return;
strcpy(str + len, " ");
len++;
strMaxLen -= len;
p += len;
}
/* See if a partition rename is preferred */
if(getVolumeLabelAlias(bvr, p, strMaxLen)) {
verbose("Renamed: %s\n", p);
strncpy(bvr->label, p, sizeof(bvr->label) - 1);
return; // we're done here no need to seek for real name
}
//
// Get the volume label using filesystem specific functions
// or use the alternate volume label if available.
//
if (*bvr->altlabel == '\0')
{
if (bvr->description)
if (*bvr->altlabel != '\0')
strncpy(p, bvr->altlabel, strMaxLen);
else if (bvr->description)
bvr->description(bvr, p, strMaxLen);
}
else
strncpy(p, bvr->altlabel, strMaxLen);
if (*p == '\0') {
const char * name = getNameForValue( fdiskTypes, type );
if (name == NULL) {
name = bvr->type_name;
}
if (name == NULL) {
sprintf(p, "TYPE %02x", type);
} else {
strncpy(p, name, strMaxLen);
}
const char * name = getNameForValue( fdiskTypes, type );
if (name == NULL) {
name = bvr->type_name;
}
if (name == NULL) {
sprintf(p, "TYPE %02x", type);
} else {
strncpy(p, name, strMaxLen);
}
}
/* See if a partion rename is wanted: */
// Set the devices label
sprintf(bvr->label, p);
strncpy(bvr->label, p, sizeof(bvr->label)-1);
}
//==========================================================================
branches/azimutz/CleanCut/i386/libsaio/disk.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
* disk.h
* Chameleon
*
* Created by Daniel Miranda on 27/07/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#ifndef __LIBSAIO_DISK_H
#define __LIBSAIO_DISK_H
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
#endif /* __LIBSAIO_DISK_H */
branches/azimutz/CleanCut/i386/libsaio/saio_types.h
135135
136136
137137
138
138
139139
140140
141141
typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
char ** name, long * flags, long * time,
FinderInfo * finderInfo, long * infoValid);
typedef long (* FSGetUUID)(CICell ih, char *uuidStr);
typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
// Can be just pointed to free or a special free function
typedef void (*BVFree)(CICell ih);
branches/azimutz/CleanCut/i386/boot2/options.c
113113
114114
115115
116
116
117117
118118
119119
......
783783
784784
785785
786
786
787787
788788
789789
......
860860
861861
862862
863
863
864864
865865
866866
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, 80, true );
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
strlcpy(prompt, val, cnt);
} else {
name = malloc(80);
getBootVolumeDescription(gBootVolume, name, 80, false);
getBootVolumeDescription(gBootVolume, name, sizeof(name) - 1, false);
prompt = malloc(256);
sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name);
free(name);
// Associate a menu item for each BVRef.
for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) {
if (bvr->visible) {
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[0].name) - 1, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;

Archive Download the corresponding diff file

Revision: 418