xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Marcus Granado <marcus.granado@citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Subject: [PATCH 1/3] xenoprof: Adjust indentation
Date: Fri, 20 Jan 2012 18:44:51 +0000	[thread overview]
Message-ID: <4F19B623.1060105@citrix.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4567 bytes --]

xenoprof: Adjust indentation

Bring indentation into Xen hypervisor standard coding style.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>


diff -r 9cdcedc133e5 -r f6953e89913f xen/arch/x86/oprofile/backtrace.c
--- a/xen/arch/x86/oprofile/backtrace.c    Wed Jan 11 10:34:45 2012 +0100
+++ b/xen/arch/x86/oprofile/backtrace.c    Wed Jan 18 17:23:02 2012 +0000
@@ -16,48 +16,48 @@
  #include<asm/guest_access.h>

  struct frame_head {
-    struct frame_head * ebp;
-    unsigned long ret;
+    struct frame_head * ebp;
+    unsigned long ret;
  } __attribute__((packed));

  static struct frame_head *
  dump_hypervisor_backtrace(struct domain *d, struct vcpu *vcpu,
                struct frame_head * head, int mode)
  {
-    if (!xenoprof_add_trace(d, vcpu, head->ret, mode))
-        return 0;
-
-    /* frame pointers should strictly progress back up the stack
-     * (towards higher addresses) */
-    if (head >= head->ebp)
-        return NULL;
-
-    return head->ebp;
+    if (!xenoprof_add_trace(d, vcpu, head->ret, mode))
+        return 0;
+
+    /* frame pointers should strictly progress back up the stack
+     * (towards higher addresses) */
+    if (head >= head->ebp)
+        return NULL;
+
+    return head->ebp;
  }

  static struct frame_head *
  dump_guest_backtrace(struct domain *d, struct vcpu *vcpu,
               struct frame_head * head, int mode)
  {
-    struct frame_head bufhead[2];
-    XEN_GUEST_HANDLE(char) guest_head = guest_handle_from_ptr(head, char);
+    struct frame_head bufhead[2];
+    XEN_GUEST_HANDLE(char) guest_head = guest_handle_from_ptr(head, char);

-    /* Also check accessibility of one struct frame_head beyond */
-    if (!guest_handle_okay(guest_head, sizeof(bufhead)))
-        return 0;
-    if (__copy_from_guest_offset((char *)bufhead, guest_head, 0,
-        sizeof(bufhead)))
-        return 0;
-
-    if (!xenoprof_add_trace(d, vcpu, bufhead[0].ret, mode))
-        return 0;
-
-    /* frame pointers should strictly progress back up the stack
-     * (towards higher addresses) */
-    if (head >= bufhead[0].ebp)
-        return NULL;
-
-    return bufhead[0].ebp;
+    /* Also check accessibility of one struct frame_head beyond */
+    if (!guest_handle_okay(guest_head, sizeof(bufhead)))
+        return 0;
+    if (__copy_from_guest_offset((char *)bufhead, guest_head, 0,
+                                 sizeof(bufhead)))
+        return 0;
+
+    if (!xenoprof_add_trace(d, vcpu, bufhead[0].ret, mode))
+        return 0;
+
+    /* frame pointers should strictly progress back up the stack
+     * (towards higher addresses) */
+    if (head >= bufhead[0].ebp)
+        return NULL;
+
+    return bufhead[0].ebp;
  }

  /*
@@ -94,22 +94,22 @@ dump_guest_backtrace(struct domain *d, s
  static int valid_hypervisor_stack(struct frame_head * head,
                    struct cpu_user_regs * regs)
  {
-    unsigned long headaddr = (unsigned long)head;
+    unsigned long headaddr = (unsigned long)head;
  #ifdef CONFIG_X86_64
-    unsigned long stack = (unsigned long)regs->rsp;
+    unsigned long stack = (unsigned long)regs->rsp;
  #else
-    unsigned long stack = (unsigned long)regs;
+    unsigned long stack = (unsigned long)regs;
  #endif
-    unsigned long stack_base = (stack & ~(STACK_SIZE - 1)) + STACK_SIZE;
+    unsigned long stack_base = (stack & ~(STACK_SIZE - 1)) + STACK_SIZE;

-    return headaddr > stack && headaddr < stack_base;
+    return headaddr > stack && headaddr < stack_base;
  }
  #else
  /* without fp, it's just junk */
  static int valid_hypervisor_stack(struct frame_head * head,
                    struct cpu_user_regs * regs)
  {
-    return 0;
+    return 0;
  }
  #endif

@@ -117,16 +117,16 @@ void xenoprof_backtrace(struct domain *d
              struct cpu_user_regs * const regs,
              unsigned long depth, int mode)
  {
-    struct frame_head *head;
+    struct frame_head *head;

-    head = (struct frame_head *)regs->ebp;
+    head = (struct frame_head *)regs->ebp;

-    if (mode > 1) {
-        while (depth-- && valid_hypervisor_stack(head, regs))
-            head = dump_hypervisor_backtrace(d, vcpu, head, mode);
-        return;
-    }
+    if (mode > 1) {
+        while (depth-- && valid_hypervisor_stack(head, regs))
+            head = dump_hypervisor_backtrace(d, vcpu, head, mode);
+        return;
+    }

-    while (depth-- && head)
-        head = dump_guest_backtrace(d, vcpu, head, mode);
+    while (depth-- && head)
+        head = dump_guest_backtrace(d, vcpu, head, mode);
  }


[-- Attachment #2: xenoprof-indent-backtrace.diff --]
[-- Type: text/x-patch, Size: 4367 bytes --]

xenoprof: Adjust indentation

Bring indentation into Xen hypervisor standard coding style.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>


diff -r 9cdcedc133e5 -r f6953e89913f xen/arch/x86/oprofile/backtrace.c
--- a/xen/arch/x86/oprofile/backtrace.c	Wed Jan 11 10:34:45 2012 +0100
+++ b/xen/arch/x86/oprofile/backtrace.c	Wed Jan 18 17:23:02 2012 +0000
@@ -16,48 +16,48 @@
 #include<asm/guest_access.h>
 
 struct frame_head {
-	struct frame_head * ebp;
-	unsigned long ret;
+    struct frame_head * ebp;
+    unsigned long ret;
 } __attribute__((packed));
 
 static struct frame_head *
 dump_hypervisor_backtrace(struct domain *d, struct vcpu *vcpu, 
 			  struct frame_head * head, int mode)
 {
-	if (!xenoprof_add_trace(d, vcpu, head->ret, mode))
-		return 0;
-
-	/* frame pointers should strictly progress back up the stack
-	 * (towards higher addresses) */
-	if (head >= head->ebp)
-		return NULL;
-
-	return head->ebp;
+    if (!xenoprof_add_trace(d, vcpu, head->ret, mode))
+        return 0;
+    
+    /* frame pointers should strictly progress back up the stack
+     * (towards higher addresses) */
+    if (head >= head->ebp)
+        return NULL;
+    
+    return head->ebp;
 }
 
 static struct frame_head *
 dump_guest_backtrace(struct domain *d, struct vcpu *vcpu, 
 		     struct frame_head * head, int mode)
 {
-	struct frame_head bufhead[2];
-	XEN_GUEST_HANDLE(char) guest_head = guest_handle_from_ptr(head, char);
+    struct frame_head bufhead[2];
+    XEN_GUEST_HANDLE(char) guest_head = guest_handle_from_ptr(head, char);
 	
-	/* Also check accessibility of one struct frame_head beyond */
-	if (!guest_handle_okay(guest_head, sizeof(bufhead)))
-		return 0;
-	if (__copy_from_guest_offset((char *)bufhead, guest_head, 0, 
-	    sizeof(bufhead)))
-		return 0;
-
-	if (!xenoprof_add_trace(d, vcpu, bufhead[0].ret, mode))
-	    return 0;
-
-	/* frame pointers should strictly progress back up the stack
-	 * (towards higher addresses) */
-	if (head >= bufhead[0].ebp)
-		return NULL;
-
-	return bufhead[0].ebp;
+    /* Also check accessibility of one struct frame_head beyond */
+    if (!guest_handle_okay(guest_head, sizeof(bufhead)))
+        return 0;
+    if (__copy_from_guest_offset((char *)bufhead, guest_head, 0, 
+                                 sizeof(bufhead)))
+        return 0;
+    
+    if (!xenoprof_add_trace(d, vcpu, bufhead[0].ret, mode))
+        return 0;
+    
+    /* frame pointers should strictly progress back up the stack
+     * (towards higher addresses) */
+    if (head >= bufhead[0].ebp)
+        return NULL;
+    
+    return bufhead[0].ebp;
 }
 
 /*
@@ -94,22 +94,22 @@ dump_guest_backtrace(struct domain *d, s
 static int valid_hypervisor_stack(struct frame_head * head, 
 				  struct cpu_user_regs * regs)
 {
-	unsigned long headaddr = (unsigned long)head;
+    unsigned long headaddr = (unsigned long)head;
 #ifdef CONFIG_X86_64
-	unsigned long stack = (unsigned long)regs->rsp;
+    unsigned long stack = (unsigned long)regs->rsp;
 #else
-	unsigned long stack = (unsigned long)regs;
+    unsigned long stack = (unsigned long)regs;
 #endif
-	unsigned long stack_base = (stack & ~(STACK_SIZE - 1)) + STACK_SIZE;
+    unsigned long stack_base = (stack & ~(STACK_SIZE - 1)) + STACK_SIZE;
 
-	return headaddr > stack && headaddr < stack_base;
+    return headaddr > stack && headaddr < stack_base;
 }
 #else
 /* without fp, it's just junk */
 static int valid_hypervisor_stack(struct frame_head * head, 
 				  struct cpu_user_regs * regs)
 {
-	return 0;
+    return 0;
 }
 #endif
 
@@ -117,16 +117,16 @@ void xenoprof_backtrace(struct domain *d
 			struct cpu_user_regs * const regs,
 			unsigned long depth, int mode)
 {
-	struct frame_head *head;
+    struct frame_head *head;
 
-	head = (struct frame_head *)regs->ebp;
+    head = (struct frame_head *)regs->ebp;
 
-	if (mode > 1) {
-		while (depth-- && valid_hypervisor_stack(head, regs))
-		    head = dump_hypervisor_backtrace(d, vcpu, head, mode);
-		return;
-	}
+    if (mode > 1) {
+        while (depth-- && valid_hypervisor_stack(head, regs))
+            head = dump_hypervisor_backtrace(d, vcpu, head, mode);
+        return;
+    }
 
-	while (depth-- && head)
-	    head = dump_guest_backtrace(d, vcpu, head, mode);
+    while (depth-- && head)
+        head = dump_guest_backtrace(d, vcpu, head, mode);
 }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2012-01-20 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 18:44 Marcus Granado [this message]
2012-01-23  9:36 ` [PATCH 1/3] xenoprof: Adjust indentation Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F19B623.1060105@citrix.com \
    --to=marcus.granado@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).