1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 Red Hat, Inc.
5 * This file is released under the GPL.
8 #ifndef DM_CACHE_BLOCK_TYPES_H
9 #define DM_CACHE_BLOCK_TYPES_H
11 #include "persistent-data/dm-block-manager.h"
13 /*----------------------------------------------------------------*/
16 * It's helpful to get sparse to differentiate between indexes into the
17 * origin device, indexes into the cache device, and indexes into the
21 typedef dm_block_t __bitwise dm_oblock_t;
22 typedef uint32_t __bitwise dm_cblock_t;
23 typedef dm_block_t __bitwise dm_dblock_t;
25 static inline dm_oblock_t to_oblock(dm_block_t b)
27 return (__force dm_oblock_t) b;
30 static inline dm_block_t from_oblock(dm_oblock_t b)
32 return (__force dm_block_t) b;
35 static inline dm_cblock_t to_cblock(uint32_t b)
37 return (__force dm_cblock_t) b;
40 static inline uint32_t from_cblock(dm_cblock_t b)
42 return (__force uint32_t) b;
45 static inline dm_dblock_t to_dblock(dm_block_t b)
47 return (__force dm_dblock_t) b;
50 static inline dm_block_t from_dblock(dm_dblock_t b)
52 return (__force dm_block_t) b;
55 #endif /* DM_CACHE_BLOCK_TYPES_H */