Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 2000 17:34:25 -0400 (EDT)
From:      Bosko Milekic <bmilekic@dsuper.net>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: M_{LEADING,TRAILING}SPACE definitions.
Message-ID:  <Pine.BSF.4.21.0010151728330.6149-100000@jehovah.technokratis.com>
In-Reply-To: <200010152018.aa65610@salmon.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 15 Oct 2000, David Malone wrote:

[...]
> 1) Both return 0 if the storage isn't writable.
> 2) Have both return the amount of space, but make the kernel check
> 	M_WRITABLE(m) before writing to it.

	(2) is better, in my opinion. The arguments are:

 (i) I'd like to be able to get LEADINGSPACE and TRAILINGSPACE for
 non-writable buffers as well.

 (ii) If the kernel is calling M_LEADINGSPACE() and/or M_TRAILINGSPACE() on
 non-writable buffers, then in the general case, the portion doing this
 calling is flawed and should be repaired itself.

> M_LEADINGSPACE is only used about 16 times in the kernel and it's
> users tend to assume that the space in question will be writable.
> M_TRAILINGSPACE is used about 60 times, most consumers seem to
> ensure the writeability themselves. This suggests I should go for
> option 2 and then check the places where M_LEADINGSPACE is called.

	Yes, that's argument (iii). :-)

> I could have an option (3) where the M_LEADINGSPACE behaves in a
> different way to M_TRAILINGSPACE, and have the former check
> M_WRITEABLE before returning.

	That would be maintaining the present inconsistency... so I
  personally wouldn't go for that. Also, despite Alfred's suggestion, I
  wouldn't bloat mbuf.h with two more macros which would essentially be
  unused. The idea is that when you're calling the two macros, you should
  already know whether the mbuf is 'writable' or not, and if you're doing
  it, you're doing it because you know it's correct, not because you hope
  that it is.

> 	David.

  Bosko Milekic
  bmilekic@technokratis.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0010151728330.6149-100000>