Chameleon

View chameleon-ext2uuid.patch

1Index: i386/libsaio/ext2fs.c
2===================================================================
3--- i386/libsaio/ext2fs.c(revision 1747)
4+++ i386/libsaio/ext2fs.c(working copy)
5@@ -40,3 +40,32 @@
6 strncpy (str, buf+0x478, MIN(strMaxLen, 16));
7 free (buf);
8 }
9+
10+long EX2GetUUID(CICell ih, char *uuidStr)
11+{
12+uint8_t *b, *buf=malloc (EX2ProbeSize);
13+if (!buf)
14+return -1;
15+Seek(ih, 0);
16+Read(ih, (long)buf, EX2ProbeSize);
17+if (!EX2Probe (buf))
18+{
19+free (buf);
20+return -1;
21+}
22+if (OSReadLittleInt32 (buf+0x44c,0)<1)
23+{
24+free (buf);
25+return -1;
26+}
27+b=buf+0x468;
28+sprintf(uuidStr,
29+"%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
30+b[0], b[1], b[2], b[3],
31+b[4], b[5],
32+b[6], b[7],
33+b[8], b[9],
34+b[10], b[11], b[12], b[13], b[14], b[15]);
35+free (buf);
36+return 0;
37+}
38Index: i386/libsaio/ext2fs.h
39===================================================================
40--- i386/libsaio/ext2fs.h(revision 1747)
41+++ i386/libsaio/ext2fs.h(working copy)
42@@ -9,3 +9,4 @@
43
44 extern bool EX2Probe (const void *buf);
45 extern void EX2GetDescription(CICell ih, char *str, long strMaxLen);
46+extern long EX2GetUUID(CICell ih, char *uuidStr);
47Index: i386/libsaio/disk.c
48===================================================================
49--- i386/libsaio/disk.c(revision 1747)
50+++ i386/libsaio/disk.c(working copy)
51@@ -897,7 +897,8 @@
52 biosdev, partno,
53 part->relsect,
54 part,
55- 0, 0, 0, 0, 0, 0,
56+ 0, 0, 0, 0, 0,
57+ EX2GetUUID,
58 EX2GetDescription,
59 (BVFree)free,
60 0, kBIOSDevTypeHardDrive, 0);
61

Archive Download this file

Attachment to issue 208

Created: 8 years 9 months ago by bltz