Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
add stub libvmemcache API and helper files from PMDK repo
Browse files Browse the repository at this point in the history
1) modified existing files:
	src/CMakeLists.txt
	src/tests/test.c
	utils/check_license/file-exceptions.sh
	utils/check_whitespace

2) added files with stub libvmemcache API:
	src/libvmemcache.c
	src/libvmemcache.h
	src/libvmemcache.map
	src/vmemcache.c
	src/vmemcache.h
	src/vmemcache_heap.c
	src/vmemcache_heap.h
	src/vmemcache_repl.c
	src/vmemcache_repl.h

3) added helper files copied from PMDK common module:
	src/common.h (renamed from src/pmemcommon.h)
	src/file.c
	src/file.h
	src/file_posix.c
	src/mmap.c
	src/mmap.h
	src/mmap_posix.c
	src/os.h
	src/os_posix.c
	src/os_thread.h
	src/os_thread_posix.c
	src/out.c
	src/out.h
	src/sys/queue.h
	src/sys_util.h
	src/util.c
	src/util.h
	src/util_posix.c
	src/valgrind_internal.h
	src/vec.h
	src/vecq.h

4) added helper files copied from PMDK libpmemobj library:
	src/ravl.c
	src/ravl.h
  • Loading branch information
ldorau committed Dec 14, 2018
1 parent d26a7e7 commit 6e97da5
Show file tree
Hide file tree
Showing 38 changed files with 8,670 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ endif (NOT CMAKE_BUILD_TYPE)

include(CheckCCompilerFlag)
include(GNUInstallDirs)

if(NOT MSVC)
find_package(PkgConfig QUIET)
endif()

if(PKG_CONFIG_FOUND)
pkg_check_modules(VALGRIND QUIET valgrind)
else()
find_package(VALGRIND QUIET)
endif()

set(CMAKE_C_STANDARD 99)

# Checks whether flag is supported by current C compiler and appends
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
libvmemcache: buffer based LRU cache
=======================================

### WARNING ###

This library is in a '**Work-In-Progress**' state,
**API is not stable** and it **may change at any time**.

# Building The Source #

Requirements:
Expand Down
27 changes: 23 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,35 @@
cmake_minimum_required(VERSION 3.3)
project(vmemcache C)

include(FindThreads)

add_cstyle(src)
add_check_whitespace(src)

set(SOURCES main.c)
set(SOURCES
out.c
os_posix.c
os_thread_posix.c
util.c
util_posix.c
file.c
file_posix.c
mmap.c
mmap_posix.c
libvmemcache.c
ravl.c
vmemcache.c
vmemcache_heap.c
vmemcache_repl.c)

add_library(vmemcache SHARED ${SOURCES})
target_link_libraries(vmemcache PRIVATE -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libvmemcache.map)
target_link_libraries(vmemcache PRIVATE
${CMAKE_THREAD_LIBS_INIT}
-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libvmemcache.map)

target_compile_definitions(vmemcache PRIVATE SRCVERSION="${VERSION}")

if(VALGRIND_FOUND)
target_compile_definitions(vmemcache PRIVATE VALGRIND_ENABLED=1)
endif()

install(TARGETS vmemcache
DESTINATION ${CMAKE_INSTALL_LIBDIR}/)
42 changes: 39 additions & 3 deletions src/main.h → src/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018, Intel Corporation
* Copyright 2016-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -30,5 +30,41 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* an example library */
int function(void);
/*
* common.h -- common definitions
*/

#ifndef COMMON_H
#define COMMON_H 1

#include "util.h"
#include "out.h"
#include "mmap.h"

#ifdef __cplusplus
extern "C" {
#endif

static inline void
common_init(const char *log_prefix, const char *log_level_var,
const char *log_file_var, int major_version,
int minor_version)
{
util_init();
out_init(log_prefix, log_level_var, log_file_var, major_version,
minor_version);
util_mmap_init();
}

static inline void
common_fini(void)
{
util_mmap_fini();
out_fini();
}

#ifdef __cplusplus
}
#endif

#endif
Loading

0 comments on commit 6e97da5

Please sign in to comment.