From 5475bc65398edbe26801b245a147b6bb2e4a3835 Mon Sep 17 00:00:00 2001 From: jxy_git Date: Sat, 1 Jul 2023 14:17:37 +0800 Subject: [PATCH] Used as a callback function for the print function of the libbpf library --- src/fsslower/fsslower.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/fsslower/fsslower.c b/src/fsslower/fsslower.c index c24c8ce2..2979a3d1 100644 --- a/src/fsslower/fsslower.c +++ b/src/fsslower/fsslower.c @@ -134,3 +134,25 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) } return 0; } + +static void alias_parse(char *prog) +{ + char *name = basename(prog); + + if (!strcmp(name, "btrfsslower")) + fs_type = BTRFS; + else if (!strcmp(name, "ext4slower")) + fs_type = EXT4; + else if (!strcmp(name, "nfsslower")) + fs_type = NFS; + else if (!strcmp(name, "xfsslower")) + fs_type = XFS; +} + +static int libbpf_print_fn(enum libbpf_print_level level, const char *format, + va_list args) +{ + if (level == LIBBPF_DEBUG && !verbose) + return 0; + return vfprintf(stderr, format, args); +} -- Gitee