Root/
Source at commit 307 created 12 years 11 months ago. By ifabio, merge changes from trunk (929). Also merge the module changes from Azimutz branche (fix compile error) Also edited the info.plist into AHCIPortInjector.kext: http://forum.voodooprojects.org/index.php/topic,1170.0.html | |
---|---|
1 | /*␊ |
2 | * befs.c␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by scorpius␊ |
6 | * Copyright 2010␊ |
7 | *␊ |
8 | */␊ |
9 | ␊ |
10 | #include "libsaio.h"␊ |
11 | #include "sl.h"␊ |
12 | #include "befs.h"␊ |
13 | ␊ |
14 | #define BeFSProbeSize␉2048␊ |
15 | ␊ |
16 | #define SUPER_BLOCK_MAGIC1 0x42465331 /* BFS1 */ ␊ |
17 | #define SUPER_BLOCK_MAGIC2 0xdd121031 ␊ |
18 | #define SUPER_BLOCK_MAGIC3 0x15b6830e␊ |
19 | ␊ |
20 | /* Find BeFS signature */␊ |
21 | bool BeFSProbe (const void *buf)␊ |
22 | {␊ |
23 | ␉return (OSReadLittleInt32(buf+0x220,0)==SUPER_BLOCK_MAGIC1);␊ |
24 | }␊ |
25 | ␊ |
26 | /* Find BeFS volume label */␊ |
27 | void BeFSGetDescription(CICell ih, char *str, long strMaxLen)␊ |
28 | {␊ |
29 | ␉char * buf=malloc (BeFSProbeSize);␊ |
30 | ␉str[0]=0;␊ |
31 | ␉if (!buf)␊ |
32 | ␉␉return;␊ |
33 | ␉Seek(ih, 0);␊ |
34 | ␉Read(ih, (long)buf, BeFSProbeSize);␊ |
35 | ␉if (!BeFSProbe (buf))␊ |
36 | ␉{␊ |
37 | ␉␉free (buf);␊ |
38 | ␉␉return;␊ |
39 | ␉}␊ |
40 | ␉str[strMaxLen]=0;␊ |
41 | ␉strncpy (str, buf+0x200, min (strMaxLen, 32));␊ |
42 | ␉free (buf);␊ |
43 | }␊ |
44 |