18 #define APA_OPT_H "apa-opt.h"
24 #define APA_SECTOR_MBR 0
25 #ifdef APA_SUPPORT_GPT
26 #define APA_SECTOR_SECTOR_ERROR 34 // 6 use for last sector that had a error...
29 #define APA_SECTOR_SECTOR_ERROR 6 // 6 use for last sector that had a error...
31 #define APA_SECTOR_PART_ERROR APA_SECTOR_SECTOR_ERROR + 1 // 7 use for last partition that had a error...
32 #define APA_SECTOR_APAL APA_SECTOR_PART_ERROR + 1 // 8
33 #define APA_SECTOR_APAL_HEADERS APA_SECTOR_APAL + 2 // 10-262
34 #define APA_SECTOR_MIN_OSDSTART APA_SECTOR_APAL_HEADERS + 252 + 1 // OSD program cannot overlap the journal
37 #define APA_MAGIC 0x00415041 // 'APA\0'
38 #define APA_MBR_VERSION 2
40 #define APA_MODVER ((APA_MODVER_MAJOR << 8) | APA_MODVER_MINOR)
69 char rpwd[APA_PASSMAX];
70 char fpwd[APA_PASSMAX];
90 #ifdef APA_SUPPORT_GPT
94 u32 UniqueMbrSignature;
109 u8 partition_record234[48];
119 #define APA_CACHE_FLAG_DIRTY 0x01
138 char fpwd[APA_PASSMAX];
139 char rpwd[APA_PASSMAX];
147 extern void apaSaveError(s32 device,
void *buffer, u32 lba, u32 err_lba);
148 extern void apaSetPartErrorSector(s32 device, u32 lba);
149 extern int apaGetPartErrorSector(s32 device, u32 lba, u32 *lba_out);
150 extern int apaGetPartErrorName(s32 device,
char *name);
152 extern apa_cache_t *apaFillHeader(s32 device,
const apa_params_t *params, u32 start, u32 next, u32 prev, u32 length,
int *err);
154 extern apa_cache_t *apaFindPartition(s32 device,
const char *
id,
int *err);
155 extern void apaAddEmptyBlock(
apa_header_t *header, u32 *emptyBlocks);
156 extern apa_cache_t *apaRemovePartition(s32 device, u32 start, u32 next, u32 prev, u32 length);
161 extern int apaCheckSum(
apa_header_t *header,
int fullcheck);
162 extern int apaReadHeader(s32 device,
apa_header_t *header, u32 lba);
163 extern int apaWriteHeader(s32 device,
apa_header_t *header, u32 lba);
164 extern int apaGetFormat(s32 device,
int *format);
165 extern u32 apaGetPartitionMax(u32 totalLBA);
170 extern int apaCacheInit(u32 size);
171 extern int apaCacheDeinit(
void);
174 extern int apaCacheTransfer(
apa_cache_t *clink,
int type);
175 extern void apaCacheFlushDirty(
apa_cache_t *clink);
176 extern int apaCacheFlushAllDirty(s32 device);
177 extern apa_cache_t *apaCacheGetHeader(s32 device, u32 sector, u32 mode,
int *err);
183 #define APAL_MAGIC 0x4150414C // 'APAL'
191 #define journalCheckSum(header) apaCheckSum((apa_header_t *)header, 1)
192 extern int apaJournalReset(s32 device);
193 extern int apaJournalFlush(s32 device);
195 extern int apaJournalRestore(s32 device);
199 extern void *apaAllocMem(
int size);
200 extern void apaFreeMem(
void *ptr);
202 extern int apaGetIlinkID(u8 *idbuf);
205 extern int apaPassCmp(
const char *password1,
const char *password2);
206 extern void apaEncryptPassword(
const char *
id,
char *password_out,
const char *password_in);
212 u32 partitionMaxSize;
217 extern int apaGetFreeSectors(s32 device, u32 *free,
apa_device_t *deviceinfo);