Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2006 16:11:53 -0600
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Attilio Rao <attilio@freebsd.org>
Cc:        freebsd-scsi@freebsd.org, mjacob@freebsd.org
Subject:   Re: a code reduction function addition to cam_xpt
Message-ID:  <20061120221153.GA5155@lor.one-eyed-alien.net>
In-Reply-To: <3bbf2fe10611191631h6883b862uf8088533913a7bc6@mail.gmail.com>
References:  <20061119161631.L44297@ns1.feral.com> <3bbf2fe10611191631h6883b862uf8088533913a7bc6@mail.gmail.com>

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

--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Nov 20, 2006 at 01:31:01AM +0100, Attilio Rao wrote:
> 2006/11/20, mjacob@freebsd.org <mjacob@freebsd.org>:
> >There are *far* too many:
> >
> >        xpt_print_path(path);
> >        printf("foo\n");
> >
> >constructs. How about we just join them?
> >
> >=3D=3D=3D=3D //depot/projects/newisp/cam/cam_xpt.c#12 -=20
> >/home/FreeBSD/p4/newisp/cam/cam_xpt.c =3D=3D=3D=3D
> >@@ -63,6 +63,7 @@
> >  #include <cam/scsi/scsi_all.h>
> >  #include <cam/scsi/scsi_message.h>
> >  #include <cam/scsi/scsi_pass.h>
> >+#include <machine/stdarg.h>    /* 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);
> >+}
> >+
> >=3D=3D=3D=3D //depot/projects/newisp/cam/cam_xpt.h#1 -=20
> >/home/FreeBSD/p4/newisp/cam/cam_xpt.h =3D=3D=3D=3D
> >@@ -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=
,=20
> >...);
> >  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);
>=20
> Would not be better a preprocessing stub?
>=20
> something like:
>=20
> #define XPT_PRINT(path, fmt, ...) do {
>            \
>              xpt_print_path(path);
>                      \
>              printf(fmt, __VA_ARGS__);
>                  \
> } while (0)

Why?  What is gained?  FWIW, when I added if_printif it reduced kernel
size by several KB.  If there's a similar effect here we should take
advantage of it.

-- Brooks

--WIyZ46R2i8wDzkSu
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFYigpXY6L6fI4GtQRArVnAJ4tOroU+bqtgffUeyfDaQv2EGM6CACdH4VV
g3nXZkqGc13jTMxLJFD0d9A=
=J5U+
-----END PGP SIGNATURE-----

--WIyZ46R2i8wDzkSu--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061120221153.GA5155>