Skip to content

Commit a4c40c1

Browse files
beaubelgraverostedt
authored andcommitted
tracing/user_events: Align structs with tabs for readability
Add tabs to make struct members easier to read and unify the style of the code. Link: https://lkml.kernel.org/r/20230328235219.203-13-beaub@linux.microsoft.com Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent ce58e96 commit a4c40c1

3 files changed

Lines changed: 60 additions & 60 deletions

File tree

include/linux/user_events.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
#ifdef CONFIG_USER_EVENTS
1919
struct user_event_mm {
20-
struct list_head link;
21-
struct list_head enablers;
22-
struct mm_struct *mm;
23-
struct user_event_mm *next;
24-
refcount_t refcnt;
25-
refcount_t tasks;
26-
struct rcu_work put_rwork;
20+
struct list_head link;
21+
struct list_head enablers;
22+
struct mm_struct *mm;
23+
struct user_event_mm *next;
24+
refcount_t refcnt;
25+
refcount_t tasks;
26+
struct rcu_work put_rwork;
2727
};
2828

2929
extern void user_event_mm_dup(struct task_struct *t,

include/uapi/linux/user_events.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@
2525
struct user_reg {
2626

2727
/* Input: Size of the user_reg structure being used */
28-
__u32 size;
28+
__u32 size;
2929

3030
/* Input: Bit in enable address to use */
31-
__u8 enable_bit;
31+
__u8 enable_bit;
3232

3333
/* Input: Enable size in bytes at address */
34-
__u8 enable_size;
34+
__u8 enable_size;
3535

3636
/* Input: Flags for future use, set to 0 */
37-
__u16 flags;
37+
__u16 flags;
3838

3939
/* Input: Address to update when enabled */
40-
__u64 enable_addr;
40+
__u64 enable_addr;
4141

4242
/* Input: Pointer to string with event name, description and flags */
43-
__u64 name_args;
43+
__u64 name_args;
4444

4545
/* Output: Index of the event to use when writing data */
46-
__u32 write_index;
46+
__u32 write_index;
4747
} __attribute__((__packed__));
4848

4949
/*
@@ -52,19 +52,19 @@ struct user_reg {
5252
*/
5353
struct user_unreg {
5454
/* Input: Size of the user_unreg structure being used */
55-
__u32 size;
55+
__u32 size;
5656

5757
/* Input: Bit to unregister */
58-
__u8 disable_bit;
58+
__u8 disable_bit;
5959

6060
/* Input: Reserved, set to 0 */
61-
__u8 __reserved;
61+
__u8 __reserved;
6262

6363
/* Input: Reserved, set to 0 */
64-
__u16 __reserved2;
64+
__u16 __reserved2;
6565

6666
/* Input: Address to unregister */
67-
__u64 disable_addr;
67+
__u64 disable_addr;
6868
} __attribute__((__packed__));
6969

7070
#define DIAG_IOC_MAGIC '*'

kernel/trace/trace_events_user.c

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
* allows isolation for events by various means.
5454
*/
5555
struct user_event_group {
56-
char *system_name;
57-
struct hlist_node node;
58-
struct mutex reg_mutex;
56+
char *system_name;
57+
struct hlist_node node;
58+
struct mutex reg_mutex;
5959
DECLARE_HASHTABLE(register_table, 8);
6060
};
6161

@@ -76,17 +76,17 @@ static unsigned int current_user_events;
7676
* refcnt reaches one.
7777
*/
7878
struct user_event {
79-
struct user_event_group *group;
80-
struct tracepoint tracepoint;
81-
struct trace_event_call call;
82-
struct trace_event_class class;
83-
struct dyn_event devent;
84-
struct hlist_node node;
85-
struct list_head fields;
86-
struct list_head validators;
87-
refcount_t refcnt;
88-
int min_size;
89-
char status;
79+
struct user_event_group *group;
80+
struct tracepoint tracepoint;
81+
struct trace_event_call call;
82+
struct trace_event_class class;
83+
struct dyn_event devent;
84+
struct hlist_node node;
85+
struct list_head fields;
86+
struct list_head validators;
87+
refcount_t refcnt;
88+
int min_size;
89+
char status;
9090
};
9191

9292
/*
@@ -95,12 +95,12 @@ struct user_event {
9595
* these to track enablement sites that are tied to an event.
9696
*/
9797
struct user_event_enabler {
98-
struct list_head link;
99-
struct user_event *event;
100-
unsigned long addr;
98+
struct list_head link;
99+
struct user_event *event;
100+
unsigned long addr;
101101

102102
/* Track enable bit, flags, etc. Aligned for bitops. */
103-
unsigned int values;
103+
unsigned int values;
104104
};
105105

106106
/* Bits 0-5 are for the bit to update upon enable/disable (0-63 allowed) */
@@ -119,9 +119,9 @@ struct user_event_enabler {
119119

120120
/* Used for asynchronous faulting in of pages */
121121
struct user_event_enabler_fault {
122-
struct work_struct work;
123-
struct user_event_mm *mm;
124-
struct user_event_enabler *enabler;
122+
struct work_struct work;
123+
struct user_event_mm *mm;
124+
struct user_event_enabler *enabler;
125125
};
126126

127127
static struct kmem_cache *fault_cache;
@@ -137,23 +137,23 @@ static DEFINE_SPINLOCK(user_event_mms_lock);
137137
* These are not shared and only accessible by the file that created it.
138138
*/
139139
struct user_event_refs {
140-
struct rcu_head rcu;
141-
int count;
142-
struct user_event *events[];
140+
struct rcu_head rcu;
141+
int count;
142+
struct user_event *events[];
143143
};
144144

145145
struct user_event_file_info {
146-
struct user_event_group *group;
147-
struct user_event_refs *refs;
146+
struct user_event_group *group;
147+
struct user_event_refs *refs;
148148
};
149149

150150
#define VALIDATOR_ENSURE_NULL (1 << 0)
151151
#define VALIDATOR_REL (1 << 1)
152152

153153
struct user_event_validator {
154-
struct list_head link;
155-
int offset;
156-
int flags;
154+
struct list_head link;
155+
int offset;
156+
int flags;
157157
};
158158

159159
typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
@@ -2276,11 +2276,11 @@ static int user_events_release(struct inode *node, struct file *file)
22762276
}
22772277

22782278
static const struct file_operations user_data_fops = {
2279-
.open = user_events_open,
2280-
.write = user_events_write,
2281-
.write_iter = user_events_write_iter,
2279+
.open = user_events_open,
2280+
.write = user_events_write,
2281+
.write_iter = user_events_write_iter,
22822282
.unlocked_ioctl = user_events_ioctl,
2283-
.release = user_events_release,
2283+
.release = user_events_release,
22842284
};
22852285

22862286
static void *user_seq_start(struct seq_file *m, loff_t *pos)
@@ -2346,10 +2346,10 @@ static int user_seq_show(struct seq_file *m, void *p)
23462346
}
23472347

23482348
static const struct seq_operations user_seq_ops = {
2349-
.start = user_seq_start,
2350-
.next = user_seq_next,
2351-
.stop = user_seq_stop,
2352-
.show = user_seq_show,
2349+
.start = user_seq_start,
2350+
.next = user_seq_next,
2351+
.stop = user_seq_stop,
2352+
.show = user_seq_show,
23532353
};
23542354

23552355
static int user_status_open(struct inode *node, struct file *file)
@@ -2375,10 +2375,10 @@ static int user_status_open(struct inode *node, struct file *file)
23752375
}
23762376

23772377
static const struct file_operations user_status_fops = {
2378-
.open = user_status_open,
2379-
.read = seq_read,
2380-
.llseek = seq_lseek,
2381-
.release = seq_release,
2378+
.open = user_status_open,
2379+
.read = seq_read,
2380+
.llseek = seq_lseek,
2381+
.release = seq_release,
23822382
};
23832383

23842384
/*

0 commit comments

Comments
 (0)