Whamcloud - gitweb
428bd4325ef8e093330cf46d6c9bf7639bb9bbbf
[fs/lustre-release.git] / lustre / llite / lproc_llite.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2002 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
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.
11  *
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.
16  *
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.
20  *
21  */
22 #define DEBUG_SUBSYSTEM S_LLITE
23
24 #include <linux/lustre_lite.h>
25 #include <linux/lprocfs_status.h>
26
27
28
29 int rd_path(char* page, char **start, off_t off,
30                int count, int *eof, void *data)
31 {
32         
33         return 0;
34
35 }
36 int rd_fstype(char* page, char **start, off_t off,
37                 int count, int *eof, void *data)
38 {
39         int len=0;
40         struct super_block *sb=(struct super_block*)data;
41         
42         len+=snprintf(page, count, "%s\n", sb->s_type->name); 
43         return len;
44 }
45 int rd_blksize(char* page, char **start, off_t off,
46                int count, int *eof, void *data)
47 {
48         int len=0;
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)); 
53         return len;
54
55 }
56 int rd_blktotal(char* page, char **start, off_t off,
57                 int count, int *eof, void *data)
58 {
59         int len=0;
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)); 
64         return len;
65         
66 }
67
68 int rd_blkfree(char* page, char **start, off_t off,
69                int count, int *eof, void *data)
70 {
71         int len=0;
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)); 
76         return len;
77         
78         
79 }
80
81 int rd_kbfree(char* page, char **start, off_t off,
82               int count, int *eof, void *data)
83 {
84         int len=0;
85         struct super_block *sb=(struct super_block*)data;
86         struct statfs mystats; 
87         long blk_size=0;
88         
89         (sb->s_op->statfs)(sb, &mystats);
90         blk_size=mystats.f_bsize;
91         
92         len+=snprintf(page, count, LPU64"\n", 
93                       (__u64)((mystats.f_bfree)/(blk_size*1024))); 
94         return len; 
95         
96 }
97
98 int rd_filestotal(char* page, char **start, off_t off,
99                   int count, int *eof, void *data)
100 {
101         
102         int len=0;
103         struct super_block *sb=(struct super_block*)data;
104         
105         struct statfs mystats; 
106         
107         
108         (sb->s_op->statfs)(sb, &mystats);
109                 
110         len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files)); 
111         return len;
112 }
113
114 int rd_filesfree(char* page, char **start, off_t off,
115                int count, int *eof, void *data)
116 {
117         
118         int len=0;
119         struct super_block *sb=(struct super_block*)data;
120         
121         struct statfs mystats; 
122         
123         
124         (sb->s_op->statfs)(sb, &mystats);
125                 
126         len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree)); 
127         return len;
128 }
129
130 int rd_filegroups(char* page, char **start, off_t off,
131                  int count, int *eof, void *data)
132 {
133         return 0;
134 }
135 int rd_uuid(char* page, char **start, off_t off,
136             int count, int *eof, void *data)
137 {
138         int len=0;
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); 
142         return len;    
143
144 }
145 int rd_dev_name(char* page, char **start, off_t off,
146                     int count, int *eof, void *data)
147 {
148         int len=0;
149         struct obd_device* dev=(struct obd_device*)data;
150         len+=snprintf(page, count, "%s\n", dev->obd_name);
151         return len;
152 }
153
154 int rd_dev_uuid(char* page, char **start, off_t off,
155                     int count, int *eof, void *data)
156 {
157         int len=0;
158         struct obd_device* dev=(struct obd_device*)data;
159         len+=snprintf(page, count, "%s\n", dev->obd_uuid);
160         return len;
161 }
162
163
164 lprocfs_vars_t 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/blockstotal",rd_blktotal, 0},
170         {"status/blocksfree",rd_blkfree, 0},
171         {"status/kbytesfree", rd_kbfree, 0},
172         {"status/filestotal", rd_filestotal, 0},
173         {"status/filesfree", rd_filesfree, 0},
174         {"status/filegroups", rd_filegroups, 0},
175         {0}
176 };