These are currently defined memory operations for redo and undo
Code Block |
---|
/* Type of memory actions */ enum { UMEM_ACT_NOOP = 0, /** copy appended payload to specified storage address */ UMEM_ACT_COPY, /** copy payload addressed by @ptr to specified storage address */ UMEM_ACT_COPY_PTR, /** assign 8/16/32/64 bits integer to specified storage address */ UMEM_ACT_COPY_INTASSIGN, /** move specified bytes from source address to destination address */ UMEM_ACT_MOVE, /** memset a region with specified value */ UMEM_ACT_SET, /** set the specified bit in bitmap */ UMEM_ACT_SET_BITS, /** unset the specified bit in bitmap */ UMEM_ACT_CLR_BITS, /** it's checksum of the specified address */ UMEM_ACT_CSUM, }; |
Each umem_action can describe a memory operation and its parameters
Code Block |
---|
/** * Memory operations for redo/undo. * 16 bytes for bit operation (set/clr) and integer assignment, 32+ bytes for * other operations. */ struct umem_action { uint16_t ac_opc; union { struct { uint16uint64_t numaddr; uint32uint64_t possize; uint64uint8_t addrpayload[0]; } ac_op_bits; copy; /**< copy payload from @payload to @addr */ struct { uint64_t addr; uint64_t size; uint8uint64_t valptr; } ac_copy_set; ptr; /**< copy payload from @ptr to @addr */ struct { uint64uint16_t srcsize; uint64uint32_t dstval; uint64_t sizeaddr; } ac_move;assign; /**< assign integer to @addr, int64 should use ac_copy */ struct { uint64uint16_t addrnum; uint64uint32_t sizepos; uint8uint64_t payload[0]bmap; } ac_copyop_bits; /**< set or clear the @pos bit in bitmap @bmap */ struct { uint64uint16_t addrval; uint64uint32_t valsize; uint8uint64_t size; /* int8/16/32/64 */addr; } ac_set; /**< memset(addr, val, size) */ struct { } ac_copy_int; uint16_t struct {pad16; uint64uint32_t addrsize; uint64_t sizesrc; uint64_t ptrdst; } ac_copy_ptrmove; /**< memmove(dst, size src) */ struct { uint64uint16_t addrcsum_sz; uint32_t size; uint16uint64_t csum_szaddr; uint8_t csum[0]; } ac_csum; /**< it is checksum of data stored in @addr */ }; }; |