From owner-freebsd-scsi@FreeBSD.ORG Mon Nov 20 00:33:09 2006 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B338216A4D1 for ; Mon, 20 Nov 2006 00:33:09 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.233]) by mx1.FreeBSD.org (Postfix) with ESMTP id 89F8243D76 for ; Mon, 20 Nov 2006 00:30:50 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by wx-out-0506.google.com with SMTP id s18so1400600wxc for ; Sun, 19 Nov 2006 16:31:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Xaqn24iJe0I9CKwYFTobF2qmlFQv2YJVaZEyUgqFWjvsODu3Gb7O5uH53a4BrexhvfPydbLP+3NAgHTc9dv/x4K0HuDSnN9LlRaNTqnd0wtoJkERrYF9wtxLIZJu3iHjnBezv1eDKAA837sQ5+RP20tLmbc5SGDx7zy3YI+VedE= Received: by 10.70.111.2 with SMTP id j2mr8477756wxc.1163982661209; Sun, 19 Nov 2006 16:31:01 -0800 (PST) Received: by 10.70.12.2 with HTTP; Sun, 19 Nov 2006 16:31:01 -0800 (PST) Message-ID: <3bbf2fe10611191631h6883b862uf8088533913a7bc6@mail.gmail.com> Date: Mon, 20 Nov 2006 01:31:01 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: mjacob@freebsd.org In-Reply-To: <20061119161631.L44297@ns1.feral.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061119161631.L44297@ns1.feral.com> X-Google-Sender-Auth: ca1ee6506469e21b Cc: freebsd-scsi@freebsd.org Subject: Re: a code reduction function addition to cam_xpt X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Nov 2006 00:33:09 -0000 2006/11/20, mjacob@freebsd.org : > There are *far* too many: > > xpt_print_path(path); > printf("foo\n"); > > constructs. How about we just join them? > > ==== //depot/projects/newisp/cam/cam_xpt.c#12 - /home/FreeBSD/p4/newisp/cam/cam_xpt.c ==== > @@ -63,6 +63,7 @@ > #include > #include > #include > +#include /* for xpt_print below */ > #include "opt_cam.h" > > /* Datastructures internal to the xpt layer */ > @@ -4160,6 +4161,16 @@ > } > } > > +void > +xpt_print(struct cam_path *path, const char *fmt, ...) > +{ > + va_list ap; > + xpt_print_path(path); > + va_start(ap, fmt); > + vprintf(fmt, ap); > + va_end(ap); > +} > + > ==== //depot/projects/newisp/cam/cam_xpt.h#1 - /home/FreeBSD/p4/newisp/cam/cam_xpt.h ==== > @@ -62,6 +62,7 @@ > int xpt_path_comp(struct cam_path *path1, > struct cam_path *path2); > void xpt_print_path(struct cam_path *path); > +void xpt_print(struct cam_path *path, const char *fmt, ...); > int xpt_path_string(struct cam_path *path, char *str, > size_t str_len); > path_id_t xpt_path_path_id(struct cam_path *path); Would not be better a preprocessing stub? something like: #define XPT_PRINT(path, fmt, ...) do { \ xpt_print_path(path); \ printf(fmt, __VA_ARGS__); \ } while (0) -- Peace can only be achieved by understanding - A. Einstein