Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: iscsid: cleanup initiator functions a bit
To:
Sebastien Marie <semarie@kapouay.eu.org>
Cc:
tech@openbsd.org, Jack Burton <jack@saosce.com.au>
Date:
Wed, 22 Jan 2025 15:03:26 +0100

Download raw body.

Thread
On Wed, Jan 22, 2025 at 02:43:45PM +0100, Sebastien Marie wrote:
> Claudio Jeker <cjeker@diehard.n-r-g.com> writes:
> 
> > The initator object is a singleton and there is no need to pass a pointer
> > around for it. The result is a somewhat cleaner interaction between
> > sessions and initator.
> >
> > Tested against netbsd-iscsi-target.
> 
> just one remark, else it is fine with me.
> 
> 
> -struct session *
> -session_new(struct initiator *i, u_int8_t st)
> -{
> -	struct session *s;
> -
> -	if (!(s = calloc(1, sizeof(*s))))
> -		return NULL;
> -
> -	/* use the same qualifier unless there is a conflict */
> -	s->isid_base = i->config.isid_base;
> -	s->isid_qual = i->config.isid_qual;
> -	s->cmdseqnum = arc4random();
> -	s->itt = arc4random();
> -	s->initiator = i;
> 
> in the rewrite of `session_new()' to `initiator_new_session()', the
> `initiator` member isn't copied. it is fine as it is static variable
> now.
> 
> but could we remove the field from `struct session` too ?

Good point. We should do that indeed.

-- 
:wq Claudio