| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* internal.h - declarations internal to debugfs |
| 4 |
* |
| 5 |
* Copyright (C) 2016 Nicolai Stange <[email protected]> |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef _DEBUGFS_INTERNAL_H_ |
| 9 |
#define _DEBUGFS_INTERNAL_H_ |
| 10 |
#include <linux/list.h> |
| 11 |
|
| 12 |
struct file_operations; |
| 13 |
|
| 14 |
struct debugfs_inode_info { |
| 15 |
struct inode vfs_inode; |
| 16 |
union { |
| 17 |
const void *raw; |
| 18 |
const struct file_operations *real_fops; |
| 19 |
const struct debugfs_short_fops *short_fops; |
| 20 |
debugfs_automount_t automount; |
| 21 |
}; |
| 22 |
void *aux; |
| 23 |
}; |
| 24 |
|
| 25 |
static inline struct debugfs_inode_info *DEBUGFS_I(struct inode *inode) |
| 26 |
{ |
| 27 |
return container_of(inode, struct debugfs_inode_info, vfs_inode); |
| 28 |
} |
| 29 |
|
| 30 |
/* declared over in file.c */ |
| 31 |
extern const struct file_operations debugfs_noop_file_operations; |
| 32 |
extern const struct file_operations debugfs_open_proxy_file_operations; |
| 33 |
extern const struct file_operations debugfs_full_proxy_file_operations; |
| 34 |
extern const struct file_operations debugfs_full_short_proxy_file_operations; |
| 35 |
|
| 36 |
struct debugfs_fsdata { |
| 37 |
const struct file_operations *real_fops; |
| 38 |
const struct debugfs_short_fops *short_fops; |
| 39 |
struct { |
| 40 |
refcount_t active_users; |
| 41 |
struct completion active_users_drained; |
| 42 |
|
| 43 |
/* protect cancellations */ |
| 44 |
struct mutex cancellations_mtx; |
| 45 |
struct list_head cancellations; |
| 46 |
unsigned int methods; |
| 47 |
}; |
| 48 |
}; |
| 49 |
|
| 50 |
enum { |
| 51 |
HAS_READ = 1, |
| 52 |
HAS_WRITE = 2, |
| 53 |
HAS_LSEEK = 4, |
| 54 |
HAS_POLL = 8, |
| 55 |
HAS_IOCTL = 16 |
| 56 |
}; |
| 57 |
|
| 58 |
#endif /* _DEBUGFS_INTERNAL_H_ */ |