X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flinux%2Flprocfs_status.h;h=1c0234a702b823de0ced36c6e85430285a703ddd;hb=886454a8f9fb45c843865955c207b6060f1f9192;hp=cd8f12b07f07f33c2831437bf133cd069b82a80b;hpb=040033cef24c5aca2967daf2da7a862abcd074cf;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/lprocfs_status.h b/lustre/include/linux/lprocfs_status.h index cd8f12b..1c0234a 100644 --- a/lustre/include/linux/lprocfs_status.h +++ b/lustre/include/linux/lprocfs_status.h @@ -1,187 +1,66 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2002 Cluster File Systems, Inc. + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre 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. + * 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 version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * - * Top level header file for LProc SNMP - * Author: Hariharan Thantry thantry@users.sourceforge.net + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * lustre/include/linux/lprocfs_status.h + * + * Top level header file for LProc SNMP + * + * Author: Hariharan Thantry thantry@users.sourceforge.net */ +#ifndef _LINUX_LPROCFS_SNMP_H +#define _LINUX_LPROCFS_SNMP_H + #ifndef _LPROCFS_SNMP_H -#define _LPROCFS_SNMP_H +#error Do not #include this file directly. #include instead +#endif #ifdef __KERNEL__ +#ifndef AUTOCONF_INCLUDED +#include +#endif #include #include +#include +#include +#include +#include +#include +#include + +#else +# define kstatfs statfs #endif -#ifndef LPROCFS -#ifdef CONFIG_PROC_FS /* Ensure that /proc is configured */ -#define LPROCFS -#endif -#endif - -struct lprocfs_vars { - char *name; - read_proc_t *read_fptr; - write_proc_t *write_fptr; - void *data; -}; - -struct lprocfs_static_vars { - struct lprocfs_vars *module_vars; - struct lprocfs_vars *obd_vars; -}; - -/* class_obd.c */ -extern struct proc_dir_entry *proc_lustre_root; - - -#define LPROCFS_INIT_MULTI_VARS(array, size) \ -void lprocfs_init_multi_vars(unsigned int idx, \ - struct lprocfs_static_vars *x) \ -{ \ - struct lprocfs_static_vars *glob = (struct lprocfs_static_vars*)array; \ - LASSERT(glob != 0); \ - LASSERT(idx < (unsigned int)(size)); \ - x->module_vars = glob[idx].module_vars; \ - x->obd_vars = glob[idx].obd_vars; \ -} \ - -#ifdef LPROCFS -#define LPROCFS_INIT_VARS(vclass, vinstance) \ -void lprocfs_init_vars(struct lprocfs_static_vars *x) \ -{ \ - x->module_vars = vclass; \ - x->obd_vars = vinstance; \ -} \ - -extern void lprocfs_init_vars(struct lprocfs_static_vars *var); -extern void lprocfs_init_multi_vars(unsigned int idx, - struct lprocfs_static_vars *var); -/* lprocfs_status.c */ -extern int lprocfs_add_vars(struct proc_dir_entry *root, - struct lprocfs_vars *var, - void *data); - -extern struct proc_dir_entry *lprocfs_register(const char *name, - struct proc_dir_entry *parent, - struct lprocfs_vars *list, - void *data); - -extern void lprocfs_remove(struct proc_dir_entry *root); - -struct obd_device; -extern int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list); -extern int lprocfs_obd_detach(struct obd_device *dev); - -/* Generic callbacks */ - -extern int lprocfs_rd_u64(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_name(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_numrefs(char *page, char **start, off_t off, - int count, int *eof, void *data); - -/* Statfs helpers */ -struct statfs; -extern int lprocfs_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); -extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); -extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); -extern int lprocfs_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); -extern int lprocfs_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); -extern int lprocfs_rd_filegroups(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs); - -#define DEFINE_LPROCFS_STATFS_FCT(fct_name, get_statfs_fct) \ -int fct_name(char *page, char **start, off_t off, \ - int count, int *eof, void *data) \ -{ \ - struct statfs sfs; \ - int rc = get_statfs_fct((struct obd_device*)data, &sfs); \ - return (rc==0 \ - ? lprocfs_##fct_name (page, start, off, count, eof, &sfs) \ - : rc); \ -} - -#else - -static inline struct proc_dir_entry * -lprocfs_register(const char *name, struct proc_dir_entry *parent, - struct lprocfs_vars *list, void *data) { return NULL; } -static inline void lprocfs_init_vars(struct lprocfs_static_vars *x) { return; } -static inline int lprocfs_add_vars(struct proc_dir_entry *root, - struct lprocfs_vars *var, - void *data) { return 0; } -static inline void lprocfs_remove(struct proc_dir_entry *root) {}; -struct obd_device; -static inline int lprocfs_obd_attach(struct obd_device *dev, - struct lprocfs_vars *list) { return 0; } -static inline int lprocfs_obd_detach(struct obd_device *dev) { return 0; } -static inline int lprocfs_rd_u64(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_name(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } - -/* Statfs helpers */ -struct statfs; -static inline -int lprocfs_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } -static inline -int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } -static inline -int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } -static inline -int lprocfs_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } -static inline -int lprocfs_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } -static inline -int lprocfs_rd_filegroups(char *page, char **start, off_t off, - int count, int *eof, struct statfs *sfs) { return 0; } - -#define DEFINE_LPROCFS_STATFS_FCT(fct_name, get_statfs_fct) \ -int fct_name(char *page, char **start, off_t off, \ - int count, int *eof, void *data) { *eof = 1; return 0; } - -#endif /* LPROCFS */ - #endif /* LPROCFS_SNMP_H */