~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/ocfs2/blockcheck.h

Version: ~ [ linux-5.6 ] ~ [ linux-5.5.13 ] ~ [ linux-5.4.28 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.113 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.174 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.217 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.217 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.82 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* -*- mode: c; c-basic-offset: 8; -*-
  2  * vim: noexpandtab sw=8 ts=8 sts=0:
  3  *
  4  * blockcheck.h
  5  *
  6  * Checksum and ECC codes for the OCFS2 userspace library.
  7  *
  8  * Copyright (C) 2004, 2008 Oracle.  All rights reserved.
  9  *
 10  * This program is free software; you can redistribute it and/or
 11  * modify it under the terms of the GNU General Public
 12  * License, version 2, as published by the Free Software Foundation.
 13  *
 14  * This program is distributed in the hope that it will be useful,
 15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17  * General Public License for more details.
 18  */
 19 
 20 #ifndef OCFS2_BLOCKCHECK_H
 21 #define OCFS2_BLOCKCHECK_H
 22 
 23 
 24 /* Count errors and error correction from blockcheck.c */
 25 struct ocfs2_blockcheck_stats {
 26         spinlock_t b_lock;
 27         u64 b_check_count;      /* Number of blocks we've checked */
 28         u64 b_failure_count;    /* Number of failed checksums */
 29         u64 b_recover_count;    /* Number of blocks fixed by ecc */
 30 
 31         /*
 32          * debugfs entries, used if this is passed to
 33          * ocfs2_blockcheck_stats_debugfs_install()
 34          */
 35         struct dentry *b_debug_dir;     /* Parent of the debugfs  files */
 36         struct dentry *b_debug_check;   /* Exposes b_check_count */
 37         struct dentry *b_debug_failure; /* Exposes b_failure_count */
 38         struct dentry *b_debug_recover; /* Exposes b_recover_count */
 39 };
 40 
 41 
 42 /* High level block API */
 43 void ocfs2_compute_meta_ecc(struct super_block *sb, void *data,
 44                             struct ocfs2_block_check *bc);
 45 int ocfs2_validate_meta_ecc(struct super_block *sb, void *data,
 46                             struct ocfs2_block_check *bc);
 47 void ocfs2_compute_meta_ecc_bhs(struct super_block *sb,
 48                                 struct buffer_head **bhs, int nr,
 49                                 struct ocfs2_block_check *bc);
 50 int ocfs2_validate_meta_ecc_bhs(struct super_block *sb,
 51                                 struct buffer_head **bhs, int nr,
 52                                 struct ocfs2_block_check *bc);
 53 
 54 /* Lower level API */
 55 void ocfs2_block_check_compute(void *data, size_t blocksize,
 56                                struct ocfs2_block_check *bc);
 57 int ocfs2_block_check_validate(void *data, size_t blocksize,
 58                                struct ocfs2_block_check *bc,
 59                                struct ocfs2_blockcheck_stats *stats);
 60 void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr,
 61                                    struct ocfs2_block_check *bc);
 62 int ocfs2_block_check_validate_bhs(struct buffer_head **bhs, int nr,
 63                                    struct ocfs2_block_check *bc,
 64                                    struct ocfs2_blockcheck_stats *stats);
 65 
 66 /* Debug Initialization */
 67 int ocfs2_blockcheck_stats_debugfs_install(struct ocfs2_blockcheck_stats *stats,
 68                                            struct dentry *parent);
 69 void ocfs2_blockcheck_stats_debugfs_remove(struct ocfs2_blockcheck_stats *stats);
 70 
 71 /*
 72  * Hamming code functions
 73  */
 74 
 75 /*
 76  * Encoding hamming code parity bits for a buffer.
 77  *
 78  * This is the low level encoder function.  It can be called across
 79  * multiple hunks just like the crc32 code.  'd' is the number of bits
 80  * _in_this_hunk_.  nr is the bit offset of this hunk.  So, if you had
 81  * two 512B buffers, you would do it like so:
 82  *
 83  * parity = ocfs2_hamming_encode(0, buf1, 512 * 8, 0);
 84  * parity = ocfs2_hamming_encode(parity, buf2, 512 * 8, 512 * 8);
 85  *
 86  * If you just have one buffer, use ocfs2_hamming_encode_block().
 87  */
 88 u32 ocfs2_hamming_encode(u32 parity, void *data, unsigned int d,
 89                          unsigned int nr);
 90 /*
 91  * Fix a buffer with a bit error.  The 'fix' is the original parity
 92  * xor'd with the parity calculated now.
 93  *
 94  * Like ocfs2_hamming_encode(), this can handle hunks.  nr is the bit
 95  * offset of the current hunk.  If bit to be fixed is not part of the
 96  * current hunk, this does nothing.
 97  *
 98  * If you only have one buffer, use ocfs2_hamming_fix_block().
 99  */
100 void ocfs2_hamming_fix(void *data, unsigned int d, unsigned int nr,
101                        unsigned int fix);
102 
103 /* Convenience wrappers for a single buffer of data */
104 extern u32 ocfs2_hamming_encode_block(void *data, unsigned int blocksize);
105 extern void ocfs2_hamming_fix_block(void *data, unsigned int blocksize,
106                                     unsigned int fix);
107 #endif
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp