diff --git a/blocks/Makefile b/blocks/Makefile index 9828cc1..f830509 100644 --- a/blocks/Makefile +++ b/blocks/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/blocks/blockstore.c b/blocks/blockstore.c index fcaf368..856ec35 100644 --- a/blocks/blockstore.c +++ b/blocks/blockstore.c @@ -50,6 +50,6 @@ int ipfs_blockstore_put(struct Block* block, struct FSRepo* fs_repo) { return 0; // send to Put with key - fs_repo->config->datastore->datastore_put(key, key_length, block, fs_repo->config->datastore); + fs_repo->config->datastore->datastore_put(key, key_length, block->data, block->data_length, fs_repo->config->datastore); return 0; } diff --git a/cid/Makefile b/cid/Makefile index f7e0269..08774d9 100644 --- a/cid/Makefile +++ b/cid/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/cmd/ipfs/Makefile b/cmd/ipfs/Makefile index 0eb33bb..9021275 100644 --- a/cmd/ipfs/Makefile +++ b/cmd/ipfs/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../../include -I../../../c-libp2p/include +CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/commands/Makefile b/commands/Makefile index d9ddb21..a0073d2 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall LFLAGS = DEPS = ../include/ipfs/commands/argument.h ../include/ipfs/commands/command_option.h \ ../include/ipfs/commands/command.h ../include/ipfs/commands/context.h \ diff --git a/commands/cli/Makefile b/commands/cli/Makefile index 07eb486..8627257 100644 --- a/commands/cli/Makefile +++ b/commands/cli/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../../include -I../../../c-libp2p/include +CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -Wall LFLAGS = DEPS = parse.h OBJS = parse.o diff --git a/core/Makefile b/core/Makefile index 00f1160..943ec08 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall LFLAGS = DEPS = builder.h ipfs_node.h OBJS = builder.o diff --git a/datastore/Makefile b/datastore/Makefile index ec69298..2460886 100644 --- a/datastore/Makefile +++ b/datastore/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../lmdb/libraries/liblmdb +CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../lmdb/libraries/liblmdb -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/flatfs/Makefile b/flatfs/Makefile index dcfebd1..6393390 100644 --- a/flatfs/Makefile +++ b/flatfs/Makefile @@ -1,6 +1,6 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/include/ipfs/repo/config/datastore.h b/include/ipfs/repo/config/datastore.h index 8391da4..e1d5333 100644 --- a/include/ipfs/repo/config/datastore.h +++ b/include/ipfs/repo/config/datastore.h @@ -20,7 +20,7 @@ struct Datastore { // function pointers for datastore operations int (*datastore_open)(int argc, char** argv, struct Datastore* datastore); int (*datastore_close)(struct Datastore* datastore); - int (*datastore_put)(const char* key, size_t key_size, struct Block* block, struct Datastore* datastore); + int (*datastore_put)(const char* key, size_t key_size, unsigned char* data, size_t data_length, struct Datastore* datastore); //int (*datastore_get)(const char* key, struct Block* block); // a handle to the datastore "context" used by the datastore void* handle; diff --git a/multibase/Makefile b/multibase/Makefile index 1552afe..af88631 100644 --- a/multibase/Makefile +++ b/multibase/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/os/Makefile b/os/Makefile index 5e4bd59..66eaabe 100644 --- a/os/Makefile +++ b/os/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include +CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall LFLAGS = DEPS = OBJS = utils.o diff --git a/repo/config/Makefile b/repo/config/Makefile index a25401c..c0a1792 100644 --- a/repo/config/Makefile +++ b/repo/config/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multihash/include +CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multihash/include -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/repo/fsrepo/Makefile b/repo/fsrepo/Makefile index bb1aed7..48e22d6 100644 --- a/repo/fsrepo/Makefile +++ b/repo/fsrepo/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../lmdb/libraries/liblmdb +CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../lmdb/libraries/liblmdb -Wall ifdef DEBUG CFLAGS += -g3 diff --git a/repo/fsrepo/lmdb_datastore.c b/repo/fsrepo/lmdb_datastore.c index 6bf8ab2..dcdcf8a 100644 --- a/repo/fsrepo/lmdb_datastore.c +++ b/repo/fsrepo/lmdb_datastore.c @@ -16,7 +16,7 @@ * @param block the block to be written * @returns true(1) on success */ -int repo_fsrepo_lmdb_put(const char* key, size_t key_size, struct Block* block, struct Datastore* datastore) { +int repo_fsrepo_lmdb_put(const char* key, size_t key_size, unsigned char* data, size_t data_size, struct Datastore* datastore) { int retVal; MDB_txn* mdb_txn; MDB_dbi mdb_dbi; @@ -38,8 +38,8 @@ int repo_fsrepo_lmdb_put(const char* key, size_t key_size, struct Block* block, // write db_key.mv_size = key_size; db_key.mv_data = (char*)key; - db_value.mv_size = block->data_length; - db_value.mv_data = block->data; + db_value.mv_size = data_size; + db_value.mv_data = data; retVal = mdb_put(mdb_txn, mdb_dbi, &db_key, &db_value, MDB_NODUPDATA); if (retVal != 0) return 0; diff --git a/test/Makefile b/test/Makefile index 61045ae..b0444da 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/ -g3 +CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/ -g3 -Wall LFLAGS = -L../../c-libp2p -L../../c-multihash -L../../c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread DEPS = cmd/ipfs/test_init.h repo/test_repo_bootstrap_peers.h repo/test_repo_config.h repo/test_repo_identity.h cid/test_cid.h OBJS = testit.o ../cmd/ipfs/init.o ../commands/argument.o ../commands/command_option.o \ diff --git a/test/cmd/ipfs/test_init.h b/test/cmd/ipfs/test_init.h index b43a0e7..6085d55 100644 --- a/test/cmd/ipfs/test_init.h +++ b/test/cmd/ipfs/test_init.h @@ -5,14 +5,16 @@ #define __TEST_INIT_H__ #include +#include +#include +//#include #include "ipfs/cmd/ipfs/init.h" #include "ipfs/commands/argument.h" #include "ipfs/commands/request.h" #include "ipfs/commands/command.h" +#include "ipfs/os/utils.h" -#include -//#include int test_init_new_installation() { unlink("/tmp/.ipfs/config"); diff --git a/test/storage/test_datastore.h b/test/storage/test_datastore.h index 935ec1b..a04b692 100644 --- a/test/storage/test_datastore.h +++ b/test/storage/test_datastore.h @@ -103,6 +103,9 @@ int make_ipfs_repository(struct FSRepo* fs_repo) { return retVal; } +/** + * create a repository and put a record in the datastore and a block in the blockstore + */ int test_ipfs_datastore_put() { struct Block* block; int retVal; @@ -134,11 +137,8 @@ int test_ipfs_datastore_put() { if (retVal == 0) return 0; - /* - // send to Put with key - retVal = fs_repo->config->datastore->datastore_put(key, key_length, block, fs_repo->config->datastore); - */ + retVal = fs_repo->config->datastore->datastore_put(key, key_length, block->data, block->data_length, fs_repo->config->datastore); if (retVal == 0) return 0;