Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/befs.c

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 BeFSProbeSize2048
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 */
21bool BeFSProbe (const void *buf)
22{
23return (OSReadLittleInt32(buf+0x220,0)==SUPER_BLOCK_MAGIC1);
24}
25
26/* Find BeFS volume label */
27void BeFSGetDescription(CICell ih, char *str, long strMaxLen)
28{
29char * buf=malloc (BeFSProbeSize);
30if (!buf)
31return;
32 str[0]=0;
33Seek(ih, 0);
34Read(ih, (long)buf, BeFSProbeSize);
35if (!BeFSProbe (buf))
36{
37free (buf);
38return;
39}
40str[strMaxLen]=0;
41strncpy (str, buf+0x200, MIN (strMaxLen, 32));
42free (buf);
43}
44

Archive Download this file

Revision: 2006