Commit Graph

31 Commits

Author SHA1 Message Date
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Pino Toscano
7c10cda266 generator: add a FilenameList parameter type
Mostly like StringList (so it can used in current StringList
parameters), but checking client- and daemon-side that the elements are
file names.
2015-10-21 13:00:18 +02:00
Pino Toscano
c31c077aa5 java: doc: add the version (if available) of APIs 2015-05-28 16:47:21 +02:00
Richard W.M. Jones
bfbcc01403 Change guestfs___* to guestfs_int_*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.

The first step is to replace all guestfs___* (3 underscores) with
guestfs_int_*.  We've used guestfs_int_* elsewhere already as a prefix
for internal identifiers.

This is an entirely mechanical change done using:
  git ls-files | xargs perl -pi.bak -e 's/guestfs___/guestfs_int_/g'

Reference: http://stackoverflow.com/a/228797
2015-02-14 18:46:04 +00:00
Pino Toscano
e157226064 java: further <p> fixes
javadoc's HTML parser seems more limited, so just close <p> blocks
before opening <pre> or <ol>.

Followup of commit f4186a7a49.
2015-02-11 15:46:19 +01:00
Pino Toscano
85b6b5e589 java: add @Deprecated annotation for deprecated methods 2015-02-11 15:02:56 +01:00
Pino Toscano
f4186a7a49 java: fix/improve slightly the javadoc
- use <p>..</p> for text paragraphs, instead of just using <p> to
  separate them
- slightly improve the metadata in eventToString and set_event_callback
- fix the textual @see in set_event_callback, so it is accepted also in
  JDK 8
- escape the doc text, so &, <, and > will not be considered as HTML
  tags but actual text
- use the @deprecated tag instead of adding the customary deprecation
  note to the doc text
2015-02-11 15:02:56 +01:00
Richard W.M. Jones
c5800dc97d Update copyright dates for 2015. 2015-01-17 09:08:15 +00:00
Richard W.M. Jones
fd9ac7f47d generator: Implement Pointer arguments.
This implements Pointer arguments properly, at least for certain
limited definitions of "implements" and "properly".

'Pointer' as an argument type is meant to indicate a pointer passed to
an API.  The canonical example is the following proposed API:

  int guestfs_add_libvirt_dom (guestfs_h *g, virDomainPtr dom, ...);

where 'dom' is described in the generator as:

  Pointer ("virDomainPtr", "dom")

Pointer existed already in the generator, but the implementation was
broken.  It is not used by any existing API.

There are two basic difficulties of implementing Pointer:

(1) In language bindings there is no portable way to turn (eg.) a Perl
Sys::Virt 'dom' object into a C virDomainPtr.

(2) We can't rely on <libvirt/libvirt.h> being included (since it's an
optional dependency).

In this commit, we solve (2) by using a 'void *'.

We don't solve (1), really.  Instead we have a macro
POINTER_NOT_IMPLEMENTED which is used by currently all the non-C
language bindings.  It complains loudly and passes a NULL to the
underlying function.  The underlying function detects the NULL and
safely returns an error.  It is to be hoped that people will
contribute patches to make each language binding work, although in
some bindings it will always remain impossible to implement.
2014-12-11 14:15:00 +00:00
Richard W.M. Jones
dff35285e4 java: Use correct Set*Field JNI accessors to set fields of the appropriate type.
Using the wrong accessors (somehow - I have no idea how) caused other
fields in the struct to contain incorrect values.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
7a0e71f733 java: Factor out common field code in RStructList.
No functional change.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
8c219636a2 java: Split long lines in generated output, and add other whitespace.
No functional change.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
d00840d727 java: Fix bogus construction of all RStructList returned values (RHBZ#1073906).
Thanks Maarten on IRC for spotting the problem.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
6cc521dc45 generator: Sort most output.
Look for use of external_functions and fish_functions and replace with
use of external_functions_sorted and fish_functions_sorted where
possible.  This ensures that the output of the generator is sorted as
far as possible.

I also checked for uses of internal_functions and documented_functions
but those are not used.  The *_sorted versions are always used
instead.
2014-02-15 20:27:12 +00:00
Pino Toscano
b10dd601fb generator: add a GUID parameter type
At the moment it is basically the change as String, and it is mapped as
if it was such.
2014-02-06 17:43:04 +01:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
7e71c9fb34 java: Use guestfs_event_to_string instead of generated code. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
5c6895bda1 java: Print a better error message when JVM version is too old.
This fixes commit 87d1f7714f.
2013-02-15 14:25:25 +00:00
Matthew Booth
ef2276654e generator: Create Mountable_or_Path, initially identical to Dev_or_Path 2013-02-11 15:43:53 +00:00
Matthew Booth
8fb2306be4 generator: Add new Mountable argument type
This type is initially identical to Device.
2013-02-08 14:59:00 +00:00
Matthew Booth
ca056d53bd generator: Add visibility to action struct
The visibility field in action replaces in_fish, in_docs and internal.
The defined types are:

VPublic:
  A public API. This is exported and documented in all language
  bindings, and in guestfish.

VStateTest:
  A public API which queries the library state machine. It is exported
  and documented in all language bindings, but not guestfish.

VBindTest:
  An internal API used only for testing language bindings. It is
  guarded by GUESTFS_PRIVATE in the C api, but exported by all other
  language bindings as it is required for testing. If language
  bindings offer any way to guard use of these apis, that mechanism
  should be used. It is not documented anywhere.

VDebug:
  A debugging API. It is exported by all language bindings, and in
  guestfish, but is not documented anywhere.

VInternal:
  An internal-only API. It is guarded by GUESTFS_PRIVATE in the C api,
  and not exported at all in any other language binding. It is not
  documented anywhere.
2013-02-06 13:53:28 +00:00
Richard W.M. Jones
ec3b75e5ff Rearrange internal header files.
This commit rearranges the internal header files.

"src/guestfs-internal.h" is just for the library, as before.

"src/guestfs-internal-frontend.h" is for use by all library, bindings,
tools C code, but NOT the daemon.

"src/guestfs-internal-all.h" is for use by all C code including the
daemon.

This is just code motion, but it has some important consequences:

(1) We can use the CLEANUP_* macros in bindings and tools code.

(2) We can get rid of TMP_TEMPLATE_ON_STACK.

(3) We will (in future) be able to stop bindings and tools code from
using the safe_* allocation functions (which are NOT safe to use
outside the library alone).
2013-02-01 14:07:25 +00:00
Richard W.M. Jones
27c81f3175 generator: Define all_events_bitmask.
In the C bindings, use this more accurate mask instead of 'all bits
set'.

In the Java bindings, use this instead of open coding.
2013-01-28 18:01:19 +00:00
Richard W.M. Jones
0d2d26d8e7 java: Implement the event API. 2013-01-15 18:40:17 +00:00
Richard W.M. Jones
3f08d50863 java: Use defined constants for flags in call to guestfs_create_flags. 2013-01-15 18:40:17 +00:00
Richard W.M. Jones
7d89baa3e9 java: Tidy up javadoc. 2013-01-15 18:40:16 +00:00
Richard W.M. Jones
62e775c350 Change the handling of private functions, safe_malloc etc.
Rename guestfs_safe_malloc et al to guestfs___safe_malloc etc.

To use the private functions, code now has to define
-DGUESTFS_PRIVATE_FUNCTIONS=1.  This will make it easier for us in
future to work out which programs are using these functions and to
minimize both the number of programs and the functions they are
calling.

Note that the Perl, Python, OCaml, Ruby and Java bindings use
guestfs_safe_* calls.  None of the other bindings do.  This is a bug
(in the bindings using those functions): these functions will call the
out of memory callback on failure.  This function defaults to abort(),
and since this happens from a language binding, there is no way to
change this default.
2012-12-15 19:41:29 +00:00
Richard W.M. Jones
eb185eef29 generator: Use an OCaml struct to store the structs.
This just makes it simpler to add extra fields to each struct.

This is code motion.
2012-10-30 12:32:30 +00:00
Richard W.M. Jones
9466060201 New APIs: guestfs_create_flags, guestfs_parse_environment,
guestfs_parse_environment_list.

Add a new function for creating a handle:

 guestfs_h *guestfs_create_flags (unsigned flags [, ...]);

This variant lets you supply flags and extra arguments, although extra
arguments are not used at the moment.

Of particular interest is the ability to separate the creation of the
handle from the parsing of environment variables like
LIBGUESTFS_DEBUG.  guestfs_create does both together, which prevents
us from propagating errors from parsing environment variables back to
the caller (guestfs_create has always printed any errors on stderr and
then just ignored them).

If you are interested in these errors, you can now write:

 g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT);
 if (!g)
   exit (EXIT_FAILURE);
 r = guestfs_parse_environment (g);
 if (!r)
   exit (EXIT_FAILURE);

Also you can *omit* the call to guestfs_parse_environment, which
creates a handle unaffected by the environment (which was not possible
before).

This commit also includes new (backwards compatible) changes to the
OCaml, Perl, Python, Ruby and Java constructors that let you use the
flags.
2012-10-15 15:04:43 +01:00
Richard W.M. Jones
f65dee769d java: Fix >= 32 optargs (thanks Wanlong Gao). 2012-09-03 09:36:04 +01:00
Richard W.M. Jones
d331fd70e2 generator: Rename 'generator_*' as '*'.
This is a simple renaming of the files/modules.

Note that in OCaml, module names are derived from filenames by
capitalizing the first letter.  Thus the old module names had the form
"Generator_api_versions".  The new modules names have the form
"Api_versions".
2012-09-02 19:47:33 +01:00