Deleted Added
full compact
scsi_sa.c (107943) scsi_sa.c (109623)
1/*
1/*
2 * $FreeBSD: head/sys/cam/scsi/scsi_sa.c 107943 2002-12-16 17:40:17Z trhodes $
2 * $FreeBSD: head/sys/cam/scsi/scsi_sa.c 109623 2003-01-21 08:56:16Z alfred $
3 *
4 * Implementation of SCSI Sequential Access Peripheral driver for CAM.
5 *
6 * Copyright (c) 1999, 2000 Matthew Jacob
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 1879 unchanged lines hidden (view full) ---

1890 /*
1891 * Do a dummy test read to force access to the
1892 * media so that the drive will really know what's
1893 * there. We actually don't really care what the
1894 * blocksize on tape is and don't expect to really
1895 * read a full record.
1896 */
1897 rblim = (struct scsi_read_block_limits_data *)
3 *
4 * Implementation of SCSI Sequential Access Peripheral driver for CAM.
5 *
6 * Copyright (c) 1999, 2000 Matthew Jacob
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 1879 unchanged lines hidden (view full) ---

1890 /*
1891 * Do a dummy test read to force access to the
1892 * media so that the drive will really know what's
1893 * there. We actually don't really care what the
1894 * blocksize on tape is and don't expect to really
1895 * read a full record.
1896 */
1897 rblim = (struct scsi_read_block_limits_data *)
1898 malloc(8192, M_TEMP, M_WAITOK);
1898 malloc(8192, M_TEMP, 0);
1899 if (rblim == NULL) {
1900 xpt_print_path(ccb->ccb_h.path);
1901 printf("no memory for test read\n");
1902 xpt_release_ccb(ccb);
1903 error = ENOMEM;
1904 goto exit;
1905 }
1906

--- 608 unchanged lines hidden (view full) ---

2515 if (params_to_get & SA_PARAM_COMPRESSION) {
2516 if (softc->quirks & SA_QUIRK_NOCOMP) {
2517 *comp_supported = FALSE;
2518 params_to_get &= ~SA_PARAM_COMPRESSION;
2519 } else
2520 mode_buffer_len += sizeof (sa_comp_t);
2521 }
2522
1899 if (rblim == NULL) {
1900 xpt_print_path(ccb->ccb_h.path);
1901 printf("no memory for test read\n");
1902 xpt_release_ccb(ccb);
1903 error = ENOMEM;
1904 goto exit;
1905 }
1906

--- 608 unchanged lines hidden (view full) ---

2515 if (params_to_get & SA_PARAM_COMPRESSION) {
2516 if (softc->quirks & SA_QUIRK_NOCOMP) {
2517 *comp_supported = FALSE;
2518 params_to_get &= ~SA_PARAM_COMPRESSION;
2519 } else
2520 mode_buffer_len += sizeof (sa_comp_t);
2521 }
2522
2523 mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO);
2523 mode_buffer = malloc(mode_buffer_len, M_TEMP, M_ZERO);
2524 mode_hdr = (struct scsi_mode_header_6 *)mode_buffer;
2525 mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1];
2526
2527 /* it is safe to retry this */
2528 scsi_mode_sense(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, FALSE,
2529 SMS_PAGE_CTRL_CURRENT, (params_to_get & SA_PARAM_COMPRESSION) ?
2530 cpage : SMS_VENDOR_SPECIFIC_PAGE, mode_buffer, mode_buffer_len,
2531 SSD_FULL_SIZE, SCSIOP_TIMEOUT);

--- 163 unchanged lines hidden (view full) ---

2695 struct scsi_mode_blk_desc *mode_blk;
2696 sa_comp_t *ccomp, *cpage;
2697 int buff_mode;
2698 union ccb *ccb = NULL;
2699 int error;
2700
2701 softc = (struct sa_softc *)periph->softc;
2702
2524 mode_hdr = (struct scsi_mode_header_6 *)mode_buffer;
2525 mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1];
2526
2527 /* it is safe to retry this */
2528 scsi_mode_sense(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, FALSE,
2529 SMS_PAGE_CTRL_CURRENT, (params_to_get & SA_PARAM_COMPRESSION) ?
2530 cpage : SMS_VENDOR_SPECIFIC_PAGE, mode_buffer, mode_buffer_len,
2531 SSD_FULL_SIZE, SCSIOP_TIMEOUT);

--- 163 unchanged lines hidden (view full) ---

2695 struct scsi_mode_blk_desc *mode_blk;
2696 sa_comp_t *ccomp, *cpage;
2697 int buff_mode;
2698 union ccb *ccb = NULL;
2699 int error;
2700
2701 softc = (struct sa_softc *)periph->softc;
2702
2703 ccomp = malloc(sizeof (sa_comp_t), M_TEMP, M_WAITOK);
2703 ccomp = malloc(sizeof (sa_comp_t), M_TEMP, 0);
2704
2705 /*
2706 * Since it doesn't make sense to set the number of blocks, or
2707 * write protection, we won't try to get the current value. We
2708 * always want to get the blocksize, so we can set it back to the
2709 * proper value.
2710 */
2711 error = sagetparams(periph,

--- 6 unchanged lines hidden (view full) ---

2718 free(ccomp, M_TEMP);
2719 return (error);
2720 }
2721
2722 mode_buffer_len = sizeof(*mode_hdr) + sizeof(*mode_blk);
2723 if (params_to_set & SA_PARAM_COMPRESSION)
2724 mode_buffer_len += sizeof (sa_comp_t);
2725
2704
2705 /*
2706 * Since it doesn't make sense to set the number of blocks, or
2707 * write protection, we won't try to get the current value. We
2708 * always want to get the blocksize, so we can set it back to the
2709 * proper value.
2710 */
2711 error = sagetparams(periph,

--- 6 unchanged lines hidden (view full) ---

2718 free(ccomp, M_TEMP);
2719 return (error);
2720 }
2721
2722 mode_buffer_len = sizeof(*mode_hdr) + sizeof(*mode_blk);
2723 if (params_to_set & SA_PARAM_COMPRESSION)
2724 mode_buffer_len += sizeof (sa_comp_t);
2725
2726 mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO);
2726 mode_buffer = malloc(mode_buffer_len, M_TEMP, M_ZERO);
2727
2728 mode_hdr = (struct scsi_mode_header_6 *)mode_buffer;
2729 mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1];
2730
2731 ccb = cam_periph_getccb(periph, 1);
2732
2733retry:
2734

--- 853 unchanged lines hidden ---
2727
2728 mode_hdr = (struct scsi_mode_header_6 *)mode_buffer;
2729 mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1];
2730
2731 ccb = cam_periph_getccb(periph, 1);
2732
2733retry:
2734

--- 853 unchanged lines hidden ---