Reorganize the code so disk parsing is in a separate library.
[virt-df.git] / lib / README
1 For user documentation:
2
3 Please see the manual page (virt-df.pod or virt-df.txt in this
4 directory).
5
6 Developer documentation
7 ----------------------------------------------------------------------
8
9 This subdirectory contains a library of useful functions for parsing
10 disk images.
11
12 It is all based on and uses the pa_bitmatch syntax extension &
13 library.  You need pa_bitmatch >= 0.5.
14
15 This program has suddenly become rather large and confusing.
16 Hopefully this documentation should go some way towards explaining
17 what is going on inside the source.
18
19 The main program consists of two modules:
20
21  - diskimage.ml / diskimage.mli (module name: Diskimage)
22
23    This has evolved into a library of miscellaneous functions
24    and values which are included throughout the rest of the
25    program.  If you see an unexplained function then it's
26    likely that it is defined in here.
27
28    Start by reading diskimage.mli which contains the full types
29    and plenty of documentation.
30
31  - diskimage_main.ml
32
33    This is the program.  It reads the command line arguments,
34    loads the domain descriptions, calls out to the plug-ins
35    to probe for disks / partitions / filesystems / etc., and
36    finally prints the results.
37
38    The file consists of basically one large program that
39    does all of the above in sequence.
40
41 Everything else in this directory is a plug-in specialized for probing
42 a particular filesystem, partition scheme or type of LVM.  The
43 plug-ins at time of writing are:
44
45  - diskimage_ext2.ml / diskimage_ext2.mli
46
47    EXT2/3/4 plug-in.
48
49  - diskimage_linux_swap.ml / diskimage_linux_swap.mli
50
51    Linux swap (new style) plug-in.
52
53  - diskimage_mbr.ml / diskimage_mbr.mli
54
55    Master Boot Record (MS-DOS) disk partitioning plug-in.
56
57  - diskimage_lvm2*
58
59    LVM2 parsing, which is by far the most complex plug-in.
60    It consists of:
61
62    - diskimage_lvm2.ml
63    - diskimage_lvm2.mli
64      LVM2 probing, PV detection.
65
66    - diskimage_lvm2_parser.mly
67    - diskimage_lvm2_lexer.mll
68      Scanner/parser for parsing LVM2 metadata definitions.
69
70    - diskimage_lvm2_metadata.ml
71    - diskimage_lvm2_metadata.mli
72      AST for LVM2 metadata definitions.