cryptsetup  2.4.3
About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.
  Fossies Dox: cryptsetup-2.4.3.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

libcryptsetup_macros.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONST_CAST(x)   (x)(uintptr_t)
 
#define UNUSED(x)   (void)(x)
 
#define ARRAY_SIZE(arr)   (sizeof(arr) / sizeof((arr)[0]))
 
#define BITFIELD_SIZE(BF_PTR)   (sizeof(*(BF_PTR)) * 8)
 
#define MOVE_REF(x, y)
 
#define FREE_AND_NULL(x)   do { free(x); x = NULL; } while (0)
 
#define AT_LEAST(a, b)   ({ __typeof__(a) __at_least = (a); (__at_least >= (b))?__at_least:(b); })
 
#define SHIFT_4K   12
 
#define SECTOR_SHIFT   9
 
#define SECTOR_SIZE   (1 << SECTOR_SHIFT)
 
#define MAX_SECTOR_SIZE   4096 /* min page size among all platforms */
 
#define ROUND_SECTOR(x)   (((x) + SECTOR_SIZE - 1) / SECTOR_SIZE)
 
#define MISALIGNED(a, b)   ((a) & ((b) - 1))
 
#define MISALIGNED_4K(a)   MISALIGNED((a), 1 << SHIFT_4K)
 
#define MISALIGNED_512(a)   MISALIGNED((a), 1 << SECTOR_SHIFT)
 
#define NOTPOW2(a)   MISALIGNED((a), (a))
 
#define DEFAULT_DISK_ALIGNMENT   1048576 /* 1MiB */
 
#define DEFAULT_MEM_ALIGNMENT   4096
 
#define DM_UUID_LEN   129
 
#define DM_BY_ID_PREFIX   "dm-uuid-"
 
#define DM_BY_ID_PREFIX_LEN   8
 
#define DM_UUID_PREFIX   "CRYPT-"
 
#define DM_UUID_PREFIX_LEN   6
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   arr)    (sizeof(arr) / sizeof((arr)[0]))

Definition at line 31 of file libcryptsetup_macros.h.

◆ AT_LEAST

#define AT_LEAST (   a,
 
)    ({ __typeof__(a) __at_least = (a); (__at_least >= (b))?__at_least:(b); })

Definition at line 45 of file libcryptsetup_macros.h.

◆ BITFIELD_SIZE

#define BITFIELD_SIZE (   BF_PTR)    (sizeof(*(BF_PTR)) * 8)

Definition at line 34 of file libcryptsetup_macros.h.

◆ CONST_CAST

#define CONST_CAST (   x)    (x)(uintptr_t)

Definition at line 26 of file libcryptsetup_macros.h.

◆ DEFAULT_DISK_ALIGNMENT

#define DEFAULT_DISK_ALIGNMENT   1048576 /* 1MiB */

Definition at line 58 of file libcryptsetup_macros.h.

◆ DEFAULT_MEM_ALIGNMENT

#define DEFAULT_MEM_ALIGNMENT   4096

Definition at line 59 of file libcryptsetup_macros.h.

◆ DM_BY_ID_PREFIX

#define DM_BY_ID_PREFIX   "dm-uuid-"

Definition at line 62 of file libcryptsetup_macros.h.

◆ DM_BY_ID_PREFIX_LEN

#define DM_BY_ID_PREFIX_LEN   8

Definition at line 63 of file libcryptsetup_macros.h.

◆ DM_UUID_LEN

#define DM_UUID_LEN   129

Definition at line 61 of file libcryptsetup_macros.h.

◆ DM_UUID_PREFIX

#define DM_UUID_PREFIX   "CRYPT-"

Definition at line 64 of file libcryptsetup_macros.h.

◆ DM_UUID_PREFIX_LEN

#define DM_UUID_PREFIX_LEN   6

Definition at line 65 of file libcryptsetup_macros.h.

◆ FREE_AND_NULL

#define FREE_AND_NULL (   x)    do { free(x); x = NULL; } while (0)

Definition at line 43 of file libcryptsetup_macros.h.

◆ MAX_SECTOR_SIZE

#define MAX_SECTOR_SIZE   4096 /* min page size among all platforms */

Definition at line 50 of file libcryptsetup_macros.h.

◆ MISALIGNED

#define MISALIGNED (   a,
 
)    ((a) & ((b) - 1))

Definition at line 53 of file libcryptsetup_macros.h.

◆ MISALIGNED_4K

#define MISALIGNED_4K (   a)    MISALIGNED((a), 1 << SHIFT_4K)

Definition at line 54 of file libcryptsetup_macros.h.

◆ MISALIGNED_512

#define MISALIGNED_512 (   a)    MISALIGNED((a), 1 << SECTOR_SHIFT)

Definition at line 55 of file libcryptsetup_macros.h.

◆ MOVE_REF

#define MOVE_REF (   x,
 
)
Value:
do { \
__typeof__(x) *_px = &(x), *_py = &(y); \
*_px = *_py; \
*_py = NULL; \
} while (0)

Definition at line 36 of file libcryptsetup_macros.h.

◆ NOTPOW2

#define NOTPOW2 (   a)    MISALIGNED((a), (a))

Definition at line 56 of file libcryptsetup_macros.h.

◆ ROUND_SECTOR

#define ROUND_SECTOR (   x)    (((x) + SECTOR_SIZE - 1) / SECTOR_SIZE)

Definition at line 51 of file libcryptsetup_macros.h.

◆ SECTOR_SHIFT

#define SECTOR_SHIFT   9

Definition at line 48 of file libcryptsetup_macros.h.

◆ SECTOR_SIZE

#define SECTOR_SIZE   (1 << SECTOR_SHIFT)

Definition at line 49 of file libcryptsetup_macros.h.

◆ SHIFT_4K

#define SHIFT_4K   12

Definition at line 47 of file libcryptsetup_macros.h.

◆ UNUSED

#define UNUSED (   x)    (void)(x)

Definition at line 28 of file libcryptsetup_macros.h.