library ieee; use ieee.std_logic_1164.all; entity dut is port ( sig_i : in std_logic_vector; sig_o : out std_logic_vector ); end entity; architecture arch of dut is begin sig_o <= sig_i; end architecture; library ieee; use ieee.std_logic_1164.all; entity tb is end entity; architecture bench of tb is signal sin : std_ulogic_vector(31 downto 0); signal sout : std_ulogic_vector(31 downto 0); begin stim : process begin wait for 1 ns; report to_string(sin); report to_string(sout); std.env.finish; end process; dut_inst: entity work.dut port map ( sig_i => sin, sig_o => sout ); end architecture; > : xen/xen
xenJames
aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap/snaplog.h
blob: 02748bdedb53425c0bfc5f3b97e7ca7b5643bb34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**************************************************************************
 * 
 * snaplog.h
 *
 * Snapshot log on-disk data structure.
 *
 */
 
#include "radix.h"
#include "blockstore.h"    /* for BLOCK_SIZE */
 
#ifndef __SNAPLOG_H__
#define __SNAPLOG_H__

typedef struct snap_id {
    u64            block;
    unsigned int   index;
} snap_id_t;

typedef struct snap_rec {
    u64            radix_root;
    struct timeval timestamp;
    /* flags: */
    unsigned       deleted:1;
} snap_rec_t;


int  snap_block_create(snap_id_t *parent_id, snap_id_t *new_id);
int  snap_append(snap_id_t *id, snap_rec_t *rec, snap_id_t *new_id);
int  snap_collapse(int height, snap_id_t *p_id, snap_id_t *c_id);
void snap_print_history(snap_id_t *snap_id);
int  snap_get_id(snap_id_t *id, snap_rec_t *target);


/* exported for vdi debugging */
#define SNAP_MAGIC 0xff00ff0aa0ff00ffLL

static const snap_id_t null_snap_id = { 0, 0 }; 

typedef struct snap_block_hdr {
    u64            magic;
    snap_id_t      parent_block; /* parent block within this chain */
    snap_id_t      fork_block;   /* where this log was forked */
    unsigned       log_entries;  /* total entries since forking */
    unsigned short nr_entries;   /* entries in snaps[] */
    unsigned short immutable;    /* has this snap page become immutable? */
} snap_block_hdr_t;


#define SNAPS_PER_BLOCK \
    ((BLOCK_SIZE - sizeof(snap_block_hdr_t)) / sizeof(snap_rec_t))

typedef struct snap_block {
    snap_block_hdr_t hdr;
    snap_rec_t       snaps[SNAPS_PER_BLOCK];
} snap_block_t;
    

snap_block_t *snap_get_block(u64 block);

#endif /* __SNAPLOG_H__ */