/* This list holds all currently allocated rs codec structures */ static LIST_HEAD(codec_list); /* Protection for the list */ static DEFINE_MUTEX(rslistlock);
/** *codec_init-InitializeaReed-Solomoncodec *@symsize:symbolsize,bits(1-8) *@gfpoly:Fieldgeneratorpolynomialcoefficients *@gffunc:Fieldgeneratorfunction *@fcr:firstrootofRScodegeneratorpolynomial,indexform *@prim:primitiveelementtogeneratepolynomialroots *@nroots:RScodegeneratorpolynomialdegree(numberofroots) *@gfp:GFP_flagsforallocations * *Allocateacodecstructureandthepolynomarraysforfaster *en/decoding.Fillthearraysaccordingtothegivenparameters.
*/ staticstruct rs_codec *codec_init(int symsize, int gfpoly, int (*gffunc)(int), int fcr, int prim, int nroots, gfp_t gfp)
{ int i, j, sr, root, iprim; struct rs_codec *rs;
rs = kzalloc(sizeof(*rs), gfp); if (!rs) return NULL;
/* Walk through the list and look for a matching entry */
list_for_each(tmp, &codec_list) { struct rs_codec *cd = list_entry(tmp, struct rs_codec, list);
if (symsize != cd->mm) continue; if (gfpoly != cd->gfpoly) continue; if (gffunc != cd->gffunc) continue; if (fcr != cd->fcr) continue; if (prim != cd->prim) continue; if (nroots != cd->nroots) continue; /* We have a matching one already */
cd->users++;
rs->codec = cd; goto out;
}
/* Create a new one */
rs->codec = codec_init(symsize, gfpoly, gffunc, fcr, prim, nroots, gfp); if (!rs->codec) {
kfree(rs);
rs = NULL;
}
out:
mutex_unlock(&rslistlock); return rs;
}
/** *init_rs_gfp-CreateaRScontrolstructandinitializeit *@symsize:thesymbolsize(numberofbits) *@gfpoly:theextendedGaloisfieldgeneratorpolynomialcoefficients, *withthe0thcoefficientintheloworderbit.Thepolynomial *mustbeprimitive; *@fcr:thefirstconsecutiverootoftherscodegeneratorpolynomial *inindexform *@prim:primitiveelementtogeneratepolynomialroots *@nroots:RScodegeneratorpolynomialdegree(numberofroots) *@gfp:Memoryallocationflags.
*/ struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim, int nroots, gfp_t gfp)
{ return init_rs_internal(symsize, gfpoly, NULL, fcr, prim, nroots, gfp);
}
EXPORT_SYMBOL_GPL(init_rs_gfp);
/** *init_rs_non_canonical-Allocaterscontrolstructforfieldswith *non-canonicalrepresentation *@symsize:thesymbolsize(numberofbits) *@gffunc:pointertofunctiontogeneratethenextfieldelement, *orthemultiplicativeidentityelementifgiven0.Used *insteadofgfpolyifgfpolyis0 *@fcr:thefirstconsecutiverootoftherscodegeneratorpolynomial *inindexform *@prim:primitiveelementtogeneratepolynomialroots *@nroots:RScodegeneratorpolynomialdegree(numberofroots)
*/ struct rs_control *init_rs_non_canonical(int symsize, int (*gffunc)(int), int fcr, int prim, int nroots)
{ return init_rs_internal(symsize, 0, gffunc, fcr, prim, nroots,
GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(init_rs_non_canonical);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Reed Solomon encoder/decoder");
MODULE_AUTHOR("Phil Karn, Thomas Gleixner");
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.