nvme_ns.c (253474) | nvme_ns.c (254389) |
---|---|
1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns.c 253474 2013-07-19 21:33:24Z jimharris $"); | 28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns.c 254389 2013-08-15 22:52:39Z ken $"); |
29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/disk.h> 35#include <sys/fcntl.h> 36#include <sys/ioccom.h> --- 91 unchanged lines hidden (view full) --- 128 bp->bio_resid = bp->bio_bcount; 129 biodone(bp); 130 } 131 132} 133 134static struct cdevsw nvme_ns_cdevsw = { 135 .d_version = D_VERSION, | 29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/disk.h> 35#include <sys/fcntl.h> 36#include <sys/ioccom.h> --- 91 unchanged lines hidden (view full) --- 128 bp->bio_resid = bp->bio_bcount; 129 biodone(bp); 130 } 131 132} 133 134static struct cdevsw nvme_ns_cdevsw = { 135 .d_version = D_VERSION, |
136#ifdef NVME_UNMAPPED_BIO_SUPPORT 137 .d_flags = D_DISK | D_UNMAPPED_IO, 138#else | |
139 .d_flags = D_DISK, | 136 .d_flags = D_DISK, |
140#endif | |
141 .d_read = physread, 142 .d_write = physwrite, 143 .d_open = nvme_ns_open, 144 .d_close = nvme_ns_close, 145 .d_strategy = nvme_ns_strategy, 146 .d_ioctl = nvme_ns_ioctl 147}; 148 --- 194 unchanged lines hidden (view full) --- 343 ns->cdev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &nvme_ns_cdevsw, 0, 344 NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", 345 device_get_unit(ctrlr->dev), ns->id); 346#else 347 ns->cdev = make_dev_credf(0, &nvme_ns_cdevsw, 0, 348 NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", 349 device_get_unit(ctrlr->dev), ns->id); 350#endif | 137 .d_read = physread, 138 .d_write = physwrite, 139 .d_open = nvme_ns_open, 140 .d_close = nvme_ns_close, 141 .d_strategy = nvme_ns_strategy, 142 .d_ioctl = nvme_ns_ioctl 143}; 144 --- 194 unchanged lines hidden (view full) --- 339 ns->cdev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &nvme_ns_cdevsw, 0, 340 NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", 341 device_get_unit(ctrlr->dev), ns->id); 342#else 343 ns->cdev = make_dev_credf(0, &nvme_ns_cdevsw, 0, 344 NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", 345 device_get_unit(ctrlr->dev), ns->id); 346#endif |
347#ifdef NVME_UNMAPPED_BIO_SUPPORT 348 ns->cdev->si_flags |= SI_UNMAPPED; 349#endif |
|
351 352 if (ns->cdev != NULL) 353 ns->cdev->si_drv1 = ns; 354 355 return (0); 356} 357 358void nvme_ns_destruct(struct nvme_namespace *ns) 359{ 360 361 if (ns->cdev != NULL) 362 destroy_dev(ns->cdev); 363} | 350 351 if (ns->cdev != NULL) 352 ns->cdev->si_drv1 = ns; 353 354 return (0); 355} 356 357void nvme_ns_destruct(struct nvme_namespace *ns) 358{ 359 360 if (ns->cdev != NULL) 361 destroy_dev(ns->cdev); 362} |