if (n > 64) {
pr_debug("next_bits invalid n %u\n", n); return -EINVAL;
}
/* split this up if reading > 8 bytes, or if we're at the end of *theinputbufferandwouldreadpasttheend
*/ if (bits > 64) return __split_next_bits(p, d, n, 32); elseif (p->ilen < 8 && bits > 32 && bits <= 56) return __split_next_bits(p, d, n, 16); elseif (p->ilen < 4 && bits > 16 && bits <= 24) return __split_next_bits(p, d, n, 8);
if (DIV_ROUND_UP(bits, 8) > p->ilen) return -EOVERFLOW;
ret = next_bits(p, &index, bits); if (ret) return ret;
offset = index * size;
/* a ring buffer of fsize is used; correct the offset */ if (total > fsize) { /* this is where the current fifo is */
u64 section = round_down(total, fsize); /* the current pos in the fifo */
u64 pos = total - section;
/* if the offset is past/at the pos, we need to *gobacktothelastfifosection
*/ if (offset >= pos)
section -= fsize;
offset += section;
}
if (offset + size > total) {
pr_debug("index%x %lx points past end %lx\n", size,
(unsignedlong)offset, (unsignedlong)total); return -EINVAL;
}
if (size != 2 && size != 4 && size != 8)
WARN(1, "__do_index invalid size %x\n", size); else
pr_debug("index%x to %lx off %lx adjoff %lx tot %lx data %lx\n",
size, (unsignedlong)index,
(unsignedlong)(index * size), (unsignedlong)offset,
(unsignedlong)total,
(unsignedlong)beN_to_cpu(&p->ostart[offset], size));
staticint do_op(struct sw842_param *p, u8 o)
{ int i, ret = 0;
if (o >= OPS_MAX) return -EINVAL;
for (i = 0; i < 4; i++) {
u8 op = decomp_ops[o][i];
pr_debug("op is %x\n", op);
switch (op & OP_ACTION) { case OP_ACTION_DATA:
ret = do_data(p, op & OP_AMOUNT); break; case OP_ACTION_INDEX:
ret = do_index(p, op & OP_AMOUNT); break; case OP_ACTION_NOOP: break; default:
pr_err("Internal error, invalid op %x\n", op); return -EINVAL;
}
if (ret) return ret;
}
if (sw842_template_counts)
atomic_inc(&template_count[o]);
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.