diff options
author | Matthew Booth <mbooth@redhat.com> | 2012-01-13 10:00:30 +0000 |
---|---|---|
committer | Matthew Booth <mbooth@redhat.com> | 2012-01-17 15:37:14 +0000 |
commit | 83c20f02dc0e97b098e9de837839a3f4a4416129 (patch) | |
tree | 4cb714a61a356e987b1f0f0c01f2c19a1d62890d /generator | |
parent | b1ea8a7808744068fe0d1306d1005e841a570b4c (diff) | |
download | libguestfs-83c20f02dc0e97b098e9de837839a3f4a4416129.tar.gz libguestfs-83c20f02dc0e97b098e9de837839a3f4a4416129.tar.xz libguestfs-83c20f02dc0e97b098e9de837839a3f4a4416129.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 | 3 |
3 files changed, 13 insertions, 5 deletions
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 5586d7bb..b014de8c 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -6174,7 +6174,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", "\ @@ -6198,7 +6198,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", "\ @@ -6230,7 +6230,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", "\ @@ -6362,7 +6362,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"]], @@ -6459,7 +6459,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 f828c816..98d84ea2 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; ) flags ) (all_functions @ fish_commands); diff --git a/generator/generator_types.ml b/generator/generator_types.ml index 16cb0895..0f43d350 100644 --- a/generator/generator_types.ml +++ b/generator/generator_types.ml @@ -222,6 +222,9 @@ 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 *) and fish_output_t = | FishOutputOctal (* for int return, print in octal *) |