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
24 #include <linux/lustre_lite.h>
25 #include <linux/lprocfs_status.h>
28 int rd_uuid(char* page, char **start, off_t off, int count, int *eof,
32 struct obd_device* dev = (struct obd_device*)data;
33 len += snprintf(page, count, "%s\n", dev->obd_uuid);
36 int rd_blksize(char* page, char **start, off_t off, int count, int *eof,
39 struct obd_device* temp = (struct obd_device*)data;
40 struct statfs mystats;
43 vfs_statfs(temp->u.filter.fo_sb, &mystats);
44 len+=snprintf(page, count, "%ld\n", mystats.f_bsize);
47 int rd_kbtotal(char* page, char **start, off_t off, int count, int *eof,
50 struct obd_device* temp = (struct obd_device*)data;
51 struct statfs mystats;
56 vfs_statfs(temp->u.filter.fo_sb, &mystats);
57 blk_size = mystats.f_bsize;
59 result = mystats.f_blocks;
60 while(blk_size >>= 1){
63 len+=snprintf(page, count, LPU64"\n", result);
67 int rd_kbfree(char* page, char **start, off_t off, int count, int *eof,
70 struct obd_device* temp = (struct obd_device*)data;
71 struct statfs mystats;
76 vfs_statfs(temp->u.filter.fo_sb, &mystats);
77 blk_size = mystats.f_bsize;
79 result = mystats.f_bfree;
80 while(blk_size >>= 1){
83 len += snprintf(page, count, LPU64"\n", result);
87 int rd_fstype(char* page, char **start, off_t off, int count, int *eof,
90 struct obd_device* temp = (struct obd_device*)data;
92 len += snprintf(page, count, "%s\n", temp->u.filter.fo_fstype);
95 int rd_files(char* page, char **start, off_t off, int count, int *eof,
98 struct obd_device* temp = (struct obd_device*)data;
99 struct statfs mystats;
101 vfs_statfs(temp->u.filter.fo_sb, &mystats);
102 len += snprintf(page, count, "%ld\n", mystats.f_files);
106 int rd_filesfree(char* page, char **start, off_t off, int count, int *eof,
109 struct obd_device* temp = (struct obd_device*)data;
110 struct statfs mystats;
112 vfs_statfs(temp->u.filter.fo_sb, &mystats);
113 len += snprintf(page, count, "%ld\n", mystats.f_ffree);
117 struct lprocfs_vars status_var_nm_1[] = {
118 {"status/uuid", rd_uuid, 0, 0},
119 {"status/blocksize",rd_blksize, 0, 0},
120 {"status/kbytestotal",rd_kbtotal, 0, 0},
121 {"status/kbytesfree", rd_kbfree, 0, 0},
122 {"status/files", rd_files, 0, 0},
123 {"status/filesfree", rd_filesfree, 0, 0},
124 {"status/fstype", rd_fstype, 0, 0},
127 int rd_numrefs(char* page, char **start, off_t off, int count, int *eof,
130 struct obd_type* class = (struct obd_type*)data;
132 len += snprintf(page, count, "%d\n", class->typ_refcnt);
136 struct lprocfs_vars status_class_var[] = {
137 {"status/num_refs", rd_numrefs, 0, 0},