]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote generator: Replace tabs with spaces and rename file
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 24 Apr 2011 07:58:01 +0000 (09:58 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 6 May 2011 18:04:55 +0000 (20:04 +0200)
No functional change included, just a whitespace change.

12 files changed:
daemon/Makefile.am
daemon/qemu_dispatch_args.h
daemon/qemu_dispatch_prototypes.h
daemon/qemu_dispatch_ret.h
daemon/qemu_dispatch_table.h
daemon/remote_dispatch_args.h
daemon/remote_dispatch_prototypes.h
daemon/remote_dispatch_ret.h
daemon/remote_dispatch_table.h
daemon/remote_generate_stubs.pl [deleted file]
daemon/remote_generator.pl [new file with mode: 0755]
src/remote/remote_protocol.x

index af71188bf73727ed5aef9cc5ba473ab179fa75d2..14088bc6ddd984c72d64650bbce13d311c29e89d 100644 (file)
@@ -23,7 +23,7 @@ AVAHI_SOURCES =                                               \
 
 DISTCLEANFILES =
 EXTRA_DIST =                                           \
-       remote_generate_stubs.pl                        \
+       remote_generator.pl                             \
        libvirtd.conf                                   \
        libvirtd.init.in                                \
        libvirtd.upstart                                \
@@ -216,29 +216,29 @@ remote.h: \
 REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
 QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
 
-remote_dispatch_prototypes.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -p remote $(REMOTE_PROTOCOL) > $@
+remote_dispatch_prototypes.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -p remote $(REMOTE_PROTOCOL) > $@
 
-remote_dispatch_table.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -t remote $(REMOTE_PROTOCOL) > $@
+remote_dispatch_table.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -t remote $(REMOTE_PROTOCOL) > $@
 
-remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -a remote $(REMOTE_PROTOCOL) > $@
+remote_dispatch_args.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -a remote $(REMOTE_PROTOCOL) > $@
 
-remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -r remote $(REMOTE_PROTOCOL) > $@
+remote_dispatch_ret.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -r remote $(REMOTE_PROTOCOL) > $@
 
-qemu_dispatch_prototypes.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -p qemu $(QEMU_PROTOCOL) > $@
+qemu_dispatch_prototypes.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -p qemu $(QEMU_PROTOCOL) > $@
 
-qemu_dispatch_table.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -t qemu $(QEMU_PROTOCOL) > $@
+qemu_dispatch_table.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -t qemu $(QEMU_PROTOCOL) > $@
 
-qemu_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -a qemu $(QEMU_PROTOCOL) > $@
+qemu_dispatch_args.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -a qemu $(QEMU_PROTOCOL) > $@
 
-qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
-       $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
+qemu_dispatch_ret.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
+       $(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -r qemu $(QEMU_PROTOCOL) > $@
 
 LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
                   libvirtd.uml.logrotate libvirtd.logrotate
index e278fa48d52f80b1a77740d152aa5b401ce2fae4..81623bcef13d12c8138afa24e4ca7113bd106c5b 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index 4ec1ab4c02cf2628b921c068ca2d225e90e705ba..031ae38cb7f04d07cadbc0b855a6753e33f807b2 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index 492dcf99446c497e2ad3b373447d88537d58e4d0..4dcab6cf05d661e2ef1edf859bf0694577fae241 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index c196a3c4f8e8c6e777af6141330f4a632b5af8bf..d8eebd0ed30ca94e5739a36152be3bb6d2ee2aff 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index f9537d7e76ddacec092429b790bc434580fa7094..31c02c7025d62c67bb2c5e941626e21945a1ffa4 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index cf2f38c6e46d8e3be9e26da3ffc7e6f279bcc2e7..a029b8532b847e6b3ad4bfe4389613e8d639380f 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index 114e832e861c2e2b0a8ba3779e21f5fdaa5794c7..cf636570884685db77fb3a626e934acb13e1aea0 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
index b39f7c2c54bee54380ba2531e5671a80b9d6fb57..d2ce08c9968f2559fef28452136b221a2cb83879 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated by remote_generate_stubs.pl.
+/* Automatically generated by remote_generator.pl.
  * Do not edit this file.  Any changes you make will be lost.
  */
 
diff --git a/daemon/remote_generate_stubs.pl b/daemon/remote_generate_stubs.pl
deleted file mode 100755 (executable)
index dbde7da..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/perl -w
-#
-# This script parses remote_protocol.x or qemu_protocol.x and produces lots of
-# boilerplate code for both ends of the remote connection.
-#
-# The first non-option argument specifies the prefix to be searched for, and
-# output to, the boilerplate code.  The second non-option argument is the
-# file you want to operate on.  For instance, to generate the dispatch table
-# for both remote_protocol.x and qemu_protocol.x, you would run the
-# following:
-#
-# remote_generate_stubs.pl -c -t remote ../src/remote/remote_protocol.x
-# remote_generate_stubs.pl -t qemu ../src/remote/qemu_protocol.x
-#
-# By Richard Jones <rjones@redhat.com>
-
-use strict;
-
-use Getopt::Std;
-
-# Command line options.
-our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c);
-getopts ('ptardc');
-
-my $structprefix = $ARGV[0];
-my $procprefix = uc $structprefix;
-shift;
-
-# Convert name_of_call to NameOfCall.
-sub name_to_ProcName {
-    my $name = shift;
-    my @elems = split /_/, $name;
-    @elems = map ucfirst, @elems;
-    join "", @elems
-}
-
-# Read the input file (usually remote_protocol.x) and form an
-# opinion about the name, args and return type of each RPC.
-my ($name, $ProcName, $id, %calls, @calls);
-
-# only generate a close method if -c was passed
-if ($opt_c) {
-    # REMOTE_PROC_CLOSE has no args or ret.
-    $calls{close} = {
-       name => "close",
-       ProcName => "Close",
-       UC_NAME => "CLOSE",
-       args => "void",
-       ret => "void",
-    };
-}
-
-while (<>) {
-    if (/^struct ${structprefix}_(.*)_args/) {
-       $name = $1;
-       $ProcName = name_to_ProcName ($name);
-
-       die "duplicate definition of ${structprefix}_${name}_args"
-           if exists $calls{$name};
-
-       $calls{$name} = {
-           name => $name,
-           ProcName => $ProcName,
-           UC_NAME => uc $name,
-           args => "${structprefix}_${name}_args",
-           ret => "void",
-       };
-
-    } elsif (/^struct ${structprefix}_(.*)_ret/) {
-       $name = $1;
-       $ProcName = name_to_ProcName ($name);
-
-       if (exists $calls{$name}) {
-           $calls{$name}->{ret} = "${structprefix}_${name}_ret";
-       } else {
-           $calls{$name} = {
-               name => $name,
-               ProcName => $ProcName,
-               UC_NAME => uc $name,
-               args => "void",
-               ret => "${structprefix}_${name}_ret"
-           }
-       }
-    } elsif (/^struct ${structprefix}_(.*)_msg/) {
-       $name = $1;
-       $ProcName = name_to_ProcName ($name);
-
-       $calls{$name} = {
-           name => $name,
-           ProcName => $ProcName,
-           UC_NAME => uc $name,
-           msg => "${structprefix}_${name}_msg"
-       }
-    } elsif (/^\s*${procprefix}_PROC_(.*?)\s+=\s+(\d+),?$/) {
-       $name = lc $1;
-       $id = $2;
-       $ProcName = name_to_ProcName ($name);
-
-       $calls[$id] = $calls{$name};
-    }
-}
-
-#----------------------------------------------------------------------
-# Output
-
-print <<__EOF__;
-/* Automatically generated by remote_generate_stubs.pl.
- * Do not edit this file.  Any changes you make will be lost.
- */
-
-__EOF__
-
-# Debugging.
-if ($opt_d) {
-    my @keys = sort (keys %calls);
-    foreach (@keys) {
-       print "$_:\n";
-       print "        name $calls{$_}->{name} ($calls{$_}->{ProcName})\n";
-       print "        $calls{$_}->{args} -> $calls{$_}->{ret}\n";
-    }
-}
-
-# Prototypes for dispatch functions ("remote_dispatch_prototypes.h").
-elsif ($opt_p) {
-    my @keys = sort (keys %calls);
-    foreach (@keys) {
-       # Skip things which are REMOTE_MESSAGE
-       next if $calls{$_}->{msg};
-
-       print "static int ${structprefix}Dispatch$calls{$_}->{ProcName}(\n";
-       print "    struct qemud_server *server,\n";
-       print "    struct qemud_client *client,\n";
-       print "    virConnectPtr conn,\n";
-       print "    remote_message_header *hdr,\n";
-       print "    remote_error *rerr,\n";
-       print "    $calls{$_}->{args} *args,\n";
-       print "    $calls{$_}->{ret} *ret);\n";
-    }
-}
-
-# Union of all arg types
-# ("remote_dispatch_args.h").
-elsif ($opt_a) {
-    for ($id = 0 ; $id <= $#calls ; $id++) {
-       if (defined $calls[$id] &&
-           !$calls[$id]->{msg} &&
-           $calls[$id]->{args} ne "void") {
-           print "    $calls[$id]->{args} val_$calls[$id]->{args};\n";
-       }
-    }
-}
-
-# Union of all arg types
-# ("remote_dispatch_ret.h").
-elsif ($opt_r) {
-    for ($id = 0 ; $id <= $#calls ; $id++) {
-       if (defined $calls[$id] &&
-           !$calls[$id]->{msg} &&
-           $calls[$id]->{ret} ne "void") {
-           print "    $calls[$id]->{ret} val_$calls[$id]->{ret};\n";
-       }
-    }
-}
-
-# Inside the switch statement, prepare the 'fn', 'args_filter', etc
-# ("remote_dispatch_table.h").
-elsif ($opt_t) {
-    for ($id = 0 ; $id <= $#calls ; $id++) {
-       if (defined $calls[$id] && !$calls[$id]->{msg}) {
-           print "{   /* $calls[$id]->{ProcName} => $id */\n";
-           print "    .fn = (dispatch_fn) ${structprefix}Dispatch$calls[$id]->{ProcName},\n";
-           if ($calls[$id]->{args} ne "void") {
-               print "    .args_filter = (xdrproc_t) xdr_$calls[$id]->{args},\n";
-           } else {
-               print "    .args_filter = (xdrproc_t) xdr_void,\n";
-           }
-           if ($calls[$id]->{ret} ne "void") {
-               print "    .ret_filter = (xdrproc_t) xdr_$calls[$id]->{ret},\n";
-           } else {
-               print "    .ret_filter = (xdrproc_t) xdr_void,\n";
-           }
-           print "},\n";
-       } else {
-           if ($calls[$id]->{msg}) {
-               print "{   /* Async event $calls[$id]->{ProcName} => $id */\n";
-           } else {
-               print "{   /* (unused) => $id */\n";
-           }
-           print "    .fn = NULL,\n";
-           print "    .args_filter = (xdrproc_t) xdr_void,\n";
-           print "    .ret_filter = (xdrproc_t) xdr_void,\n";
-           print "},\n";
-       }
-    }
-}
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
new file mode 100755 (executable)
index 0000000..e4cade6
--- /dev/null
@@ -0,0 +1,195 @@
+#!/usr/bin/perl -w
+#
+# This script parses remote_protocol.x or qemu_protocol.x and produces lots of
+# boilerplate code for both ends of the remote connection.
+#
+# The first non-option argument specifies the prefix to be searched for, and
+# output to, the boilerplate code.  The second non-option argument is the
+# file you want to operate on.  For instance, to generate the dispatch table
+# for both remote_protocol.x and qemu_protocol.x, you would run the
+# following:
+#
+# remote_generator.pl -c -t remote ../src/remote/remote_protocol.x
+# remote_generator.pl -t qemu ../src/remote/qemu_protocol.x
+#
+# By Richard Jones <rjones@redhat.com>
+
+use strict;
+
+use Getopt::Std;
+
+# Command line options.
+our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c);
+getopts ('ptardc');
+
+my $structprefix = $ARGV[0];
+my $procprefix = uc $structprefix;
+shift;
+
+# Convert name_of_call to NameOfCall.
+sub name_to_ProcName {
+    my $name = shift;
+    my @elems = split /_/, $name;
+    @elems = map ucfirst, @elems;
+    join "", @elems
+}
+
+# Read the input file (usually remote_protocol.x) and form an
+# opinion about the name, args and return type of each RPC.
+my ($name, $ProcName, $id, %calls, @calls);
+
+# only generate a close method if -c was passed
+if ($opt_c) {
+    # REMOTE_PROC_CLOSE has no args or ret.
+    $calls{close} = {
+        name => "close",
+        ProcName => "Close",
+        UC_NAME => "CLOSE",
+        args => "void",
+        ret => "void",
+    };
+}
+
+while (<>) {
+    if (/^struct ${structprefix}_(.*)_args/) {
+        $name = $1;
+        $ProcName = name_to_ProcName ($name);
+
+        die "duplicate definition of ${structprefix}_${name}_args"
+            if exists $calls{$name};
+
+        $calls{$name} = {
+            name => $name,
+            ProcName => $ProcName,
+            UC_NAME => uc $name,
+            args => "${structprefix}_${name}_args",
+            ret => "void",
+        };
+
+    } elsif (/^struct ${structprefix}_(.*)_ret/) {
+        $name = $1;
+        $ProcName = name_to_ProcName ($name);
+
+        if (exists $calls{$name}) {
+            $calls{$name}->{ret} = "${structprefix}_${name}_ret";
+        } else {
+            $calls{$name} = {
+                name => $name,
+                ProcName => $ProcName,
+                UC_NAME => uc $name,
+                args => "void",
+                ret => "${structprefix}_${name}_ret"
+            }
+        }
+    } elsif (/^struct ${structprefix}_(.*)_msg/) {
+        $name = $1;
+        $ProcName = name_to_ProcName ($name);
+
+        $calls{$name} = {
+            name => $name,
+            ProcName => $ProcName,
+            UC_NAME => uc $name,
+            msg => "${structprefix}_${name}_msg"
+        }
+    } elsif (/^\s*${procprefix}_PROC_(.*?)\s+=\s+(\d+),?$/) {
+        $name = lc $1;
+        $id = $2;
+        $ProcName = name_to_ProcName ($name);
+
+        $calls[$id] = $calls{$name};
+    }
+}
+
+#----------------------------------------------------------------------
+# Output
+
+print <<__EOF__;
+/* Automatically generated by remote_generator.pl.
+ * Do not edit this file.  Any changes you make will be lost.
+ */
+
+__EOF__
+
+# Debugging.
+if ($opt_d) {
+    my @keys = sort (keys %calls);
+    foreach (@keys) {
+        print "$_:\n";
+        print "        name $calls{$_}->{name} ($calls{$_}->{ProcName})\n";
+        print "        $calls{$_}->{args} -> $calls{$_}->{ret}\n";
+    }
+}
+
+# Prototypes for dispatch functions ("remote_dispatch_prototypes.h").
+elsif ($opt_p) {
+    my @keys = sort (keys %calls);
+    foreach (@keys) {
+        # Skip things which are REMOTE_MESSAGE
+        next if $calls{$_}->{msg};
+
+        print "static int ${structprefix}Dispatch$calls{$_}->{ProcName}(\n";
+        print "    struct qemud_server *server,\n";
+        print "    struct qemud_client *client,\n";
+        print "    virConnectPtr conn,\n";
+        print "    remote_message_header *hdr,\n";
+        print "    remote_error *rerr,\n";
+        print "    $calls{$_}->{args} *args,\n";
+        print "    $calls{$_}->{ret} *ret);\n";
+    }
+}
+
+# Union of all arg types
+# ("remote_dispatch_args.h").
+elsif ($opt_a) {
+    for ($id = 0 ; $id <= $#calls ; $id++) {
+        if (defined $calls[$id] &&
+            !$calls[$id]->{msg} &&
+            $calls[$id]->{args} ne "void") {
+            print "    $calls[$id]->{args} val_$calls[$id]->{args};\n";
+        }
+    }
+}
+
+# Union of all arg types
+# ("remote_dispatch_ret.h").
+elsif ($opt_r) {
+    for ($id = 0 ; $id <= $#calls ; $id++) {
+        if (defined $calls[$id] &&
+            !$calls[$id]->{msg} &&
+            $calls[$id]->{ret} ne "void") {
+            print "    $calls[$id]->{ret} val_$calls[$id]->{ret};\n";
+        }
+    }
+}
+
+# Inside the switch statement, prepare the 'fn', 'args_filter', etc
+# ("remote_dispatch_table.h").
+elsif ($opt_t) {
+    for ($id = 0 ; $id <= $#calls ; $id++) {
+        if (defined $calls[$id] && !$calls[$id]->{msg}) {
+            print "{   /* $calls[$id]->{ProcName} => $id */\n";
+            print "    .fn = (dispatch_fn) ${structprefix}Dispatch$calls[$id]->{ProcName},\n";
+            if ($calls[$id]->{args} ne "void") {
+                print "    .args_filter = (xdrproc_t) xdr_$calls[$id]->{args},\n";
+            } else {
+                print "    .args_filter = (xdrproc_t) xdr_void,\n";
+            }
+            if ($calls[$id]->{ret} ne "void") {
+                print "    .ret_filter = (xdrproc_t) xdr_$calls[$id]->{ret},\n";
+            } else {
+                print "    .ret_filter = (xdrproc_t) xdr_void,\n";
+            }
+            print "},\n";
+        } else {
+            if ($calls[$id]->{msg}) {
+                print "{   /* Async event $calls[$id]->{ProcName} => $id */\n";
+            } else {
+                print "{   /* (unused) => $id */\n";
+            }
+            print "    .fn = NULL,\n";
+            print "    .args_filter = (xdrproc_t) xdr_void,\n";
+            print "    .ret_filter = (xdrproc_t) xdr_void,\n";
+            print "},\n";
+        }
+    }
+}
index 675eccd0c60e9a401b9b72e30313fdbbd8d6962f..b9f1bc7008fec07997ad2ea04d9237ab2d3a3795 100644 (file)
@@ -367,7 +367,7 @@ struct remote_memory_param {
  * connection).  Errors are returned implicitly in the RPC protocol.
  *
  * Please follow the naming convention carefully - this file is
- * parsed by 'remote_generate_stubs.pl'.
+ * parsed by 'remote_generator.pl'.
  */
 
 struct remote_open_args {