Whamcloud - gitweb
- b_hd_audit landing
[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_NONE = 0,
39         AUDIT_CREATE,
40         AUDIT_LINK,
41         AUDIT_UNLINK,
42         AUDIT_SYMLINK,
43         AUDIT_RENAME,
44         AUDIT_SETATTR,
45         AUDIT_WRITE,
46         AUDIT_READ,
47         AUDIT_OPEN,
48         AUDIT_STAT,
49         AUDIT_MMAP,
50         AUDIT_READLINK,
51         AUDIT_READDIR,
52         AUDIT_MAX,
53 } audit_op;
54
55 #define AUDIT_FAIL AUDIT_MAX
56 #define AUDIT_DIR  (AUDIT_MAX + 1)
57 #define AUDIT_FS   (AUDIT_MAX + 2)
58
59 #define AUD_BIT(a) (1 << a)
60
61 #define AUDIT_ALL_OPS ((1 << AUDIT_MAX) - 1)
62 #define AUDIT_OFF 0
63
64 #define IS_AUDIT_OP(mask,op) (mask & (1<<op))
65 #define IS_AUDIT(mask) (mask & AUDIT_ALL_OPS)
66 #define SET_AUDIT_OP(mask,op) (mask |= (1<<op))
67
68 //llog audit record 24 bytes
69 struct audit_record {
70         __u64 nid;
71         __u32 uid;
72         __u32 gid;
73         __u32 time;
74         __u16 opcode;
75         __u16 result;
76 } __attribute__ ((packed));
77
78 //32 bytes
79 struct audit_id_record {
80         __u64 au_num;
81         __u64 au_fid;
82         __u32 au_gen;
83         __u32 au_type;
84         __u64 au_mds;
85 } __attribute__ ((packed));
86
87 //1 + namelen
88 struct audit_name_record {
89         __u8 name_len;
90         char name[0];
91 } __attribute__ ((packed));
92
93 struct audit_info {
94         struct audit_msg m;
95         char * name;
96         __u32 namelen;
97 };
98
99 struct audit_lov_msg {
100         struct lov_stripe_md * lsm;
101         __u64 mask;
102         uid_t uid;
103         gid_t gid;
104 };
105
106 #endif