2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2013-05-12 10:14:07 -04:00
|
|
|
* loop.h
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
|
|
|
|
* Written by Theodore Ts'o, 3/29/93.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1993 by Theodore Ts'o. Redistribution of this file is
|
|
|
|
|
* permitted under the GNU General Public License.
|
|
|
|
|
*/
|
2012-10-13 10:46:48 +01:00
|
|
|
#ifndef _LINUX_LOOP_H
|
|
|
|
|
#define _LINUX_LOOP_H
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
#include <linux/bio.h>
|
|
|
|
|
#include <linux/blkdev.h>
|
2015-01-02 15:20:25 -07:00
|
|
|
#include <linux/blk-mq.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <linux/spinlock.h>
|
2006-03-23 03:00:38 -08:00
|
|
|
#include <linux/mutex.h>
|
2012-10-13 10:46:48 +01:00
|
|
|
#include <uapi/linux/loop.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
/* Possible states of device */
|
|
|
|
|
enum {
|
|
|
|
|
Lo_unbound,
|
|
|
|
|
Lo_bound,
|
|
|
|
|
Lo_rundown,
|
2021-06-05 17:09:50 +03:00
|
|
|
Lo_deleting,
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct loop_func_table;
|
|
|
|
|
|
|
|
|
|
struct loop_device {
|
|
|
|
|
int lo_number;
|
2015-05-06 12:26:23 +08:00
|
|
|
atomic_t lo_refcnt;
|
2005-04-16 15:20:36 -07:00
|
|
|
loff_t lo_offset;
|
|
|
|
|
loff_t lo_sizelimit;
|
|
|
|
|
int lo_flags;
|
|
|
|
|
char lo_file_name[LO_NAME_SIZE];
|
|
|
|
|
|
|
|
|
|
struct file * lo_backing_file;
|
|
|
|
|
struct block_device *lo_device;
|
|
|
|
|
|
2005-10-21 03:22:34 -04:00
|
|
|
gfp_t old_gfp_mask;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
spinlock_t lo_lock;
|
|
|
|
|
int lo_state;
|
2021-06-28 19:38:15 -07:00
|
|
|
spinlock_t lo_work_lock;
|
|
|
|
|
struct workqueue_struct *workqueue;
|
|
|
|
|
struct work_struct rootcg_work;
|
|
|
|
|
struct list_head rootcg_cmd_list;
|
|
|
|
|
struct list_head idle_worker_list;
|
|
|
|
|
struct rb_root worker_tree;
|
|
|
|
|
struct timer_list timer;
|
2015-08-17 10:31:49 +08:00
|
|
|
bool use_dio;
|
2018-05-04 10:58:09 -06:00
|
|
|
bool sysfs_inited;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-07-23 18:44:00 -07:00
|
|
|
struct request_queue *lo_queue;
|
2014-12-31 13:22:57 +00:00
|
|
|
struct blk_mq_tag_set tag_set;
|
2007-05-08 00:28:20 -07:00
|
|
|
struct gendisk *lo_disk;
|
2021-01-26 09:46:30 -05:00
|
|
|
struct mutex lo_mutex;
|
2021-09-02 09:07:35 +09:00
|
|
|
bool idr_visible;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
2014-12-31 13:22:57 +00:00
|
|
|
struct loop_cmd {
|
2021-06-28 19:38:15 -07:00
|
|
|
struct list_head list_entry;
|
2017-09-20 14:24:34 -07:00
|
|
|
bool use_aio; /* use AIO interface to handle I/O */
|
|
|
|
|
atomic_t ref; /* only for aio */
|
2017-04-20 16:03:02 +02:00
|
|
|
long ret;
|
2015-08-17 10:31:51 +08:00
|
|
|
struct kiocb iocb;
|
2017-08-31 22:09:46 -07:00
|
|
|
struct bio_vec *bvec;
|
2021-06-28 19:38:21 -07:00
|
|
|
struct cgroup_subsys_state *blkcg_css;
|
|
|
|
|
struct cgroup_subsys_state *memcg_css;
|
2014-12-31 13:22:57 +00:00
|
|
|
};
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif
|