linux/fs/ocfs2/blockcheck.h
<<
v3.0> /spa2" > /form" > a v3.0> href="../linux+v3.7.2/fs/ocfs2/blockcheck.h">v3.0> img src="../.static/gfx/right.png" alt=">>">v3 /spa2" v3 spa2 class="lxr_search">v3.0v3.0> input typ v3hidden" nam v3navtarget" 3 < v3">v3.0> input typ v3text" nam v3search" idv3search">v3.0> butt typ v3submit">Search /form" /spa2" v3 spa2 class="lxr_prefs"" > a href="+prefs?return=fs/ocfs2/blockcheck.h"v3.0> onclick="return ajax_prefs();">v3.0> Prefs > /a>v3 /spa2" .0> /div" .0> form ac4.12="ajax+*" method="post" onsubmit="return false;">v3 input typ v3hidden" nam v3ajax_lookup" idv3ajax_lookup" 3 < v3">v.0> /form" v.0> div class="headingbott m"> > div idv3search_results" class="search_results" >" .0> /div" div idv3content"> div idv3file_contents""
 
1 /a> spa2 class="comment">/* -*- mode: c; c-basic-offset: 8; -*- /spa2"

 
2 /a> spa2 class="comment"> * vim: noexpa2dtab sw=8 ts=8 sts=0: /spa2"

 
3 /a> spa2 class="comment"> * /spa2"

 
4 /a> spa2 class="comment"> * blockcheck.h /spa2"

 
5 /a> spa2 class="comment"> * /spa2"

 
6 /a> spa2 class="comment"> * Checksum and ECC codes for the OCFS2 userspace library. /spa2"

 
7 /a> spa2 class="comment"> * /spa2"

 
8 /a> spa2 class="comment"> * Copyright (C) 2004, 2008 Oracle.  All rights reserved. /spa2"

 
9 /a> spa2 class="comment"> * /spa2"

 n vaa> spa2 class="comment"> * This program is free software; you ca2 redistribute it and/or /spa2"

 11 /a> spa2 class="comment"> * modify it under the terms of the GNU General Public /spa2"

 12 /a> spa2 class="comment"> * License, vers"
	 2, as published by the Free Software Founda4.12. /spa2"

 13 /a> spa2 class="comment"> * /spa2"

 14 /a> spa2 class="comment"> * This program is distributed in the hope that it will be useful, /spa2"

 15 /a> spa2 class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of /spa2"

 16 /a> spa2 class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU /spa2"

 17 /a> spa2 class="comment"> * General Public License for more details. /spa2"

 18 /a> spa2 class="comment"> */ /spa2"

 19 /a>

 2 vaa>#ifndef
 a href="+code=OCFS2_BLOCKCHECK_H" class="sref">OCFS2_BLOCKCHECK_H /a>

 21 /a>#define
 a href="+code=OCFS2_BLOCKCHECK_H" class="sref">OCFS2_BLOCKCHECK_H /a>

 22 /a>

 23 /a>

 24 /a> spa2 class="comment">/* Count errors and error correc4.12 from blockcheck.c */ /spa2"

 25 /a>struct
 a href="+code=ocfs2_blockcheck_stats" class="sref">ocfs2_blockcheck_stats /a> {

 26 /a>         a href="+code=spinlock_t" class="sref">spinlock_t /a>  a href="+code=b_lock" class="sref">b_lock /a>;

 27 /a>         a href="+code=u64" class="sref">u64 /a>  a href="+code=b_check_count" class="sref">b_check_count /a>;       spa2 class="comment">/* Number of blocks we've checked */ /spa2"

 28 /a>         a href="+code=u64" class="sref">u64 /a>  a href="+code=b_failure_count" class="sref">b_failure_count /a>;     spa2 class="comment">/* Number of failed checksums */ /spa2"

 29 /a>         a href="+code=u64" class="sref">u64 /a>  a href="+code=b_recover_count" class="sref">b_recover_count /a>;     spa2 class="comment">/* Number of blocks fixed by ecc */ /spa2"

 30 /a>

 31 /a>         spa2 class="comment">/* /spa2"

 32 /a> spa2 class="comment">         * debugfs entries, used if this is passed to /spa2"

 33 /a> spa2 class="comment">         * ocfs2_blockcheck_stats_debugfs_install() /spa2"

 34 /a> spa2 class="comment">         */ /spa2"

 35 /a>        struct
 a href="+code=dentry" class="sref">dentry /a> * a href="+code=b_debug_dir" class="sref">b_debug_dir /a>;      spa2 class="comment">/* Parent of the debugfs  files */ /spa2"

 36 /a>        struct
 a href="+code=dentry" class="sref">dentry /a> * a href="+code=b_debug_check" class="sref">b_debug_check /a>;    spa2 class="comment">/* Exposes b_check_count */ /spa2"

 37 /a>        struct
 a href="+code=dentry" class="sref">dentry /a> * a href="+code=b_debug_failure" class="sref">b_debug_failure /a>;  spa2 class="comment">/* Exposes b_failure_count */ /spa2"

 38 /a>        struct
 a href="+code=dentry" class="sref">dentry /a> * a href="+code=b_debug_recover" class="sref">b_debug_recover /a>;  spa2 class="comment">/* Exposes b_recover_count */ /spa2"

 39 /a>};

 40 /a>

 41 /a>

 42 /a> spa2 class="comment">/* High level block API */ /spa2"

 43 /a>void
 a href="+code=ocfs2_compute_meta_ecc" class="sref">ocfs2_compute_meta_ecc /a>(struct
 a href="+code=super_block" class="sref">super_block /a> * a href="+code=sb" class="sref">sb /a>, void
* a href="+code=data" class="sref">data /a>,

 44 /a>                            struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 45 /a>int
 a href="+code=ocfs2_validate_meta_ecc" class="sref">ocfs2_validate_meta_ecc /a>(struct
 a href="+code=super_block" class="sref">super_block /a> * a href="+code=sb" class="sref">sb /a>, void
* a href="+code=data" class="sref">data /a>,

 46 /a>                            struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 47 /a>void
 a href="+code=ocfs2_compute_meta_ecc_bhs" class="sref">ocfs2_compute_meta_ecc_bhs /a>(struct
 a href="+code=super_block" class="sref">super_block /a> * a href="+code=sb" class="sref">sb /a>,

 48 /a>                                struct
 a href="+code=buffer_head" class="sref">buffer_head /a> ** a href="+code=bhs" class="sref">bhs /a>, int
 a href="+code=nr" class="sref">nr /a>,

 49 /a>                                struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 50 /a>int
 a href="+code=ocfs2_validate_meta_ecc_bhs" class="sref">ocfs2_validate_meta_ecc_bhs /a>(struct
 a href="+code=super_block" class="sref">super_block /a> * a href="+code=sb" class="sref">sb /a>,

 51 /a>                                struct
 a href="+code=buffer_head" class="sref">buffer_head /a> ** a href="+code=bhs" class="sref">bhs /a>, int
 a href="+code=nr" class="sref">nr /a>,

 52 /a>                                struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 53 /a>

 54 /a> spa2 class="comment">/* Lower level API */ /spa2"

 55 /a>void
 a href="+code=ocfs2_block_check_compute" class="sref">ocfs2_block_check_compute /a>(void
* a href="+code=data" class="sref">data /a>,
 a href="+code=size_t" class="sref">size_t /a>  a href="+code=blocksize" class="sref">blocksize /a>,

 56 /a>                               struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 57 /a>int
 a href="+code=ocfs2_block_check_validate" class="sref">ocfs2_block_check_validate /a>(void
* a href="+code=data" class="sref">data /a>,
 a href="+code=size_t" class="sref">size_t /a>  a href="+code=blocksize" class="sref">blocksize /a>,

 58 /a>                               struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>,

 59 /a>                               struct
 a href="+code=ocfs2_blockcheck_stats" class="sref">ocfs2_blockcheck_stats /a> * a href="+code=stats" class="sref">stats /a>);

 60 /a>void
 a href="+code=ocfs2_block_check_compute_bhs" class="sref">ocfs2_block_check_compute_bhs /a>(struct
 a href="+code=buffer_head" class="sref">buffer_head /a> ** a href="+code=bhs" class="sref">bhs /a>, int
 a href="+code=nr" class="sref">nr /a>,

 61 /a>                                   struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>);

 62 /a>int
 a href="+code=ocfs2_block_check_validate_bhs" class="sref">ocfs2_block_check_validate_bhs /a>(struct
 a href="+code=buffer_head" class="sref">buffer_head /a> ** a href="+code=bhs" class="sref">bhs /a>, int
 a href="+code=nr" class="sref">nr /a>,

 63 /a>                                   struct
 a href="+code=ocfs2_block_check" class="sref">ocfs2_block_check /a> * a href="+code=bc" class="sref">bc /a>,

 64 /a>                                   struct
 a href="+code=ocfs2_blockcheck_stats" class="sref">ocfs2_blockcheck_stats /a> * a href="+code=stats" class="sref">stats /a>);

 65 /a>

 66 /a> spa2 class="comment">/* Debug Initializa4.12 */ /spa2"

 67 /a>int
 a href="+code=ocfs2_blockcheck_stats_debugfs_install" class="sref">ocfs2_blockcheck_stats_debugfs_install /a>(struct
 a href="+code=ocfs2_blockcheck_stats" class="sref">ocfs2_blockcheck_stats /a> * a href="+code=stats" class="sref">stats /a>,

 68 /a>                                           struct
 a href="+code=dentry" class="sref">dentry /a> * a href="+code=parent" class="sref">parent /a>);

 69 /a>void
 a href="+code=ocfs2_blockcheck_stats_debugfs_remove" class="sref">ocfs2_blockcheck_stats_debugfs_remove /a>(struct
 a href="+code=ocfs2_blockcheck_stats" class="sref">ocfs2_blockcheck_stats /a> * a href="+code=stats" class="sref">stats /a>);

 70 /a>

 71 /a> spa2 class="comment">/* /spa2"

 72 /a> spa2 class="comment"> * Hamming code func4.12s /spa2"

 73 /a> spa2 class="comment"> */ /spa2"

 74 /a>

 75 /a> spa2 class="comment">/* /spa2"

 76 /a> spa2 class="comment"> * Encoding hamming code parity bits for a buffer. /spa2"

 77 /a> spa2 class="comment"> * /spa2"

 78 /a> spa2 class="comment"> * This is the low level encoder func4.12.  It ca2 be called across /spa2"

 79 /a> spa2 class="comment"> * multiple hunks just like the crc32 code.  'd' is the number of bits /spa2"

 8 vaa> spa2 class="comment"> * _in_this_hunk_.  nr is the bit offset of this hunk.  So, if you had /spa2"

 81 /a> spa2 class="comment"> * two 512B buffers, you would do it like so: /spa2"

 82 /a> spa2 class="comment"> * /spa2"

 83 /a> spa2 class="comment"> * parity = ocfs2_hamming_encode(0, buf1, 512 * 8, 0); /spa2"

 84 /a> spa2 class="comment"> * parity = ocfs2_hamming_encode(parity, buf2, 512 * 8, 512 * 8); /spa2"

 85 /a> spa2 class="comment"> * /spa2"

 86 /a> spa2 class="comment"> * If you just have one buffer, use ocfs2_hamming_encode_block(). /spa2"

 87 /a> spa2 class="comment"> */ /spa2"

 88 /a> a href="+code=u32" class="sref">u32 /a>
 a href="+code=ocfs2_hamming_encode" class="sref">ocfs2_hamming_encode /a>( a href="+code=u32" class="sref">u32 /a>
 a href="+code=parity" class="sref">parity /a>, void
* a href="+code=data" class="sref">data /a>, unsigned int
 a href="+code=d" class="sref">d /a>,

 89 /a>                         unsigned int
 a href="+code=nr" class="sref">nr /a>);

 9 vaa> spa2 class="comment">/* /spa2"

 91 /a> spa2 class="comment"> * Fix a buffer with a bit error.  The 'fix' is the original parity /spa2"

 92 /a> spa2 class="comment"> * xor'd with the parity calculated now. /spa2"

 93 /a> spa2 class="comment"> * /spa2"

 94 /a> spa2 class="comment"> * Like ocfs2_hamming_encode(), this ca2 handle hunks.  nr is the bit /spa2"

 95 /a> spa2 class="comment"> * offset of the current hunk.  If bit to be fixed is not part of the /spa2"

 96 /a> spa2 class="comment"> * current hunk, this does nothing. /spa2"

 97 /a> spa2 class="comment"> * /spa2"

 98 /a> spa2 class="comment"> * If you only have one buffer, use ocfs2_hamming_fix_block(). /spa2"

 99 /a> spa2 class="comment"> */ /spa2"

100 /a>void
 a href="+code=ocfs2_hamming_fix" class="sref">ocfs2_hamming_fix /a>(void
* a href="+code=data" class="sref">data /a>,
unsigned int
 a href="+code=d" class="sref">d /a>, unsigned int
 a href="+code=nr" class="sref">nr /a>,

101 /a>                       unsigned int
 a href="+code=fix" class="sref">fix /a>);

102 /a>

103 /a> spa2 class="comment">/* Convenience wrappers for a single buffer of data */ /spa2"

104 /a>extern  a href="+code=u32" class="sref">u32 /a>
 a href="+code=ocfs2_hamming_encode_block" class="sref">ocfs2_hamming_encode_block /a>(void
* a href="+code=data" class="sref">data /a>,
unsigned int
 a href="+code=blocksize" class="sref">blocksize /a>);

105 /a>extern void
 a href="+code=ocfs2_hamming_fix_block" class="sref">ocfs2_hamming_fix_block /a>(void
* a href="+code=data" class="sref">data /a>,
unsigned int
 a href="+code=blocksize" class="sref">blocksize /a>,

106 /a>                                    unsigned int
 a href="+code=fix" class="sref">fix /a>);

107 /a>#endif

108 /a> /pre>
The original LXR software by the LXR community /a>, this experimental vers"
	 by lxr@linux.no /a>.
 /div"
 div class="subfooter">
lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and opera4.12s services since 1995.
 /div"

 /body"
 /html"