Chameleon

Chameleon Commit Details

Date:2010-08-27 01:24:25 (13 years 7 months ago)
Author:Azimutz
Commit:433
Parents: 432
Message:Trunk it, revs 428 & 432.
Changes:
M/branches/azimutz/CleanCut/i386/boot2/options.c
M/branches/azimutz/CleanCut/i386/libsa/string.c
M/branches/azimutz/CleanCut/i386/libsaio/disk.h
M/branches/azimutz/Chazileon/i386/libsa/libsa.h
M/branches/azimutz/CleanCut/i386/libsa/libsa.h
M/branches/azimutz/Chazileon/i386/libsaio/disk.c
M/branches/azimutz/Chazileon/i386/libsaio/nvidia.c
M/branches/azimutz/CleanCut/i386/libsaio/disk.c
M/branches/azimutz/CleanCut/i386/libsaio/nvidia.c
M/branches/azimutz/Chazileon/i386/boot2/options.c
M/branches/azimutz/Chazileon/i386/libsa/string.c
M/branches/azimutz/Chazileon/i386/libsaio/disk.h

File differences

branches/azimutz/Chazileon/i386/libsaio/nvidia.c
291291
292292
293293
294
294
295295
296296
297297
......
323323
324324
325325
326
327
328
329
326330
327331
328332
......
337341
338342
339343
344
340345
341346
342347
......
355360
356361
357362
358
359
360
361
362363
363364
364365
{ 0x10DE0614, "GeForce 9800 GT" },
{ 0x10DE0615, "GeForce GTS 250" },
{ 0x10DE0617, "GeForce 9800M GTX" },
{ 0x10DE0618, "GeForce GTX 260M" },
{ 0x10DE0618, "GeForce GTX 260M" },
{ 0x10DE061A, "Quadro FX 3700" },
{ 0x10DE061C, "Quadro FX 3600M" },
{ 0x10DE061D, "Quadro FX 2800M" },
{ 0x10DE065A, "Quadro FX 1700M" },
{ 0x10DE065B, "GeForce 9400 GT" },
{ 0x10DE065C, "Quadro FX 770M" },
{ 0x10DE06C0, "GeForce GTX 480" },
{ 0x10DE06C4, "GeForce GTX 465" },
{ 0x10DE06CA, "GeForce GTX 480M" },
{ 0x10DE06CD, "GeForce GTX 470" },
{ 0x10DE06E0, "GeForce 9300 GE" },
{ 0x10DE06E1, "GeForce 9300 GS" },
{ 0x10DE06E4, "GeForce 8400 GS" },
{ 0x10DE06F9, "Quadro FX 370 LP" },
{ 0x10DE06FA, "Quadro NVS 450" },
{ 0x10DE06FD, "Quadro NVS 295" },
{ 0x10DE086C, "GeForce 9300/nForce 730i" },
{ 0x10DE087D, "ION 9400M" },
{ 0x10DE087E, "ION LE" },
{ 0x10DE0A20, "GeForce GT220" },
{ 0x10DE0CA8, "GeForce GTS 260M" },
{ 0x10DE0CA9, "GeForce GTS 250M" },
{ 0x10DE0CA3, "GeForce GT240" },
{ 0x10DE06C0, "GeForce GTX 480" },
{ 0x10DE06CD, "GeForce GTX 470" },
{ 0x10DE06C4, "GeForce GTX 465" },
{ 0x10DE06CA, "GeForce GTX 480M" },
{ 0x10DE0E22, "GeForce GTX 460" },
{ 0x10DE0E24, "GeForce GTX 460" },
{ 0x10DE06D1, "Tesla C2050" },// TODO: sub-device id: 0x0771
branches/azimutz/Chazileon/i386/libsaio/disk.c
16061606
16071607
16081608
1609
1610
1609
1610
1611
1612
1613
1614
1615
1616
1617
16111618
16121619
16131620
......
16891696
16901697
16911698
1692
1699
16931700
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
17091701
1710
1711
1712
1713
1714
1715
1702
17161703
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
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
17501730
17511731
1752
1753
1732
1733
1734
1735
1736
1737
17541738
1755
1756
1757
1758
1739
17591740
17601741
17611742
......
17631744
17641745
17651746
1766
1767
1768
1747
1748
1749
1750
17691751
1770
1771
1752
1753
17721754
1773
1774
1775
1776
1777
1778
1779
1755
1756
1757
17801758
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1759
1760
17911761
17921762
1793
1794
1795
1796
1763
1764
17971765
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
18181777
18191778
1820
1779
18211780
18221781
18231782
......
18461805
18471806
18481807
1849
1850
1808
18511809
18521810
18531811
......
18731831
18741832
18751833
1876
1834
18771835
18781836
18791837
*/
if ( (newBVR->flags & kBVFlagForeignBoot) )
{
if(val && matchVolumeToString(newBVR, val, true))
newBVR->visible = false;
char *start, *next = val;
long len = 0;
do
{
start = strbreak(next, &next, &len);
if(len && matchVolumeToString(newBVR, start, len) )
newBVR->visible = false;
}
while ( next && *next );
}
/*
//==========================================================================
static char * matchStrings(const char * str1, const char * str2, bool matchPartial)
bool matchVolumeToString( BVRef bvr, const char* match, long matchLen)
{
char * ret = NULL;
if (matchPartial)
ret = strstr(str1, str2);
else if (!strcmp(str1, str2))
ret = (char *)str1;
if(ret)
ret += strlen(str2);
return ret;
}
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;
return 0;
if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 )
return 0;
// Try to match hd(x,y) first.
sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
// Try to match volume UUID.
if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0)
{
if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
}
// Try to match volume label (always quoted).
if ( bvr->description )
{
bvr->description(bvr, testStr, sizeof(testStr)-1);
if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
}
return false;
}
/* If Rename Partition has defined an alias, then extract it for description purpose */
bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen)
/* If Rename Partition has defined an alias, then extract it for description purpose
* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
*/
bool getVolumeLabelAlias(BVRef bvr, char* str, long 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;
char *aliasList, *entryStart, *entryNext;
if ( !str || strMaxLen <= 0)
return false;
aliasList = XMLDecode(getStringForKey(kRenamePartitionKey, &bootInfo->bootConfig));
if ( !aliasList )
return false;
next = aliasList;
while ( next && *next )
for ( entryStart = entryNext = aliasList;
entryNext && *entryNext;
entryStart = entryNext )
{
char *start, *aliasStart, *aliasEnd;
char *ret;
char *volStart, *volEnd, *aliasStart;
long volLen, aliasLen;
start = aliasStart = (char*)matchVolumeToString(bvr, next, true);
if ( !start || !*start )
break;
/* Find and delimit the current entry's end */
next = strstr(start, ";");
if ( next )
// Delimit current entry
entryNext = strchr(entryStart, ';');
if ( entryNext )
{
/* 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++;
*entryNext = '\0';
entryNext++;
}
/* Check for at least one space, but ignore the rest of them */
while ( isspace(*aliasStart) )
aliasStart++;
if ( start == aliasStart )
volStart = strbreak(entryStart, &volEnd, &volLen);
if(!volLen)
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;
aliasStart = strbreak(volEnd, 0, &aliasLen);
if(!aliasLen)
continue;
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncpy(str, aliasStart, min(strMaxLen, aliasLen));
free(aliasList);
return true;
}
}
free(aliasList);
return false;
}
/* 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);
//verbose("Renamed: %s\n", p); Azi:remove??
return; // we're done here no need to seek for real name
}
}
// Set the devices label
strncpy(bvr->label, p, sizeof(bvr->label)-1);
sprintf(bvr->label, p);
}
//==========================================================================
branches/azimutz/Chazileon/i386/libsaio/disk.h
99
1010
1111
12
12
1313
1414
#ifndef __LIBSAIO_DISK_H
#define __LIBSAIO_DISK_H
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
bool matchVolumeToString( BVRef bvr, const char* match, long strMaxLen);
#endif /* __LIBSAIO_DISK_H */
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, sizeof(dummy) - 1, true );
getBootVolumeDescription( gBootVolume, dummy, 80, 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, sizeof(name) - 1, false);
getBootVolumeDescription(gBootVolume, name, 80, 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, sizeof(menuItems[0].name) - 1, true);
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;
branches/azimutz/Chazileon/i386/libsa/libsa.h
107107
108108
109109
110
111
112
110113
111114
112115
extern int strncasecmp(const char * s1, const char * s2, size_t n);
#endif
extern char * strchr(const char *str, int c);
extern char * strbreak(const char *str, char **next, long *len);
extern uint8_t checksum8( void * start, unsigned int length );
/*
branches/azimutz/Chazileon/i386/libsa/string.c
257257
258258
259259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
260309
261310
262311
}
#endif
char* strchr(const char *str, int c)
{
do
{
if(*str == c)
return (char*)str;
}
while(*(str++));
return 0;
}
char* strbreak(const char *str, char **next, long *len)
{
char *start = (char*)str, *end;
bool quoted = false;
if ( !start || !len )
return 0;
*len = 0;
while ( isspace(*start) )
start++;
if (*start == '"')
{
start++;
end = strchr(start, '"');
if(end)
quoted = true;
else
end = strchr(start, '\0');
}
else
{
for ( end = start; *end && !isspace(*end); end++ )
{}
}
*len = end - start;
if(next)
*next = quoted ? end+1 : end;
return start;
}
/* COPYRIGHT NOTICE: checksum8 from AppleSMBIOS */
uint8_t checksum8( void * start, unsigned int length )
{
branches/azimutz/CleanCut/i386/libsaio/nvidia.c
291291
292292
293293
294
294
295295
296296
297297
......
323323
324324
325325
326
327
328
329
326330
327331
328332
......
337341
338342
339343
344
340345
341346
342347
......
355360
356361
357362
358
359
360
361
362363
363364
364365
{ 0x10DE0614, "GeForce 9800 GT" },
{ 0x10DE0615, "GeForce GTS 250" },
{ 0x10DE0617, "GeForce 9800M GTX" },
{ 0x10DE0618, "GeForce GTX 260M" },
{ 0x10DE0618, "GeForce GTX 260M" },
{ 0x10DE061A, "Quadro FX 3700" },
{ 0x10DE061C, "Quadro FX 3600M" },
{ 0x10DE061D, "Quadro FX 2800M" },
{ 0x10DE065A, "Quadro FX 1700M" },
{ 0x10DE065B, "GeForce 9400 GT" },
{ 0x10DE065C, "Quadro FX 770M" },
{ 0x10DE06C0, "GeForce GTX 480" },
{ 0x10DE06C4, "GeForce GTX 465" },
{ 0x10DE06CA, "GeForce GTX 480M" },
{ 0x10DE06CD, "GeForce GTX 470" },
{ 0x10DE06E0, "GeForce 9300 GE" },
{ 0x10DE06E1, "GeForce 9300 GS" },
{ 0x10DE06E4, "GeForce 8400 GS" },
{ 0x10DE06F9, "Quadro FX 370 LP" },
{ 0x10DE06FA, "Quadro NVS 450" },
{ 0x10DE06FD, "Quadro NVS 295" },
{ 0x10DE086C, "GeForce 9300/nForce 730i" },
{ 0x10DE087D, "ION 9400M" },
{ 0x10DE087E, "ION LE" },
{ 0x10DE0A20, "GeForce GT220" },
{ 0x10DE0CA8, "GeForce GTS 260M" },
{ 0x10DE0CA9, "GeForce GTS 250M" },
{ 0x10DE0CA3, "GeForce GT240" },
{ 0x10DE06C0, "GeForce GTX 480" },
{ 0x10DE06CD, "GeForce GTX 470" },
{ 0x10DE06C4, "GeForce GTX 465" },
{ 0x10DE06CA, "GeForce GTX 480M" },
{ 0x10DE0E22, "GeForce GTX 460" },
{ 0x10DE0E24, "GeForce GTX 460" },
{ 0x10DE06D1, "Tesla C2050" },// TODO: sub-device id: 0x0771
branches/azimutz/CleanCut/i386/libsaio/disk.c
16061606
16071607
16081608
1609
1610
1609
1610
1611
1612
1613
1614
1615
1616
1617
16111618
16121619
16131620
......
16891696
16901697
16911698
1692
1699
16931700
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
17091701
1710
1711
1712
1713
1714
1715
1702
17161703
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
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
17501730
17511731
1752
1753
1732
1733
1734
1735
1736
1737
17541738
1755
1756
1757
1758
1739
17591740
17601741
17611742
......
17631744
17641745
17651746
1766
1767
1768
1747
1748
1749
1750
17691751
1770
1771
1752
1753
17721754
1773
1774
1775
1776
1777
1778
1779
1755
1756
1757
17801758
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1759
1760
17911761
17921762
1793
1794
1795
1796
1763
1764
17971765
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
18181777
18191778
1820
1779
18211780
18221781
18231782
......
18461805
18471806
18481807
1849
1850
1808
18511809
18521810
18531811
......
18731831
18741832
18751833
1876
1834
18771835
18781836
18791837
*/
if ( (newBVR->flags & kBVFlagForeignBoot) )
{
if(val && matchVolumeToString(newBVR, val, true))
newBVR->visible = false;
char *start, *next = val;
long len = 0;
do
{
start = strbreak(next, &next, &len);
if(len && matchVolumeToString(newBVR, start, len) )
newBVR->visible = false;
}
while ( next && *next );
}
/*
//==========================================================================
static char * matchStrings(const char * str1, const char * str2, bool matchPartial)
bool matchVolumeToString( BVRef bvr, const char* match, long matchLen)
{
char * ret = NULL;
if (matchPartial)
ret = strstr(str1, str2);
else if (!strcmp(str1, str2))
ret = (char *)str1;
if(ret)
ret += strlen(str2);
return ret;
}
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;
return 0;
if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 )
return 0;
// Try to match hd(x,y) first.
sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
// Try to match volume UUID.
if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0)
{
if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
}
// Try to match volume label (always quoted).
if ( bvr->description )
{
bvr->description(bvr, testStr, sizeof(testStr)-1);
if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
}
return false;
}
/* If Rename Partition has defined an alias, then extract it for description purpose */
bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen)
/* If Rename Partition has defined an alias, then extract it for description purpose
* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
*/
bool getVolumeLabelAlias(BVRef bvr, char* str, long 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;
char *aliasList, *entryStart, *entryNext;
if ( !str || strMaxLen <= 0)
return false;
aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->bootConfig));
if ( !aliasList )
return false;
next = aliasList;
while ( next && *next )
for ( entryStart = entryNext = aliasList;
entryNext && *entryNext;
entryStart = entryNext )
{
char *start, *aliasStart, *aliasEnd;
char *ret;
char *volStart, *volEnd, *aliasStart;
long volLen, aliasLen;
start = aliasStart = (char*)matchVolumeToString(bvr, next, true);
if ( !start || !*start )
break;
/* Find and delimit the current entry's end */
next = strstr(start, ";");
if ( next )
// Delimit current entry
entryNext = strchr(entryStart, ';');
if ( entryNext )
{
/* 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++;
*entryNext = '\0';
entryNext++;
}
/* Check for at least one space, but ignore the rest of them */
while ( isspace(*aliasStart) )
aliasStart++;
if ( start == aliasStart )
volStart = strbreak(entryStart, &volEnd, &volLen);
if(!volLen)
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;
aliasStart = strbreak(volEnd, 0, &aliasLen);
if(!aliasLen)
continue;
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncpy(str, aliasStart, min(strMaxLen, aliasLen));
free(aliasList);
return true;
}
}
free(aliasList);
return false;
}
/* 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);
strncpy(bvr->label, p, strMaxLen);
return; // we're done here no need to seek for real name
}
}
// Set the devices label
strncpy(bvr->label, p, sizeof(bvr->label)-1);
sprintf(bvr->label, p);
}
//==========================================================================
branches/azimutz/CleanCut/i386/libsaio/disk.h
99
1010
1111
12
12
1313
1414
#ifndef __LIBSAIO_DISK_H
#define __LIBSAIO_DISK_H
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
bool matchVolumeToString( BVRef bvr, const char* match, long strMaxLen);
#endif /* __LIBSAIO_DISK_H */
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, sizeof(dummy) - 1, true );
getBootVolumeDescription( gBootVolume, dummy, 80, 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, sizeof(name) - 1, false);
getBootVolumeDescription(gBootVolume, name, 80, 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, sizeof(menuItems[0].name) - 1, true);
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;
branches/azimutz/CleanCut/i386/libsa/libsa.h
107107
108108
109109
110
111
112
110113
111114
112115
extern int strncasecmp(const char * s1, const char * s2, size_t n);
#endif
extern char * strchr(const char *str, int c);
extern char * strbreak(const char *str, char **next, long *len);
extern uint8_t checksum8( void * start, unsigned int length );
/*
branches/azimutz/CleanCut/i386/libsa/string.c
257257
258258
259259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
260309
261310
262311
}
#endif
char* strchr(const char *str, int c)
{
do
{
if(*str == c)
return (char*)str;
}
while(*(str++));
return 0;
}
char* strbreak(const char *str, char **next, long *len)
{
char *start = (char*)str, *end;
bool quoted = false;
if ( !start || !len )
return 0;
*len = 0;
while ( isspace(*start) )
start++;
if (*start == '"')
{
start++;
end = strchr(start, '"');
if(end)
quoted = true;
else
end = strchr(start, '\0');
}
else
{
for ( end = start; *end && !isspace(*end); end++ )
{}
}
*len = end - start;
if(next)
*next = quoted ? end+1 : end;
return start;
}
/* COPYRIGHT NOTICE: checksum8 from AppleSMBIOS */
uint8_t checksum8( void * start, unsigned int length )
{

Archive Download the corresponding diff file

Revision: 433