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_LLITE
23 #include <linux/obd_support.h>
24 #include <linux/obd_class.h>
25 #include <linux/lustre_lite.h>
26 #include <linux/lprocfs.h>
27 #include <linux/string.h>
29 #include <linux/lustre_lib.h>
32 int rd_path(char* page, char **start, off_t off,
33 int count, int *eof, void *data)
39 int rd_fstype(char* page, char **start, off_t off,
40 int count, int *eof, void *data)
43 struct super_block *sb=(struct super_block*)data;
45 len+=snprintf(page, count, "%s\n", sb->s_type->name);
48 int rd_blksize(char* page, char **start, off_t off,
49 int count, int *eof, void *data)
52 struct super_block *sb=(struct super_block*)data;
53 struct statfs mystats;
54 (sb->s_op->statfs)(sb, &mystats);
55 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize));
59 int rd_blktotal(char* page, char **start, off_t off,
60 int count, int *eof, void *data)
63 struct super_block *sb=(struct super_block*)data;
64 struct statfs mystats;
65 (sb->s_op->statfs)(sb, &mystats);
66 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_blocks));
71 int rd_blkfree(char* page, char **start, off_t off,
72 int count, int *eof, void *data)
75 struct super_block *sb=(struct super_block*)data;
76 struct statfs mystats;
77 (sb->s_op->statfs)(sb, &mystats);
78 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bfree));
84 int rd_kbfree(char* page, char **start, off_t off,
85 int count, int *eof, void *data)
88 struct super_block *sb=(struct super_block*)data;
89 struct statfs mystats;
92 (sb->s_op->statfs)(sb, &mystats);
93 blk_size=mystats.f_bsize;
95 len+=snprintf(page, count, LPU64"\n", \
96 (__u64)((mystats.f_bfree)/(blk_size*1024)));
101 int rd_numobjects(char* page, char **start, off_t off,
102 int count, int *eof, void *data)
106 struct super_block *sb=(struct super_block*)data;
108 struct statfs mystats;
111 (sb->s_op->statfs)(sb, &mystats);
113 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
117 int rd_objfree(char* page, char **start, off_t off,
118 int count, int *eof, void *data)
122 struct super_block *sb=(struct super_block*)data;
124 struct statfs mystats;
127 (sb->s_op->statfs)(sb, &mystats);
129 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
133 int rd_objgroups(char* page, char **start, off_t off,
134 int count, int *eof, void *data)
138 int rd_uuid(char* page, char **start, off_t off,
139 int count, int *eof, void *data)
142 struct super_block *sb=(struct super_block*)data;
143 struct ll_sb_info *sbi=ll_s2sbi(sb);
144 len+=snprintf(page, count, "%s\n", sbi->ll_sb_uuid);
148 int rd_dev_name(char* page, char **start, off_t off,
149 int count, int *eof, void *data)
152 struct obd_device* dev=(struct obd_device*)data;
153 len+=snprintf(page, count, "%s\n", dev->obd_name);
157 int rd_dev_uuid(char* page, char **start, off_t off,
158 int count, int *eof, void *data)
161 struct obd_device* dev=(struct obd_device*)data;
162 len+=snprintf(page, count, "%s\n", dev->obd_uuid);
167 lprocfs_vars_t snmp_var_nm_1[]={
168 {"snmp/uuid", rd_uuid, 0},
169 {"snmp/mntpt_path", rd_path, 0},
170 {"snmp/fs_type", rd_fstype, 0},
171 {"snmp/f_blocksize",rd_blksize, 0},
172 {"snmp/f_blockstotal",rd_blktotal, 0},
173 {"snmp/f_blocksfree",rd_blkfree, 0},
174 {"snmp/f_kbytesfree", rd_kbfree, 0},
175 {"snmp/f_objects", rd_numobjects, 0},
176 {"snmp/f_objectsfree", rd_objfree, 0},
177 {"snmp/f_objectgroups", rd_objgroups, 0},