📄 hfs.h
字号:
int bitmap_lock; struct list_head entry_dirty;};/* * struct hfs_extent * * The offset to allocation block mapping for a given file is * contained in a series of these structures. Each (struct * hfs_extent) records up to three runs of contiguous allocation * blocks. An allocation block is a contiguous group of physical * blocks. */struct hfs_extent { int magic; /* A magic number */ unsigned short start; /* Where in the file this record begins (in allocation blocks) */ unsigned short end; /* Where in the file this record ends (in allocation blocks) */ unsigned short block[3]; /* The allocation block on disk which begins this extent */ unsigned short length[3]; /* The number of allocation blocks in this extent */ struct hfs_extent *next; /* Next extent record for this file */ struct hfs_extent *prev; /* Previous extent record for this file */ int count; /* Number of times it is used */};/* * struct hfs_dir * * This structure holds information specific * to a directory in an HFS filesystem. */struct hfs_dir { int magic; /* A magic number */ hfs_u16 flags; hfs_u16 dirs; /* Number of directories in this one */ hfs_u16 files; /* Number of files in this directory */ int readers; hfs_wait_queue read_wait; int writers; hfs_wait_queue write_wait;};/* * struct hfs_fork * * This structure holds the information * specific to a single fork of a file. */struct hfs_fork { struct hfs_cat_entry *entry; /* The file this fork is part of */ struct hfs_extent first; /* The first extent record for this fork */ struct hfs_extent *cache; /* The most-recently accessed extent record for this fork */ hfs_u32 lsize; /* The logical size in bytes */ hfs_u32 psize; /* The phys size (512-byte blocks) */ hfs_u8 fork; /* Which fork is this? */};/* * struct hfs_file * * This structure holds information specific * to a file in an HFS filesystem. */struct hfs_file { int magic; struct hfs_fork data_fork; struct hfs_fork rsrc_fork; hfs_u16 clumpablks; hfs_u8 flags;};/* * struct hfs_file * * This structure holds information about a * file or directory in an HFS filesystem. * * 'wait' must remain 1st and 'hash' 2nd since we do some pointer arithmetic. */struct hfs_cat_entry { hfs_wait_queue wait; struct list_head hash; struct list_head list; struct hfs_mdb *mdb; hfs_sysentry sys_entry; struct hfs_cat_key key; union hfs_finder_info info; hfs_u32 cnid; /* In network byte-order */ hfs_u32 create_date; /* In network byte-order */ hfs_u32 modify_date; /* In network byte-order */ hfs_u32 backup_date; /* In network byte-order */ unsigned short count; unsigned long state; hfs_u8 type; union { struct hfs_dir dir; struct hfs_file file; } u;};/* hfs entry state bits */#define HFS_DIRTY 1#define HFS_KEYDIRTY 2#define HFS_LOCK 4#define HFS_DELETED 8/* * struct hfs_bnode_ref * * A pointer to a (struct hfs_bnode) and the type of lock held on it. */struct hfs_bnode_ref { struct hfs_bnode *bn; int lock_type;};/* * struct hfs_belem * * An element of the path from the root of a B-tree to a leaf. * Includes the reference to a (struct hfs_bnode), the index of * the appropriate record in that node, and some flags. */struct hfs_belem { struct hfs_bnode_ref bnr; int record; int flags;};/* * struct hfs_brec * * The structure returned by hfs_bfind() to describe the requested record. */struct hfs_brec { int keep_flags; struct hfs_btree *tree; struct hfs_belem *top; struct hfs_belem *bottom; struct hfs_belem elem[9]; struct hfs_bkey *key; void *data; /* The actual data */};/*================ Function prototypes ================*//* bdelete.c */extern int hfs_bdelete(struct hfs_btree *, const struct hfs_bkey *);/* bfind.c */extern void hfs_brec_relse(struct hfs_brec *, struct hfs_belem *);extern int hfs_bsucc(struct hfs_brec *, int);extern int hfs_bfind(struct hfs_brec *, struct hfs_btree *, const struct hfs_bkey *, int); /* binsert.c */extern int hfs_binsert(struct hfs_btree *, const struct hfs_bkey *, const void *, hfs_u16);/* bitmap.c */extern hfs_u16 hfs_vbm_count_free(const struct hfs_mdb *, hfs_u16);extern hfs_u16 hfs_vbm_search_free(const struct hfs_mdb *, hfs_u16 *);extern int hfs_set_vbm_bits(struct hfs_mdb *, hfs_u16, hfs_u16);extern int hfs_clear_vbm_bits(struct hfs_mdb *, hfs_u16, hfs_u16);/* bitops.c */extern hfs_u32 hfs_find_zero_bit(const hfs_u32 *, hfs_u32, hfs_u32);extern hfs_u32 hfs_count_zero_bits(const hfs_u32 *, hfs_u32, hfs_u32);/* btree.c */extern struct hfs_btree *hfs_btree_init(struct hfs_mdb *, ino_t, hfs_byte_t *, hfs_u32, hfs_u32);extern void hfs_btree_free(struct hfs_btree *);extern void hfs_btree_commit(struct hfs_btree *, hfs_byte_t *, hfs_lword_t);/* catalog.c */extern void hfs_cat_init(void);extern void hfs_cat_put(struct hfs_cat_entry *);extern void hfs_cat_mark_dirty(struct hfs_cat_entry *);extern struct hfs_cat_entry *hfs_cat_get(struct hfs_mdb *, const struct hfs_cat_key *);extern void hfs_cat_invalidate(struct hfs_mdb *);extern void hfs_cat_commit(struct hfs_mdb *);extern void hfs_cat_free(void);extern int hfs_cat_compare(const struct hfs_cat_key *, const struct hfs_cat_key *);extern void hfs_cat_build_key(hfs_u32, const struct hfs_name *, struct hfs_cat_key *);extern struct hfs_cat_entry *hfs_cat_parent(struct hfs_cat_entry *);extern int hfs_cat_open(struct hfs_cat_entry *, struct hfs_brec *);extern int hfs_cat_next(struct hfs_cat_entry *, struct hfs_brec *, hfs_u16, hfs_u32 *, hfs_u8 *);extern void hfs_cat_close(struct hfs_cat_entry *, struct hfs_brec *);extern int hfs_cat_create(struct hfs_cat_entry *, struct hfs_cat_key *, hfs_u8, hfs_u32, hfs_u32, struct hfs_cat_entry **);extern int hfs_cat_mkdir(struct hfs_cat_entry *, struct hfs_cat_key *, struct hfs_cat_entry **);extern int hfs_cat_delete(struct hfs_cat_entry *, struct hfs_cat_entry *, int);extern int hfs_cat_move(struct hfs_cat_entry *, struct hfs_cat_entry *, struct hfs_cat_entry *, struct hfs_cat_key *, struct hfs_cat_entry **);/* extent.c */extern int hfs_ext_compare(const struct hfs_ext_key *, const struct hfs_ext_key *);extern void hfs_extent_in(struct hfs_fork *, const hfs_byte_t *);extern void hfs_extent_out(const struct hfs_fork *, hfs_byte_t *);extern int hfs_extent_map(struct hfs_fork *, int, int);extern void hfs_extent_adj(struct hfs_fork *);extern void hfs_extent_free(struct hfs_fork *);/* file.c */extern int hfs_get_block(struct inode *, long, struct buffer_head *, int);/* mdb.c */extern struct hfs_mdb *hfs_mdb_get(hfs_sysmdb, int, hfs_s32);extern void hfs_mdb_commit(struct hfs_mdb *, int);extern void hfs_mdb_put(struct hfs_mdb *, int);/* part_tbl.c */extern int hfs_part_find(hfs_sysmdb, int, int, hfs_s32 *, hfs_s32 *);/* string.c */extern unsigned int hfs_strhash(const unsigned char *, unsigned int);extern int hfs_strcmp(const unsigned char *, unsigned int, const unsigned char *, unsigned int);extern int hfs_streq(const unsigned char *, unsigned int, const unsigned char *, unsigned int);extern void hfs_tolower(unsigned char *, int);static __inline__ struct dentry *hfs_lookup_dentry(struct dentry *base, const char *name, const int len){ struct qstr this; this.name = name; this.len = len; this.hash = hfs_strhash(name, len); return d_lookup(base, &this);}/* drop a dentry for one of the special directories. * it's in the form of base/name/dentry. */static __inline__ void hfs_drop_special(struct dentry *base, const struct hfs_name *name, struct dentry *dentry){ struct dentry *dparent, *de; dparent = hfs_lookup_dentry(base, name->Name, name->Len); if (dparent) { de = hfs_lookup_dentry(dparent, dentry->d_name.name, dentry->d_name.len); if (de) { if (!de->d_inode) d_drop(de); dput(de); } dput(dparent); }}extern struct dentry_operations hfs_dentry_operations;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -