#define BC_BOOT_PLAYLIST "/var/db/BootCache.playlist"
#define BC_BOOT_FLAGFILE "/var/db/BootCache.flag"
#define BC_BOOT_STATFILE "/tmp/BootCache.statistics"
#define BC_BOOT_HISTFILE "/tmp/BootCache.history"
#define BC_BOOT_LOGFILE "/tmp/BootCache.log"
#define BC_CONTROL_TOOL "/usr/sbin/BootCacheControl"
#define BC_KEXTUNLOAD "/sbin/kextunload"
#define BC_BUNDLE_ID "com.apple.BootCache"
struct BC_command {
int bc_magic;
#define BC_MAGIC_0 0x10102021
#define BC_MAGIC_1 0x10102021
#define BC_MAGIC 0x10102021
int bc_opcode;
#define BC_OP_START 0x01
#define BC_OP_STOP 0x02
#define BC_OP_HISTORY 0x03
#define BC_OP_STATS 0x04
#define BC_OP_TAG 0x05
int bc_param;
void *bc_data;
size_t bc_length;
};
#define BC_SYSCTL "kern.BootCache"
struct BC_playlist_header {
int ph_magic;
#define PH_MAGIC_0 0xa1b2c3d4
#define PH_MAGIC_1 0xa1b2c3d5
#define PH_MAGIC 0xa1b2c3d6
int ph_entries;
int ph_blocksize;
};
struct BC_playlist_entry {
u_int64_t pce_offset;
u_int64_t pce_length;
u_int32_t pce_batch;
#define CE_BATCH_MASK 0xff
};
#define BC_PLC_CHUNK 512
#define BC_MAXENTRIES 100000
struct BC_history_entry {
u_int64_t he_offset;
u_int64_t he_length;
int he_flags;
#define BC_HE_MISS 0
#define BC_HE_HIT 1
#define BC_HE_TAG 2
#define BC_HE_WRITE 3
};
#define STAT_BATCHMAX 4
struct BC_statistics {
u_int ss_blocksize;
u_int ss_initiated_reads;
u_int ss_read_blocks;
u_int ss_read_errors;
u_int ss_error_discards;
u_int ss_batch_size[STAT_BATCHMAX+1];
struct timeval ss_batch_time[STAT_BATCHMAX+1];
struct timeval ss_cache_stop;
struct timeval ss_wait_time;
u_int ss_strategy_calls;
u_int ss_strategy_nonread;
u_int ss_strategy_bypassed;
u_int ss_strategy_bypass_active;
u_int ss_strategy_blocked;
u_int ss_strategy_stolen;
uint ss_strategy_duringio;
u_int ss_total_extents;
u_int ss_extent_lookups;
u_int ss_extent_hits;
u_int ss_hit_blkmissing;
u_int ss_requested_blocks;
u_int ss_hit_blocks;
u_int ss_write_discards;
u_int ss_spurious_blocks;
u_int ss_spurious_pages;
u_int ss_history_clusters;
u_int ss_cache_flags;
};
#ifndef KERNEL
extern int BC_blocksize;
extern int BC_read_playlist(const char *, struct BC_playlist_entry **, int *);
extern int BC_write_playlist(const char *, const struct BC_playlist_entry *, int);
extern int BC_merge_playlists(struct BC_playlist_entry **, int *,
const struct BC_playlist_entry *, int);
extern void BC_sort_playlist(struct BC_playlist_entry *, int);
extern int BC_coalesce_playlist(struct BC_playlist_entry **, int *);
extern int BC_fetch_statistics(struct BC_statistics **);
extern int BC_convert_history(const struct BC_history_entry *,
struct BC_playlist_entry **, int *);
extern int BC_start(struct BC_playlist_entry *, int);
extern int BC_stop(struct BC_history_entry **, int *);
extern int BC_print_statistics(char *, struct BC_statistics *);
extern int BC_print_history(char *, struct BC_history_entry *, int);
extern int BC_tag_history(void);
extern int BC_unload(void);
#endif