From owner-freebsd-current Sat Sep 8 2:40:34 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 7E9CA37B40E; Sat, 8 Sep 2001 02:40:26 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA11676; Sat, 8 Sep 2001 19:40:17 +1000 Date: Sat, 8 Sep 2001 19:39:30 +1000 (EST) From: Bruce Evans X-X-Sender: To: Bakul Shah Cc: Julian Elischer , John Baldwin , Subject: Re: RFC: hack volatile bzero and bcopy In-Reply-To: <200109071956.PAA29905@thunderer.cnchost.com> Message-ID: <20010908193015.X45840-100000@alphplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 7 Sep 2001, Bakul Shah wrote: > > out-of order is probably ok for a buffer if you know that it's > > presently yours to write into. > > If the area being bcopied/bzeroed has this behavior why not > remove the volatile from the struct ptrs instead of "fixing" > bcopy/bzero? One reason is that the memory might be normal at the time of the bcopy (because you have locked out concurrent accesses to it), but volatile at other times. I think this should be handled in general by declaring it as normal and always locking it. > > 2/ add to the prototype of bzero and bcopy so that volatile pointers are > > acceptable > > arguments. (I don't see any reason to not do this). > > Because the (informal) defn of bcopy/bzero does not allow > volatile arguments. You are wagging the dog. > > Why not just cast these ptrs at the call sites where you > _know_ bcopy, bzero use is safe. That sort of documents what > is going on without opening a big hole. FreeBSD turns on -Wcast-qual in order to prevent inadvertant loss of type qualifiers, so using explicit casts just moves the warning from the implicit casts caused by the prototype to the implicit casts. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message