summaryrefslogtreecommitdiffstats
path: root/generator/c.ml
Commit message (Collapse)AuthorAgeFilesLines
* lib: Add new C API calls: guestfs_push_error_handler,Richard W.M. Jones2012-11-091-0/+6
| | | | | | | | | | | | | | | | | guestfs_pop_error_handler. The addition of these calls makes it much simpler to temporarily disable or ignore errors: guestfs_push_error_handler (g, NULL, NULL); guestfs_mkdir (g, "/foo"); /* We don't care if this fails. */ guestfs_pop_error_handler (g); Note these calls are used by the C API only. They are not necessary in other languages, because those map errors to exceptions. The subsequent commits change existing code to use push/pop instead of laboriously saving and restoring the error handler.
* header: Define LIBGUESTFS_HAVE_CREATE_FLAGS=1.Richard W.M. Jones2012-11-091-0/+1
| | | | This fixes commit 9466060201600db47016133d80af22eb38091a49.
* lib: Rework temporary and cache directory code.Richard W.M. Jones2012-11-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir. The current code has evolved over time and has a number of problems: (a) A single environment variable ($TMPDIR) controls the location of several directories. (b) It's hard for the library user to predict which directory libguestfs will use, unless the user simulates the same internal steps that libguestfs performs. This commit fixes these issues. (a) Now three environment variables control the location of all small temporary files, and the appliance cache: For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp. For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp. The user can also set these directories explicitly through API calls (guestfs_set_tmpdir and guestfs_set_cachedir). (b) The user can also retrieve the actual directories that libguestfs will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir. These functions are also used internally. This commit also: - reworks the internal tmpdir code - removes the internal (undocumented) guestfs_tmpdir call (replacing it with calls to the documented guestfs_get_tmpdir API instead) - changes the ./run script to set LIBGUESTFS_TMPDIR and LIBGUESTFS_CACHEDIR - adds a test - fixes a few places like libguestfs-make-fixed-appliance which depended on $TMPDIR
* generator: Split up huge src/actions.c into separate files.Richard W.M. Jones2012-11-021-3/+15
| | | | | | | | Split the functions according to a simple hash across C.nr_actions_files files (this number can be increased later if necessary). This is just code motion.
* generator: actions: Move variant functions to a separate file.Richard W.M. Jones2012-11-021-4/+21
| | | | This is just code motion.
* generator: actions: Move 3 helper functions to a separate file.Richard W.M. Jones2012-11-021-89/+6
| | | | This is just code motion.
* generator: Use an OCaml struct to store the structs.Richard W.M. Jones2012-10-301-4/+4
| | | | | | This just makes it simpler to add extra fields to each struct. This is code motion.
* lib: Force visibility default on public actions.Richard W.M. Jones2012-10-301-4/+10
| | | | | | This is currently done implicitly because of the linker script. However in order to do symbol versioning, we will have to do this explicitly at each definition instead.
* generator: Move struct-freeing functions to a separate source file.Richard W.M. Jones2012-10-301-27/+42
| | | | This is just code motion.
* New APIs: guestfs_create_flags, guestfs_parse_environment,Richard W.M. Jones2012-10-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* lib: Pointer arg to safe_memdup function should be const.Richard W.M. Jones2012-10-131-1/+1
|
* syntax: Remove trailing whitespace.Richard W.M. Jones2012-09-151-1/+1
| | | | Found by 'make syntax-check'.
* generator: Rename 'generator_*' as '*'.Richard W.M. Jones2012-09-021-0/+1655
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".