svn commit: r286450 - in head/sys: kern sys

Alexander V. Chernikov melifaro at FreeBSD.org
Sat Aug 8 15:50:48 UTC 2015


Author: melifaro
Date: Sat Aug  8 15:50:46 2015
New Revision: 286450
URL: https://svnweb.freebsd.org/changeset/base/286450

Log:
  Add const-qualifiers for source mbuf argument in m_dup(), m_copym(),
    m_dup_pkthdr() and m_tag_copy_chain().

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_mbuf2.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c	Sat Aug  8 12:29:03 2015	(r286449)
+++ head/sys/kern/uipc_mbuf.c	Sat Aug  8 15:50:46 2015	(r286450)
@@ -396,7 +396,7 @@ mb_free_ext(struct mbuf *m)
  * and bump the refcount of the cluster.
  */
 static void
-mb_dupcl(struct mbuf *n, struct mbuf *m)
+mb_dupcl(struct mbuf *n, const struct mbuf *m)
 {
 
 	KASSERT(m->m_flags & M_EXT, ("%s: M_EXT not set on %p", __func__, m));
@@ -567,7 +567,7 @@ m_move_pkthdr(struct mbuf *to, struct mb
  * In particular, this does a deep copy of the packet tags.
  */
 int
-m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how)
+m_dup_pkthdr(struct mbuf *to, const struct mbuf *from, int how)
 {
 
 #if 0
@@ -631,7 +631,7 @@ m_prepend(struct mbuf *m, int len, int h
  * only their reference counts are incremented.
  */
 struct mbuf *
-m_copym(struct mbuf *m, int off0, int len, int wait)
+m_copym(const struct mbuf *m, int off0, int len, int wait)
 {
 	struct mbuf *n, **np;
 	int off = off0;
@@ -785,7 +785,7 @@ m_copydata(const struct mbuf *m, int off
  * you need a writable copy of an mbuf chain.
  */
 struct mbuf *
-m_dup(struct mbuf *m, int how)
+m_dup(const struct mbuf *m, int how)
 {
 	struct mbuf **p, *top = NULL;
 	int remain, moff, nsize;

Modified: head/sys/kern/uipc_mbuf2.c
==============================================================================
--- head/sys/kern/uipc_mbuf2.c	Sat Aug  8 12:29:03 2015	(r286449)
+++ head/sys/kern/uipc_mbuf2.c	Sat Aug  8 15:50:46 2015	(r286450)
@@ -427,7 +427,7 @@ m_tag_copy(struct m_tag *t, int how)
  * destination mbuf.
  */
 int
-m_tag_copy_chain(struct mbuf *to, struct mbuf *from, int how)
+m_tag_copy_chain(struct mbuf *to, const struct mbuf *from, int how)
 {
 	struct m_tag *p, *t, *tprev = NULL;
 

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h	Sat Aug  8 12:29:03 2015	(r286449)
+++ head/sys/sys/mbuf.h	Sat Aug  8 15:50:46 2015	(r286450)
@@ -953,7 +953,7 @@ int		 m_extadd(struct mbuf *, caddr_t, u
 struct mbuf	*m_collapse(struct mbuf *, int, int);
 void		 m_copyback(struct mbuf *, int, int, c_caddr_t);
 void		 m_copydata(const struct mbuf *, int, int, caddr_t);
-struct mbuf	*m_copym(struct mbuf *, int, int, int);
+struct mbuf	*m_copym(const struct mbuf *, int, int, int);
 struct mbuf	*m_copypacket(struct mbuf *, int);
 void		 m_copy_pkthdr(struct mbuf *, struct mbuf *);
 struct mbuf	*m_copyup(struct mbuf *, int, int);
@@ -962,8 +962,8 @@ void		 m_demote_pkthdr(struct mbuf *);
 void		 m_demote(struct mbuf *, int, int);
 struct mbuf	*m_devget(char *, int, int, struct ifnet *,
 		    void (*)(char *, caddr_t, u_int));
-struct mbuf	*m_dup(struct mbuf *, int);
-int		 m_dup_pkthdr(struct mbuf *, struct mbuf *, int);
+struct mbuf	*m_dup(const struct mbuf *, int);
+int		 m_dup_pkthdr(struct mbuf *, const struct mbuf *, int);
 u_int		 m_fixhdr(struct mbuf *);
 struct mbuf	*m_fragment(struct mbuf *, int, int);
 void		 m_freem(struct mbuf *);
@@ -1070,7 +1070,7 @@ void		 m_tag_delete_chain(struct mbuf *,
 void		 m_tag_free_default(struct m_tag *);
 struct m_tag	*m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *);
 struct m_tag	*m_tag_copy(struct m_tag *, int);
-int		 m_tag_copy_chain(struct mbuf *, struct mbuf *, int);
+int		 m_tag_copy_chain(struct mbuf *, const struct mbuf *, int);
 void		 m_tag_delete_nonpersistent(struct mbuf *);
 
 /*


More information about the svn-src-head mailing list