From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Subject: Re: [RFCv2] cld: replace "if (verbose) { act_log }" with CLD_DEBUG Date: Sun, 06 Dec 2009 20:06:54 -0500 Message-ID: <4B1C552E.4030904@garzik.org> References: <1260114065-14473-1-git-send-email-cmccabe@alumni.cmu.edu> <20091206172304.30cb0361@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=BPmZU3s50yWr5AZ8qLP6yroKtK4BkcNCXnSBd0+xRzk=; b=hVnXTf4LmaXbpgEXcSwz/LlR94yxlyEDOdG51ouS+8lWYGj0H4lyGT04DFyWP4cgZI 41agUq5LaJOomEyyK4S1F8Sr5XEH8Miw8C9pZLfJ6FXLLWZEKO7hBym3qs0fTKOGYfVj qO0IOWMrg4nL/Lp3Ye6wHQRX73dXm7n5UdZMY= In-Reply-To: <20091206172304.30cb0361@redhat.com> Sender: hail-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Pete Zaitcev Cc: Colin McCabe , Project Hail List On 12/06/2009 07:23 PM, Pete Zaitcev wrote: > On Sun, 6 Dec 2009 07:41:05 -0800 > Colin McCabe wrote: > >> Move prototypes for common.c functions out of cld_msg.h and into a new header >> file, common.h. Create a structure that represents the current log level and >> also the function to use for logging. > >> static int sess_send_pkt(struct cldc_session *sess, >> const struct cld_packet *pkt, size_t pkt_len) >> { >> - if (sess->verbose) { >> + if (sess->log.verbose) { >> uint32_t flags = le32_to_cpu(pkt->flags); >> bool first = (flags& CPF_FIRST); >> bool last = (flags& CPF_LAST); > > I'm wondering if we can drop these ifs now, at the cost of some > small inefficiency. I would rather keep the if's. The verbose logging is unlikely to be used in production. Therefore, the common case would be to execute unnecessary code for each packet. Jeff