#endif
io_channel b_io;
int b_size;
- unsigned long long b_blocknr;
- int b_dirty;
- int b_uptodate;
int b_err;
+ unsigned int b_dirty:1;
+ unsigned int b_uptodate:1;
+ unsigned long long b_blocknr;
char b_data[1024];
};
#define K_DEV_FS 1
#define K_DEV_JOURNAL 2
-typedef struct kdev_s *kdev_t;
-
#define lock_buffer(bh) do {} while (0)
#define unlock_buffer(bh) do {} while (0)
#define buffer_req(bh) 1
free(cache);
}
+/* generic hashing taken from the Linux kernel */
+#define GOLDEN_RATIO_32 0x61C88647
+#define GOLDEN_RATIO_64 0x61C8864680B583EBull
+
+_INLINE_ __u32 __hash_32(__u32 val)
+{
+ return val * GOLDEN_RATIO_32;
+}
+
+_INLINE_ __u32 hash_32(__u32 val, unsigned int bits)
+{
+ /* High bits are more random, so use them. */
+ return __hash_32(val) >> (32 - bits);
+}
+
+_INLINE_ __u32 hash_64(__u64 val, unsigned int bits)
+{
+ if (sizeof(long) >= 8) {
+ /* 64x64-bit multiply is efficient on all 64-bit processors */
+ return val * GOLDEN_RATIO_64 >> (64 - bits);
+ } else {
+ /* Hash 64 bits using only 32x32-bit multiply. */
+ return hash_32((__u32)val ^ __hash_32(val >> 32), bits);
+ }
+}
+
#undef _INLINE_
#endif
#define JSB_HAS_INCOMPAT_FEATURE(jsb, mask) \
((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JFS_SUPERBLOCK_V2) && \
((jsb)->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
-static inline size_t journal_super_tag_bytes(journal_superblock_t *jsb)
-{
- size_t sz;
-
- if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V3))
- return sizeof(journal_block_tag3_t);
-
- sz = sizeof(journal_block_tag_t);
-
- if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V2))
- sz += sizeof(__u16);
-
- if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT))
- return sz;
-
- return sz - sizeof(__u32);
-}
#else /* !DEBUGFS */
extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
#endif /* DEBUGFS */
+#ifndef EFSBADCRC
+#define EFSBADCRC EXT2_ET_BAD_CRC
+#endif
+#ifndef EFSCORRUPTED
+#define EFSCORRUPTED EXT2_ET_FILESYSTEM_CORRUPTED
+#endif
+
+/* recovery.c */
+extern int journal_recover (journal_t *journal);
+extern int journal_skip_recovery (journal_t *);
+
+/* revoke.c */
+extern int journal_init_revoke(journal_t *, int);
+extern void journal_destroy_revoke(journal_t *);
+extern void journal_destroy_revoke_caches(void);
+extern int journal_init_revoke_caches(void);
+
+extern int journal_set_revoke(journal_t *, unsigned long long, tid_t);
+extern int journal_test_revoke(journal_t *, unsigned long long, tid_t);
+extern void journal_clear_revoke(journal_t *);
+
#endif /* _JFS_USER_H */