3 #include <linux/byteorder.h>
4 #include <linux/types.h>
6 /* stub out the bcache code we aren't building: */
9 struct bcache_superblock;
11 struct cache_accounting;
17 struct kmem_cache *bch_search_cache;
19 const char *bch_backing_dev_register(struct bcache_superblock *sb)
21 return "not implemented";
23 void bch_blockdevs_stop(struct cache_set *c) {}
24 int bch_blockdev_volumes_start(struct cache_set *c) { return 0; }
25 void bch_attach_backing_devs(struct cache_set *c) {}
26 bool bch_is_open_backing_dev(struct block_device *bdev) { return false; }
27 void bch_blockdev_exit(void) {}
28 int bch_blockdev_init(void) { return 0; }
30 void bch_fs_exit(void) {}
31 int bch_fs_init(void) { return 0; }
33 const struct file_operations bch_chardev_fops;
35 void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned inode,
36 u64 offset, int nr_sectors) {}
37 void bch_writeback_recalc_oldest_gens(struct cache_set *c) {}
39 void bch_notify_cache_set_read_write(struct cache_set *c) {}
40 void bch_notify_cache_set_read_only(struct cache_set *c) {}
41 void bch_notify_cache_set_stopped(struct cache_set *c) {}
42 void bch_notify_cache_read_write(struct cache *c) {}
43 void bch_notify_cache_read_only(struct cache *c) {}
44 void bch_notify_cache_added(struct cache *c) {}
45 void bch_notify_cache_removing(struct cache *c) {}
46 void bch_notify_cache_removed(struct cache *c) {}
47 void bch_notify_cache_remove_failed(struct cache *c) {}
48 void bch_notify_cache_error(struct cache *c, bool b) {}
50 int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
51 struct kobject *parent) { return 0; }
52 void bch_cache_accounting_destroy(struct cache_accounting *acc) {}
53 void bch_cache_accounting_init(struct cache_accounting *acc,
54 struct closure *parent) {}
59 #include "bkey_methods.c"
60 //#include "blockdev.c"
62 #include "btree_cache.c"
65 #include "btree_iter.c"
66 #include "btree_update.c"
68 //#include "chardev.c"
90 //#include "request.c"
99 //#include "writeback.c"
102 #define SHIM_KTYPE(type) \
103 struct kobj_type type ## _ktype = { .release = type ## _release, }
105 static void bch_cache_set_internal_release(struct kobject *k) {}
107 static void bch_cache_set_opts_dir_release(struct kobject *k) {}
109 static void bch_cache_set_time_stats_release(struct kobject *k) {}
111 SHIM_KTYPE(bch_cache);
112 SHIM_KTYPE(bch_cache_set);
113 SHIM_KTYPE(bch_cache_set_internal);
114 SHIM_KTYPE(bch_cache_set_time_stats);
115 SHIM_KTYPE(bch_cache_set_opts_dir);
117 //#include "tools-util.h"
119 int cmd_fsck(int argc, char *argv[])
121 DECLARE_COMPLETION_ONSTACK(shutdown);
122 struct cache_set_opts opts = cache_set_opts_empty();
123 struct cache_set *c = NULL;
126 printf("registering %s...\n", argv[1]);
128 err = bch_register_cache_set(argv + 1, argc - 1, opts, &c);
131 fprintf(stderr, "error opening %s: %s\n", argv[1], err);
135 c->stop_completion = &shutdown;
136 bch_cache_set_stop(c);
140 wait_for_completion(&shutdown);