Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/nvme/nvme_da.c
| Show First 20 Lines • Show All 924 Lines • ▼ Show 20 Lines | ndaregister(struct cam_periph *periph, void *arg) | ||||
| if ((cpi.hba_misc & PIM_UNMAPPED) != 0) { | if ((cpi.hba_misc & PIM_UNMAPPED) != 0) { | ||||
| disk->d_flags |= DISKFLAG_UNMAPPED_BIO; | disk->d_flags |= DISKFLAG_UNMAPPED_BIO; | ||||
| softc->unmappedio = 1; | softc->unmappedio = 1; | ||||
| } | } | ||||
| /* | /* | ||||
| * d_ident and d_descr are both far bigger than the length of either | * d_ident and d_descr are both far bigger than the length of either | ||||
| * the serial or model number strings. | * the serial or model number strings. | ||||
| */ | */ | ||||
| cam_strvis(disk->d_descr, cd->mn, | cam_strvis_flag(disk->d_descr, cd->mn, NVME_MODEL_NUMBER_LENGTH, | ||||
| NVME_MODEL_NUMBER_LENGTH, sizeof(disk->d_descr)); | sizeof(disk->d_descr), CAM_STRVIS_FLAG_NONASCII_SPC); | ||||
| cam_strvis(disk->d_ident, cd->sn, | |||||
| NVME_SERIAL_NUMBER_LENGTH, sizeof(disk->d_ident)); | cam_strvis_flag(disk->d_ident, cd->sn, NVME_SERIAL_NUMBER_LENGTH, | ||||
| sizeof(disk->d_ident), CAM_STRVIS_FLAG_NONASCII_SPC); | |||||
imp: These three statements are repeated 3 times. Please make it a function since it would also save… | |||||
| disk->d_hba_vendor = cpi.hba_vendor; | disk->d_hba_vendor = cpi.hba_vendor; | ||||
| disk->d_hba_device = cpi.hba_device; | disk->d_hba_device = cpi.hba_device; | ||||
| disk->d_hba_subvendor = cpi.hba_subvendor; | disk->d_hba_subvendor = cpi.hba_subvendor; | ||||
| disk->d_hba_subdevice = cpi.hba_subdevice; | disk->d_hba_subdevice = cpi.hba_subdevice; | ||||
| snprintf(disk->d_attachment, sizeof(disk->d_attachment), | snprintf(disk->d_attachment, sizeof(disk->d_attachment), | ||||
| "%s%d", cpi.dev_name, cpi.unit_number); | "%s%d", cpi.dev_name, cpi.unit_number); | ||||
| if (((nsd->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & | if (((nsd->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & | ||||
| NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && nsd->npwg != 0) | NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && nsd->npwg != 0) | ||||
| ▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines | |||||
These three statements are repeated 3 times. Please make it a function since it would also save at least one declarations of sb.