LIBFMSR  0.1
fmsrutil.h
Go to the documentation of this file.
00001 
00007 /* ===================================================================
00008 Copyright (c) 2013, Henry C. H. Chen
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are
00013 met:
00014 
00015   - Redistributions of source code must retain the above copyright
00016     notice, this list of conditions and the following disclaimer.
00017 
00018   - Redistributions in binary form must reproduce the above copyright
00019     notice, this list of conditions and the following disclaimer in
00020     the documentation and/or other materials provided with the
00021     distribution.
00022 
00023   - Neither the name of the Chinese University of Hong Kong nor the
00024     names of its contributors may be used to endorse or promote
00025     products derived from this software without specific prior written
00026     permission.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031 A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
00032 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039 =================================================================== */
00040 
00041 
00042 #ifndef LIBFMSR_FMSRUTIL_H
00043 #define LIBFMSR_FMSRUTIL_H
00044 
00045 #include "gf.h"
00046 
00047 /* for functions below returning int,
00048  * they return 1 for yes/passed and 0 for no/failed */
00049 
00050 /*  --------------------------------  */
00051 /* | internal FMSR helper functions | */
00052 /*  --------------------------------  */
00053 int fmsr_encode_support(gf k, gf n);
00054 int fmsr_repair_support(gf k, gf n, gf num_erasures);
00055 void fmsr_create_encode_matrix(gf k, gf n, gf *encode_matrix);
00056 void fmsr_pad_data(gf k, gf n, gf *data, size_t data_size);
00057 size_t fmsr_unpad_data(gf *data, size_t data_size);  // return true size
00058 
00059 
00060 /*  ----------------------------------  */
00061 /* | repair-specific helper functions | */
00062 /*  ----------------------------------  */
00063 void fmsr_calculate_lambda(gf k, gf n, gf *survivor_matrix, gf *lambda, gf select);
00064 int fmsr_check_ermds(gf k, gf n, gf *gamma, gf *lambda, gf select);
00065 int fmsr_check_mds(gf k, gf n, gf *encode_matrix);
00066 int fmsr_check_rmds(gf k, gf n, gf *encode_matrix,
00067                     gf *nodes_repaired, gf num_nodes_repaired);
00068 
00069 #endif  /* LIBFMSR_FMSRUTIL_H */
00070 
 All Data Structures Files Functions Variables Typedefs Defines