Skip to content

Commit 58247c2

Browse files
committed
Merge pull request #386 from puppyofkosh/CDRIVER-1395-squished
CDRIVER-1395 client metadata linux distro scanner
1 parent a840f06 commit 58247c2

15 files changed

+859
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,13 @@ endif()
359359

360360
if (ENABLE_EXPERIMENTAL_FEATURES)
361361
set(HEADERS ${HEADERS}
362+
${SOURCE_DIR}/src/mongoc/mongoc-linux-distro-scanner-private.h
362363
${SOURCE_DIR}/src/mongoc/mongoc-metadata.h
363364
${SOURCE_DIR}/src/mongoc/mongoc-metadata-os-private.h
364365
${SOURCE_DIR}/src/mongoc/mongoc-metadata-private.h
365366
)
366367
set(SOURCES ${SOURCES}
368+
${SOURCE_DIR}/src/mongoc/mongoc-linux-distro-scanner.c
367369
${SOURCE_DIR}/src/mongoc/mongoc-metadata.c
368370
)
369371
endif ()
@@ -512,6 +514,7 @@ endif ()
512514

513515
if (ENABLE_EXPERIMENTAL_FEATURES)
514516
set(test-libmongoc-sources ${test-libmongoc-sources}
517+
${SOURCE_DIR}/tests/test-mongoc-linux-distro-scanner.c
515518
${SOURCE_DIR}/tests/test-mongoc-max-staleness.c
516519
${SOURCE_DIR}/tests/test-mongoc-metadata.c
517520
)

src/mongoc/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ INST_H_FILES = \
109109

110110
if ENABLE_EXPERIMENTAL_FEATURES
111111
INST_H_FILES += \
112+
src/mongoc/mongoc-linux-distro-scanner-private.h \
112113
src/mongoc/mongoc-metadata.h \
113114
src/mongoc/mongoc-metadata-os-private.h \
114115
src/mongoc/mongoc-metadata-private.h
@@ -216,6 +217,7 @@ endif
216217

217218
if ENABLE_EXPERIMENTAL_FEATURES
218219
MONGOC_SOURCES_SHARED += \
220+
src/mongoc/mongoc-linux-distro-scanner.c \
219221
src/mongoc/mongoc-metadata.c
220222
endif
221223

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2016 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
#ifndef MONGOC_LINUX_DISTRO_SCANNER_PRIVATE_H
19+
#define MONGOC_LINUX_DISTRO_SCANNER_PRIVATE_H
20+
21+
#include "mongoc-metadata-os-private.h"
22+
23+
#ifdef MONGOC_OS_IS_LINUX
24+
25+
BSON_BEGIN_DECLS
26+
27+
bool
28+
_mongoc_linux_distro_scanner_get_distro (char **name,
29+
char **version);
30+
31+
/* These functions are exposed so we can test them separately. */
32+
void
33+
_mongoc_linux_distro_scanner_read_key_value_file (const char *path,
34+
const char *name_key,
35+
ssize_t name_key_len,
36+
char **name,
37+
const char *version_key,
38+
ssize_t version_key_len,
39+
char **version);
40+
void
41+
_mongoc_linux_distro_scanner_read_generic_release_file (const char **paths,
42+
char **name,
43+
char **version);
44+
void
45+
_mongoc_linux_distro_scanner_split_line_by_release (const char *line,
46+
ssize_t line_len,
47+
char **name,
48+
char **version);
49+
BSON_END_DECLS
50+
51+
#endif
52+
53+
#endif

0 commit comments

Comments
 (0)