import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / md / lvm-internal.h
1
2 /*
3  * kernel/lvm_internal.h
4  *
5  * Copyright (C) 2001 Sistina Software
6  *
7  *
8  * LVM driver is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * LVM driver is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with GNU CC; see the file COPYING.  If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24
25 /*
26  * Changelog
27  *
28  *    05/01/2001 - Factored this file out of lvm.c (Joe Thornber)
29  *    11/01/2001 - Renamed lvm_internal and added declarations
30  *                 for lvm_fs.c stuff
31  *
32  */
33
34 #ifndef LVM_INTERNAL_H
35 #define LVM_INTERNAL_H
36
37 #include <linux/lvm.h>
38
39 #define _LVM_INTERNAL_H_VERSION "LVM "LVM_RELEASE_NAME" ("LVM_RELEASE_DATE")"
40
41 /* global variables, defined in lvm.c */
42 extern char *lvm_version;
43 extern ushort lvm_iop_version;
44 extern int loadtime;
45 extern const char *const lvm_name;
46
47
48 extern uint vg_count;
49 extern vg_t *vg[];
50 extern struct file_operations lvm_chr_fops;
51
52 #ifndef uchar
53 typedef unsigned char   uchar;
54 #endif
55
56 extern struct block_device_operations lvm_blk_dops;
57
58 #define lvm_sectsize(dev) get_hardsect_size(dev)
59
60 /* 2.4.8 had no global min/max macros, and 2.4.9's were flawed */
61
62 /* debug macros */
63 #ifdef DEBUG_IOCTL
64 #define P_IOCTL(fmt, args...) printk(KERN_DEBUG "lvm ioctl: " fmt, ## args)
65 #else
66 #define P_IOCTL(fmt, args...)
67 #endif
68
69 #ifdef DEBUG_MAP
70 #define P_MAP(fmt, args...) printk(KERN_DEBUG "lvm map: " fmt, ## args)
71 #else
72 #define P_MAP(fmt, args...)
73 #endif
74
75 #ifdef DEBUG_KFREE
76 #define P_KFREE(fmt, args...) printk(KERN_DEBUG "lvm kfree: " fmt, ## args)
77 #else
78 #define P_KFREE(fmt, args...)
79 #endif
80
81 #ifdef DEBUG_DEVICE
82 #define P_DEV(fmt, args...) printk(KERN_DEBUG "lvm device: " fmt, ## args)
83 #else
84 #define P_DEV(fmt, args...)
85 #endif
86
87
88 /* lvm-snap.c */
89 int lvm_get_blksize(kdev_t);
90 int lvm_snapshot_alloc(lv_t *);
91 int lvm_snapshot_fill_COW_page(vg_t *, lv_t *);
92 int lvm_snapshot_COW(kdev_t, ulong, ulong, ulong, vg_t *vg, lv_t *);
93 int lvm_snapshot_remap_block(kdev_t *, ulong *, ulong, lv_t *);
94 void lvm_snapshot_release(lv_t *);
95 int lvm_write_COW_table_block(vg_t *, lv_t *);
96 void lvm_hash_link(lv_block_exception_t *, kdev_t, ulong, lv_t *);
97 int lvm_snapshot_alloc_hash_table(lv_t *);
98 void lvm_drop_snapshot(vg_t *vg, lv_t *, const char *);
99
100
101 /* lvm_fs.c */
102 void lvm_init_fs(void);
103 void lvm_fin_fs(void);
104
105 void lvm_fs_create_vg(vg_t *vg_ptr);
106 void lvm_fs_remove_vg(vg_t *vg_ptr);
107 devfs_handle_t lvm_fs_create_lv(vg_t *vg_ptr, lv_t *lv);
108 void lvm_fs_remove_lv(vg_t *vg_ptr, lv_t *lv);
109 void lvm_fs_create_pv(vg_t *vg_ptr, pv_t *pv);
110 void lvm_fs_remove_pv(vg_t *vg_ptr, pv_t *pv);
111
112 #endif