Commit Graph

410 Commits

Author SHA1 Message Date
Richard W.M. Jones
704e46af9c java: Fix bindtests when passing 64 bit integer literals. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
9526f632d8 ocaml: Fix bindtests when passing negative optional arguments. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
f6de298d04 erlang: Add tests.
Add bindtests and general tests for Erlang.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
bd35b3c055 erlang: Fix 64 bit integers in parameters. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
e3f356bda1 erlang: Fix BufferIn parameters.
These would break if the buffer contained a \0 character.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
fad0f53dc8 New internal APIs: internal-test-set-output, internal-test-close-output.
These internal (testing) APIs allow the bindtests output to
be sent to some other place than stdout.

This is necessary for Erlang, since stdout is used to communicate with
the Erlang interpreter.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
449bd4b50f generator: Allow permission of output files to be specified. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
42e8c093b7 python: Fix optargs so we don't use special sentinel values.
Previously with Python it was impossible to set a boolean or integer
optarg to -1 because that was used as a special sentinel value to
indicate that the optarg was not set.

Instead, use None as the sentinel value, since that cannot be a
boolean or integer type.
2012-08-15 12:16:54 +01:00
Richard W.M. Jones
e990e80c26 python: Before freeing OStringList, cast it to char ** to avoid a compiler warning.
This fixes commit c1a269513c.
2012-08-15 12:14:06 +01:00
Richard W.M. Jones
94f133f25b Remove unnecessary comment from <guestfs.h>.
Read guestfs(3) for documentation, and don't discourage people from
doing that by putting these comments into the header file.
2012-08-14 18:21:05 +01:00
Richard W.M. Jones
5ea795aa48 docs: Fix '= head' -> '=head' in back compat entries in guestfs(3). 2012-08-14 18:17:40 +01:00
Richard W.M. Jones
ce35eb90a2 tar-out: Add list of excluded patterns (--exclude=...) (RHBZ#847881). 2012-08-14 16:40:14 +01:00
Richard W.M. Jones
c1a269513c generator: Add new OStringList optional arg type.
This allows lists of strings to be passed as an optional argument.
2012-08-14 16:40:11 +01:00
Richard W.M. Jones
690bdaa392 bindtests: Space before parens in call. 2012-08-14 11:14:10 +01:00
Richard W.M. Jones
4dbae7cc06 tar-out: Add optional numericowner flag (RHBZ#847880).
This is equivalent to the tar option --numeric-owner.
2012-08-14 10:00:27 +01:00
Richard W.M. Jones
864ef706a8 Add optional compress flag to tar-in, tar-out APIs.
The compress flag can be used to control compression, one of: (none),
"compress", "gzip", "bzip2", "xz", "lzop".  Thus these calls can now
be used instead of tgz-in/tgz-out/txz-in/txz-out, and also support
more compression types.

Mark these APIs as once_had_no_optargs so that compatibility code is
generated.
2012-08-14 09:53:37 +01:00
Richard W.M. Jones
769a6f24c6 ocaml: Use Store_field macro instead of caml_modify.
Use the safer, higher level Store_field macro when constructing arrays
of structs to return.

I don't know if it is strictly necessary in this case, but it's safer.
2012-08-12 17:03:24 +01:00
Richard W.M. Jones
198cc630f0 New APIs: rsync, rsync-in, rsync-out
Implement rsync.
2012-08-11 09:28:58 +01:00
Richard W.M. Jones
7d6f76709e generator: 'delete' is a reserved word (in C++). 2012-08-11 09:28:58 +01:00
Richard W.M. Jones
083125f709 ruby: Mark all VALUEs as volatile. 2012-08-03 19:24:44 +01:00
Richard W.M. Jones
b3d0cc0588 grep: Add optargs to grep API and deprecate fgrep etc.
This commit makes grep into an optargs API, with flags for extended,
fixed, [case-]insensitive and compressed.

At the same time it deprecates: egrep, fgrep, grepi, egrepi, fgrepi,
zgrep, zegrep, zfgrep, zgrepi, zegrepi and zfgrepi.
2012-08-02 14:05:54 +01:00
Wanlong Gao
d40b502876 xfs: add new api xfs-growfs
New api xfs_growfs for expanding a XFS filesystem.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-02 10:20:57 +01:00
Richard W.M. Jones
b075b4d1fe New API: utsname
Typical output:

><fs> utsname
uts_sysname: Linux
uts_release: 3.5.0-1.fc18.x86_64
uts_version: #1 SMP Mon Jul 23 17:43:39 UTC 2012
uts_machine: x86_64
2012-07-30 15:16:45 +01:00
Richard W.M. Jones
0f837ec068 ruby: Allow optional arguments hash to be really optional.
Allow optargs functions to be called as either:

  g.mkfs_opts(fs, device)

or:

  g.mkfs_opts(fs, device, { optargs hash })

This also preserves backwards compatibility with once_has_no_optargs
functions such as mkfs.
2012-07-26 11:57:02 +01:00
Richard W.M. Jones
5f30912d74 ruby: In event wrapper, ignore callback functions which have type T_ZOMBIE.
Note that in old versions of Ruby, T_ZOMBIE was not defined.
2012-07-26 11:56:49 +01:00
Richard W.M. Jones
e64bf3fb29 New APIs: pvchange-uuid, pvchange-uuid-all, vgchange-uuid, vgchange-uuid-all.
These APIs will allow sysprep to change the UUIDs of all PVs and VGs
in the system.

LVs don't have UUIDs AFAICT, or at least there seems to be no way to
change them if they do have them.
2012-07-25 14:47:15 +01:00
Masami HIRATA
d74e7fad28 Mac OS X: Use u_int64_t/uint64_t instead of unsigned hyper in .x file
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>

RWMJ:
  Fixed whitespace in generator_xdr.ml
2012-07-24 19:40:40 +01:00
Wanlong Gao
d8b2c1afee umount: use Dev_or_Path for the argument type
Use Dev_or_Path instead of String.

Remove the RESOLVE_DEVICE since Dev_or_Path will generate
REQUIRE_ROOT_OR_RESOLVE_DEVICE instead.

RWMJ:
Note a change in semantics: this now requires root.  However this is
OK and still works with mkmountpoint and friends because
'is_root_mounted' works even if something is mounted below the root.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 13:01:08 +01:00
Richard W.M. Jones
40e5317cfb xfs-info: Fix description to refer to 'pathordevice' param. 2012-07-24 10:16:31 +01:00
Wanlong Gao
f4094b91d2 xfs_info: resolve device when doing xfs_info on a device
Resolve device first, like do_umount.
Use Dev_or_Path.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 10:10:30 +01:00
Wanlong Gao
bda974e64c umount: add force umount and lazy umount
Add the option force and lazy for force and lazy umount.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 09:06:27 +01:00
Richard W.M. Jones
a6366f5dae python: Set file encoding to utf-8. 2012-07-23 20:17:24 +01:00
Richard W.M. Jones
b6afb98a79 tests: Fix get-attach-method test.
If ./configure --with-default-attach-method is set to something other
than 'appliance', then this will legitimately return a different
string.  Simply test that it runs, rather than testing the output.

This fixes commit 20a5b4de7d.
2012-07-23 18:44:07 +01:00
Richard W.M. Jones
c65ee25a75 tests: Remove get-pid test.
If the libvirt attach-method is used, then there is no known PID
(libvirt hides it).
2012-07-23 18:44:02 +01:00
Richard W.M. Jones
20a5b4de7d launch: Allow default attach-method to be set in environment or configure.
You can now choose the default attach method in two ways:

(1) Set the LIBGUESTFS_ATTACH_METHOD environment variable.

(2)  ./configure --with-default-attach-method=appliance|libvirt|...

Note that (1) overrides (2).
2012-07-23 15:24:57 +01:00
Richard W.M. Jones
42ba262003 Add attach-method "libvirt" or "libvirt:<URI>".
With this commit, you can set the attach method to libvirt,
but calling launch will give an error.
2012-07-21 15:47:50 +01:00
Richard W.M. Jones
52fa23d74f launch: Move guestfs_config API and build list of qemu parameters in handle.
Move and rewrite guestfs_config so it accumulates a list of qemu
parameters in the handle.  These are added to the appliance at launch
time (with attach method == unix:...  you'll now get an error).
2012-07-20 13:43:55 +01:00
Richard W.M. Jones
a6e0e0d6bf add-cdrom: Rewrite description emphasising that this API should not be used. 2012-07-20 13:43:13 +01:00
Richard W.M. Jones
80d102c49d Remove debug-cmdline API.
Note that debug* calls are not part of the stable API and can be
removed or changed at any time.
2012-07-19 17:12:44 +01:00
Richard W.M. Jones
2e4089f300 build: Rename most C files that contain underscore with dash.
This is just code motion.

Some files cannot be renamed.  Notably rpcgen input and output files
must not contain dash characters, else rpcgen breaks.
2012-07-19 16:11:47 +01:00
Wanlong Gao
87206e4e9e New API: add new api xfs_info
Add xfs_info to show the geometry of the xfs filesystem.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:
 - Updated po/POTFILES.
 - Use xfs_ prefix for all struct fields.
 - Return uninitialized fields as -1 / empty string.
 - Copyedit the description.
2012-07-18 09:37:17 +01:00
Richard W.M. Jones
973581780d case_sensitive_path: Allow trailing path element to be missing (RHBZ#840115).
case_sensitive_path is undefined when the final path element doesn't
exist.  Currently it returns an error, but this means that creating a
new file doesn't work as expected:

  $ guestfish --rw -i -d windows touch 'win:c:\blah'
  libguestfs: error: case_sensitive_path: blah no file or directory found with this name

We should allow this case (provided there is no trailing slash) so
that new files or directories can be created.
2012-07-17 14:37:03 +01:00
Richard W.M. Jones
f6846d74c9 perl: In examples, call $g->shutdown, $g->close. 2012-07-17 12:34:51 +01:00
Richard W.M. Jones
a99ea198b2 perl: Use $g instead of $h in documentation.
$g is the "standard" name for libguestfs handles.
2012-07-17 12:33:45 +01:00
Richard W.M. Jones
95d26f0240 generator: Rename 'ntfsresize_opts' API to 'ntfsresize'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers.
2012-07-14 13:08:21 +01:00
Richard W.M. Jones
e055bf4cab generator: Rename 'mkfs_opts' API to 'mkfs'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers.
2012-07-14 12:43:13 +01:00
Richard W.M. Jones
7486fc6f43 generator: Rename 'add_drive_opts' API to 'add_drive'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers (except Haskell, PHP and GObject as discussed
in earlier commit).
2012-07-14 12:42:24 +01:00
Richard W.M. Jones
b48ae2eadf generator: In non-C bindings, generate '*_opts' alias.
In C, a function called 'func' which has once_had_no_optargs=true will
(because of the previous commit) generate 'func_opts' and a
backwards-compatibility function called 'func'.

This commit changes some of the non-C bindings so that they also
generate 'func_opts' which is merely a wrapper that calls 'func'.

This avoids incompatibility when we rename 'mkfs_opts' etc back to
plain 'mkfs', and it also makes it easier to translate between other
language bindings and C code.

NB: Some bindings do not include aliases:

  PHP:     There's no way to easily alias methods in PHP < 5.3, and we
           can't assume everyone has this minimum version.

  GObject: Very complex to add aliases, but we should probably do this
           at some point.

  Haskell: No support for optargs in these bindings.  Unfortunately
           this means that we can no longer bind 'Guestfs.add_drive'
           (since it will be changed to add optional arguments) making
           the Haskell bindings even less useful than they were already.
2012-07-14 11:13:49 +01:00
Richard W.M. Jones
98757e151a generator: Allow non-optargs functions to gain optargs.
This commit adds a flag (once_had_no_optargs) which can be used to add
optargs to functions that currently don't have any.

The idea is that if 'func' currently has no optargs, we can safely add
optargs provided we are backwards compatible for existing callers.

In C that means we leave 'guestfs_func' alone and provide an extra
function 'guestfs_func_opts' that takes the optargs ('guestfs_func'
becomes a wrapper that calls 'guestfs_func_opts').

In the C generator this means there are two names for each function
(although the two names are normally identical).  'c_name' is the name
that we export publicly (eg. [guestfs_] 'func_opts').  'name' is the
internal name of the function (eg. 'func') which is used for
everything apart from the public interface, and also to generate the
no-optargs compat function.

In other languages that can add optional arguments safely, we simply
add the arguments to the existing 'func', so for example in Perl:

  $g->func (required_args)
  $g->func (required_args, optional_args)

can be used.

Note that this commit does not cause any change to the output of the
generator.  I verified this by diffing the output before and after.
2012-07-14 10:20:58 +01:00
Richard W.M. Jones
9eb6060456 generator: Rearrange some C generator code into sub-functions.
This is just code motion.  I verified this by comparing the
generator output before and after this commit.
2012-07-13 14:02:43 +01:00