[Libguestfs] [PATCH 01/10] Revert "Revert "generator: Add CamelName flag""

Matthew Booth mbooth at redhat.com
Fri Jan 20 11:07:44 UTC 2012


This reverts commit 3f6ca541c7b24d4c86688a509582cb41a7e0078c.

The original commit was reverted prematurely.
---
 generator/generator_actions.ml |   10 +++++-----
 generator/generator_checks.ml  |    5 +++++
 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 56691c5..d2e9f67 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -6189,7 +6189,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",
    "\
@@ -6213,7 +6213,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",
    "\
@@ -6245,7 +6245,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",
    "\
@@ -6379,7 +6379,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"]],
@@ -6476,7 +6476,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 4792dbf..464b9cd 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 d690377..233be54 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 *)
   | Cancellable           (* The user can cancel this long-running function *)
 
 and fish_output_t =
-- 
1.7.7.5




More information about the Libguestfs mailing list