Deleted Added
full compact
iscsi.c (178330) iscsi.c (183397)
1/*-
2 * Copyright (c) 2005-2007 Daniel Braniss <danny@cs.huji.ac.il>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 *
26 */
27/*
28 | iSCSI
29 | $Id: iscsi.c,v 1.35 2007/04/22 08:58:29 danny Exp danny $
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005-2007 Daniel Braniss <danny@cs.huji.ac.il>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 *
26 */
27/*
28 | iSCSI
29 | $Id: iscsi.c,v 1.35 2007/04/22 08:58:29 danny Exp danny $
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/iscsi.c 178330 2008-04-20 15:56:59Z antoine $");
33__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/iscsi.c 183397 2008-09-27 08:51:18Z ed $");
34
35#include "opt_iscsi_initiator.h"
36
37#include <sys/param.h>
38#include <sys/kernel.h>
39#include <sys/module.h>
40#include <sys/conf.h>
41#include <sys/bus.h>

--- 68 unchanged lines hidden (view full) ---

110 .d_name = "iSCSI",
111};
112
113static int
114iscsi_open(struct cdev *dev, int flags, int otype, struct thread *td)
115{
116 debug_called(8);
117
34
35#include "opt_iscsi_initiator.h"
36
37#include <sys/param.h>
38#include <sys/kernel.h>
39#include <sys/module.h>
40#include <sys/conf.h>
41#include <sys/bus.h>

--- 68 unchanged lines hidden (view full) ---

110 .d_name = "iSCSI",
111};
112
113static int
114iscsi_open(struct cdev *dev, int flags, int otype, struct thread *td)
115{
116 debug_called(8);
117
118 debug(7, "dev=%d", minor(dev));
118 debug(7, "dev=%d", dev2unit(dev));
119
119
120 if(minor(dev) > MAX_SESSIONS) {
120 if(dev2unit(dev) > MAX_SESSIONS) {
121 // should not happen
122 return ENODEV;
123 }
121 // should not happen
122 return ENODEV;
123 }
124 if(minor(dev) == MAX_SESSIONS) {
124 if(dev2unit(dev) == MAX_SESSIONS) {
125#if 1
126 struct isc_softc *sc = (struct isc_softc *)dev->si_drv1;
127
128 // this should be in iscsi_start
129 if(sc->cam_sim == NULL)
130 ic_init(sc);
131#endif
132 }

--- 6 unchanged lines hidden (view full) ---

139 struct isc *sc;
140 isc_session_t *sp;
141
142 debug_called(8);
143
144 debug(3, "flag=%x", flag);
145
146 sc = (struct isc *)dev->si_drv1;
125#if 1
126 struct isc_softc *sc = (struct isc_softc *)dev->si_drv1;
127
128 // this should be in iscsi_start
129 if(sc->cam_sim == NULL)
130 ic_init(sc);
131#endif
132 }

--- 6 unchanged lines hidden (view full) ---

139 struct isc *sc;
140 isc_session_t *sp;
141
142 debug_called(8);
143
144 debug(3, "flag=%x", flag);
145
146 sc = (struct isc *)dev->si_drv1;
147 if(minor(dev) == MAX_SESSIONS) {
147 if(dev2unit(dev) == MAX_SESSIONS) {
148 return 0;
149 }
150 sp = (isc_session_t *)dev->si_drv2;
151 if(sp != NULL) {
148 return 0;
149 }
150 sp = (isc_session_t *)dev->si_drv2;
151 if(sp != NULL) {
152 sdebug(2, "session=%d flags=%x", minor(dev), sp->flags );
152 sdebug(2, "session=%d flags=%x", dev2unit(dev), sp->flags );
153 /*
154 | if still in full phase, this probably means
155 | that something went realy bad.
156 | it could be a result from 'shutdown', in which case
157 | we will ignore it (so buffers can be flushed).
158 | the problem is that there is no way of differentiating
159 | between a shutdown procedure and 'iscontrol' dying.
160 */

--- 13 unchanged lines hidden (view full) ---

174 isc_session_t *sp;
175 isc_opt_t *opt;
176 int error;
177
178 sc = (struct isc *)dev->si_drv1;
179 debug_called(8);
180
181 error = 0;
153 /*
154 | if still in full phase, this probably means
155 | that something went realy bad.
156 | it could be a result from 'shutdown', in which case
157 | we will ignore it (so buffers can be flushed).
158 | the problem is that there is no way of differentiating
159 | between a shutdown procedure and 'iscontrol' dying.
160 */

--- 13 unchanged lines hidden (view full) ---

174 isc_session_t *sp;
175 isc_opt_t *opt;
176 int error;
177
178 sc = (struct isc *)dev->si_drv1;
179 debug_called(8);
180
181 error = 0;
182 if(minor(dev) == MAX_SESSIONS) {
182 if(dev2unit(dev) == MAX_SESSIONS) {
183 /*
184 | non Session commands
185 */
186 if(sc == NULL)
187 return ENXIO;
188
189 switch(cmd) {
190 case ISCSISETSES:

--- 9 unchanged lines hidden (view full) ---

200 }
201 sp = (isc_session_t *)dev->si_drv2;
202 /*
203 | session commands
204 */
205 if(sp == NULL)
206 return ENXIO;
207
183 /*
184 | non Session commands
185 */
186 if(sc == NULL)
187 return ENXIO;
188
189 switch(cmd) {
190 case ISCSISETSES:

--- 9 unchanged lines hidden (view full) ---

200 }
201 sp = (isc_session_t *)dev->si_drv2;
202 /*
203 | session commands
204 */
205 if(sp == NULL)
206 return ENXIO;
207
208 sdebug(6, "dev=%d cmd=%d", minor(dev), (int)(cmd & 0xff));
208 sdebug(6, "dev=%d cmd=%d", dev2unit(dev), (int)(cmd & 0xff));
209
210 switch(cmd) {
211 case ISCSISETSOC:
212 error = i_setsoc(sp, *(u_int *)arg, td);
213 break;
214
215 case ISCSISETOPT:
216 opt = (isc_opt_t *)arg;

--- 63 unchanged lines hidden (view full) ---

280#ifdef ISCSI_INITIATOR_DEBUG
281 struct isc_softc *sc;
282 isc_session_t *sp;
283 pduq_t *pq;
284 char buf[1024];
285
286 sc = (struct isc_softc *)dev->si_drv1;
287 sp = (isc_session_t *)dev->si_drv2;
209
210 switch(cmd) {
211 case ISCSISETSOC:
212 error = i_setsoc(sp, *(u_int *)arg, td);
213 break;
214
215 case ISCSISETOPT:
216 opt = (isc_opt_t *)arg;

--- 63 unchanged lines hidden (view full) ---

280#ifdef ISCSI_INITIATOR_DEBUG
281 struct isc_softc *sc;
282 isc_session_t *sp;
283 pduq_t *pq;
284 char buf[1024];
285
286 sc = (struct isc_softc *)dev->si_drv1;
287 sp = (isc_session_t *)dev->si_drv2;
288 if(minor(dev) == MAX_SESSIONS) {
288 if(dev2unit(dev) == MAX_SESSIONS) {
289 sprintf(buf, "/----- Session ------/\n");
290 uiomove(buf, strlen(buf), uio);
291 int i = 0;
292
293 TAILQ_FOREACH(sp, &sc->isc_sess, sp_link) {
294 if(uio->uio_resid == 0)
295 return 0;
296 sprintf(buf, "%03d] '%s' '%s'\n", i++, sp->opt.targetAddress, sp->opt.targetName);

--- 515 unchanged lines hidden ---
289 sprintf(buf, "/----- Session ------/\n");
290 uiomove(buf, strlen(buf), uio);
291 int i = 0;
292
293 TAILQ_FOREACH(sp, &sc->isc_sess, sp_link) {
294 if(uio->uio_resid == 0)
295 return 0;
296 sprintf(buf, "%03d] '%s' '%s'\n", i++, sp->opt.targetAddress, sp->opt.targetName);

--- 515 unchanged lines hidden ---