#ifndef __HFS_CATALOG__
#define __HFS_CATALOG__
#include <sys/appleapiopts.h>
#ifdef KERNEL
#ifdef __APPLE_API_PRIVATE
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/lock.h>
#include <hfs/hfs_format.h>
typedef u_int32_t cnid_t;
struct cat_desc {
u_int8_t cd_flags;
u_int8_t cd_encoding;
int16_t cd_namelen;
char * cd_nameptr;
cnid_t cd_parentcnid;
u_long cd_hint;
cnid_t cd_cnid;
};
#define CD_HASBUF 0x01
#define CD_DECOMPOSED 0x02
#define CD_ISMETA 0x40
#define CD_ISDIR 0x80
struct cat_attr {
cnid_t ca_fileid;
mode_t ca_mode;
nlink_t ca_nlink;
uid_t ca_uid;
gid_t ca_gid;
dev_t ca_rdev;
time_t ca_atime;
time_t ca_mtime;
int32_t ca_mtime_nsec;
time_t ca_ctime;
time_t ca_itime;
time_t ca_btime;
u_long ca_flags;
union {
u_int32_t cau_blocks;
u_int32_t cau_entries;
} ca_union;
u_int8_t ca_finderinfo[32];
};
#define ca_blocks ca_union.cau_blocks
#define ca_entries ca_union.cau_entries
struct cat_fork {
u_int64_t cf_size;
union {
u_int32_t cfu_clump;
u_int64_t cfu_bytesread;
} cf_union;
u_int32_t cf_vblocks;
u_int32_t cf_blocks;
struct HFSPlusExtentDescriptor cf_extents[8];
};
#define cf_clump cf_union.cfu_clump
#define cf_bytesread cf_union.cfu_bytesread
struct cat_entry {
struct cat_desc ce_desc;
struct cat_attr ce_attr;
off_t ce_datasize;
off_t ce_rsrcsize;
u_long ce_datablks;
u_long ce_rsrcblks;
};
#define MAXCATENTRIES 8
struct cat_entrylist {
u_long maxentries;
u_long realentries;
struct cat_entry entry[MAXCATENTRIES];
};
#define CAT_DELETE 0x00020000
#define CAT_CREATE 0x00000002
#define CAT_RENAME 0x00020002
#define CAT_EXCHANGE 0x00020002
typedef u_int32_t catops_t;
typedef struct cat_cookie_t {
char opaque[24];
} cat_cookie_t;
struct hfsmount;
extern void cat_releasedesc(struct cat_desc *descp);
extern int cat_create ( struct hfsmount *hfsmp,
struct cat_desc *descp,
struct cat_attr *attrp,
struct cat_desc *out_descp);
extern int cat_delete ( struct hfsmount *hfsmp,
struct cat_desc *descp,
struct cat_attr *attrp);
extern int cat_lookup ( struct hfsmount *hfsmp,
struct cat_desc *descp,
int wantrsrc,
struct cat_desc *outdescp,
struct cat_attr *attrp,
struct cat_fork *forkp);
extern int cat_idlookup (struct hfsmount *hfsmp,
cnid_t cnid,
struct cat_desc *outdescp,
struct cat_attr *attrp,
struct cat_fork *forkp);
extern int cat_getentriesattr(
struct hfsmount *hfsmp,
struct cat_desc *prevdesc,
int index,
struct cat_entrylist *ce_list);
extern int cat_rename ( struct hfsmount * hfsmp,
struct cat_desc * from_cdp,
struct cat_desc * todir_cdp,
struct cat_desc * to_cdp,
struct cat_desc * cdp);
extern int cat_update ( struct hfsmount *hfsmp,
struct cat_desc *descp,
struct cat_attr *attrp,
struct cat_fork *dataforkp,
struct cat_fork *rsrcforkp);
extern int cat_getdirentries(
struct hfsmount *hfsmp,
struct cat_desc *descp,
int entrycnt,
struct uio *uio,
int *eofflag,
u_long *cookies,
int ncookies);
extern int cat_insertfilethread (
struct hfsmount *hfsmp,
struct cat_desc *descp);
extern int cat_preflight(
struct hfsmount *hfsmp,
catops_t ops,
cat_cookie_t *cookie,
struct proc *p);
extern void cat_postflight(
struct hfsmount *hfsmp,
cat_cookie_t *cookie,
struct proc *p);
extern int cat_binarykeycompare(
HFSPlusCatalogKey *searchKey,
HFSPlusCatalogKey *trialKey);
#endif
#endif
#endif