Skip to content

Commit 6b07f02

Browse files
committed
Merge branch 'devel'
2 parents fc47b87 + b731a5c commit 6b07f02

File tree

117 files changed

+1963
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1963
-511
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22
CMakeFiles/
3+
Testing/
34
generated/
45
CMakeCache.txt
56
CTestTestfile.cmake

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66

77
cmake_minimum_required(VERSION 3.12)
8-
project(bfdev VERSION 1.0.4 LANGUAGES C)
8+
project(bfdev VERSION 1.0.5 LANGUAGES C)
99

1010
include(GNUInstallDirs)
1111
include(CheckIncludeFiles)
@@ -36,6 +36,15 @@ include(scripts/commit.cmake)
3636

3737
commit_hash(BFDEV_COMMITID)
3838
commit_branch(BFDEV_BRANCH)
39+
string(TIMESTAMP BFDEV_BUILD_TIME "%A %B %d %H:%M:%S UTC %Y" UTC)
40+
41+
string(APPEND BFDEV_RELEASE
42+
"${PROJECT_NAME}-${BFDEV_NAME} "
43+
"${BFDEV_VERSION}.${BFDEV_ARCH} "
44+
"${BFDEV_COMMITID}-${BFDEV_BRANCH} "
45+
"(${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} ${CMAKE_HOST_SYSTEM_NAME}) "
46+
"${BFDEV_BUILD_TIME}"
47+
)
3948

4049
option(BFDEV_DEVEL "Enable development mode" OFF)
4150
option(BFDEV_STRICT "Enable strict compilation" ON)

cmake/config.h.in

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ BFDEV_BEGIN_DECLS
1919
#define BFDEV_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}
2020
#define BFDEV_EXTREVERSION ${BFDEV_EXTREVERSION}
2121

22-
#define BFDEV_ARCH ${BFDEV_ARCH}
2322
#define BFDEV_NAME ${BFDEV_NAME}
23+
#define BFDEV_ARCH ${BFDEV_ARCH}
2424
#define BFDEV_VERSION ${BFDEV_VERSION}
25-
26-
#define BFDEV_COMMITID ${BFDEV_COMMITID}
27-
#define BFDEV_BRANCH ${BFDEV_BRANCH}
25+
#define BFDEV_RELEASE "${BFDEV_RELEASE}"
2826

2927
#cmakedefine BFDEV_DEBUG_LIST
3028
#cmakedefine BFDEV_DEBUG_SLIST
@@ -43,6 +41,18 @@ BFDEV_BEGIN_DECLS
4341
(patch) <= BFDEV_VERSION_PATCH)) \
4442
)
4543

44+
static inline const char *
45+
bfdev_version(void)
46+
{
47+
return __bfdev_stringify(BFDEV_VERSION);
48+
}
49+
50+
static inline const char *
51+
bfdev_release(void)
52+
{
53+
return BFDEV_RELEASE;
54+
}
55+
4656
static inline int
4757
bfdev_version_major(void)
4858
{
@@ -63,4 +73,4 @@ bfdev_version_patch(void)
6373

6474
BFDEV_END_DECLS
6575

66-
#endif /*_BFDEV_CONFIG_H_*/
76+
#endif /* _BFDEV_CONFIG_H_ */

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_subdirectory(btree)
1616
add_subdirectory(cache)
1717
add_subdirectory(circle)
1818
add_subdirectory(crc)
19+
add_subdirectory(crypto)
1920
add_subdirectory(fifo)
2021
add_subdirectory(fsm)
2122
add_subdirectory(guards)

examples/action/simple.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ test_action(void *pdata)
1717
return 0;
1818
}
1919

20-
int main(int argc, char **argv)
20+
int
21+
main(int argc, char **argv)
2122
{
2223
BFDEV_DEFINE_ACTION(action, test_action, NULL);
2324
int retval;

examples/allocator/simple.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ test_alloc(size_t size, void *pdata)
1212
return malloc(size);
1313
}
1414

15+
static void *
16+
test_zalloc(size_t size, void *pdata)
17+
{
18+
return calloc(1, size);
19+
}
20+
1521
static void *
1622
test_realloc(void *block, size_t resize, void *pdata)
1723
{
@@ -24,30 +30,31 @@ test_free(void *block, void *pdata)
2430
return free((void *)block);
2531
}
2632

27-
BFDEV_DEFINE_ALLOC(
33+
BFDEV_DEFINE_ALLOC_OPS(
2834
test_ops,
29-
test_alloc,
30-
test_realloc,
31-
test_free,
32-
NULL
35+
test_alloc, test_zalloc,
36+
test_realloc, test_free
3337
);
3438

35-
int main(int argc, char const *argv[])
39+
int
40+
main(int argc, char const *argv[])
3641
{
42+
BFDEV_DEFINE_ALLOC(test, &test_ops, NULL);
3743
int *block;
3844

39-
block = bfdev_malloc(&test_ops, sizeof(*block));
45+
block = bfdev_malloc(&test, sizeof(*block));
4046
if (!block)
4147
return 1;
42-
bfdev_free(&test_ops, block);
48+
bfdev_free(&test, block);
4349

44-
block = bfdev_zalloc(&test_ops, sizeof(*block));
50+
block = bfdev_zalloc(&test, sizeof(*block));
4551
if (!block)
4652
return 1;
47-
block = bfdev_realloc(&test_ops, block, sizeof(*block) * 2);
53+
54+
block = bfdev_realloc(&test, block, sizeof(*block) * 2);
4855
if (!block)
4956
return 1;
50-
bfdev_free(&test_ops, block);
57+
bfdev_free(&test, block);
5158

5259
return 0;
5360
}

examples/arc4/bandwidth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
#define TEST_LOOP 3
1919
#define TEST_KEY 64
2020

21-
int main(int argc, const char *argv[])
21+
int
22+
main(int argc, const char *argv[])
2223
{
2324
bfdev_arc4_ctx_t sctx, dctx;
2425
unsigned int count, loop;

examples/array/simple.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#define TEST_SIZE 64
1313
BFDEV_DEFINE_ARRAY(test_array, NULL, TEST_SIZE);
1414

15-
int main(int argc, const char *argv[])
15+
int
16+
main(int argc, const char *argv[])
1617
{
1718
unsigned int count;
1819
void *array;

examples/ascii85/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22
/ascii85-bandwidth
3+
/ascii85

examples/ascii85/bandwidth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#define TEST_SIZE BFDEV_SZ_1MiB
1818
#define TEST_LOOP 3
1919

20-
int main(int argc, char const *argv[])
20+
int
21+
main(int argc, char const *argv[])
2122
{
2223
unsigned int count, loop;
2324
uint8_t *dbuff, *sbuff;

0 commit comments

Comments
 (0)