All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvmtrace_format: read /usr/share/kvm/formats by default
@ 2009-05-25 20:21 Eduardo Habkost
  2009-05-26  8:09 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Habkost @ 2009-05-25 20:21 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

This will help distributions to package kvmtrace and kvmtrace_format, making
kvmtrace_format work out-of-the-box.

The directory is defined at the beginning of the script to make it easier for
distributions to customize the path at install-time, depending on packaging
parameters.

There are no install rules to install kvmtrace and kvmtrace_format, but it
would be interesting to add such rules later. They could replace the PREFIX
definition with the prefix set by ./configure.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 kvm/user/kvmtrace_format |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/kvm/user/kvmtrace_format b/kvm/user/kvmtrace_format
index 10eb1fe..6556475 100755
--- a/kvm/user/kvmtrace_format
+++ b/kvm/user/kvmtrace_format
@@ -6,6 +6,11 @@
 
 import re, sys, string, signal, struct, os, getopt, operator
 
+PREFIX = '/usr'
+DATADIR = os.path.join(PREFIX, 'share')
+KVMDIR = os.path.join(DATADIR, 'kvm')
+FORMATS_FILE = os.path.join(KVMDIR, 'formats')
+
 def usage():
     print >> sys.stderr, \
           "Usage: " + sys.argv[0] + """ defs-file
@@ -362,9 +367,6 @@ def get_special(instr):
 
 summary = False
 
-if len(sys.argv) < 2:
-    usage()
-
 try:
     opts, arg = getopt.getopt(sys.argv[1:], "sc:" )
     for opt in opts:
@@ -379,7 +381,10 @@ signal.signal(signal.SIGINT,  sighand)
 
 interrupted = 0
 
-defs = read_defs(arg[0])
+if len(arg) > 0:
+    defs = read_defs(arg[0])
+else:
+    defs = read_defs(FORMATS_FILE)
 
 # structure of trace record (as output by kvmtrace):
 # HDR(I) {TSC(Q)} D1(I) D2(I) D3(I) D4(I) D5(I)
-- 
1.6.3.rc4.29.g8146


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvmtrace_format: read /usr/share/kvm/formats by default
  2009-05-25 20:21 [PATCH] kvmtrace_format: read /usr/share/kvm/formats by default Eduardo Habkost
@ 2009-05-26  8:09 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-05-26  8:09 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: kvm

Eduardo Habkost wrote:
> This will help distributions to package kvmtrace and kvmtrace_format, making
> kvmtrace_format work out-of-the-box.
>
> The directory is defined at the beginning of the script to make it easier for
> distributions to customize the path at install-time, depending on packaging
> parameters.
>
> There are no install rules to install kvmtrace and kvmtrace_format, but it
> would be interesting to add such rules later. They could replace the PREFIX
> definition with the prefix set by ./configure.
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-26  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 20:21 [PATCH] kvmtrace_format: read /usr/share/kvm/formats by default Eduardo Habkost
2009-05-26  8:09 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.