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
24 #include <linux/lustre_lite.h>
25 #include <linux/lprocfs_status.h>
29 int rd_path(char* page, char **start, off_t off,
30 int count, int *eof, void *data)
36 int rd_fstype(char* page, char **start, off_t off,
37 int count, int *eof, void *data)
40 struct super_block *sb=(struct super_block*)data;
42 len+=snprintf(page, count, "%s\n", sb->s_type->name);
45 int rd_blksize(char* page, char **start, off_t off,
46 int count, int *eof, void *data)
49 struct super_block *sb=(struct super_block*)data;
50 struct statfs mystats;
51 (sb->s_op->statfs)(sb, &mystats);
52 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize));
56 int rd_kbytestotal(char* page, char **start, off_t off,
57 int count, int *eof, void *data)
60 struct super_block *sb=(struct super_block*)data;
61 struct statfs mystats;
62 (sb->s_op->statfs)(sb, &mystats);
63 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_blocks));
68 int rd_blkfree(char* page, char **start, off_t off,
69 int count, int *eof, void *data)
72 struct super_block *sb=(struct super_block*)data;
73 struct statfs mystats;
74 (sb->s_op->statfs)(sb, &mystats);
75 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bfree));
81 int rd_kbytesfree(char* page, char **start, off_t off,
82 int count, int *eof, void *data)
85 struct super_block *sb=(struct super_block*)data;
86 struct statfs mystats;
89 (sb->s_op->statfs)(sb, &mystats);
90 blk_size=mystats.f_bsize;
92 len+=snprintf(page, count, LPU64"\n",
93 (__u64)((mystats.f_bfree)/(blk_size*1024)));
98 int rd_filestotal(char* page, char **start, off_t off,
99 int count, int *eof, void *data)
103 struct super_block *sb=(struct super_block*)data;
105 struct statfs mystats;
108 (sb->s_op->statfs)(sb, &mystats);
110 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
114 int rd_filesfree(char* page, char **start, off_t off,
115 int count, int *eof, void *data)
119 struct super_block *sb=(struct super_block*)data;
121 struct statfs mystats;
124 (sb->s_op->statfs)(sb, &mystats);
126 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
130 int rd_filegroups(char* page, char **start, off_t off,
131 int count, int *eof, void *data)
135 int rd_uuid(char* page, char **start, off_t off,
136 int count, int *eof, void *data)
139 struct super_block *sb=(struct super_block*)data;
140 struct ll_sb_info *sbi=ll_s2sbi(sb);
141 len+=snprintf(page, count, "%s\n", sbi->ll_sb_uuid);
145 int rd_dev_name(char* page, char **start, off_t off,
146 int count, int *eof, void *data)
149 struct obd_device* dev=(struct obd_device*)data;
150 len+=snprintf(page, count, "%s\n", dev->obd_name);
154 int rd_dev_uuid(char* page, char **start, off_t off,
155 int count, int *eof, void *data)
158 struct obd_device* dev=(struct obd_device*)data;
159 len+=snprintf(page, count, "%s\n", dev->obd_uuid);
164 struct lprocfs_vars status_var_nm_1[]={
165 {"status/uuid", rd_uuid, 0},
166 {"status/mntpt_path", rd_path, 0},
167 {"status/fs_type", rd_fstype, 0},
168 {"status/blocksize",rd_blksize, 0},
169 {"status/kbytestotal",rd_kbytestotal, 0},
170 {"status/kbytesfree", rd_kbytesfree, 0},
171 {"status/filestotal", rd_filestotal, 0},
172 {"status/filesfree", rd_filesfree, 0},
173 {"status/filegroups", rd_filegroups, 0},