diff options
author | Matthew Booth <mbooth@redhat.com> | 2012-01-20 10:55:24 +0000 |
---|---|---|
committer | Matthew Booth <mbooth@redhat.com> | 2012-01-20 18:06:37 +0000 |
commit | eb58fa9978b71448c01348c151cc002c21983c71 (patch) | |
tree | de0a6509c57a7f6d5eb9c1b354839710c661fc16 /generator | |
parent | b8720abfe56391bf5b7b624e003ab7df90f5ceb4 (diff) | |
download | libguestfs-eb58fa9978b71448c01348c151cc002c21983c71.tar.gz libguestfs-eb58fa9978b71448c01348c151cc002c21983c71.tar.xz libguestfs-eb58fa9978b71448c01348c151cc002c21983c71.zip |
generator: Add CamelName flag
We can make a good guess at camel case names for most APIs. For example,
add_drive_opts can be automatically transformed to AddDriveOpts. However, other
apis don't produce a satisfactory name when transformed automatically. For
example, we would want md_create to produce MDCreate rather than MdCreate.
This change adds a CamelName flag which allows a camel case name to be specified
explicitly when the automatic transformation isn't satisfactory.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/generator_actions.ml | 10 | ||||
-rw-r--r-- | generator/generator_checks.ml | 5 | ||||
-rw-r--r-- | generator/generator_types.ml | 5 |
3 files changed, 15 insertions, 5 deletions
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index f6e22d7b..3d8cc4bc 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -6190,7 +6190,7 @@ Note that for large devices this can take a long time to run."); List all 9p filesystems attached to the guest. A list of mount tags is returned."); - ("mount_9p", (RErr, [String "mounttag"; String "mountpoint"], [OString "options"]), 286, [], + ("mount_9p", (RErr, [String "mounttag"; String "mountpoint"], [OString "options"]), 286, [CamelName "Mount9P"], [], "mount 9p filesystem", "\ @@ -6214,7 +6214,7 @@ Device mapper devices which correspond to logical volumes are I<not> returned in this list. Call C<guestfs_lvs> if you want to list logical volumes."); - ("ntfsresize_opts", (RErr, [Device "device"], [OInt64 "size"; OBool "force"]), 288, [Optional "ntfsprogs"], + ("ntfsresize_opts", (RErr, [Device "device"], [OInt64 "size"; OBool "force"]), 288, [Optional "ntfsprogs"; CamelName "NTFSResizeOpts"], [], "resize an NTFS filesystem", "\ @@ -6246,7 +6246,7 @@ single filesystem without booting into Windows between each resize. See also L<ntfsresize(8)>."); - ("btrfs_filesystem_resize", (RErr, [Pathname "mountpoint"], [OInt64 "size"]), 289, [Optional "btrfs"], + ("btrfs_filesystem_resize", (RErr, [Pathname "mountpoint"], [OInt64 "size"]), 289, [Optional "btrfs"; CamelName "BTRFSFilesystemResize"], [], "resize a btrfs filesystem", "\ @@ -6380,7 +6380,7 @@ is for copying blocks within existing files. See C<guestfs_cp>, C<guestfs_cp_a> and C<guestfs_mv> for general file copying and moving functions."); - ("tune2fs", (RErr, [Device "device"], [OBool "force"; OInt "maxmountcount"; OInt "mountcount"; OString "errorbehavior"; OInt64 "group"; OInt "intervalbetweenchecks"; OInt "reservedblockspercentage"; OString "lastmounteddirectory"; OInt64 "reservedblockscount"; OInt64 "user"]), 298, [], + ("tune2fs", (RErr, [Device "device"], [OBool "force"; OInt "maxmountcount"; OInt "mountcount"; OString "errorbehavior"; OInt64 "group"; OInt "intervalbetweenchecks"; OInt "reservedblockspercentage"; OString "lastmounteddirectory"; OInt64 "reservedblockscount"; OInt64 "user"]), 298, [CamelName "Tune2FS"], [InitScratchFS, Always, TestOutputHashtable ( [["tune2fs"; "/dev/sdb1"; "false"; "0"; ""; "NOARG"; ""; "0"; ""; "NOARG"; ""; ""]; ["tune2fs_l"; "/dev/sdb1"]], @@ -6477,7 +6477,7 @@ To get the current values of filesystem parameters, see C<guestfs_tune2fs_l>. For precise details of how tune2fs works, see the L<tune2fs(8)> man page."); - ("md_create", (RErr, [String "name"; DeviceList "devices"], [OInt64 "missingbitmap"; OInt "nrdevices"; OInt "spare"; OInt64 "chunk"; OString "level"]), 299, [Optional "mdadm"], + ("md_create", (RErr, [String "name"; DeviceList "devices"], [OInt64 "missingbitmap"; OInt "nrdevices"; OInt "spare"; OInt64 "chunk"; OString "level"]), 299, [Optional "mdadm"; CamelName "MDCreate"], [], "create a Linux md (RAID) device", "\ diff --git a/generator/generator_checks.ml b/generator/generator_checks.ml index 4792dbfe..464b9cd8 100644 --- a/generator/generator_checks.ml +++ b/generator/generator_checks.ml @@ -208,6 +208,11 @@ let () = failwithf "%s: Optional group name %s should not contain uppercase chars" name n; if String.contains n '-' || String.contains n '_' then failwithf "%s: Optional group name %s should not contain '-' or '_'" name n + | CamelName n -> + if not (contains_uppercase n) then + failwithf "%s: camel case name must contains uppercase characters" name n; + if String.contains n '_' then + failwithf "%s: camel case name must not contain '_'" name n; | Cancellable -> (match ret with | RConstOptString n -> diff --git a/generator/generator_types.ml b/generator/generator_types.ml index d6903773..c04d49ed 100644 --- a/generator/generator_types.ml +++ b/generator/generator_types.ml @@ -222,6 +222,11 @@ type flags = | DeprecatedBy of string (* function is deprecated, use .. instead *) | Optional of string (* function is part of an optional group *) | Progress (* function can generate progress messages *) + | CamelName of string (* Pretty camel case name of function. Only specify + this if the generator doesn't make a good job of + it, for example if it contains an abbreviation. + This flag is currently only used by the GObject + bindings. *) | Cancellable (* The user can cancel this long-running function *) and fish_output_t = |