Subject: Re: CVS commit: src/sys
To: None <tron@zhadum.de>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-net
Date: 06/02/2005 23:15:53
> > > Log Message:
> > > Change the first argument of m_copydata() to "const struct mbuf *" (which
> > > doesn't require any implementation changes). This will allow us to get
> > > rid off a lot of nasty type casts.
> > please don't.
> 
> I was necessary to fix build problems in at least stf(4) and probably
> also gif(4) (my kernel build died in "in_stf.c")/

yes, i know.  stf should be fixed instead, IMO.

> > in general, constness of a structure is not the same as
> > logical constness of the data described by it.
> 
> Yes, I know. But m_copydata() changes neither of those.

making the argument const just exposes the current implementation details.
i don't think it's a good idea.

> > i'm working on lazy mbuf mapping and it sometimes modify
> > mbufs in m_copydata.
> 
> That would be wrong anyway because m_copydata() is used in locations of
> the code which aren't allowed to modify the mbuf (e.g. in the tunnel
> interface pseudo drivers, see above). Wouldn't it be better to invent
> a new function for your purpose?

i don't think so.

currently most of m_xxx functions can handle some kinds of mbufs.
(eg. M_EXT and not)
i don't see any good reason not to make them handle lazily mapped mbufs
as well.

YAMAMOTO Takashi