Debugging tips.
[libguestfs.git] / guestfs-actions.pod
1 =head2 guestfs_cat
2
3  char *guestfs_cat (guestfs_h *handle,
4                 const char *path);
5
6 Return the contents of the file named C<path>.
7
8 This function returns a string or NULL on error.  The caller
9 must free the returned string after use.
10
11 Because of the message protocol, there is a transfer limit 
12 of somewhere between 2MB and 4MB.  To transfer large files you should use
13 FTP.
14
15 =head2 guestfs_ll
16
17  char *guestfs_ll (guestfs_h *handle,
18                 const char *directory);
19
20 List the files in C<directory> (relative to the root directory,
21 there is no cwd) in the format of 'ls -la'.
22
23 This command is mostly useful for interactive sessions.  It
24 is I<not> intended that you try to parse the output string.
25
26 This function returns a string or NULL on error.  The caller
27 must free the returned string after use.
28
29 =head2 guestfs_ls
30
31  char **guestfs_ls (guestfs_h *handle,
32                 const char *directory);
33
34 List the files in C<directory> (relative to the root directory,
35 there is no cwd).  The '.' and '..' entries are not returned, but
36 hidden files are shown.
37
38 This command is mostly useful for interactive sessions.
39
40 This function returns a NULL-terminated array of strings
41 (like L<environ(3)>), or NULL if there was an error.
42
43 The caller must free the strings I<and> the array after use.
44
45 =head2 guestfs_mount
46
47  int guestfs_mount (guestfs_h *handle,
48                 const char *device,
49                 const char *mountpoint);
50
51 Mount a guest disk at a position in the filesystem.  Block devices
52 are named C</dev/sda>, C</dev/sdb> and so on, as they were added to
53 the guest.  If those block devices contain partitions, they will have
54 the usual names (eg. C</dev/sda1>).  Also LVM C</dev/VG/LV>-style
55 names can be used.
56
57 The rules are the same as for L<mount(2)>:  A filesystem must
58 first be mounted on C</> before others can be mounted.  Other
59 filesystems can only be mounted on directories which already
60 exist.
61
62 The mounted filesystem is writable, if we have sufficient permissions
63 on the underlying device.
64
65 The filesystem options C<sync> and C<noatime> are set with this
66 call, in order to improve reliability.
67
68 This function returns 0 on success or -1 on error.
69
70 =head2 guestfs_sync
71
72  int guestfs_sync (guestfs_h *handle);
73
74 This syncs the disk, so that any writes are flushed through to the
75 underlying disk image.
76
77 You should always call this if you have modified a disk image, before
78 calling C<guestfs_close>.
79
80 This function returns 0 on success or -1 on error.
81
82 =head2 guestfs_touch
83
84  int guestfs_touch (guestfs_h *handle,
85                 const char *path);
86
87 Touch acts like the L<touch(1)> command.  It can be used to
88 update the timestamps on a file, or, if the file does not exist,
89 to create a new zero-length file.
90
91 This function returns 0 on success or -1 on error.
92