Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/openbsd.c

1#include "libsaio.h"
2#include "sl.h"
3#include "openbsd.h"
4
5#define OpenBSDProbeSize2048
6#define DISKMAGIC((uint32_t)0x82564557)/* The disk magic number */
7
8bool OpenBSDProbe (const void *buf)
9{
10return (OSReadLittleInt32(buf+0x200,0) == DISKMAGIC);
11}
12void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen)
13{
14char * buf=malloc(OpenBSDProbeSize);
15str[0]=0;
16if (!buf)
17return;
18Seek(ih, 0);
19Read(ih, (long)buf, OpenBSDProbeSize);
20if (!OpenBSDProbe (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: HEAD