Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/freebsd.c

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

Archive Download this file

Revision: 2425