1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Creating audit records for mapped devices.
5 * Copyright (C) 2021 Fraunhofer AISEC. All rights reserved.
7 * Authors: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
13 #include <linux/device-mapper.h>
14 #include <linux/audit.h>
16 #ifdef CONFIG_DM_AUDIT
17 void dm_audit_log_bio(const char *dm_msg_prefix
, const char *op
,
18 struct bio
*bio
, sector_t sector
, int result
);
21 * dm_audit_log_ti() is not intended to be used directly in dm modules,
22 * the wrapper functions below should be called by dm modules instead.
24 void dm_audit_log_ti(int audit_type
, const char *dm_msg_prefix
, const char *op
,
25 struct dm_target
*ti
, int result
);
27 static inline void dm_audit_log_ctr(const char *dm_msg_prefix
,
28 struct dm_target
*ti
, int result
)
30 dm_audit_log_ti(AUDIT_DM_CTRL
, dm_msg_prefix
, "ctr", ti
, result
);
33 static inline void dm_audit_log_dtr(const char *dm_msg_prefix
,
34 struct dm_target
*ti
, int result
)
36 dm_audit_log_ti(AUDIT_DM_CTRL
, dm_msg_prefix
, "dtr", ti
, result
);
39 static inline void dm_audit_log_target(const char *dm_msg_prefix
, const char *op
,
40 struct dm_target
*ti
, int result
)
42 dm_audit_log_ti(AUDIT_DM_EVENT
, dm_msg_prefix
, op
, ti
, result
);
45 static inline void dm_audit_log_bio(const char *dm_msg_prefix
, const char *op
,
46 struct bio
*bio
, sector_t sector
,
50 static inline void dm_audit_log_target(const char *dm_msg_prefix
,
51 const char *op
, struct dm_target
*ti
,
55 static inline void dm_audit_log_ctr(const char *dm_msg_prefix
,
56 struct dm_target
*ti
, int result
)
60 static inline void dm_audit_log_dtr(const char *dm_msg_prefix
,
61 struct dm_target
*ti
, int result
)