This was useful in converting armv8crypto to use buffer cursors. There
are some cases where you want to make two passes over data, so you want
a way to "reset" a cursor.
Details
- Reviewers
jmg jhb pauamma_gundo.com - Group Reviewers
manpages - Commits
- rG09bfa5cf16a3: opencrypto: Add a routine to copy a crypto buffer cursor
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 44414 Build 41302: arc lint + arc unit
Event Timeline
I think I've just used direct structure copies for this in other places, but an API call is fine. I'd be tempted to make it an inline so the compiler can inline it perhaps. I think you should also add it to crypto_buffer.9?
share/man/man9/crypto_buffer.9 | ||
---|---|---|
33 | ||
325 | May be belaboring the obvious - I don't know the audience well enough to say. | |
326–327 | Looking at the struct definition in sys/opencrypto/cryptodev.h, I see union { char *cc_buf; struct mbuf *cc_mbuf; struct iovec *cc_iov; vm_page_t *cc_vmpage; }; Is that part of the state (it may well not be - my code-reading skills are past their prime)? |
share/man/man9/crypto_buffer.9 | ||
---|---|---|
326–327 | It is part of the state, but once the you've copied the cursor, changes to fromc don't affect toc and vice versa. In particular, this part of the state is duplicated in each cursor. They point to a shared buffer, but the buffer isn't part of the state. Rather, a cursor is an offset into a buffer and state necessary to iterate over a buffer. |
share/man/man9/crypto_buffer.9 | ||
---|---|---|
326–327 | If I read your implication right that the shared buffer is never written into through one while the other reads from it, that language works. |