1 |
<?xml version="1.0"?> |
2 |
|
3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
4 |
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
5 |
|
6 |
<refentry id="sg_get_fs_stats"> |
7 |
|
8 |
<refentryinfo> |
9 |
<date>$Date: 2005/04/25 11:25:45 $</date> |
10 |
<releaseinfo>$Id: sg_get_fs_stats.xml,v 1.4 2005/04/25 11:25:45 tdb Exp $</releaseinfo> |
11 |
</refentryinfo> |
12 |
|
13 |
<refmeta> |
14 |
<refentrytitle>sg_get_fs_stats</refentrytitle> |
15 |
<manvolnum>3</manvolnum> |
16 |
<refmiscinfo>i-scream</refmiscinfo> |
17 |
</refmeta> |
18 |
|
19 |
<refnamediv> |
20 |
<refname>sg_get_fs_stats</refname> |
21 |
<refpurpose>get filesystem statistics</refpurpose> |
22 |
</refnamediv> |
23 |
|
24 |
<refsynopsisdiv> |
25 |
<funcsynopsis> |
26 |
<funcsynopsisinfo>#include <statgrab.h></funcsynopsisinfo> |
27 |
<funcprototype> |
28 |
<funcdef>sg_fs_stats *<function>sg_get_fs_stats</function></funcdef> |
29 |
<paramdef>int *<parameter>entries</parameter></paramdef> |
30 |
</funcprototype> |
31 |
</funcsynopsis> |
32 |
</refsynopsisdiv> |
33 |
|
34 |
<refsect1> |
35 |
<title>Description</title> |
36 |
<para> |
37 |
The <function>sg_get_fs_stats</function> takes a pointer to an |
38 |
int, <parameter>entries</parameter>, which is filled with the |
39 |
number of mounted file systems the machine has. The return |
40 |
value is a pointer to the first member of an array of |
41 |
<structname>sg_fs_stats</structname> structures; the number of |
42 |
entries in the array is returned in <parameter>entries</parameter>. |
43 |
</para> |
44 |
<para> |
45 |
The function returns statistics about mounted filesystems, |
46 |
including free space and inode usage. |
47 |
</para> |
48 |
</refsect1> |
49 |
|
50 |
<refsect1> |
51 |
<title>Return Values</title> |
52 |
|
53 |
<para> |
54 |
<function>sg_get_fs_stats</function> returns a pointer to a |
55 |
structure of type <structname>sg_fs_stats</structname>. |
56 |
</para> |
57 |
|
58 |
<programlisting> |
59 |
typedef struct { |
60 |
char *device_name; |
61 |
char *fs_type; |
62 |
char *mnt_point; |
63 |
long long size; |
64 |
long long used; |
65 |
long long avail; |
66 |
long long total_inodes; |
67 |
long long used_inodes; |
68 |
long long free_inodes; |
69 |
long long avail_inodes; |
70 |
long long io_size; |
71 |
long long block_size; |
72 |
long long total_blocks; |
73 |
long long free_blocks; |
74 |
long long used_blocks; |
75 |
long long avail_blocks; |
76 |
} sg_fs_stats; |
77 |
</programlisting> |
78 |
|
79 |
<variablelist> |
80 |
<varlistentry> |
81 |
<term> |
82 |
<structfield>device_name</structfield> |
83 |
</term> |
84 |
<listitem> |
85 |
<para> |
86 |
The name known to the operating system. |
87 |
(eg. on linux it might be hda) |
88 |
</para> |
89 |
</listitem> |
90 |
</varlistentry> |
91 |
<varlistentry> |
92 |
<term> |
93 |
<structfield>fs_type</structfield> |
94 |
</term> |
95 |
<listitem> |
96 |
<para> |
97 |
The type of the filesystem. |
98 |
</para> |
99 |
</listitem> |
100 |
</varlistentry> |
101 |
<varlistentry> |
102 |
<term> |
103 |
<structfield>mnt_point</structfield> |
104 |
</term> |
105 |
<listitem> |
106 |
<para> |
107 |
The mount point of the file system. |
108 |
</para> |
109 |
</listitem> |
110 |
</varlistentry> |
111 |
<varlistentry> |
112 |
<term> |
113 |
<structfield>size</structfield> |
114 |
</term> |
115 |
<listitem> |
116 |
<para> |
117 |
The size, in bytes, of the file system. |
118 |
</para> |
119 |
</listitem> |
120 |
</varlistentry> |
121 |
<varlistentry> |
122 |
<term> |
123 |
<structfield>used</structfield> |
124 |
</term> |
125 |
<listitem> |
126 |
<para> |
127 |
The amount of space, in bytes, used on the |
128 |
filesystem. |
129 |
</para> |
130 |
</listitem> |
131 |
</varlistentry> |
132 |
<varlistentry> |
133 |
<term> |
134 |
<structfield>avail</structfield> |
135 |
</term> |
136 |
<listitem> |
137 |
<para> |
138 |
The amount of space, in bytes, available on |
139 |
the filesystem. |
140 |
</para> |
141 |
</listitem> |
142 |
</varlistentry> |
143 |
<varlistentry> |
144 |
<term> |
145 |
<structfield>total_inodes</structfield> |
146 |
</term> |
147 |
<listitem> |
148 |
<para> |
149 |
The total number of inodes in the filesystem. |
150 |
</para> |
151 |
</listitem> |
152 |
</varlistentry> |
153 |
<varlistentry> |
154 |
<term> |
155 |
<structfield>used_inodes</structfield> |
156 |
</term> |
157 |
<listitem> |
158 |
<para> |
159 |
The number of used inodes in the filesystem. |
160 |
</para> |
161 |
</listitem> |
162 |
</varlistentry> |
163 |
<varlistentry> |
164 |
<term> |
165 |
<structfield>free_inodes</structfield> |
166 |
</term> |
167 |
<listitem> |
168 |
<para> |
169 |
The number of free inodes in the filesystem. |
170 |
</para> |
171 |
</listitem> |
172 |
</varlistentry> |
173 |
<varlistentry> |
174 |
<term> |
175 |
<structfield>avail_inodes</structfield> |
176 |
</term> |
177 |
<listitem> |
178 |
<para> |
179 |
The number of free inodes available to non-privileged processes. |
180 |
</para> |
181 |
</listitem> |
182 |
</varlistentry> |
183 |
<varlistentry> |
184 |
<term> |
185 |
<structfield>io_size</structfield> |
186 |
</term> |
187 |
<listitem> |
188 |
<para> |
189 |
A suggested optimal block size for IO operations -- if you're |
190 |
reading or writing lots of data, do it in chunks of this size. |
191 |
</para> |
192 |
</listitem> |
193 |
</varlistentry> |
194 |
<varlistentry> |
195 |
<term> |
196 |
<structfield>block_size</structfield> |
197 |
</term> |
198 |
<listitem> |
199 |
<para> |
200 |
How big blocks actually are on the underlying filesystem |
201 |
(typically for purposes of stats reporting). |
202 |
</para> |
203 |
</listitem> |
204 |
</varlistentry> |
205 |
<varlistentry> |
206 |
<term> |
207 |
<structfield>total_blocks</structfield> |
208 |
</term> |
209 |
<listitem> |
210 |
<para> |
211 |
The total number of blocks in the filesystem. |
212 |
</para> |
213 |
</listitem> |
214 |
</varlistentry> |
215 |
<varlistentry> |
216 |
<term> |
217 |
<structfield>free_blocks</structfield> |
218 |
</term> |
219 |
<listitem> |
220 |
<para> |
221 |
The number of free blocks in the filesystem. |
222 |
</para> |
223 |
</listitem> |
224 |
</varlistentry> |
225 |
<varlistentry> |
226 |
<term> |
227 |
<structfield>used_blocks</structfield> |
228 |
</term> |
229 |
<listitem> |
230 |
<para> |
231 |
The number of used blocks in the filesystem. |
232 |
</para> |
233 |
</listitem> |
234 |
</varlistentry> |
235 |
<varlistentry> |
236 |
<term> |
237 |
<structfield>avail_blocks</structfield> |
238 |
</term> |
239 |
<listitem> |
240 |
<para> |
241 |
The number of free blocks available to non-privileged processes. |
242 |
</para> |
243 |
</listitem> |
244 |
</varlistentry> |
245 |
</variablelist> |
246 |
</refsect1> |
247 |
|
248 |
<refsect1> |
249 |
<title>See Also</title> |
250 |
|
251 |
<simplelist type="inline"> |
252 |
<member> |
253 |
<citerefentry> |
254 |
<refentrytitle>statgrab</refentrytitle> |
255 |
<manvolnum>3</manvolnum> |
256 |
</citerefentry> |
257 |
</member> |
258 |
</simplelist> |
259 |
</refsect1> |
260 |
|
261 |
<refsect1> |
262 |
<title>Website</title> |
263 |
|
264 |
<simplelist type="vert"> |
265 |
<member> |
266 |
<ulink url="http://www.i-scream.org/libstatgrab/"> |
267 |
http://www.i-scream.org/libstatgrab/ |
268 |
</ulink> |
269 |
</member> |
270 |
</simplelist> |
271 |
</refsect1> |
272 |
|
273 |
</refentry> |