1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #define DEBUG_SUBSYSTEM S_CLASS
23 #include <linux/obd_support.h>
24 #include <linux/obd_class.h>
25 #include <linux/lprocfs.h>
26 #include <linux/string.h>
27 #include <linux/lustre_lib.h>
31 * Common SNMP namespace
34 int rd_uuid(char* page, char **start, off_t off,
35 int count, int *eof, void *data)
38 struct obd_device* dev=(struct obd_device*)data;
39 len+=snprintf(page, count, "%s\n", dev->obd_uuid);
44 int rd_stripesize(char* page, char **start, off_t off,
45 int count, int *eof, void *data)
47 struct obd_device* dev=(struct obd_device*)data;
49 struct lov_obd* lov=&dev->u.lov;
50 len+=snprintf(page, count, LPU64"\n", \
51 (__u64)(lov->desc.ld_default_stripe_count));
56 int rd_stripedepth(char* page, char **start, off_t off,
57 int count, int *eof, void *data)
59 struct obd_device* dev=(struct obd_device*)data;
61 struct lov_obd* lov=&dev->u.lov;
62 len+=snprintf(page, count, LPU64"\n", \
63 lov->desc.ld_default_stripe_size);
67 int rd_stripefactor(char* page, char **start, off_t off,
68 int count, int *eof, void *data)
70 struct obd_device* dev=(struct obd_device*)data;
72 struct lov_obd* lov=&dev->u.lov;
73 len+=snprintf(page, count, LPU64"\n", \
74 lov->desc.ld_default_stripe_offset);
79 int rd_stripetype(char* page, char **start, off_t off,
80 int count, int *eof, void *data)
82 struct obd_device* dev=(struct obd_device*)data;
84 struct lov_obd* lov=&dev->u.lov;
85 len+=snprintf(page, count, LPU64"\n", \
86 (__u64)(lov->desc.ld_pattern));
91 int rd_blksize(char* page, char **start, off_t off,
92 int count, int *eof, void *data)
98 int rd_blktotal(char* page, char **start, off_t off,
99 int count, int *eof, void *data)
104 int rd_blkfree(char* page, char **start, off_t off,
105 int count, int *eof, void *data)
110 int rd_kbfree(char* page, char **start, off_t off,
111 int count, int *eof, void *data)
116 int rd_numobjects(char* page, char **start, off_t off,
117 int count, int *eof, void *data)
122 int rd_objfree(char* page, char **start, off_t off,
123 int count, int *eof, void *data)
128 int rd_objgroups(char* page, char **start, off_t off,
129 int count, int *eof, void *data)
134 int rd_target(char* page, char **start, off_t off,
135 int count, int *eof, void *data)
137 struct obd_device* dev=(struct obd_device*)data;
139 struct lov_obd* lov=&dev->u.lov;
140 struct lov_tgt_desc* tgts=lov->tgts;
141 while(i<lov->desc.ld_tgt_count){
142 len+=snprintf(page, count, \
143 "OBD Device [%d] UUID: %s\n", \
152 int rd_mdc(char* page, char **start, off_t off,
153 int count, int *eof, void *data)
155 struct obd_device* dev=(struct obd_device*)data;
157 struct lov_obd* lov=&dev->u.lov;
158 len+=snprintf(page, count, \
160 lov->mdcobd->obd_uuid);
164 lprocfs_vars_t snmp_var_nm_1[]={
165 {"snmp/uuid", rd_uuid, 0},
166 {"snmp/lov_stripesize",rd_stripesize, 0},
167 {"snmp/lov_stripedepth",rd_stripedepth, 0},
168 {"snmp/lov_stripefactor",rd_stripefactor, 0},
169 {"snmp/lov_stripetype", rd_stripetype, 0},
170 {"snmp/f_objects", rd_numobjects, 0},
171 {"snmp/f_objectsfree", rd_objfree, 0},
172 {"snmp/f_objectgroups", rd_objgroups, 0},
173 {"snmp/f_blocksize", rd_blksize, 0},
174 {"snmp/f_blockstotal", rd_blktotal, 0},
175 {"snmp/f_kbytesfree", rd_kbfree, 0},
176 {"snmp/f_blocksfree", rd_blkfree, 0},
177 {"snmp/target_obd", rd_target, 0},
178 {"snmp/target_mdc", rd_mdc, 0},