diff options
Diffstat (limited to 'sag-0.6.1-www/Invisible/sag-0.6/node111.html')
-rw-r--r-- | sag-0.6.1-www/Invisible/sag-0.6/node111.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sag-0.6.1-www/Invisible/sag-0.6/node111.html b/sag-0.6.1-www/Invisible/sag-0.6/node111.html new file mode 100644 index 0000000..d40ca5a --- /dev/null +++ b/sag-0.6.1-www/Invisible/sag-0.6/node111.html @@ -0,0 +1,61 @@ +<!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"> +</HEAD> +<BODY LANG="EN" > + <A NAME="tex2html1709" HREF="node112.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1707" HREF="sag.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1701" HREF="node110.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1711" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1712" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR> +<B> Next:</B> <A NAME="tex2html1710" HREF="node112.html">Glossary (DRAFT)</A> +<B>Up:</B> <A NAME="tex2html1708" HREF="sag.html">Linux System Administrators' Guide </A> +<B> Previous:</B> <A NAME="tex2html1702" HREF="node110.html">When the clock is </A> +<BR> <P> +<H1><A NAME="SECTION001300000000000000000">Measuring Holes</A></H1> + <A NAME="chapmeasureholes"> </A> +<P> +This appendix contains the interesting part of the program used to measure +the potential for holes in a filesystem. 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> +Sat Nov 15 02:32:11 EET 1997</I> +</ADDRESS> +</BODY> +</HTML> |