5be250476b87ab50abe75346e436ffc239308d68
[libguestfs.git] / HACKING
1 PLEASE LOOK AT THE TOP OF EACH FILE BEFORE EDITING TO SEE WHETHER IT
2 IS AUTOMATICALLY GENERATED OR NOT.
3
4 Adding a new action
5 ----------------------------------------------------------------------
6
7 All action functions are generated automatically, so there are only
8 two files you need to edit:
9
10 (1) src/generator.ml: Add your new action, parameters, description,
11 etc. to the big list called 'functions' at the top of this file.
12
13 (2) Edit/create a C file in daemon/ subdirectory which implements your
14 'do_action' function.  Take a look at one of the numerous examples
15 there.
16
17 Formatting
18 ----------------------------------------------------------------------
19
20 Try to use GNU / Emacs default formatting, following the convention
21 used elsewhere in the source.
22
23 Please make sure that the code compiles without warnings.
24
25 Please test any changes.
26
27 Directories
28 ----------------------------------------------------------------------
29
30 appliance/
31         The qemu appliance, build scripts and so on.
32
33 capitests/
34         Automated tests of the C API.
35
36 contrib/
37         Outside contributions, experimental parts.
38
39 daemon/
40         The daemon that runs inside the guest and carries out actions.
41
42 examples/
43         The examples.
44
45 fish/
46         Guestfish (the command-line program / shell)
47
48 haskell/
49         Haskell bindings.
50
51 images/
52         Some guest images to test against.  These are gzipped to save
53         space.  You have to unzip them before use.
54
55         Also contains some files used by the test suite.
56
57 inspector/
58         Virtual machine image inspector (virt-inspector).
59
60 java/
61         Java bindings.
62
63 m4/
64         M4 macros used by autoconf.
65
66 ocaml/
67         OCaml bindings.
68
69 po/
70         Translations.
71
72 perl/
73         Perl bindings.
74
75 python/
76         Python bindings.
77
78 regressions/
79         Regression tests.
80
81 ruby/
82         Ruby bindings.
83
84 src/
85         Source code to the C library.
86         Also contains the crucial generator program.
87
88 Debugging
89 ----------------------------------------------------------------------
90
91 It's a good idea to use guestfish to try out new commands.
92
93 Debugging the daemon is a problem because it runs inside a minimal
94 qemu environment.  However you can print messages from the daemon, and
95 they will show up if you use 'guestfish -v'.
96
97 Patches
98 ----------------------------------------------------------------------
99
100 Submit patches to the mailing list:
101 http://www.redhat.com/mailman/listinfo/libguestfs
102 and CC to rjones@redhat.com
103
104 I18N
105 ----------------------------------------------------------------------
106
107 We support i18n (gettext anyhow) in the library.
108
109 However many messages come from the daemon, and we don't translate
110 those at the moment.  One reason is that the appliance generally has
111 all locale files removed from it, because they take up a lot of space.
112 So we'd have to readd some of those, as well as copying our PO files
113 into the appliance.
114
115 Debugging messages are never translated, since they are intended for
116 the programmers.