Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2012 Red Hat, Inc.
 4 *
 5 * This file is released under the GPL.
 6 */
 7
 8#ifndef DM_CACHE_BLOCK_TYPES_H
 9#define DM_CACHE_BLOCK_TYPES_H
10
11#include "persistent-data/dm-block-manager.h"
12
13/*----------------------------------------------------------------*/
14
15/*
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
18 * discard bitset.
19 */
20
21typedef dm_block_t __bitwise dm_oblock_t;
22typedef uint32_t __bitwise dm_cblock_t;
23typedef dm_block_t __bitwise dm_dblock_t;
24
25static inline dm_oblock_t to_oblock(dm_block_t b)
26{
27	return (__force dm_oblock_t) b;
28}
29
30static inline dm_block_t from_oblock(dm_oblock_t b)
31{
32	return (__force dm_block_t) b;
33}
34
35static inline dm_cblock_t to_cblock(uint32_t b)
36{
37	return (__force dm_cblock_t) b;
38}
39
40static inline uint32_t from_cblock(dm_cblock_t b)
41{
42	return (__force uint32_t) b;
43}
44
45static inline dm_dblock_t to_dblock(dm_block_t b)
46{
47	return (__force dm_dblock_t) b;
48}
49
50static inline dm_block_t from_dblock(dm_dblock_t b)
51{
52	return (__force dm_block_t) b;
53}
54
55#endif /* DM_CACHE_BLOCK_TYPES_H */
v5.14.15
 
 1/*
 2 * Copyright (C) 2012 Red Hat, Inc.
 3 *
 4 * This file is released under the GPL.
 5 */
 6
 7#ifndef DM_CACHE_BLOCK_TYPES_H
 8#define DM_CACHE_BLOCK_TYPES_H
 9
10#include "persistent-data/dm-block-manager.h"
11
12/*----------------------------------------------------------------*/
13
14/*
15 * It's helpful to get sparse to differentiate between indexes into the
16 * origin device, indexes into the cache device, and indexes into the
17 * discard bitset.
18 */
19
20typedef dm_block_t __bitwise dm_oblock_t;
21typedef uint32_t __bitwise dm_cblock_t;
22typedef dm_block_t __bitwise dm_dblock_t;
23
24static inline dm_oblock_t to_oblock(dm_block_t b)
25{
26	return (__force dm_oblock_t) b;
27}
28
29static inline dm_block_t from_oblock(dm_oblock_t b)
30{
31	return (__force dm_block_t) b;
32}
33
34static inline dm_cblock_t to_cblock(uint32_t b)
35{
36	return (__force dm_cblock_t) b;
37}
38
39static inline uint32_t from_cblock(dm_cblock_t b)
40{
41	return (__force uint32_t) b;
42}
43
44static inline dm_dblock_t to_dblock(dm_block_t b)
45{
46	return (__force dm_dblock_t) b;
47}
48
49static inline dm_block_t from_dblock(dm_dblock_t b)
50{
51	return (__force dm_block_t) b;
52}
53
54#endif /* DM_CACHE_BLOCK_TYPES_H */