CVS commit: othersrc/external/bsd/rs
Module Name:othersrc Committed By: agc Date: Fri Apr 12 20:38:50 UTC 2013 Modified Files: othersrc/external/bsd/rs: Makefile Log Message: get rid of debugging artifacts which should never have been committed in the first place To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/Makefile diff -u othersrc/external/bsd/rs/Makefile:1.2 othersrc/external/bsd/rs/Makefile:1.3 --- othersrc/external/bsd/rs/Makefile:1.2 Tue Apr 26 15:41:26 2011 +++ othersrc/external/bsd/rs/Makefile Fri Apr 12 20:38:49 2013 @@ -1,12 +1,8 @@ -# $NetBSD: Makefile,v 1.2 2011/04/26 15:41:26 agc Exp $ +# $NetBSD: Makefile,v 1.3 2013/04/12 20:38:49 agc Exp $ SUBDIR+= librs .WAIT rs -PROCESSOR!= uname -p - .include bsd.subdir.mk t: - sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/${PROCESSOR} ${MAKE} includes - sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/${PROCESSOR} ${MAKE} install cd ${.CURDIR}/rs ${MAKE} t
CVS commit: othersrc/external/bsd/rs/rs
Module Name:othersrc Committed By: agc Date: Fri Apr 12 20:47:47 UTC 2013 Modified Files: othersrc/external/bsd/rs/rs: Makefile Log Message: when testing, use the library we've just built, rather than any installed one To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/rs/rs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/rs/Makefile diff -u othersrc/external/bsd/rs/rs/Makefile:1.3 othersrc/external/bsd/rs/rs/Makefile:1.4 --- othersrc/external/bsd/rs/rs/Makefile:1.3 Wed Mar 23 04:56:33 2011 +++ othersrc/external/bsd/rs/rs/Makefile Fri Apr 12 20:47:47 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2011/03/23 04:56:33 agc Exp $ +# $NetBSD: Makefile,v 1.4 2013/04/12 20:47:47 agc Exp $ .include bsd.own.mk @@ -27,17 +27,17 @@ t: ./${PROG} echo $$f; \ rm -f a a2 a3; \ cp $$f a; \ - ./${PROG} a a2;\ + env LD_LIBRARY_PATH=${LIBRSDIR} ./${PROG} a a2; \ sed -e 's|X|M|g' a2 | ./${PROG} -d a3; \ ls -al a a2 a3; \ cmp a a3; \ rm -f a a2 a3; \ done - ./${PROG} -o a2 -p 28,24 Makefile - ./${PROG} -d -o a3 a2 + env LD_LIBRARY_PATH=${LIBRSDIR} ./${PROG} -o a2 -p 28,24 Makefile + env LD_LIBRARY_PATH=${LIBRSDIR} ./${PROG} -d -o a3 a2 diff Makefile a3 rm -f a2 a3 - ./${PROG} -p 28,24 Makefile | ./${PROG} -o a2 -p 32,28 - ./${PROG} -d a2 | ./${PROG} -d -o a3 + env LD_LIBRARY_PATH=${LIBRSDIR} ./${PROG} -p 28,24 Makefile | ./${PROG} -o a2 -p 32,28 + env LD_LIBRARY_PATH=${LIBRSDIR} ./${PROG} -d a2 | ./${PROG} -d -o a3 diff Makefile a3 rm -f a2 a3
CVS commit: othersrc/external/bsd/rs/dist
Module Name:othersrc Committed By: agc Date: Tue Dec 4 07:24:19 UTC 2012 Modified Files: othersrc/external/bsd/rs/dist: rs.c Log Message: feedback from fuzz testing - check arguments to functions on input. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/rs/dist/rs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/rs.c diff -u othersrc/external/bsd/rs/dist/rs.c:1.3 othersrc/external/bsd/rs/dist/rs.c:1.4 --- othersrc/external/bsd/rs/dist/rs.c:1.3 Tue Apr 26 15:41:26 2011 +++ othersrc/external/bsd/rs/dist/rs.c Tue Dec 4 07:24:19 2012 @@ -513,6 +513,9 @@ le32(uint32_t in) int rs_init(rs_t *rs, const unsigned poly, const uint8_t databytes, const uint8_t paritybytes) { + if (rs == NULL) { + return 0; + } if (paritybytes databytes) { (void) fprintf(stderr, paritybytes %u larger than data bytes %u\n, paritybytes, databytes); @@ -544,6 +547,9 @@ rs_encode(rs_t *rs, const void *inp, siz size_t incc; size_t chunk; + if (rs == NULL || inp == NULL || out == NULL) { + return -1; + } if (!rs-header.poly) { rs_init(rs, RS_DEFAULT_POLYNOMIAL, RS_DEFAULT_DATA, RS_DEFAULT_PARITY); } @@ -564,6 +570,9 @@ rs_decode(rs_t *rs, const void *inp, siz size_t incc; size_t chunk; + if (rs == NULL || inp == NULL || out == NULL) { + return -1; + } for (outcc = 0, incc = 0 ; incc size outcc (ssize_t)outsize ; incc += chunk) { chunk = MIN(size - incc, rs-header.datac + rs-header.parityc); if ((cc = decode_chunk(rs, in[incc], chunk, out[outcc])) 0) { @@ -580,6 +589,9 @@ rs_get_header(rs_t *rs, const void *in, { rs_header_t head; + if (rs == NULL || in == NULL) { + return -1; + } USE_ARG(insize); (void) memcpy(head, in, sizeof(head)); head.poly = le32(head.poly); @@ -593,6 +605,9 @@ rs_put_header(rs_t *rs, void *out, size_ { rs_header_t head; + if (rs == NULL || out == NULL) { + return -1; + } USE_ARG(outsize); (void) memcpy(head, rs-header, sizeof(head)); (void) snprintf(head.magic, sizeof(head.magic), %s, RS_MAGIC); @@ -611,6 +626,9 @@ rs_parity(rs_t *rs, const void *inp, siz size_t incc; size_t chunk; + if (rs == NULL || inp == NULL || out == NULL) { + return -1; + } if (!rs-header.poly) { rs_init(rs, RS_DEFAULT_POLYNOMIAL, RS_DEFAULT_DATA, RS_DEFAULT_PARITY); }
CVS commit: othersrc/external/bsd/rs
Module Name:othersrc Committed By: agc Date: Tue Apr 26 15:41:26 UTC 2011 Modified Files: othersrc/external/bsd/rs: Makefile othersrc/external/bsd/rs/dist: TODO librs.3 rs.c rs.h Log Message: add a small rs_parity(3) function, which simply calculates the Reed Solomon parity - no input copying is involved. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/Makefile cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/dist/TODO cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/rs/dist/librs.3 cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/dist/rs.c \ othersrc/external/bsd/rs/dist/rs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/Makefile diff -u othersrc/external/bsd/rs/Makefile:1.1.1.1 othersrc/external/bsd/rs/Makefile:1.2 --- othersrc/external/bsd/rs/Makefile:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/Makefile Tue Apr 26 15:41:26 2011 @@ -1,10 +1,12 @@ -# $NetBSD: Makefile,v 1.1.1.1 2011/03/12 08:08:29 agc Exp $ +# $NetBSD: Makefile,v 1.2 2011/04/26 15:41:26 agc Exp $ SUBDIR+= librs .WAIT rs +PROCESSOR!= uname -p + .include bsd.subdir.mk t: - sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/x86_64 ${MAKE} includes - sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/x86_64 ${MAKE} install + sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/${PROCESSOR} ${MAKE} includes + sudo env USETOOLS=no MAKEOBJDIRPREFIX=/usr/build/obj/${PROCESSOR} ${MAKE} install cd ${.CURDIR}/rs ${MAKE} t Index: othersrc/external/bsd/rs/dist/TODO diff -u othersrc/external/bsd/rs/dist/TODO:1.1.1.1 othersrc/external/bsd/rs/dist/TODO:1.2 --- othersrc/external/bsd/rs/dist/TODO:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/dist/TODO Tue Apr 26 15:41:26 2011 @@ -2,7 +2,6 @@ = circ interleave -multiple levels Done @@ -18,3 +17,4 @@ get rid of erasures - need them split into lib and main man pages +multiple levels Index: othersrc/external/bsd/rs/dist/librs.3 diff -u othersrc/external/bsd/rs/dist/librs.3:1.3 othersrc/external/bsd/rs/dist/librs.3:1.4 --- othersrc/external/bsd/rs/dist/librs.3:1.3 Wed Mar 23 06:55:44 2011 +++ othersrc/external/bsd/rs/dist/librs.3 Tue Apr 26 15:41:26 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: librs.3,v 1.3 2011/03/23 06:55:44 wiz Exp $ +.\ $NetBSD: librs.3,v 1.4 2011/04/26 15:41:26 agc Exp $ .\ .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org .\ All rights reserved. @@ -23,7 +23,7 @@ .\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\/ -.Dd March 22, 2011 +.Dd April 26, 2011 .Dt LIBRS 3 .Os .Sh NAME @@ -47,6 +47,10 @@ .Fa rs_t *rs const void *input size_t insize uint8_t *output size_t outsize .Fc .Ft ssize_t +.Fo rs_parity +.Fa rs_t *rs const void *input size_t insize uint8_t *output size_t outsize +.Fc +.Ft ssize_t .Fo rs_get_header .Fa rs_t *rs void *input size_t size .Fc @@ -96,6 +100,13 @@ 256 bytes. .Pp The +.Fn rs_encode +function will automatically copy the source data to the output, +whilst the +.Fn rs_parity +will simply calculate the parity, placing the result in the output. +.Pp +The .Fn rs_put_header function is used to store information about the encoding in the output that is generated. Index: othersrc/external/bsd/rs/dist/rs.c diff -u othersrc/external/bsd/rs/dist/rs.c:1.2 othersrc/external/bsd/rs/dist/rs.c:1.3 --- othersrc/external/bsd/rs/dist/rs.c:1.2 Wed Mar 23 03:17:48 2011 +++ othersrc/external/bsd/rs/dist/rs.c Tue Apr 26 15:41:26 2011 @@ -442,10 +442,11 @@ * */ static ssize_t -encode_chunk(rs_t *rs, const uint8_t *msg, size_t size, uint8_t *dst) +encode_chunk(rs_t *rs, const uint8_t *msg, size_t size, uint8_t *dst, int include) { uint8_t lfsr[MAX_PARITY + 1]; uint8_t dbyte; + size_t off; size_t i; int j; @@ -457,11 +458,16 @@ } lfsr[0] = gfmult(rs-genPoly[0], dbyte); } - (void) memcpy(dst, msg, size); + if (include) { + (void) memcpy(dst, msg, size); + off = size; + } else { + off = 0; + } for (i = 0; i rs-header.parityc; i++) { - dst[size + i] = lfsr[rs-header.parityc - 1 - i]; + dst[off + i] = lfsr[rs-header.parityc - 1 - i]; } - return size + rs-header.parityc; + return off + rs-header.parityc; } /* decode one chunk of the input */ @@ -533,6 +539,7 @@ rs_encode(rs_t *rs, const void *inp, size_t size, uint8_t *out, size_t outsize) { const uint8_t *in = (const uint8_t *)inp; + const int includemsg = 1; size_t outcc; size_t incc; size_t chunk; @@ -542,7 +549,7 @@ } for (outcc = 0, incc = 0 ; incc size outcc outsize ; incc += chunk) { chunk = MIN(size - incc, rs-header.datac); - outcc += encode_chunk(rs, in[incc], chunk, out[outcc]); + outcc += encode_chunk(rs, in[incc], chunk, out[outcc], includemsg); } return (ssize_t)outcc; } @@ -593,3
CVS commit: othersrc/external/bsd/rs
Module Name:othersrc Committed By: agc Date: Wed Mar 23 03:17:48 UTC 2011 Modified Files: othersrc/external/bsd/rs/dist: librs.3 main.c rs.c rs.h othersrc/external/bsd/rs/librs: shlib_version othersrc/external/bsd/rs/rs: Makefile Log Message: + add code to store the encoding parameters in the generated output + use the encoding parameters at decode time + add a test for non-standard encoding values + update manual page to incorporate some feedback from David Young - more to come + bring manual page up to date + bump shlib major number To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/dist/librs.3 \ othersrc/external/bsd/rs/dist/rs.c othersrc/external/bsd/rs/dist/rs.h cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/rs/dist/main.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/librs/shlib_version cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/rs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/librs.3 diff -u othersrc/external/bsd/rs/dist/librs.3:1.1.1.1 othersrc/external/bsd/rs/dist/librs.3:1.2 --- othersrc/external/bsd/rs/dist/librs.3:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/dist/librs.3 Wed Mar 23 03:17:48 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: librs.3,v 1.1.1.1 2011/03/12 08:08:29 agc Exp $ +.\ $NetBSD: librs.3,v 1.2 2011/03/23 03:17:48 agc Exp $ .\ .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org .\ All rights reserved. @@ -23,12 +23,12 @@ .\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\/ -.Dd March 9, 2011 +.Dd March 22, 2011 .Dt LIBRS 3 .Os .Sh NAME .Nm librs -.Nd reed-solomon erasure code library +.Nd Reed-Solomon forward erasure code library .Sh LIBRARY .Lb librs .Sh SYNOPSIS @@ -46,6 +46,14 @@ .Fo rs_decode .Fa rs_t *rs const void *input size_t insize uint8_t *output size_t outsize .Fc +.Ft ssize_t +.Fo rs_get_header +.Fa rs_t *rs void *input size_t size +.Fc +.Ft ssize_t +.Fo rs_put_header +.Fa rs_t *rs const void *input size_t size +.Fc .Sh DESCRIPTION The .Nm @@ -86,6 +94,30 @@ function, the output will be split up into slices of 256 bytes, and the final buffer may contain less than 256 bytes. +.Pp +The +.Fn rs_put_header +function is used to store information about the encoding in +the output that is generated. This will allow a future call +of the +.Fn rs_decode +function to know the exact coding parameters in order to reconstruct +the original data, by using the +.Fn rs_get_header +function. +.Pp +The output size from the +.Fn rs_encode +function depends on the number of parity bytes, and the number of +data bytes used. +In addition, there is an overhead of 12 bytes to hold the +encoding information. +For example, a +.Dv 28,24 +encoding will use 4 parity bytes for every 24 data bytes. +This means that the output will be at least +.Dv (((datasize / 6) + 1) * 7) + 12 +bytes long. .Sh HISTORY The .Nm Index: othersrc/external/bsd/rs/dist/rs.c diff -u othersrc/external/bsd/rs/dist/rs.c:1.1.1.1 othersrc/external/bsd/rs/dist/rs.c:1.2 --- othersrc/external/bsd/rs/dist/rs.c:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/dist/rs.c Wed Mar 23 03:17:48 2011 @@ -63,6 +63,8 @@ #define USE_ARG(x) /*LINTED*/(void)(x) #endif +#define RS_MAGIC rs1 + /* set up the gf8 tables */ static int galois_inits(const unsigned poly) @@ -208,9 +210,9 @@ uint8_t product[MAX_DEGREE * 2]; int i; - poly_mult(product, rs-lambda, rs-syndrome, rs-parityc * 2); - poly_zero(rs-omega, rs-parityc * 2); - for (i = 0; i rs-parityc; i++) { + poly_mult(product, rs-lambda, rs-syndrome, rs-header.parityc * 2); + poly_zero(rs-omega, rs-header.parityc * 2); + for (i = 0; i rs-header.parityc; i++) { rs-omega[i] = product[i]; } } @@ -264,36 +266,36 @@ int n; /* initialize Gamma, the erasure locator polynomial */ - init_gamma(rs, gamma, rs-parityc * 2); + init_gamma(rs, gamma, rs-header.parityc * 2); /* initialize to z */ - (void) memcpy(D, gamma, rs-parityc * 2); - poly_mul_z(D, rs-parityc * 2); + (void) memcpy(D, gamma, rs-header.parityc * 2); + poly_mul_z(D, rs-header.parityc * 2); - (void) memcpy(psi, gamma, rs-parityc * 2); + (void) memcpy(psi, gamma, rs-header.parityc * 2); k = -1; - for (L = n = 0; n rs-parityc; n++) { + for (L = n = 0; n rs-header.parityc; n++) { if ((d = compute_discrepancy(psi, rs-syndrome, L, n)) != 0) { /* psi2 = psi - d*D */ - for (i = 0; i rs-parityc * 2; i++) { + for (i = 0; i rs-header.parityc * 2; i++) { psi2[i] = psi[i] ^ gfmult(d, D[i]); } if (L (n - k)) { L2 = n - k; k = n - L; /* D = poly_scale(psi, gfinv(d), rs-parityc * 2); */ -for (i = 0; i rs-parityc * 2; i++) { +for (i = 0; i rs-header.parityc * 2; i++) { D[i] =
CVS commit: othersrc/external/bsd/rs/rs
Module Name:othersrc Committed By: agc Date: Wed Mar 23 04:56:33 UTC 2011 Modified Files: othersrc/external/bsd/rs/rs: Makefile Log Message: add a test for nested rs encoding, remarkably similar to the rs encoding steps in CIRC (in use on CDs), but without the cross-interleaving - the test uses the same 28,24 then 32,28 encodings. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/rs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/rs/Makefile diff -u othersrc/external/bsd/rs/rs/Makefile:1.2 othersrc/external/bsd/rs/rs/Makefile:1.3 --- othersrc/external/bsd/rs/rs/Makefile:1.2 Wed Mar 23 03:17:48 2011 +++ othersrc/external/bsd/rs/rs/Makefile Wed Mar 23 04:56:33 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2011/03/23 03:17:48 agc Exp $ +# $NetBSD: Makefile,v 1.3 2011/03/23 04:56:33 agc Exp $ .include bsd.own.mk @@ -37,3 +37,7 @@ ./${PROG} -d -o a3 a2 diff Makefile a3 rm -f a2 a3 + ./${PROG} -p 28,24 Makefile | ./${PROG} -o a2 -p 32,28 + ./${PROG} -d a2 | ./${PROG} -d -o a3 + diff Makefile a3 + rm -f a2 a3
CVS commit: othersrc/external/bsd/rs/dist
Module Name:othersrc Committed By: agc Date: Fri Mar 18 23:43:13 UTC 2011 Modified Files: othersrc/external/bsd/rs/dist: main.c Log Message: get rid of debugging comment To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/dist/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/main.c diff -u othersrc/external/bsd/rs/dist/main.c:1.2 othersrc/external/bsd/rs/dist/main.c:1.3 --- othersrc/external/bsd/rs/dist/main.c:1.2 Thu Mar 17 03:21:11 2011 +++ othersrc/external/bsd/rs/dist/main.c Fri Mar 18 23:43:13 2011 @@ -140,8 +140,6 @@ } (void) memset(rs, 0x0, sizeof(rs)); /* Initialization of the ECC library */ -/* databytes: def 224, should be 255 */ -/* parity: def 32, should be 223 */ if (!rs_init(rs, poly, databytes, parity)) { exit(EXIT_FAILURE); }
CVS commit: othersrc/external/bsd/rs/dist
Module Name:othersrc Committed By: agc Date: Fri Mar 18 23:59:55 UTC 2011 Modified Files: othersrc/external/bsd/rs/dist: main.c Log Message: check for the appropriate terminating character To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/rs/dist/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/main.c diff -u othersrc/external/bsd/rs/dist/main.c:1.3 othersrc/external/bsd/rs/dist/main.c:1.4 --- othersrc/external/bsd/rs/dist/main.c:1.3 Fri Mar 18 23:43:13 2011 +++ othersrc/external/bsd/rs/dist/main.c Fri Mar 18 23:59:55 2011 @@ -119,7 +119,7 @@ break; case 'b': case 'p': - for (s = optarg, data2 = 0 ; *s *s != '/' ; s++) { + for (s = optarg, data2 = 0 ; *s *s != ',' ; s++) { data2 = (data2 * 10) + (*s - '0'); } if (*s == ',') {
CVS commit: othersrc/external/bsd/rs/dist
Module Name:othersrc Committed By: agc Date: Thu Mar 17 03:21:11 UTC 2011 Modified Files: othersrc/external/bsd/rs/dist: main.c rs.1 Log Message: rework the data/parity bytes command line specification to be more natural, especially for this area of erasure codes. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/dist/main.c cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/dist/rs.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/main.c diff -u othersrc/external/bsd/rs/dist/main.c:1.1.1.1 othersrc/external/bsd/rs/dist/main.c:1.2 --- othersrc/external/bsd/rs/dist/main.c:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/dist/main.c Thu Mar 17 03:21:11 2011 @@ -93,8 +93,11 @@ unsigned poly; uint8_t databytes; uint8_t parity; + uint8_t data2; + uint8_t par2; rs_t rs; char *out; + char *s; int encoding; int i; @@ -108,17 +111,24 @@ case 'P': poly = (unsigned)strtol(optarg, NULL, 16); break; - case 'b': - databytes = atoi(optarg) 0xff; - break; case 'd': encoding = 0; break; case 'o': out = optarg; break; + case 'b': case 'p': - parity = atoi(optarg) 0xff; + for (s = optarg, data2 = 0 ; *s *s != '/' ; s++) { +data2 = (data2 * 10) + (*s - '0'); + } + if (*s == ',') { +for (s++, par2 = 0 ; *s ; s++) { + par2 = (par2 * 10) + (*s - '0'); +} +parity = data2 - par2; +databytes = par2; + } break; case 'v': printf(Version: %u\n, PKG_VERSION); @@ -130,6 +140,8 @@ } (void) memset(rs, 0x0, sizeof(rs)); /* Initialization of the ECC library */ +/* databytes: def 224, should be 255 */ +/* parity: def 32, should be 223 */ if (!rs_init(rs, poly, databytes, parity)) { exit(EXIT_FAILURE); } Index: othersrc/external/bsd/rs/dist/rs.1 diff -u othersrc/external/bsd/rs/dist/rs.1:1.2 othersrc/external/bsd/rs/dist/rs.1:1.3 --- othersrc/external/bsd/rs/dist/rs.1:1.2 Sat Mar 12 13:20:00 2011 +++ othersrc/external/bsd/rs/dist/rs.1 Thu Mar 17 03:21:11 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: rs.1,v 1.2 2011/03/12 13:20:00 wiz Exp $ +.\ $NetBSD: rs.1,v 1.3 2011/03/17 03:21:11 agc Exp $ .\ .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org .\ All rights reserved. @@ -23,7 +23,7 @@ .\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\ -.Dd March 10, 2011 +.Dd March 16, 2011 .Dt RS 1 .Os .Sh NAME @@ -32,9 +32,9 @@ .Sh SYNOPSIS .Nm .Fl dv -.Op Fl b Ar data-bytes +.Op Fl b Ar total-bytes,parity-bytes .Op Fl o Ar filename -.Op Fl p Ar parity-bytes +.Op Fl p Ar total-bytes,parity-bytes .Ar file ... .Sh DESCRIPTION The @@ -60,32 +60,26 @@ data bytes. .Pp The following options are available: -.Bl -tag -width parity-bytes-and +.Bl -tag -width total-bytes-and-data-bytes .It Fl d decode the file(s) given, or .Dv stdin if no files were specified. -.It Fl v -print the version information on -.Dv stdout -and then exit. -.It Fl b Ar data-bytes -specifies the number of data bytes to be used in an output packet. +.It Fl b Ar total-bytes,data-bytes +.It Fl p Ar total-bytes,data-bytes +specifies the total number of bytes in an +.Dq output packet +as well as the number of data bytes to be used in an output packet. If no value is specified, -.Dv 224 +.Dv 255,223 is used. +This will protect against 16 errors in the data. .It Fl o Ar output-file use the specified file for output. By default, output will go to .Dv stdout -.It Fl p Ar parity-bytes -specifies the number of parity bytes to be used in an output packet. -If no value is specified, -.Dv 32 -is used. -This will protect against 16 errors in the data. .It Fl v -prints the version of +prints the version information of .Nm on .Dv stdout
CVS commit: othersrc/external/bsd/rs
Module Name:othersrc Committed By: agc Date: Sat Mar 12 08:08:30 UTC 2011 Update of /cvsroot/othersrc/external/bsd/rs In directory ivanova.netbsd.org:/tmp/cvs-serv8550 Log Message: Initial import into othersrc of library and rs(1) progream, implementing Reed Solomon erasure coding. Status: Vendor Tag: CROOKS Release Tags: rs-base N othersrc/external/bsd/rs/Makefile N othersrc/external/bsd/rs/dist/rs.1 N othersrc/external/bsd/rs/dist/Makefile N othersrc/external/bsd/rs/dist/README N othersrc/external/bsd/rs/dist/TODO N othersrc/external/bsd/rs/dist/main.c N othersrc/external/bsd/rs/dist/rs.c N othersrc/external/bsd/rs/dist/rs.h N othersrc/external/bsd/rs/dist/librs.3 N othersrc/external/bsd/rs/librs/Makefile N othersrc/external/bsd/rs/librs/shlib_version N othersrc/external/bsd/rs/rs/Makefile No conflicts created by this import
CVS commit: othersrc/external/bsd/rs/dist
Module Name:othersrc Committed By: wiz Date: Sat Mar 12 13:20:00 UTC 2011 Modified Files: othersrc/external/bsd/rs/dist: rs.1 Log Message: Sort sections, remove superfluous Pp, upper-case names. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/dist/rs.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/bsd/rs/dist/rs.1 diff -u othersrc/external/bsd/rs/dist/rs.1:1.1.1.1 othersrc/external/bsd/rs/dist/rs.1:1.2 --- othersrc/external/bsd/rs/dist/rs.1:1.1.1.1 Sat Mar 12 08:08:29 2011 +++ othersrc/external/bsd/rs/dist/rs.1 Sat Mar 12 13:20:00 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: rs.1,v 1.1.1.1 2011/03/12 08:08:29 agc Exp $ +.\ $NetBSD: rs.1,v 1.2 2011/03/12 13:20:00 wiz Exp $ .\ .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org .\ All rights reserved. @@ -28,7 +28,7 @@ .Os .Sh NAME .Nm rs -.Nd reed-solomon erasure coding +.Nd Reed-Solomon erasure coding .Sh SYNOPSIS .Nm .Fl dv @@ -91,8 +91,12 @@ .Dv stdout and exits. .El -.Pp -.Sh EXAMPLE +.Sh RETURN VALUES +The +.Nm +utility will return 0 for success, +and 1 for failure. +.Sh EXAMPLES .Bd -literal % cp Makefile a % rs -o a.rs a @@ -106,11 +110,6 @@ % cmp a a.2 % .Ed -.Sh RETURN VALUES -The -.Nm -utility will return 0 for success, -and 1 for failure. .Sh SEE ALSO .Xr librs 3 .Sh HISTORY