X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flinux%2Flprocfs_status.h;h=ac2e7fc44b1844cdf5c447a6d86102874e9410cc;hb=5bd85b467a4b6ef57d7a3c119296c9a317afc73b;hp=14a713cc25779f6448e325b25696a5922420a9bd;hpb=93acd158c57c4c5d0fc751d46741231490c04707;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/lprocfs_status.h b/lustre/include/linux/lprocfs_status.h index 14a713c..ac2e7fc 100644 --- a/lustre/include/linux/lprocfs_status.h +++ b/lustre/include/linux/lprocfs_status.h @@ -1,184 +1,62 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: +/* + * GPL HEADER START * - * Copyright (C) 2002 Cluster File Systems, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * This file is part of Lustre, http://www.lustre.org. + * 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 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 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). * - * 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. + * 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 * - * 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. + * 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. * - * Top level header file for LProc SNMP - * Author: Hariharan Thantry thantry@users.sourceforge.net + * GPL HEADER END */ -#ifndef _LPROCFS_SNMP_H -#define _LPROCFS_SNMP_H - -#include -#include +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2011, Intel Corporation. + */ +/* + * 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 -#ifdef CONFIG_PROC_FS /* Ensure that /proc is configured */ -#define LPROCFS -#endif +#ifndef _LPROCFS_SNMP_H +#error Do not #include this file directly. #include instead #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; - -extern void lprocfs_init_vars(struct lprocfs_static_vars *var); -extern void lprocfs_init_multi_vars(unsigned int idx, - struct lprocfs_static_vars *var); - -#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; \ -} \ - -#define LPROCFS_INIT_VARS(vclass, vinstance) \ -void lprocfs_init_vars(struct lprocfs_static_vars *x) \ -{ \ - x->module_vars = vclass; \ - x->obd_vars = vinstance; \ -} \ - -#ifdef LPROCFS -/* 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); \ -} +#ifdef __KERNEL__ +#include +#include +#include +#include +#include +#include +#include #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 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 */ +#define kstatfs statfs +#endif #endif /* LPROCFS_SNMP_H */