/* * Copyright (c) 2019 AVM GmbH . * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef __ERRSTAT_H__ #define __ERRSTAT_H__ #include #include #include #include /* User-allocated struct for the domain */ struct errstat_domain_storage { unsigned int num_entries; char const *const *names; atomic_t *counters; atomic_t unknown; struct kobject *parent; struct kobj_attribute attr; }; struct errstat_domain; struct errstat_domain *errstat_domain_init(struct errstat_domain_storage *dom, const char *const *names, atomic_t *counters, unsigned int num_entries); unsigned long errstat_track(struct errstat_domain *dom, unsigned long err); int errstat_sysfs_attach(struct errstat_domain *dom, struct kobject *parent, const char *name); void errstat_sysfs_detach(struct errstat_domain *dom); #endif // __ERRSTAT_H__