Lines Matching +full:cm +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
3 #include <subcmd/parse-options.h>
13 const char *name; member
18 { .name = n, .clockid = (c), }
20 #define CLOCKID_END { .name = NULL, }
70 struct record_opts *opts = (struct record_opts *)opt->value; in parse_clockid()
71 const struct clockid_map *cm; in parse_clockid() local
75 opts->use_clockid = 0; in parse_clockid()
84 if (opts->use_clockid) in parse_clockid()
85 return -1; in parse_clockid()
87 opts->use_clockid = true; in parse_clockid()
90 if (sscanf(str, "%d", &opts->clockid) == 1) in parse_clockid()
91 return get_clockid_res(opts->clockid, &opts->clockid_res_ns); in parse_clockid()
93 /* allow a "CLOCK_" prefix to the name */ in parse_clockid()
97 for (cm = clockids; cm->name; cm++) { in parse_clockid()
98 if (!strcasecmp(str, cm->name)) { in parse_clockid()
99 opts->clockid = cm->clockid; in parse_clockid()
100 return get_clockid_res(opts->clockid, in parse_clockid()
101 &opts->clockid_res_ns); in parse_clockid()
105 opts->use_clockid = false; in parse_clockid()
107 return -1; in parse_clockid()
112 const struct clockid_map *cm; in clockid_name() local
114 for (cm = clockids; cm->name; cm++) { in clockid_name()
115 if (cm->clockid == clk_id) in clockid_name()
116 return cm->name; in clockid_name()