Deleted Added
full compact
ctl_backend_ramdisk.c (240993) ctl_backend_ramdisk.c (252569)
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_ramdisk.c 240993 2012-09-27 10:51:38Z trasz $");
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_ramdisk.c 252569 2013-07-03 14:58:11Z mav $");
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

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

436 be_lun->flags |= CTL_BE_RAMDISK_LUN_WAITING;
437 mtx_unlock(&softc->lock);
438
439 retval = ctl_invalidate_lun(&be_lun->ctl_be_lun);
440 if (retval != 0) {
441 snprintf(req->error_str, sizeof(req->error_str),
442 "%s: error %d returned from ctl_invalidate_lun() for "
443 "LUN %d", __func__, retval, params->lun_id);
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

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

436 be_lun->flags |= CTL_BE_RAMDISK_LUN_WAITING;
437 mtx_unlock(&softc->lock);
438
439 retval = ctl_invalidate_lun(&be_lun->ctl_be_lun);
440 if (retval != 0) {
441 snprintf(req->error_str, sizeof(req->error_str),
442 "%s: error %d returned from ctl_invalidate_lun() for "
443 "LUN %d", __func__, retval, params->lun_id);
444 mtx_lock(&softc->lock);
445 be_lun->flags &= ~CTL_BE_RAMDISK_LUN_WAITING;
446 mtx_unlock(&softc->lock);
444 goto bailout_error;
445 }
446
447 mtx_lock(&softc->lock);
448
449 while ((be_lun->flags & CTL_BE_RAMDISK_LUN_UNCONFIGURED) == 0) {
450 retval = msleep(be_lun, &softc->lock, PCATCH, "ctlram", 0);
451 if (retval == EINTR)

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

470 if (retval == 0)
471 free(be_lun, M_RAMDISK);
472
473 req->status = CTL_LUN_OK;
474
475 return (retval);
476
477bailout_error:
447 goto bailout_error;
448 }
449
450 mtx_lock(&softc->lock);
451
452 while ((be_lun->flags & CTL_BE_RAMDISK_LUN_UNCONFIGURED) == 0) {
453 retval = msleep(be_lun, &softc->lock, PCATCH, "ctlram", 0);
454 if (retval == EINTR)

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

473 if (retval == 0)
474 free(be_lun, M_RAMDISK);
475
476 req->status = CTL_LUN_OK;
477
478 return (retval);
479
480bailout_error:
478
479 /*
480 * Don't leave the waiting flag set.
481 */
482 mtx_lock(&softc->lock);
483 be_lun->flags &= ~CTL_BE_RAMDISK_LUN_WAITING;
484 mtx_unlock(&softc->lock);
485
486 req->status = CTL_LUN_ERROR;
487
488 return (0);
489}
490
491static int
492ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
493 struct ctl_lun_req *req, int do_wait)

--- 402 unchanged lines hidden ---
481 req->status = CTL_LUN_ERROR;
482
483 return (0);
484}
485
486static int
487ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
488 struct ctl_lun_req *req, int do_wait)

--- 402 unchanged lines hidden ---