summaryrefslogtreecommitdiffstats
path: root/drivers/block/loop/loop_file_fmt_qcow.c
blob: 18fb0565f44a42e72638d2a80a00223f10da3c39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * loop_file_fmt_qcow.c
 *
 * QCOW file format driver for the loop device module.
 *
 * Copyright (C) 2019 Manuel Bentele
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

#include "loop_file_fmt.h"

static int qcow_file_fmt_init(struct loop_file_fmt *lo_fmt)
{
	printk(KERN_INFO "loop_file_fmt_qcow: init QCOW file format");
	return 0;
}

static void qcow_file_fmt_exit(struct loop_file_fmt *lo_fmt)
{
	printk(KERN_INFO "loop_file_fmt_qcow: exit QCOW file format");
	return;
}

static int qcow_file_fmt_read(struct loop_file_fmt *lo_fmt,
			      struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: read QCOW file format");
	return 0;
}

static int qcow_file_fmt_read_aio(struct loop_file_fmt *lo_fmt,
				  struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: read (aio) QCOW file format");
	return 0;
}

static int qcow_file_fmt_write(struct loop_file_fmt *lo_fmt,
			       struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: write QCOW file format");
	return 0;
}

static int qcow_file_fmt_write_aio(struct loop_file_fmt *lo_fmt,
				   struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: write (aio) QCOW file format");
	return 0;
}

static int qcow_file_fmt_discard(struct loop_file_fmt *lo_fmt,
				 struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: discard QCOW file format");
	return 0;
}

static int qcow_file_fmt_flush(struct loop_file_fmt *lo_fmt,
			       struct request *rq)
{
	printk(KERN_INFO "loop_file_fmt_qcow: flush QCOW file format");
	return 0;
}

static struct loop_file_fmt_ops qcow_file_fmt_ops = {
	.init = qcow_file_fmt_init,
	.exit = qcow_file_fmt_exit,
	.read = qcow_file_fmt_read,
	.write = qcow_file_fmt_write,
	.read_aio = qcow_file_fmt_read_aio,
	.write_aio = qcow_file_fmt_write_aio,
	.discard = qcow_file_fmt_discard,
	.flush = qcow_file_fmt_flush
};

static struct loop_file_fmt_driver qcow_file_fmt_driver = {
	.name = "QCOW",
	.file_fmt_type = LO_FILE_FMT_QCOW,
	.ops = &qcow_file_fmt_ops,
	.owner = THIS_MODULE
};

static int __init loop_file_fmt_qcow_init(void)
{
	printk(KERN_INFO "loop_file_fmt_qcow: init loop device QCOW file format driver");
	return loop_file_fmt_register_driver(&qcow_file_fmt_driver);
}

static void __exit loop_file_fmt_qcow_exit(void)
{
	printk(KERN_INFO "loop_file_fmt_qcow: exit loop device QCOW file format driver");
	loop_file_fmt_unregister_driver(&qcow_file_fmt_driver);
}

module_init(loop_file_fmt_qcow_init);
module_exit(loop_file_fmt_qcow_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Manuel Bentele <development@manuel-bentele.de>");
MODULE_DESCRIPTION("Loop device QCOW file format driver");
MODULE_SOFTDEP("pre: loop");