This rather complex set of patches allow non-optargs functions to gain optional arguments, while preserving source and binary backwards compatibility.
The problem is that we cannot add an optional argument to an existing function. For example, we might want to add flags to the 'lvresize' API which currently has no optional arguments. http://libguestfs.org/guestfs.3.html#guestfs_lvresize The reason this wouldn't be possible is because in C the call is specified as: int guestfs_lvresize (guestfs_h *g, const char *device, int mbytes); which leaves no scope for extra parameters to be added. However in other languages, it wouldn't be a problem, eg. in Perl you can overload functions with additional arguments perfectly happily: $g->lvresize (device, mbytes); $g->lvresize (device, mbytes, free_percent => 50); and this is true in most non-C languages. The way to make this work is to generate C bindings differently. We would still generate the (backwards-compatible) guestfs_lvresize function as before, but we would generate an additional function 'guestfs_lvresize_opts' which could take optional arguments. Additionally, there are three "*-opts" APIs already (add-drive-opts, mkfs-opts, ntfsresize-opts). By luck, all of these have "non-opts" variants which take all the same required arguments. Therefore we can rename these as non-opts functions (add-drive, mkfs, ntfsresize) and use the same machinery above to generate the "*-opts" variants automatically. Existing callers will not be affected. The patches in this series do just this: 1/6, 2/6: Adds a 'once_had_no_optargs' flag to the generator, allowing functions to be transitioned from non-opts -> opts. This flag must be set to true when this is done so the corresponding backwards- compatibility functions can be generated. 3/6: Adds *-opts aliases in non-C languages. This ensures that non-C bindings won't be broken by this transition. *NB* PHP, Haskell and GObject bindings *are* broken at the moment; see the notes in the commit message. 4/6, 5/6, 6/6: Rename add-drive-opts -> add_drive, mkfs-opts -> mkfs, ntfsresize-opts -> ntfsresize. By setting the once_had_no_optargs flag we avoid breaking code for callers. ---- At the moment, the GObject bindings don't run at all on Rawhide. I suspect this is a general bug in Rawhide, since it doesn't happen on F17. The error is: JS ERROR: !!! Exception was: Error: Unsupported type void, deriving from fundamental void JS ERROR: !!! message = '"Unsupported type void, deriving from fundamental void"' JS ERROR: !!! fileName = '"./bindtests.js"' JS ERROR: !!! lineNumber = '27' JS ERROR: !!! stack = '"@./bindtests.js:27 Rich. _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
