dm thin metadata: fix __udivdi3 undefined on 32-bit
[linux/fpc-iii.git] / drivers / nvdimm / bus.c
bloba71187c783b7475b4744941284af4e25a7d21dbe
1 /*
2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/vmalloc.h>
15 #include <linux/uaccess.h>
16 #include <linux/module.h>
17 #include <linux/blkdev.h>
18 #include <linux/fcntl.h>
19 #include <linux/async.h>
20 #include <linux/genhd.h>
21 #include <linux/ndctl.h>
22 #include <linux/sched.h>
23 #include <linux/slab.h>
24 #include <linux/fs.h>
25 #include <linux/io.h>
26 #include <linux/mm.h>
27 #include <linux/nd.h>
28 #include "nd-core.h"
29 #include "nd.h"
31 int nvdimm_major;
32 static int nvdimm_bus_major;
33 static struct class *nd_class;
35 static int to_nd_device_type(struct device *dev)
37 if (is_nvdimm(dev))
38 return ND_DEVICE_DIMM;
39 else if (is_nd_pmem(dev))
40 return ND_DEVICE_REGION_PMEM;
41 else if (is_nd_blk(dev))
42 return ND_DEVICE_REGION_BLK;
43 else if (is_nd_pmem(dev->parent) || is_nd_blk(dev->parent))
44 return nd_region_to_nstype(to_nd_region(dev->parent));
46 return 0;
49 static int nvdimm_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
52 * Ensure that region devices always have their numa node set as
53 * early as possible.
55 if (is_nd_pmem(dev) || is_nd_blk(dev))
56 set_dev_node(dev, to_nd_region(dev)->numa_node);
57 return add_uevent_var(env, "MODALIAS=" ND_DEVICE_MODALIAS_FMT,
58 to_nd_device_type(dev));
61 static int nvdimm_bus_match(struct device *dev, struct device_driver *drv)
63 struct nd_device_driver *nd_drv = to_nd_device_driver(drv);
65 return test_bit(to_nd_device_type(dev), &nd_drv->type);
68 static struct module *to_bus_provider(struct device *dev)
70 /* pin bus providers while regions are enabled */
71 if (is_nd_pmem(dev) || is_nd_blk(dev)) {
72 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
74 return nvdimm_bus->module;
76 return NULL;
79 static void nvdimm_bus_probe_start(struct nvdimm_bus *nvdimm_bus)
81 nvdimm_bus_lock(&nvdimm_bus->dev);
82 nvdimm_bus->probe_active++;
83 nvdimm_bus_unlock(&nvdimm_bus->dev);
86 static void nvdimm_bus_probe_end(struct nvdimm_bus *nvdimm_bus)
88 nvdimm_bus_lock(&nvdimm_bus->dev);
89 if (--nvdimm_bus->probe_active == 0)
90 wake_up(&nvdimm_bus->probe_wait);
91 nvdimm_bus_unlock(&nvdimm_bus->dev);
94 static int nvdimm_bus_probe(struct device *dev)
96 struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver);
97 struct module *provider = to_bus_provider(dev);
98 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
99 int rc;
101 if (!try_module_get(provider))
102 return -ENXIO;
104 nvdimm_bus_probe_start(nvdimm_bus);
105 rc = nd_drv->probe(dev);
106 if (rc == 0)
107 nd_region_probe_success(nvdimm_bus, dev);
108 else
109 nd_region_disable(nvdimm_bus, dev);
110 nvdimm_bus_probe_end(nvdimm_bus);
112 dev_dbg(&nvdimm_bus->dev, "%s.probe(%s) = %d\n", dev->driver->name,
113 dev_name(dev), rc);
115 if (rc != 0)
116 module_put(provider);
117 return rc;
120 static int nvdimm_bus_remove(struct device *dev)
122 struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver);
123 struct module *provider = to_bus_provider(dev);
124 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
125 int rc;
127 rc = nd_drv->remove(dev);
128 nd_region_disable(nvdimm_bus, dev);
130 dev_dbg(&nvdimm_bus->dev, "%s.remove(%s) = %d\n", dev->driver->name,
131 dev_name(dev), rc);
132 module_put(provider);
133 return rc;
136 static struct bus_type nvdimm_bus_type = {
137 .name = "nd",
138 .uevent = nvdimm_bus_uevent,
139 .match = nvdimm_bus_match,
140 .probe = nvdimm_bus_probe,
141 .remove = nvdimm_bus_remove,
144 static ASYNC_DOMAIN_EXCLUSIVE(nd_async_domain);
146 void nd_synchronize(void)
148 async_synchronize_full_domain(&nd_async_domain);
150 EXPORT_SYMBOL_GPL(nd_synchronize);
152 static void nd_async_device_register(void *d, async_cookie_t cookie)
154 struct device *dev = d;
156 if (device_add(dev) != 0) {
157 dev_err(dev, "%s: failed\n", __func__);
158 put_device(dev);
160 put_device(dev);
163 static void nd_async_device_unregister(void *d, async_cookie_t cookie)
165 struct device *dev = d;
167 /* flush bus operations before delete */
168 nvdimm_bus_lock(dev);
169 nvdimm_bus_unlock(dev);
171 device_unregister(dev);
172 put_device(dev);
175 void __nd_device_register(struct device *dev)
177 dev->bus = &nvdimm_bus_type;
178 get_device(dev);
179 async_schedule_domain(nd_async_device_register, dev,
180 &nd_async_domain);
183 void nd_device_register(struct device *dev)
185 device_initialize(dev);
186 __nd_device_register(dev);
188 EXPORT_SYMBOL(nd_device_register);
190 void nd_device_unregister(struct device *dev, enum nd_async_mode mode)
192 switch (mode) {
193 case ND_ASYNC:
194 get_device(dev);
195 async_schedule_domain(nd_async_device_unregister, dev,
196 &nd_async_domain);
197 break;
198 case ND_SYNC:
199 nd_synchronize();
200 device_unregister(dev);
201 break;
204 EXPORT_SYMBOL(nd_device_unregister);
207 * __nd_driver_register() - register a region or a namespace driver
208 * @nd_drv: driver to register
209 * @owner: automatically set by nd_driver_register() macro
210 * @mod_name: automatically set by nd_driver_register() macro
212 int __nd_driver_register(struct nd_device_driver *nd_drv, struct module *owner,
213 const char *mod_name)
215 struct device_driver *drv = &nd_drv->drv;
217 if (!nd_drv->type) {
218 pr_debug("driver type bitmask not set (%pf)\n",
219 __builtin_return_address(0));
220 return -EINVAL;
223 if (!nd_drv->probe || !nd_drv->remove) {
224 pr_debug("->probe() and ->remove() must be specified\n");
225 return -EINVAL;
228 drv->bus = &nvdimm_bus_type;
229 drv->owner = owner;
230 drv->mod_name = mod_name;
232 return driver_register(drv);
234 EXPORT_SYMBOL(__nd_driver_register);
236 int nvdimm_revalidate_disk(struct gendisk *disk)
238 struct device *dev = disk->driverfs_dev;
239 struct nd_region *nd_region = to_nd_region(dev->parent);
240 int disk_ro = get_disk_ro(disk);
243 * Upgrade to read-only if the region is read-only preserve as
244 * read-only if the disk is already read-only.
246 if (disk_ro || nd_region->ro == disk_ro)
247 return 0;
249 dev_info(dev, "%s read-only, marking %s read-only\n",
250 dev_name(&nd_region->dev), disk->disk_name);
251 set_disk_ro(disk, 1);
253 return 0;
256 EXPORT_SYMBOL(nvdimm_revalidate_disk);
258 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
259 char *buf)
261 return sprintf(buf, ND_DEVICE_MODALIAS_FMT "\n",
262 to_nd_device_type(dev));
264 static DEVICE_ATTR_RO(modalias);
266 static ssize_t devtype_show(struct device *dev, struct device_attribute *attr,
267 char *buf)
269 return sprintf(buf, "%s\n", dev->type->name);
271 static DEVICE_ATTR_RO(devtype);
273 static struct attribute *nd_device_attributes[] = {
274 &dev_attr_modalias.attr,
275 &dev_attr_devtype.attr,
276 NULL,
280 * nd_device_attribute_group - generic attributes for all devices on an nd bus
282 struct attribute_group nd_device_attribute_group = {
283 .attrs = nd_device_attributes,
285 EXPORT_SYMBOL_GPL(nd_device_attribute_group);
287 static ssize_t numa_node_show(struct device *dev,
288 struct device_attribute *attr, char *buf)
290 return sprintf(buf, "%d\n", dev_to_node(dev));
292 static DEVICE_ATTR_RO(numa_node);
294 static struct attribute *nd_numa_attributes[] = {
295 &dev_attr_numa_node.attr,
296 NULL,
299 static umode_t nd_numa_attr_visible(struct kobject *kobj, struct attribute *a,
300 int n)
302 if (!IS_ENABLED(CONFIG_NUMA))
303 return 0;
305 return a->mode;
309 * nd_numa_attribute_group - NUMA attributes for all devices on an nd bus
311 struct attribute_group nd_numa_attribute_group = {
312 .attrs = nd_numa_attributes,
313 .is_visible = nd_numa_attr_visible,
315 EXPORT_SYMBOL_GPL(nd_numa_attribute_group);
317 int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
319 dev_t devt = MKDEV(nvdimm_bus_major, nvdimm_bus->id);
320 struct device *dev;
322 dev = device_create(nd_class, &nvdimm_bus->dev, devt, nvdimm_bus,
323 "ndctl%d", nvdimm_bus->id);
325 if (IS_ERR(dev)) {
326 dev_dbg(&nvdimm_bus->dev, "failed to register ndctl%d: %ld\n",
327 nvdimm_bus->id, PTR_ERR(dev));
328 return PTR_ERR(dev);
330 return 0;
333 void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus)
335 device_destroy(nd_class, MKDEV(nvdimm_bus_major, nvdimm_bus->id));
338 static const struct nd_cmd_desc __nd_cmd_dimm_descs[] = {
339 [ND_CMD_IMPLEMENTED] = { },
340 [ND_CMD_SMART] = {
341 .out_num = 2,
342 .out_sizes = { 4, 128, },
344 [ND_CMD_SMART_THRESHOLD] = {
345 .out_num = 2,
346 .out_sizes = { 4, 8, },
348 [ND_CMD_DIMM_FLAGS] = {
349 .out_num = 2,
350 .out_sizes = { 4, 4 },
352 [ND_CMD_GET_CONFIG_SIZE] = {
353 .out_num = 3,
354 .out_sizes = { 4, 4, 4, },
356 [ND_CMD_GET_CONFIG_DATA] = {
357 .in_num = 2,
358 .in_sizes = { 4, 4, },
359 .out_num = 2,
360 .out_sizes = { 4, UINT_MAX, },
362 [ND_CMD_SET_CONFIG_DATA] = {
363 .in_num = 3,
364 .in_sizes = { 4, 4, UINT_MAX, },
365 .out_num = 1,
366 .out_sizes = { 4, },
368 [ND_CMD_VENDOR] = {
369 .in_num = 3,
370 .in_sizes = { 4, 4, UINT_MAX, },
371 .out_num = 3,
372 .out_sizes = { 4, 4, UINT_MAX, },
376 const struct nd_cmd_desc *nd_cmd_dimm_desc(int cmd)
378 if (cmd < ARRAY_SIZE(__nd_cmd_dimm_descs))
379 return &__nd_cmd_dimm_descs[cmd];
380 return NULL;
382 EXPORT_SYMBOL_GPL(nd_cmd_dimm_desc);
384 static const struct nd_cmd_desc __nd_cmd_bus_descs[] = {
385 [ND_CMD_IMPLEMENTED] = { },
386 [ND_CMD_ARS_CAP] = {
387 .in_num = 2,
388 .in_sizes = { 8, 8, },
389 .out_num = 2,
390 .out_sizes = { 4, 4, },
392 [ND_CMD_ARS_START] = {
393 .in_num = 4,
394 .in_sizes = { 8, 8, 2, 6, },
395 .out_num = 1,
396 .out_sizes = { 4, },
398 [ND_CMD_ARS_STATUS] = {
399 .out_num = 2,
400 .out_sizes = { 4, UINT_MAX, },
404 const struct nd_cmd_desc *nd_cmd_bus_desc(int cmd)
406 if (cmd < ARRAY_SIZE(__nd_cmd_bus_descs))
407 return &__nd_cmd_bus_descs[cmd];
408 return NULL;
410 EXPORT_SYMBOL_GPL(nd_cmd_bus_desc);
412 u32 nd_cmd_in_size(struct nvdimm *nvdimm, int cmd,
413 const struct nd_cmd_desc *desc, int idx, void *buf)
415 if (idx >= desc->in_num)
416 return UINT_MAX;
418 if (desc->in_sizes[idx] < UINT_MAX)
419 return desc->in_sizes[idx];
421 if (nvdimm && cmd == ND_CMD_SET_CONFIG_DATA && idx == 2) {
422 struct nd_cmd_set_config_hdr *hdr = buf;
424 return hdr->in_length;
425 } else if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2) {
426 struct nd_cmd_vendor_hdr *hdr = buf;
428 return hdr->in_length;
431 return UINT_MAX;
433 EXPORT_SYMBOL_GPL(nd_cmd_in_size);
435 u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
436 const struct nd_cmd_desc *desc, int idx, const u32 *in_field,
437 const u32 *out_field)
439 if (idx >= desc->out_num)
440 return UINT_MAX;
442 if (desc->out_sizes[idx] < UINT_MAX)
443 return desc->out_sizes[idx];
445 if (nvdimm && cmd == ND_CMD_GET_CONFIG_DATA && idx == 1)
446 return in_field[1];
447 else if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2)
448 return out_field[1];
449 else if (!nvdimm && cmd == ND_CMD_ARS_STATUS && idx == 1)
450 return ND_CMD_ARS_STATUS_MAX;
452 return UINT_MAX;
454 EXPORT_SYMBOL_GPL(nd_cmd_out_size);
456 void wait_nvdimm_bus_probe_idle(struct device *dev)
458 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
460 do {
461 if (nvdimm_bus->probe_active == 0)
462 break;
463 nvdimm_bus_unlock(&nvdimm_bus->dev);
464 wait_event(nvdimm_bus->probe_wait,
465 nvdimm_bus->probe_active == 0);
466 nvdimm_bus_lock(&nvdimm_bus->dev);
467 } while (true);
470 /* set_config requires an idle interleave set */
471 static int nd_cmd_clear_to_send(struct nvdimm *nvdimm, unsigned int cmd)
473 struct nvdimm_bus *nvdimm_bus;
475 if (!nvdimm || cmd != ND_CMD_SET_CONFIG_DATA)
476 return 0;
478 nvdimm_bus = walk_to_nvdimm_bus(&nvdimm->dev);
479 wait_nvdimm_bus_probe_idle(&nvdimm_bus->dev);
481 if (atomic_read(&nvdimm->busy))
482 return -EBUSY;
483 return 0;
486 static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
487 int read_only, unsigned int ioctl_cmd, unsigned long arg)
489 struct nvdimm_bus_descriptor *nd_desc = nvdimm_bus->nd_desc;
490 size_t buf_len = 0, in_len = 0, out_len = 0;
491 static char out_env[ND_CMD_MAX_ENVELOPE];
492 static char in_env[ND_CMD_MAX_ENVELOPE];
493 const struct nd_cmd_desc *desc = NULL;
494 unsigned int cmd = _IOC_NR(ioctl_cmd);
495 void __user *p = (void __user *) arg;
496 struct device *dev = &nvdimm_bus->dev;
497 const char *cmd_name, *dimm_name;
498 unsigned long dsm_mask;
499 void *buf;
500 int rc, i;
502 if (nvdimm) {
503 desc = nd_cmd_dimm_desc(cmd);
504 cmd_name = nvdimm_cmd_name(cmd);
505 dsm_mask = nvdimm->dsm_mask ? *(nvdimm->dsm_mask) : 0;
506 dimm_name = dev_name(&nvdimm->dev);
507 } else {
508 desc = nd_cmd_bus_desc(cmd);
509 cmd_name = nvdimm_bus_cmd_name(cmd);
510 dsm_mask = nd_desc->dsm_mask;
511 dimm_name = "bus";
514 if (!desc || (desc->out_num + desc->in_num == 0) ||
515 !test_bit(cmd, &dsm_mask))
516 return -ENOTTY;
518 /* fail write commands (when read-only) */
519 if (read_only)
520 switch (cmd) {
521 case ND_CMD_VENDOR:
522 case ND_CMD_SET_CONFIG_DATA:
523 case ND_CMD_ARS_START:
524 dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
525 nvdimm ? nvdimm_cmd_name(cmd)
526 : nvdimm_bus_cmd_name(cmd));
527 return -EPERM;
528 default:
529 break;
532 /* process an input envelope */
533 for (i = 0; i < desc->in_num; i++) {
534 u32 in_size, copy;
536 in_size = nd_cmd_in_size(nvdimm, cmd, desc, i, in_env);
537 if (in_size == UINT_MAX) {
538 dev_err(dev, "%s:%s unknown input size cmd: %s field: %d\n",
539 __func__, dimm_name, cmd_name, i);
540 return -ENXIO;
542 if (in_len < sizeof(in_env))
543 copy = min_t(u32, sizeof(in_env) - in_len, in_size);
544 else
545 copy = 0;
546 if (copy && copy_from_user(&in_env[in_len], p + in_len, copy))
547 return -EFAULT;
548 in_len += in_size;
551 /* process an output envelope */
552 for (i = 0; i < desc->out_num; i++) {
553 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i,
554 (u32 *) in_env, (u32 *) out_env);
555 u32 copy;
557 if (out_size == UINT_MAX) {
558 dev_dbg(dev, "%s:%s unknown output size cmd: %s field: %d\n",
559 __func__, dimm_name, cmd_name, i);
560 return -EFAULT;
562 if (out_len < sizeof(out_env))
563 copy = min_t(u32, sizeof(out_env) - out_len, out_size);
564 else
565 copy = 0;
566 if (copy && copy_from_user(&out_env[out_len],
567 p + in_len + out_len, copy))
568 return -EFAULT;
569 out_len += out_size;
572 buf_len = out_len + in_len;
573 if (buf_len > ND_IOCTL_MAX_BUFLEN) {
574 dev_dbg(dev, "%s:%s cmd: %s buf_len: %zu > %d\n", __func__,
575 dimm_name, cmd_name, buf_len,
576 ND_IOCTL_MAX_BUFLEN);
577 return -EINVAL;
580 buf = vmalloc(buf_len);
581 if (!buf)
582 return -ENOMEM;
584 if (copy_from_user(buf, p, buf_len)) {
585 rc = -EFAULT;
586 goto out;
589 nvdimm_bus_lock(&nvdimm_bus->dev);
590 rc = nd_cmd_clear_to_send(nvdimm, cmd);
591 if (rc)
592 goto out_unlock;
594 rc = nd_desc->ndctl(nd_desc, nvdimm, cmd, buf, buf_len);
595 if (rc < 0)
596 goto out_unlock;
597 nvdimm_bus_unlock(&nvdimm_bus->dev);
599 if (copy_to_user(p, buf, buf_len))
600 rc = -EFAULT;
602 vfree(buf);
603 return rc;
605 out_unlock:
606 nvdimm_bus_unlock(&nvdimm_bus->dev);
607 out:
608 vfree(buf);
609 return rc;
612 static long nd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
614 long id = (long) file->private_data;
615 int rc = -ENXIO, read_only;
616 struct nvdimm_bus *nvdimm_bus;
618 read_only = (O_RDWR != (file->f_flags & O_ACCMODE));
619 mutex_lock(&nvdimm_bus_list_mutex);
620 list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
621 if (nvdimm_bus->id == id) {
622 rc = __nd_ioctl(nvdimm_bus, NULL, read_only, cmd, arg);
623 break;
626 mutex_unlock(&nvdimm_bus_list_mutex);
628 return rc;
631 static int match_dimm(struct device *dev, void *data)
633 long id = (long) data;
635 if (is_nvdimm(dev)) {
636 struct nvdimm *nvdimm = to_nvdimm(dev);
638 return nvdimm->id == id;
641 return 0;
644 static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
646 int rc = -ENXIO, read_only;
647 struct nvdimm_bus *nvdimm_bus;
649 read_only = (O_RDWR != (file->f_flags & O_ACCMODE));
650 mutex_lock(&nvdimm_bus_list_mutex);
651 list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
652 struct device *dev = device_find_child(&nvdimm_bus->dev,
653 file->private_data, match_dimm);
654 struct nvdimm *nvdimm;
656 if (!dev)
657 continue;
659 nvdimm = to_nvdimm(dev);
660 rc = __nd_ioctl(nvdimm_bus, nvdimm, read_only, cmd, arg);
661 put_device(dev);
662 break;
664 mutex_unlock(&nvdimm_bus_list_mutex);
666 return rc;
669 static int nd_open(struct inode *inode, struct file *file)
671 long minor = iminor(inode);
673 file->private_data = (void *) minor;
674 return 0;
677 static const struct file_operations nvdimm_bus_fops = {
678 .owner = THIS_MODULE,
679 .open = nd_open,
680 .unlocked_ioctl = nd_ioctl,
681 .compat_ioctl = nd_ioctl,
682 .llseek = noop_llseek,
685 static const struct file_operations nvdimm_fops = {
686 .owner = THIS_MODULE,
687 .open = nd_open,
688 .unlocked_ioctl = nvdimm_ioctl,
689 .compat_ioctl = nvdimm_ioctl,
690 .llseek = noop_llseek,
693 int __init nvdimm_bus_init(void)
695 int rc;
697 rc = bus_register(&nvdimm_bus_type);
698 if (rc)
699 return rc;
701 rc = register_chrdev(0, "ndctl", &nvdimm_bus_fops);
702 if (rc < 0)
703 goto err_bus_chrdev;
704 nvdimm_bus_major = rc;
706 rc = register_chrdev(0, "dimmctl", &nvdimm_fops);
707 if (rc < 0)
708 goto err_dimm_chrdev;
709 nvdimm_major = rc;
711 nd_class = class_create(THIS_MODULE, "nd");
712 if (IS_ERR(nd_class)) {
713 rc = PTR_ERR(nd_class);
714 goto err_class;
717 return 0;
719 err_class:
720 unregister_chrdev(nvdimm_major, "dimmctl");
721 err_dimm_chrdev:
722 unregister_chrdev(nvdimm_bus_major, "ndctl");
723 err_bus_chrdev:
724 bus_unregister(&nvdimm_bus_type);
726 return rc;
729 void nvdimm_bus_exit(void)
731 class_destroy(nd_class);
732 unregister_chrdev(nvdimm_bus_major, "ndctl");
733 unregister_chrdev(nvdimm_major, "dimmctl");
734 bus_unregister(&nvdimm_bus_type);