aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/subcmd/parse-options.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-03 21:13:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-03 21:13:43 -0400
commit01897f3e05ede4d66c0f9df465fde1d67a1d733f (patch)
tree3c0f1e0fb8bc352e6821d16e46f335484cc3868a /tools/lib/subcmd/parse-options.c
parente9ebc2151f88600e726e51e5f7ca9c33ad53b35f (diff)
parent29995d296e3e9ce4f9767963ecbef143ade26c36 (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates and fixes from Ingo Molnar: "These are almost all tooling updates: 'perf top', 'perf trace' and 'perf script' fixes and updates, an UAPI header sync with the merge window versions, license marker updates, much improved Sparc support from David Miller, and a number of fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (66 commits) perf intel-pt/bts: Calculate cpumode for synthesized samples perf intel-pt: Insert callchain context into synthesized callchains perf tools: Don't clone maps from parent when synthesizing forks perf top: Start display thread earlier tools headers uapi: Update linux/if_link.h header copy tools headers uapi: Update linux/netlink.h header copy tools headers: Sync the various kvm.h header copies tools include uapi: Update linux/mmap.h copy perf trace beauty: Use the mmap flags table generated from headers perf beauty: Wire up the mmap flags table generator to the Makefile perf beauty: Add a generator for MAP_ mmap's flag constants tools include uapi: Update asound.h copy tools arch uapi: Update asm-generic/unistd.h and arm64 unistd.h copies tools include uapi: Update linux/fs.h copy perf callchain: Honour the ordering of PERF_CONTEXT_{USER,KERNEL,etc} perf cs-etm: Correct CPU mode for samples perf unwind: Take pgoff into account when reporting elf to libdwfl perf top: Do not use overwrite mode by default perf top: Allow disabling the overwrite mode perf trace: Beautify mount's first pathname arg ...
Diffstat (limited to 'tools/lib/subcmd/parse-options.c')
-rw-r--r--tools/lib/subcmd/parse-options.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
index cb7154eccbdc..dbb9efbf718a 100644
--- a/tools/lib/subcmd/parse-options.c
+++ b/tools/lib/subcmd/parse-options.c
@@ -116,6 +116,7 @@ static int get_value(struct parse_opt_ctx_t *p,
116 case OPTION_INTEGER: 116 case OPTION_INTEGER:
117 case OPTION_UINTEGER: 117 case OPTION_UINTEGER:
118 case OPTION_LONG: 118 case OPTION_LONG:
119 case OPTION_ULONG:
119 case OPTION_U64: 120 case OPTION_U64:
120 default: 121 default:
121 break; 122 break;
@@ -166,6 +167,7 @@ static int get_value(struct parse_opt_ctx_t *p,
166 case OPTION_INTEGER: 167 case OPTION_INTEGER:
167 case OPTION_UINTEGER: 168 case OPTION_UINTEGER:
168 case OPTION_LONG: 169 case OPTION_LONG:
170 case OPTION_ULONG:
169 case OPTION_U64: 171 case OPTION_U64:
170 default: 172 default:
171 break; 173 break;
@@ -295,6 +297,22 @@ static int get_value(struct parse_opt_ctx_t *p,
295 return opterror(opt, "expects a numerical value", flags); 297 return opterror(opt, "expects a numerical value", flags);
296 return 0; 298 return 0;
297 299
300 case OPTION_ULONG:
301 if (unset) {
302 *(unsigned long *)opt->value = 0;
303 return 0;
304 }
305 if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
306 *(unsigned long *)opt->value = opt->defval;
307 return 0;
308 }
309 if (get_arg(p, opt, flags, &arg))
310 return -1;
311 *(unsigned long *)opt->value = strtoul(arg, (char **)&s, 10);
312 if (*s)
313 return opterror(opt, "expects a numerical value", flags);
314 return 0;
315
298 case OPTION_U64: 316 case OPTION_U64:
299 if (unset) { 317 if (unset) {
300 *(u64 *)opt->value = 0; 318 *(u64 *)opt->value = 0;
@@ -703,6 +721,7 @@ static void print_option_help(const struct option *opts, int full)
703 case OPTION_ARGUMENT: 721 case OPTION_ARGUMENT:
704 break; 722 break;
705 case OPTION_LONG: 723 case OPTION_LONG:
724 case OPTION_ULONG:
706 case OPTION_U64: 725 case OPTION_U64:
707 case OPTION_INTEGER: 726 case OPTION_INTEGER:
708 case OPTION_UINTEGER: 727 case OPTION_UINTEGER: