1 | #include "libsaio.h"␊ |
2 | #include "sl.h"␊ |
3 | #include "freebsd.h"␊ |
4 | ␊ |
5 | #define FreeBSDProbeSize␉2048␊ |
6 | #define DISKMAGIC␉((uint32_t)0x19540119)␉/* The disk magic number */␊ |
7 | ␊ |
8 | bool FreeBSDProbe (const void *buf)␊ |
9 | {␊ |
10 | ␉return (OSReadLittleInt32(buf+0xA55C,0) == DISKMAGIC);␊ |
11 | }␊ |
12 | void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen)␊ |
13 | {␊ |
14 | ␉char * buf=malloc(FreeBSDProbeSize);␊ |
15 | ␉str[0]=0;␊ |
16 | ␉if (!buf)␊ |
17 | ␉␉return;␊ |
18 | ␉Seek(ih, 0);␊ |
19 | ␉Read(ih, (long)buf, FreeBSDProbeSize);␊ |
20 | ␉if (!FreeBSDProbe (buf))␊ |
21 | ␉{␊ |
22 | ␉␉free (buf);␊ |
23 | ␉␉return;␊ |
24 | ␉}␊ |
25 | ␉if (OSReadLittleInt32 (buf+0x44c,0)<1)␊ |
26 | ␉{␊ |
27 | ␉␉free (buf);␊ |
28 | ␉␉return;␊ |
29 | ␉}␊ |
30 | ␉str[strMaxLen]=0;␊ |
31 | ␉strncpy (str, buf+0x478, MIN (strMaxLen, 32));␊ |
32 | ␉free (buf);␊ |
33 | }␊ |
34 | |