Index: sbin/camcontrol/camcontrol.c =================================================================== --- sbin/camcontrol/camcontrol.c +++ sbin/camcontrol/camcontrol.c @@ -66,52 +66,52 @@ #endif typedef enum { - CAM_CMD_NONE = 0x00000000, - CAM_CMD_DEVLIST = 0x00000001, - CAM_CMD_TUR = 0x00000002, - CAM_CMD_INQUIRY = 0x00000003, - CAM_CMD_STARTSTOP = 0x00000004, - CAM_CMD_RESCAN = 0x00000005, - CAM_CMD_READ_DEFECTS = 0x00000006, - CAM_CMD_MODE_PAGE = 0x00000007, - CAM_CMD_SCSI_CMD = 0x00000008, - CAM_CMD_DEVTREE = 0x00000009, - CAM_CMD_USAGE = 0x0000000a, - CAM_CMD_DEBUG = 0x0000000b, - CAM_CMD_RESET = 0x0000000c, - CAM_CMD_FORMAT = 0x0000000d, - CAM_CMD_TAG = 0x0000000e, - CAM_CMD_RATE = 0x0000000f, - CAM_CMD_DETACH = 0x00000010, - CAM_CMD_REPORTLUNS = 0x00000011, - CAM_CMD_READCAP = 0x00000012, - CAM_CMD_IDENTIFY = 0x00000013, - CAM_CMD_IDLE = 0x00000014, - CAM_CMD_STANDBY = 0x00000015, - CAM_CMD_SLEEP = 0x00000016, - CAM_CMD_SMP_CMD = 0x00000017, - CAM_CMD_SMP_RG = 0x00000018, - CAM_CMD_SMP_PC = 0x00000019, - CAM_CMD_SMP_PHYLIST = 0x0000001a, - CAM_CMD_SMP_MANINFO = 0x0000001b, - CAM_CMD_DOWNLOAD_FW = 0x0000001c, - CAM_CMD_SECURITY = 0x0000001d, - CAM_CMD_HPA = 0x0000001e, - CAM_CMD_SANITIZE = 0x0000001f, - CAM_CMD_PERSIST = 0x00000020, - CAM_CMD_APM = 0x00000021, - CAM_CMD_AAM = 0x00000022, - CAM_CMD_ATTRIB = 0x00000023, - CAM_CMD_OPCODES = 0x00000024, - CAM_CMD_REPROBE = 0x00000025, - CAM_CMD_ZONE = 0x00000026, - CAM_CMD_EPC = 0x00000027, - CAM_CMD_TIMESTAMP = 0x00000028, - CAM_CMD_MMCSD_CMD = 0x00000029, - CAM_CMD_POWER_MODE = 0x0000002a, - CAM_CMD_DEVTYPE = 0x0000002b, - CAM_CMD_AMA = 0x0000002c, -} cam_cmdmask; + CAM_CMD_NONE, + CAM_CMD_DEVLIST, + CAM_CMD_TUR, + CAM_CMD_INQUIRY, + CAM_CMD_STARTSTOP, + CAM_CMD_RESCAN, + CAM_CMD_READ_DEFECTS, + CAM_CMD_MODE_PAGE, + CAM_CMD_SCSI_CMD, + CAM_CMD_DEVTREE, + CAM_CMD_USAGE, + CAM_CMD_DEBUG, + CAM_CMD_RESET, + CAM_CMD_FORMAT, + CAM_CMD_TAG, + CAM_CMD_RATE, + CAM_CMD_DETACH, + CAM_CMD_REPORTLUNS, + CAM_CMD_READCAP, + CAM_CMD_IDENTIFY, + CAM_CMD_IDLE, + CAM_CMD_STANDBY, + CAM_CMD_SLEEP, + CAM_CMD_SMP_CMD, + CAM_CMD_SMP_RG, + CAM_CMD_SMP_PC, + CAM_CMD_SMP_PHYLIST, + CAM_CMD_SMP_MANINFO, + CAM_CMD_DOWNLOAD_FW, + CAM_CMD_SECURITY, + CAM_CMD_HPA, + CAM_CMD_SANITIZE, + CAM_CMD_PERSIST, + CAM_CMD_APM, + CAM_CMD_AAM, + CAM_CMD_ATTRIB, + CAM_CMD_OPCODES, + CAM_CMD_REPROBE, + CAM_CMD_ZONE, + CAM_CMD_EPC, + CAM_CMD_TIMESTAMP, + CAM_CMD_MMCSD_CMD, + CAM_CMD_POWER_MODE, + CAM_CMD_DEVTYPE, + CAM_CMD_AMA, +} cam_cmd; typedef enum { CAM_ARG_NONE = 0x00000000, @@ -248,7 +248,6 @@ path_id_t path_id; }; -static cam_cmdmask cmdlist; static cam_argmask arglist; static const char *devtype_names[] = { @@ -1022,9 +1021,6 @@ return (1); } - /* cam_getccb cleans up the header, caller has to zero the payload */ - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - inq_buf = (struct scsi_inquiry_data *)malloc( sizeof(struct scsi_inquiry_data)); @@ -1132,9 +1128,6 @@ return (1); } - /* cam_getccb cleans up the header, caller has to zero the payload */ - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - serial_buf = (struct scsi_vpd_unit_serial_number *) malloc(sizeof(*serial_buf)); @@ -1219,8 +1212,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); - ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -1826,8 +1817,6 @@ ata_flags |= AP_FLAG_TLEN_NO_DATA; } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - scsi_ata_pass_16(&ccb->csio, retries, NULL, @@ -4482,8 +4471,6 @@ if (ccb == NULL) errx(1, "mode_select: couldn't allocate CCB"); - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - scsi_mode_select_len(&ccb->csio, /* retries */ retry_count, /* cbfcnp */ NULL, @@ -4622,8 +4609,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(ccb); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { case 'a': @@ -5108,7 +5093,6 @@ cam_path_string(device, pathstr, sizeof(pathstr)); if (numtags >= 0) { - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->crs); ccb->ccb_h.func_code = XPT_REL_SIMQ; ccb->ccb_h.flags = CAM_DEV_QFREEZE; ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS; @@ -5352,7 +5336,6 @@ warnx("get_cpi: couldn't allocate CCB"); return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); ccb->ccb_h.func_code = XPT_PATH_INQ; if (cam_send_ccb(device, ccb) < 0) { warn("get_cpi: error sending Path Inquiry CCB"); @@ -5387,7 +5370,6 @@ warnx("get_cgd: couldn't allocate CCB"); return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); ccb->ccb_h.func_code = XPT_GDEV_TYPE; if (cam_send_ccb(device, ccb) < 0) { warn("get_cgd: error sending Get type information CCB"); @@ -5428,9 +5410,6 @@ goto bailout; } - /* cam_getccb cleans up the header, caller has to zero the payload */ - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - bzero(&sup_pages, sizeof(sup_pages)); scsi_inquiry(&ccb->csio, @@ -5960,8 +5939,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); - ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; if (user_settings == 0) @@ -6104,7 +6081,6 @@ */ if ((retval = get_cpi(device, &cpi)) != 0) goto ratecontrol_bailout; - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); if (quiet == 0) { fprintf(stdout, "%s parameters:\n", user_settings ? "User" : "Current"); @@ -6353,8 +6329,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { case 'q': @@ -6848,8 +6822,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { case 'a': @@ -7206,8 +7178,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - countonly = 0; lunsonly = 0; @@ -7450,8 +7420,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'b': @@ -7651,8 +7619,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'R': @@ -8200,8 +8166,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'l': @@ -8344,8 +8308,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'a': @@ -8601,8 +8563,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'l': @@ -8695,8 +8655,6 @@ goto bailout; } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cdai); - /* * On the first try, we just probe for the size of the data, and * then allocate that much memory and try again. @@ -8980,7 +8938,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); STAILQ_INIT(&devlist.dev_queue); rgrequest = malloc(sizeof(*rgrequest)); @@ -9445,9 +9402,6 @@ goto bailout; } - /* cam_getccb cleans up the header, caller has to zero the payload */ - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - if (opcode_set != 0) { options |= RSO_OPTIONS_OC; num_opcodes = 1; @@ -9885,8 +9839,6 @@ return (1); } - CCB_CLEAR_ALL_EXCEPT_HDR(ccb); - ccb->ccb_h.func_code = XPT_REPROBE_LUN; if (cam_send_ccb(device, ccb) < 0) { @@ -10281,6 +10233,7 @@ int error = 0, optstart = 2; int task_attr = MSG_SIMPLE_Q_TAG; int devopen = 1; + cam_cmd cmdlist; path_id_t bus; target_id_t target; lun_id_t lun;