Whamcloud - gitweb
add null_audit command to lctl which will make audit silent. For testing purposes.
[fs/lustre-release.git] / lustre / include / linux / lustre_audit.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001-2003 Cluster File Systems, Inc. <info@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  *   smfs data structures.
22  *   See also lustre_idl.h for wire formats of requests.
23  *
24  */
25
26 #ifndef __LUSTRE_AUDIT_H
27 #define __LUSTRE_AUDIT_H
28
29 /* Audit plugin stuff */
30 #define AUDIT_MDS_NAME    "audit_mds"
31 #define AUDIT_OST_NAME    "audit_ost"
32 #define AUDIT_CLI_NAME    "audit_client-"
33 #define AUDIT_ATTR_EA     "audit"
34 #define AUDIT_ATTR_FILE   "audit_setting"
35 //AUDIT OPCODES, also bit number in audit_setting mask
36
37 typedef enum {
38         AUDIT_UNKNOWN = 0,
39         AUDIT_CREATE,
40         AUDIT_LINK,
41         AUDIT_UNLINK,
42         AUDIT_RENAME,
43         AUDIT_SETATTR,
44         AUDIT_WRITE,
45         AUDIT_READ,
46         AUDIT_OPEN,
47         AUDIT_STAT,
48         AUDIT_MMAP,
49         AUDIT_READLINK,
50         AUDIT_READDIR,
51         AUDIT_MAX,
52 } audit_op;
53
54 #define AUDIT_FAIL  AUDIT_MAX
55 #define AUDIT_DIR   (AUDIT_MAX + 1)
56 #define AUDIT_FS    (AUDIT_MAX + 2)
57 #define AUDIT_SYNC  (AUDIT_MAX + 3)
58 #define AUDIT_NULL  (AUDIT_MAX + 4)
59
60 #define AUD_BIT(a) (1 << a)
61
62 #define AUDIT_ALL_OPS ((1 << AUDIT_MAX) - 1)
63 #define AUDIT_OFF 0
64
65 #define IS_AUDIT_OP(mask,op) (mask & (1<<op))
66 #define IS_AUDIT(mask) (mask & AUDIT_ALL_OPS)
67 #define SET_AUDIT_OP(mask,op) (mask |= (1<<op))
68
69 //llog audit record 24 bytes
70 struct audit_record {
71         __u64 nid;
72         __u32 uid;
73         __u32 gid;
74         __u32 time;
75         __u16 opcode;
76         __u16 result;
77 } __attribute__ ((packed));
78
79 //32 bytes
80 struct audit_id_record {
81         __u64 au_num;
82         __u64 au_fid;
83         __u32 au_gen;
84         __u32 au_type;
85         __u64 au_mds;
86 } __attribute__ ((packed));
87
88 //1 + namelen
89 struct audit_name_record {
90         __u8 name_len;
91         char name[0];
92 } __attribute__ ((packed));
93
94 struct audit_info {
95         struct audit_msg m;
96         struct inode * child;
97         char * name;
98         __u32 namelen;
99 };
100
101 struct audit_lov_msg {
102         struct lov_stripe_md * lsm;
103         __u64 mask;
104         uid_t uid;
105         gid_t gid;
106 };
107
108 #endif