• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef _LINUX_ELEVATOR_H
13 #define _LINUX_ELEVATOR_H
14 
15 typedef int (elevator_merge_fn) (request_queue_t *, struct request **,
16  struct bio *);
17 
18 typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *);
19 
20 typedef void (elevator_merged_fn) (request_queue_t *, struct request *);
21 
22 typedef int (elevator_dispatch_fn) (request_queue_t *, int);
23 
24 typedef void (elevator_add_req_fn) (request_queue_t *, struct request *);
25 typedef int (elevator_queue_empty_fn) (request_queue_t *);
26 typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *);
27 typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
28 typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *);
29 
30 typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t);
31 typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
32 typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
33 typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
34 
35 typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *);
36 typedef void (elevator_exit_fn) (elevator_t *);
37 
38 struct elevator_ops
39 {
40  elevator_merge_fn *elevator_merge_fn;
41  elevator_merged_fn *elevator_merged_fn;
42  elevator_merge_req_fn *elevator_merge_req_fn;
43 
44  elevator_dispatch_fn *elevator_dispatch_fn;
45  elevator_add_req_fn *elevator_add_req_fn;
46  elevator_activate_req_fn *elevator_activate_req_fn;
47  elevator_deactivate_req_fn *elevator_deactivate_req_fn;
48 
49  elevator_queue_empty_fn *elevator_queue_empty_fn;
50  elevator_completed_req_fn *elevator_completed_req_fn;
51 
52  elevator_request_list_fn *elevator_former_req_fn;
53  elevator_request_list_fn *elevator_latter_req_fn;
54 
55  elevator_set_req_fn *elevator_set_req_fn;
56  elevator_put_req_fn *elevator_put_req_fn;
57 
58  elevator_may_queue_fn *elevator_may_queue_fn;
59 
60  elevator_init_fn *elevator_init_fn;
61  elevator_exit_fn *elevator_exit_fn;
62  void (*trim)(struct io_context *);
63 };
64 
65 #define ELV_NAME_MAX (16)
66 
67 struct elv_fs_entry {
68  struct attribute attr;
69  ssize_t (*show)(elevator_t *, char *);
70  ssize_t (*store)(elevator_t *, const char *, size_t);
71 };
72 
73 struct elevator_type
74 {
75  struct list_head list;
76  struct elevator_ops ops;
77  struct elevator_type *elevator_type;
78  struct elv_fs_entry *elevator_attrs;
79  char elevator_name[ELV_NAME_MAX];
80  struct module *elevator_owner;
81 };
82 
83 struct elevator_queue
84 {
85  struct elevator_ops *ops;
86  void *elevator_data;
87  struct kobject kobj;
88  struct elevator_type *elevator_type;
89  struct mutex sysfs_lock;
90 };
91 
92 #define ELEVATOR_NO_MERGE 0
93 #define ELEVATOR_FRONT_MERGE 1
94 #define ELEVATOR_BACK_MERGE 2
95 
96 #define ELEVATOR_INSERT_FRONT 1
97 #define ELEVATOR_INSERT_BACK 2
98 #define ELEVATOR_INSERT_SORT 3
99 #define ELEVATOR_INSERT_REQUEUE 4
100 
101 enum {
102  ELV_MQUEUE_MAY,
103  ELV_MQUEUE_NO,
104  ELV_MQUEUE_MUST,
105 };
106 
107 #define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors)
108 
109 #endif
110