LCOV - code coverage report
Current view: top level - shared - volatile-util.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 0 16 0.0 %
Date: 2019-08-22 15:41:25 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : 
       3             : #include <errno.h>
       4             : 
       5             : #include "alloc-util.h"
       6             : #include "macro.h"
       7             : #include "parse-util.h"
       8             : #include "proc-cmdline.h"
       9             : #include "string-table.h"
      10             : #include "string-util.h"
      11             : #include "volatile-util.h"
      12             : 
      13           0 : int query_volatile_mode(VolatileMode *ret) {
      14           0 :         _cleanup_free_ char *mode = NULL;
      15             :         int r;
      16             : 
      17           0 :         r = proc_cmdline_get_key("systemd.volatile", PROC_CMDLINE_VALUE_OPTIONAL, &mode);
      18           0 :         if (r < 0)
      19           0 :                 return r;
      20           0 :         if (r == 0) {
      21           0 :                 *ret = VOLATILE_NO;
      22           0 :                 return 0;
      23             :         }
      24             : 
      25           0 :         if (mode) {
      26             :                 VolatileMode m;
      27             : 
      28           0 :                 m = volatile_mode_from_string(mode);
      29           0 :                 if (m < 0)
      30           0 :                         return -EINVAL;
      31             : 
      32           0 :                 *ret = m;
      33             :         } else
      34           0 :                 *ret = VOLATILE_YES;
      35             : 
      36           0 :         return 1;
      37             : }
      38             : 
      39             : static const char* const volatile_mode_table[_VOLATILE_MODE_MAX] = {
      40             :         [VOLATILE_NO] = "no",
      41             :         [VOLATILE_YES] = "yes",
      42             :         [VOLATILE_STATE] = "state",
      43             :         [VOLATILE_OVERLAY] = "overlay",
      44             : };
      45             : 
      46           0 : DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(volatile_mode, VolatileMode, VOLATILE_YES);

Generated by: LCOV version 1.14