Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
11
12#include <linux/bio.h>
13#include <linux/blkdev.h>
14#include <linux/blk-mq.h>
15#include <linux/spinlock.h>
16#include <linux/mutex.h>
17#include <uapi/linux/loop.h>
18
19/* Possible states of device */
20enum {
21 Lo_unbound,
22 Lo_bound,
23 Lo_rundown,
24 Lo_deleting,
25};
26
27struct loop_func_table;
28
29struct loop_device {
30 int lo_number;
31 atomic_t lo_refcnt;
32 loff_t lo_offset;
33 loff_t lo_sizelimit;
34 int lo_flags;
35 char lo_file_name[LO_NAME_SIZE];
36
37 struct file * lo_backing_file;
38 struct block_device *lo_device;
39
40 gfp_t old_gfp_mask;
41
42 spinlock_t lo_lock;
43 int lo_state;
44 spinlock_t lo_work_lock;
45 struct workqueue_struct *workqueue;
46 struct work_struct rootcg_work;
47 struct list_head rootcg_cmd_list;
48 struct list_head idle_worker_list;
49 struct rb_root worker_tree;
50 struct timer_list timer;
51 bool use_dio;
52 bool sysfs_inited;
53
54 struct request_queue *lo_queue;
55 struct blk_mq_tag_set tag_set;
56 struct gendisk *lo_disk;
57 struct mutex lo_mutex;
58 bool idr_visible;
59};
60
61struct loop_cmd {
62 struct list_head list_entry;
63 bool use_aio; /* use AIO interface to handle I/O */
64 atomic_t ref; /* only for aio */
65 long ret;
66 struct kiocb iocb;
67 struct bio_vec *bvec;
68 struct cgroup_subsys_state *blkcg_css;
69 struct cgroup_subsys_state *memcg_css;
70};
71
72#endif