diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/ChangeLog | 6 | ||||
-rw-r--r-- | runtime/runtime.h | 31 |
2 files changed, 36 insertions, 1 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 9f0c1425..69f467d1 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,9 @@ +2006-12-08 Josh Stone <joshua.i.stone@intel.com> + + * runtime.h (param_set_int64_t, param_get_int64_t, + param_check_int64_t): New functions to allow taking module parameters + directly as int64_t values. + 2006-12-06 Josh Stone <joshua.i.stone@intel.com> * time.c (stp_timer_reregister): Add a global to control whether the diff --git a/runtime/runtime.h b/runtime/runtime.h index 63b7432e..b8094451 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -1,6 +1,6 @@ /* main header file * Copyright (C) 2005, 2006 Red Hat Inc. - * Copyright (C) 2005 Intel Corporation. + * Copyright (C) 2005, 2006 Intel Corporation. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -82,6 +82,35 @@ static struct #include "perf.c" #endif +/* Support functions for int64_t module parameters. */ +int param_set_int64_t(const char *val, struct kernel_param *kp) +{ + char *endp; + long long ll; + + if (!val) + return -EINVAL; + + /* simple_strtoll isn't exported... */ + if (*val == '-') + ll = -simple_strtoull(val+1, &endp, 0); + else + ll = simple_strtoull(val, &endp, 0); + + if ((endp == val) || ((int64_t)ll != ll)) + return -EINVAL; + + *((int64_t *)kp->arg) = ll; + return 0; +} + +int param_get_int64_t(char *buffer, struct kernel_param *kp) +{ + return sprintf(buffer, "%lli", (long long)*((int64_t *)kp->arg)); +} + +#define param_check_int64_t(name, p) __param_check(name, p, int64_t) + /************* Module Stuff ********************/ |