static struct request *emc_trespass_get(struct emc_handler *h, struct path *path) { struct bio *bio; struct request *rq; unsigned char *page22; unsigned char long_trespass_pg[] = { 0, 0, 0, 0, TRESPASS_PAGE, /* Page code */ 0x09, /* Page length - 2 */ h->hr ? 0x01 : 0x81, /* Trespass code + Honor reservation bit */ 0xff, 0xff, /* Trespass target */ 0, 0, 0, 0, 0, 0 /* Reserved bytes / unknown */ }; unsigned char short_trespass_pg[] = { 0, 0, 0, 0, TRESPASS_PAGE, /* Page code */ 0x02, /* Page length - 2 */ h->hr ? 0x01 : 0x81, /* Trespass code + Honor reservation bit */ 0xff, /* Trespass target */ }; unsigned data_size = h->short_trespass ? sizeof(short_trespass_pg) : sizeof(long_trespass_pg); /* get bio backing */ if (data_size > PAGE_SIZE) /* this should never happen */ return NULL; bio = get_failover_bio(path, data_size); if (!bio) { DMERR("dm-emc: emc_trespass_get: no bio"); return NULL; } page22 = (unsigned char *)bio_data(bio); memset(page22, 0, data_size); memcpy(page22, h->short_trespass ? short_trespass_pg : long_trespass_pg, data_size); /* get request for block layer packet command */ rq = get_failover_req(h, bio, path); if (!rq) { DMERR("dm-emc: emc_trespass_get: no rq"); free_bio(bio); return NULL; } /* Prepare the command. */ rq->cmd[0] = MODE_SELECT; rq->cmd[1] = 0x10; rq->cmd[4] = data_size; rq->cmd_len = COMMAND_SIZE(rq->cmd[0]); return rq; }
static void emc_endio(struct bio *bio, int error) { struct dm_path *path = bio->bi_private; /* We also need to look at the sense keys here whether or not to * switch to the next PG etc. * * For now simple logic: either it works or it doesn't. */ if (error) dm_pg_init_complete(path, MP_FAIL_PATH); else dm_pg_init_complete(path, 0); /* request is freed in block layer */ free_bio(bio); }