Author: pjd
Date: Wed Nov 16 19:06:55 2011
New Revision: 227581
URL: http://svn.freebsd.org/changeset/base/227581

Log:
  Constify stack argument for functions that don't modify it.
  
  Reviewed by:  ed, kib, jhb

Modified:
  head/share/man/man9/stack.9
  head/sys/kern/subr_stack.c
  head/sys/sys/stack.h

Modified: head/share/man/man9/stack.9
==============================================================================
--- head/share/man/man9/stack.9 Wed Nov 16 18:53:52 2011        (r227580)
+++ head/share/man/man9/stack.9 Wed Nov 16 19:06:55 2011        (r227581)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 24, 2009
+.Dd November 16, 2011
 .Dt STACK 9
 .Os
 .Sh NAME
@@ -46,21 +46,21 @@ In the kernel configuration file:
 .Ft int
 .Fn stack_put "struct stack *st" "vm_offset_t pc"
 .Ft void
-.Fn stack_copy "struct stack *src" "struct stack dst"
+.Fn stack_copy "const struct stack *src" "struct stack dst"
 .Ft void
 .Fn stack_zero "struct stack *st"
 .Ft void
-.Fn stack_print "struct stack *st"
+.Fn stack_print "const struct stack *st"
 .Ft void
-.Fn stack_print_ddb "struct stack *st"
+.Fn stack_print_ddb "const struct stack *st"
 .Ft void
-.Fn stack_print_short "struct stack *st"
+.Fn stack_print_short "const struct stack *st"
 .Ft void
-.Fn stack_print_short_ddb "struct stack *st"
+.Fn stack_print_short_ddb "const struct stack *st"
 .Ft void
-.Fn stack_sbuf_print "struct sbuf sb*" "struct stack *st"
+.Fn stack_sbuf_print "struct sbuf sb*" "const struct stack *st"
 .Ft void
-.Fn stack_sbuf_print_ddb "struct sbuf sb*" "struct stack *st"
+.Fn stack_sbuf_print_ddb "struct sbuf sb*" "const struct stack *st"
 .Ft void
 .Fn stack_save "struct stack *st"
 .Sh DESCRIPTION

Modified: head/sys/kern/subr_stack.c
==============================================================================
--- head/sys/kern/subr_stack.c  Wed Nov 16 18:53:52 2011        (r227580)
+++ head/sys/kern/subr_stack.c  Wed Nov 16 19:06:55 2011        (r227581)
@@ -77,7 +77,7 @@ stack_put(struct stack *st, vm_offset_t 
 }
 
 void
-stack_copy(struct stack *src, struct stack *dst)
+stack_copy(const struct stack *src, struct stack *dst)
 {
 
        *dst = *src;
@@ -91,7 +91,7 @@ stack_zero(struct stack *st)
 }
 
 void
-stack_print(struct stack *st)
+stack_print(const struct stack *st)
 {
        char namebuf[64];
        long offset;
@@ -107,7 +107,7 @@ stack_print(struct stack *st)
 }
 
 void
-stack_print_short(struct stack *st)
+stack_print_short(const struct stack *st)
 {
        char namebuf[64];
        long offset;
@@ -127,7 +127,7 @@ stack_print_short(struct stack *st)
 }
 
 void
-stack_print_ddb(struct stack *st)
+stack_print_ddb(const struct stack *st)
 {
        const char *name;
        long offset;
@@ -143,7 +143,7 @@ stack_print_ddb(struct stack *st)
 
 #ifdef DDB
 void
-stack_print_short_ddb(struct stack *st)
+stack_print_short_ddb(const struct stack *st)
 {
        const char *name;
        long offset;
@@ -167,7 +167,7 @@ stack_print_short_ddb(struct stack *st)
  * other for use in the live kernel.
  */
 void
-stack_sbuf_print(struct sbuf *sb, struct stack *st)
+stack_sbuf_print(struct sbuf *sb, const struct stack *st)
 {
        char namebuf[64];
        long offset;
@@ -184,7 +184,7 @@ stack_sbuf_print(struct sbuf *sb, struct
 
 #ifdef DDB
 void
-stack_sbuf_print_ddb(struct sbuf *sb, struct stack *st)
+stack_sbuf_print_ddb(struct sbuf *sb, const struct stack *st)
 {
        const char *name;
        long offset;
@@ -201,8 +201,8 @@ stack_sbuf_print_ddb(struct sbuf *sb, st
 
 #ifdef KTR
 void
-stack_ktr(u_int mask, const char *file, int line, struct stack *st, u_int 
depth,
-    int cheap)
+stack_ktr(u_int mask, const char *file, int line, const struct stack *st,
+    u_int depth, int cheap)
 {
 #ifdef DDB
        const char *name;

Modified: head/sys/sys/stack.h
==============================================================================
--- head/sys/sys/stack.h        Wed Nov 16 18:53:52 2011        (r227580)
+++ head/sys/sys/stack.h        Wed Nov 16 19:06:55 2011        (r227581)
@@ -37,16 +37,17 @@ struct sbuf;
 struct stack   *stack_create(void);
 void            stack_destroy(struct stack *);
 int             stack_put(struct stack *, vm_offset_t);
-void            stack_copy(struct stack *, struct stack *);
+void            stack_copy(const struct stack *, struct stack *);
 void            stack_zero(struct stack *);
-void            stack_print(struct stack *);
-void            stack_print_ddb(struct stack *);
-void            stack_print_short(struct stack *);
-void            stack_print_short_ddb(struct stack *);
-void            stack_sbuf_print(struct sbuf *, struct stack *);
-void            stack_sbuf_print_ddb(struct sbuf *, struct stack *);
+void            stack_print(const struct stack *);
+void            stack_print_ddb(const struct stack *);
+void            stack_print_short(const struct stack *);
+void            stack_print_short_ddb(const struct stack *);
+void            stack_sbuf_print(struct sbuf *, const struct stack *);
+void            stack_sbuf_print_ddb(struct sbuf *, const struct stack *);
 #ifdef KTR
-void            stack_ktr(u_int, const char *, int, struct stack *, u_int, 
int);
+void            stack_ktr(u_int, const char *, int, const struct stack *,
+                   u_int, int);
 #define        CTRSTACK(m, st, depth, cheap) do {                              
\
        if (KTR_COMPILE & (m))                                          \
                stack_ktr((m), __FILE__, __LINE__, st, depth, cheap);   \
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to