readahead.c | readahead.c | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
#include "util.h" | #include "util.h" | |||
#include "def.h" | #include "def.h" | |||
#include "build.h" | #include "build.h" | |||
#include "readahead-common.h" | #include "readahead-common.h" | |||
unsigned arg_files_max = 16*1024; | unsigned arg_files_max = 16*1024; | |||
off_t arg_file_size_max = READAHEAD_FILE_SIZE_MAX; | off_t arg_file_size_max = READAHEAD_FILE_SIZE_MAX; | |||
usec_t arg_timeout = 2*USEC_PER_MINUTE; | usec_t arg_timeout = 2*USEC_PER_MINUTE; | |||
static int help(void) { | static void help(void) { | |||
printf("%1$s [OPTIONS...] collect [DIRECTORY]\n\n" | ||||
printf("%s [OPTIONS...] collect [DIRECTORY]\n\n" | ||||
"Collect read-ahead data on early boot.\n\n" | "Collect read-ahead data on early boot.\n\n" | |||
" -h --help Show this help\n" | " -h --help Show this help\n" | |||
" --version Show package version\n" | " --version Show package version\n" | |||
" --files-max=INT Maximum number of files to read ahead\n" | " --files-max=INT Maximum number of files to read ahead\n" | |||
" --file-size-max=BYTES Maximum size of files to read a head\n" | " --file-size-max=BYTES Maximum size of files to read a head\n" | |||
" --timeout=USEC Maximum time to spend collectin | " --timeout=USEC Maximum time to spend collectin | |||
g data\n\n\n", | g data\n" | |||
program_invocation_short_name); | "\n\n" | |||
"%1$s [OPTIONS...] replay [DIRECTORY]\n\n" | ||||
printf("%s [OPTIONS...] replay [DIRECTORY]\n\n" | ||||
"Replay collected read-ahead data on early boot.\n\n" | "Replay collected read-ahead data on early boot.\n\n" | |||
" -h --help Show this help\n" | " -h --help Show this help\n" | |||
" --version Show package version\n" | " --version Show package version\n" | |||
" --file-size-max=BYTES Maximum size of files to read a | " --file-size-max=BYTES Maximum size of files to read a | |||
head\n\n\n", | head\n" | |||
program_invocation_short_name); | "\n\n" | |||
"%1$s [OPTIONS...] analyze [PACK-FILE]\n\n" | ||||
printf("%s [OPTIONS...] analyze [PACK FILE]\n\n" | ||||
"Analyze collected read-ahead data.\n\n" | "Analyze collected read-ahead data.\n\n" | |||
" -h --help Show this help\n" | " -h --help Show this help\n" | |||
" --version Show package version\n", | " --version Show package version\n", | |||
program_invocation_short_name); | program_invocation_short_name); | |||
return 0; | ||||
} | } | |||
static int parse_argv(int argc, char *argv[]) { | static int parse_argv(int argc, char *argv[]) { | |||
enum { | enum { | |||
ARG_VERSION = 0x100, | ARG_VERSION = 0x100, | |||
ARG_FILES_MAX, | ARG_FILES_MAX, | |||
ARG_FILE_SIZE_MAX, | ARG_FILE_SIZE_MAX, | |||
ARG_TIMEOUT | ARG_TIMEOUT | |||
}; | }; | |||
skipping to change at line 89 | skipping to change at line 84 | |||
{ "file-size-max", required_argument, NULL, ARG_FILE_SIZE_M AX }, | { "file-size-max", required_argument, NULL, ARG_FILE_SIZE_M AX }, | |||
{ "timeout", required_argument, NULL, ARG_TIMEOUT }, | { "timeout", required_argument, NULL, ARG_TIMEOUT }, | |||
{} | {} | |||
}; | }; | |||
int c; | int c; | |||
assert(argc >= 0); | assert(argc >= 0); | |||
assert(argv); | assert(argv); | |||
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) { | while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) | |||
switch (c) { | switch (c) { | |||
case 'h': | case 'h': | |||
return help(); | help(); | |||
return 0; | ||||
case ARG_VERSION: | case ARG_VERSION: | |||
puts(PACKAGE_STRING); | puts(PACKAGE_STRING); | |||
puts(SYSTEMD_FEATURES); | puts(SYSTEMD_FEATURES); | |||
return 0; | return 0; | |||
case ARG_FILES_MAX: | case ARG_FILES_MAX: | |||
if (safe_atou(optarg, &arg_files_max) < 0 || arg_fi les_max <= 0) { | if (safe_atou(optarg, &arg_files_max) < 0 || arg_fi les_max <= 0) { | |||
log_error("Failed to parse maximum number o f files %s.", optarg); | log_error("Failed to parse maximum number o f files %s.", optarg); | |||
return -EINVAL; | return -EINVAL; | |||
skipping to change at line 134 | skipping to change at line 130 | |||
} | } | |||
break; | break; | |||
case '?': | case '?': | |||
return -EINVAL; | return -EINVAL; | |||
default: | default: | |||
assert_not_reached("Unhandled option"); | assert_not_reached("Unhandled option"); | |||
} | } | |||
} | ||||
if (optind != argc-1 && | if (optind != argc-1 && | |||
optind != argc-2) { | optind != argc-2) { | |||
help(); | log_error("%s: wrong number of arguments.", | |||
program_invocation_short_name); | ||||
return -EINVAL; | return -EINVAL; | |||
} | } | |||
return 1; | return 1; | |||
} | } | |||
int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { | |||
int r; | int r; | |||
log_set_target(LOG_TARGET_SAFE); | log_set_target(LOG_TARGET_SAFE); | |||
End of changes. 8 change blocks. | ||||
19 lines changed or deleted | 15 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |