/*
* osd_iam.h
*/
-#ifndef CLASSERT
-#define CLASSERT(cond) do {switch(42) {case (cond): case 0: break;}} while (0)
-#endif
+
/* implication */
#define ergo(a, b) (!(a) || (b))
/* logical equivalence */
* Parameters, describing a flavor of iam container.
*/
struct iam_descr {
- /*
- * Size of a key in this container, in bytes.
- */
- size_t id_key_size;
- /*
- * Size of a key in index nodes, in bytes.
- */
- size_t id_ikey_size;
- /*
- * Size of a pointer to the next level (stored in index nodes), in
- * bytes.
- */
- size_t id_ptr_size;
- /*
- * Size of a record (stored in leaf nodes), in bytes.
- */
- size_t id_rec_size;
- /*
- * Size of unused (by iam) space at the beginning of every non-root
- * node, in bytes. Used for compatibility with ldiskfs.
- */
- size_t id_node_gap;
- /*
- * Size of unused (by iam) space at the beginning of root node, in
- * bytes. Used for compatibility with ldiskfs.
- */
- size_t id_root_gap;
+ /*
+ * Size of a key in this container, in bytes.
+ */
+ size_t id_key_size;
+ /*
+ * Size of a key in index nodes, in bytes.
+ */
+ size_t id_ikey_size;
+ /*
+ * Size of a pointer to the next level (stored in index nodes), in
+ * bytes.
+ */
+ size_t id_ptr_size;
+ /*
+ * Size of a record (stored in leaf nodes), in bytes.
+ */
+ size_t id_rec_size;
+ /*
+ * Size of unused (by iam) space at the beginning of every non-root
+ * node, in bytes. Used for compatibility with ldiskfs.
+ */
+ size_t id_node_gap;
+ /*
+ * Size of unused (by iam) space at the beginning of root node, in
+ * bytes. Used for compatibility with ldiskfs.
+ */
+ size_t id_root_gap;
- struct iam_operations *id_ops;
- struct iam_leaf_operations *id_leaf_ops;
+ const struct iam_operations *id_ops;
+ const struct iam_leaf_operations *id_leaf_ops;
};
enum {
/*
* this iterator will move (iam_it_next() will be called on it)
*/
- IAM_IT_MOVE = (1 << 0),
+ IAM_IT_MOVE = BIT(0),
/*
* tree can be updated through this iterator.
*/
- IAM_IT_WRITE = (1 << 1)
+ IAM_IT_WRITE = BIT(1)
};
/*
return iam_leaf_container(leaf)->ic_descr;
}
-static inline struct iam_leaf_operations *
+static inline const struct iam_leaf_operations *
iam_leaf_ops(const struct iam_leaf *leaf)
{
- return iam_leaf_descr(leaf)->id_leaf_ops;
+ return iam_leaf_descr(leaf)->id_leaf_ops;
}
static inline void iam_reccpy(const struct iam_leaf *leaf,
struct iam_path *iam_leaf_path(const struct iam_leaf *leaf);
struct iam_container *iam_leaf_container(const struct iam_leaf *leaf);
struct iam_descr *iam_leaf_descr(const struct iam_leaf *leaf);
-struct iam_leaf_operations *iam_leaf_ops(const struct iam_leaf *leaf);
+const struct iam_leaf_operations *iam_leaf_ops(const struct iam_leaf *leaf);
int iam_node_read(struct iam_container *c, iam_ptr_t ptr,
handle_t *h, struct buffer_head **bh);
-/*
- * Container format.
- */
-struct iam_format {
- /*
- * Method called to recognize container format. Should return true iff
- * container @c conforms to this format. This method may do IO to read
- * container pages.
- *
- * If container is recognized, this method sets operation vectors
- * ->id_ops and ->id_leaf_ops in container description (c->ic_descr),
- * and fills other description fields.
- */
- int (*if_guess)(struct iam_container *c);
- /*
- * Linkage into global list of container formats.
- */
- struct list_head if_linkage;
-};
-
-void iam_format_register(struct iam_format *fmt);
int iam_root_limit(int rootgap, int blocksize, int size);
void iam_lfix_format_init(void);
void iam_lvar_format_init(void);
+int iam_lfix_guess(struct iam_container *c);
+int iam_lvar_guess(struct iam_container *c);
void iam_htree_format_init(void);
int iam_lfix_create(struct inode *obj,
extern int ldiskfs_check_dir_entry(const char *, struct inode *,
struct ldiskfs_dir_entry_2 *,
struct buffer_head *, unsigned long);
+extern int dx_node_check(struct iam_path *p, struct iam_frame *f);
#else
static inline int ldiskfs_check_dir_entry(const char * function,
struct inode * dir,