Updated HACKING notes about debugging.
[libguestfs.git] / HACKING
1 Adding a new action
2 ----------------------------------------------------------------------
3
4 All action functions are generated automatically, so there are only
5 two files you need to edit:
6
7 (1) src/generator.ml: Add your new action, parameters, description,
8 etc. to the big list called 'functions' at the top of this file.
9
10 (2) Edit/create a C file in daemon/ subdirectory which implements your
11 'do_action' function.  Take a look at one of the numerous examples
12 there.
13
14 You will need to run src/generator.ml (from the top directory) which
15 regenerates all the auto-generated files, and then continue with the
16 ordinary build process.
17
18 PLEASE LOOK AT THE TOP OF EACH FILE BEFORE EDITING to see whether it
19 is automatically generated or not.
20
21 Formatting
22 ----------------------------------------------------------------------
23
24 Try to use GNU / Emacs default formatting, following the convention
25 used elsewhere in the source.
26
27 Please make sure that the code compiles without warnings.
28
29 Please test any changes.
30
31 Directories
32 ----------------------------------------------------------------------
33
34 daemon/
35         The daemon that runs inside the guest and carries out actions.
36
37 examples/
38         The examples.
39
40 fish/
41         Guestfish (the command-line program / shell)
42
43 images/
44         Some guest images to test against.  These are gzipped to save
45         space.  You have to unzip them before use.
46
47 m4/
48         M4 macros used by autoconf.
49
50 ocaml/
51         OCaml bindings.
52
53 perl/
54         Perl bindings.
55
56 python/
57         Python bindings.
58
59 src/
60         Source code to the C library.
61         Also contains the crucial generator program.
62
63 Debugging
64 ----------------------------------------------------------------------
65
66 It's a good idea to use guestfish to try out new commands.
67
68 Debugging the daemon is a problem because it runs inside a minimal
69 qemu environment.  However you can print messages from the daemon, and
70 they will show up if you use 'guestfish -v'.
71
72 Patches
73 ----------------------------------------------------------------------
74
75 Submit patches to the fedora-virt mailing list:
76 http://www.redhat.com/mailman/listinfo/fedora-virt
77 and CC to rjones@redhat.com