📄 node105.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Measuring Holes</TITLE>
<META NAME="description" CONTENT="Measuring Holes">
<META NAME="keywords" CONTENT="sag">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="sag.css" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/sag.css">
</HEAD>
<BODY LANG="EN" >
<A NAME="tex2html1614" HREF="node106.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node106.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/next_motif.gif"></A> <A NAME="tex2html1612" HREF="sag.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/sag.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/up_motif.gif"></A> <A NAME="tex2html1606" HREF="node104.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node104.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/previous_motif.gif"></A> <A NAME="tex2html1616" HREF="node1.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/contents_motif.gif"></A> <A NAME="tex2html1617" HREF="node108.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node108.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1615" HREF="node106.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node106.html">Glossary (DRAFT)</A>
<B>Up:</B> <A NAME="tex2html1613" HREF="sag.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/sag.html">Linux System Administrators' Guide </A>
<B> Previous:</B> <A NAME="tex2html1607" HREF="node104.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node104.html">When the clock is </A>
<BR> <P>
<H1><A NAME="SECTION001200000000000000000">测量孔(Measuring Holes)</A></H1>
<A NAME="chapmeasureholes"> </A>
<P>
本附录包括用于测量文件系统中潜在的孔的程序的有趣的部分。
The source distribution of the book contains the full source code(<tt>sag/measure-holes/measure-holes.c</tt>).
<P>
<BLOCKQUOTE>
<PRE>int process(FILE *f, char *filename) {
static char *buf = NULL;
static long prev_block_size = -1;
long zeroes;
char *p;
if (buf == NULL || prev_block_size != block_size) {
free(buf);
buf = xmalloc(block_size + 1);
buf[block_size] = 1;
prev_block_size = block_size;
}
zeroes = 0;
while (fread(buf, block_size, 1, f) == 1) {
for (p = buf; *p == '\0'; )
++p;
if (p == buf+block_size)
zeroes += block_size;
}
if (zeroes > 0)
printf("%ld %s\n", zeroes, filename);
if (ferror(f)) {
errormsg(0, -1, "read failed for `%s'", filename);
return -1;
}
return 0;
}</PRE>
</BLOCKQUOTE><BR> <HR>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sun Jun 29 13:31:22 EEST 1997</I>
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -