Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

These are currently defined memory operations for redo and undo

/* 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_ASSIGN,
        /** 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

/**
 * 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 {
                        uint64_t                addr;
                        uint64_t                size;
                        uint8_t                 payload[0];
                } ac_copy;      /**< copy payload from @payload to @addr */
                struct {
                        uint64_t                addr;
                        uint64_t                size;
                        uint64_t                ptr;
                } ac_copy_ptr;  /**< copy payload from @ptr to @addr */
                struct {
                        uint16_t                size;
                        uint32_t                val;
                        uint64_t                addr;
                } ac_assign;    /**< assign integer to @addr, int64 should use ac_copy */
                struct {
                        uint16_t                num;
                        uint32_t                pos;
                        uint64_t                bmap;
                } ac_op_bits;   /**< set or clear the @pos bit in bitmap @bmap */
                struct {
                        uint16_t                val;
                        uint32_t                size;
                        uint64_t                addr;
                } ac_set;       /**< memset(addr, val, size) */
                struct {
                        uint16_t                pad16;
                        uint32_t                size;
                        uint64_t                src;
                        uint64_t                dst;
                } ac_move;      /**< memmove(dst, size src) */
                struct {
                        uint16_t                csum_sz;
                        uint32_t                size;
                        uint64_t                addr;
                        uint8_t                 csum[0];
                } ac_csum;      /**< it is checksum of data stored in @addr */
        };
};
  • No labels