// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2005-2019 Junjiro R. Okajima */ /* * debug print functions */ #include "aufs.h" /* Returns 0, or -errno. arg is in kp->arg. */ static int param_atomic_t_set(const char *val, const struct kernel_param *kp) { int err, n; err = kstrtoint(val, 0, &n); if (!err) { if (n > 0) au_debug_on(); else au_debug_off(); } return err; } /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ static int param_atomic_t_get(char *buffer, const struct kernel_param *kp) { atomic_t *a; a = kp->arg; return sprintf(buffer, "%d", atomic_read(a)); } static struct kernel_param_ops param_ops_atomic_t = { .set = param_atomic_t_set, .get = param_atomic_t_get /* void (*free)(void *arg) */ }; atomic_t aufs_debug = ATOMIC_INIT(0); MODULE_PARM_DESC(debug, "debug print"); module_param_named(debug, aufs_debug, atomic_t, 0664);