Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2012 19:48:19 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Josh Paetzel <jpaetzel@FreeBSD.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r234425 - in head: sbin/iscontrol sys/modules/iscsi/initiator
Message-ID:  <D0A9ABB4-C4E2-4D0A-868F-132C4688FECA@gmail.com>
In-Reply-To: <201204181647.q3IGlvjq040763@svn.freebsd.org>
References:  <201204181647.q3IGlvjq040763@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Apr 18, 2012, at 9:47 AM, Josh Paetzel <jpaetzel@FreeBSD.org> wrote:

> Author: jpaetzel
> Date: Wed Apr 18 16:47:57 2012
> New Revision: 234425
> URL: http://svn.freebsd.org/changeset/base/234425
>=20
> Log:
> Unbreak tinderbox.
>=20
> Fix FreeBSD paradigms in the upstream code.
>=20
> PR:    bin/166933
> Submitted by:    Garrett Cooper <yanegomi@gmail.com>
>=20
> Modified:
> head/sbin/iscontrol/Makefile
> head/sbin/iscontrol/iscontrol.c
> head/sys/modules/iscsi/initiator/Makefile
>=20
> Modified: head/sbin/iscontrol/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> --- head/sbin/iscontrol/Makefile    Wed Apr 18 16:29:55 2012    (r234424)
> +++ head/sbin/iscontrol/Makefile    Wed Apr 18 16:47:57 2012    (r234425)
> @@ -7,8 +7,7 @@ LDADD=3D -lcam -lmd
> S=3D ${.CURDIR}/../../sys
>=20
> WARNS?=3D    3
> -CFLAGS +=3D -I$S
> -CFLAGS +=3D -g -DDEBUG
> +CFLAGS+=3D    -I$S
>=20
> MAN=3D iscsi.conf.5 iscontrol.8
>=20
>=20
> Modified: head/sbin/iscontrol/iscontrol.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> --- head/sbin/iscontrol/iscontrol.c    Wed Apr 18 16:29:55 2012    (r23442=
4)
> +++ head/sbin/iscontrol/iscontrol.c    Wed Apr 18 16:47:57 2012    (r23442=
5)
> @@ -44,13 +44,15 @@ __FBSDID("$FreeBSD$");
> #include <arpa/inet.h>
> #include <sys/ioctl.h>
> #include <netdb.h>
> -#include <stdlib.h>
> -#include <unistd.h>
> -#include <stdio.h>
> -#include <string.h>
> +#include <err.h>
> #include <errno.h>
> #include <fcntl.h>
> +#include <libgen.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> #include <time.h>
> +#include <unistd.h>
> #include <camlib.h>
>=20
> #include <dev/iscsi/initiator/iscsi.h>
> @@ -111,6 +113,13 @@ isc_opt_t opvals =3D {
>     .immediateData        =3D TRUE,
> };
>=20
> +static void
> +usage(const char *pname)
> +{
> +    fprintf(stderr, "usage: %s " USAGE "\n", pname);
> +    exit(1);
> +}
> +
> int
> lookup(token_t *tbl, char *m)
> {
> @@ -135,8 +144,8 @@ main(int cc, char **vv)
>     iscsidev =3D "/dev/"ISCSIDEV;
>     fd =3D NULL;
>     pname =3D vv[0];
> -     if((p =3D strrchr(pname, '/')) !=3D NULL)
> -      pname =3D p + 1;
> +     if ((pname =3D basename(pname)) =3D=3D NULL)
> +      err(1, "basename");
>=20
>     kw =3D ta =3D 0;
>     disco =3D 0;
> @@ -145,17 +154,21 @@ main(int cc, char **vv)
>      | check for driver & controller version match
>      */
>     n =3D 0;
> -     if(sysctlbyname("net.iscsi_initiator.driver_version", 0, &n, 0, 0) !=
=3D 0)
> -      perror("sysctlbyname");
> -     v =3D malloc(n+1);
> -     if(sysctlbyname("net.iscsi_initiator.driver_version", v, &n, 0, 0) !=
=3D 0)
> -      perror("sysctlbyname");
> -
> -     if(strncmp(version, v, 3)) {
> -      fprintf(stderr, "versions missmatch\n");
> -      exit(1);
> +#define VERSION_OID_S    "net.iscsi_initiator.driver_version"
> +     if (sysctlbyname(VERSION_OID_S, 0, &n, 0, 0) !=3D 0) {
> +      if (errno =3D=3D ENOENT)
> +        errx(1, "sysctlbyname(\"" VERSION_OID_S "\") "
> +            "failed; is the iscsi driver loaded?");
> +      err(1, "sysctlbyname(\"" VERSION_OID_S "\")");
>     }
> +     v =3D malloc(n+1);
> +     if (v =3D=3D NULL)
> +      err(1, "malloc");
> +     if (sysctlbyname(VERSION_OID_S, v, &n, 0, 0) !=3D 0)
> +      err(1, "sysctlbyname");
>=20
> +     if (strncmp(version, v, 3) !=3D 0)
> +      errx(1, "versions mismatch");
>=20
>     while((ch =3D getopt(cc, vv, OPTIONS)) !=3D -1) {
>     switch(ch) {
> @@ -164,10 +177,8 @@ main(int cc, char **vv)
>          break;
>     case 'c':
>          fd =3D fopen(optarg, "r");
> -           if(fd =3D=3D NULL) {
> -            perror(optarg);
> -            exit(1);
> -           }
> +           if (fd =3D=3D NULL)
> +            err(1, "fopen(\"%s\")", optarg);
>          break;
>     case 'd':
>          disco =3D 1;
> @@ -182,9 +193,7 @@ main(int cc, char **vv)
>          pidfile =3D optarg;
>          break;
>     default:
> -      badu:
> -           fprintf(stderr, "Usage: %s %s\n", pname, USAGE);
> -           exit(1);
> +           usage(pname);
>     }
>     }
>     if(fd =3D=3D NULL)
> @@ -205,8 +214,8 @@ main(int cc, char **vv)
>     op->targetAddress =3D ta;
>=20
>     if(op->targetAddress =3D=3D NULL) {
> -      fprintf(stderr, "No target!\n");
> -      goto badu;
> +      warnx("no target specified!");
> +      usage(pname);
>     }
>     q =3D op->targetAddress;
>     if(*q =3D=3D '[' && (q =3D strchr(q, ']')) !=3D NULL) {
> @@ -224,7 +233,7 @@ main(int cc, char **vv)
>     op->targetPortalGroupTag =3D atoi(p);
>     }
>     if(op->initiatorName =3D=3D 0) {
> -      char    hostname[256];
> +      char    hostname[MAXHOSTNAMELEN];
>=20
>     if(op->iqn) {
>          if(gethostname(hostname, sizeof(hostname)) =3D=3D 0)
>=20
> Modified: head/sys/modules/iscsi/initiator/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> --- head/sys/modules/iscsi/initiator/Makefile    Wed Apr 18 16:29:55 2012 =
   (r234424)
> +++ head/sys/modules/iscsi/initiator/Makefile    Wed Apr 18 16:47:57 2012 =
   (r234425)
> @@ -10,7 +10,9 @@ SRCS+=3D iscsi.c isc_cam.c isc_soc.c isc_s
> SRCS+=3D opt_cam.h opt_iscsi_initiator.h
> SRCS+=3D bus_if.h device_if.h
> #CFLAGS+=3D -DNO_USE_MBUF
> +CFLAGS+=3D -DISCSI_INITIATOR_DEBUG=3D2
> #CFLAGS+=3D -DISCSI_INITIATOR_DEBUG=3D2
> +CFLAGS+=3D -DINVARIANTS
> CFLAGS+=3D -I$S
> CFLAGS+=3D -DINVARIANTS
> .include <bsd.kmod.mk>

Uh... Somehow the diff I provided got reversed. This commit broke tinderbox [=
again] ;/...
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0A9ABB4-C4E2-4D0A-868F-132C4688FECA>