scsi_cd.c (139743) | scsi_cd.c (141031) |
---|---|
1/*- 2 * Copyright (c) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Kenneth D. Merry. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 32 unchanged lines hidden (view full) --- 41 * functioning of this software in any circumstances. 42 * 43 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 44 * 45 * from: cd.c,v 1.83 1997/05/04 15:24:22 joerg Exp $ 46 */ 47 48#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Kenneth D. Merry. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 32 unchanged lines hidden (view full) --- 41 * functioning of this software in any circumstances. 42 * 43 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 44 * 45 * from: cd.c,v 1.83 1997/05/04 15:24:22 joerg Exp $ 46 */ 47 48#include <sys/cdefs.h> |
49__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_cd.c 139743 2005-01-05 22:34:37Z imp $"); | 49__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_cd.c 141031 2005-01-30 08:12:37Z sobomax $"); |
50 51#include "opt_cd.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/kernel.h> 56#include <sys/bio.h> 57#include <sys/conf.h> --- 1846 unchanged lines hidden (view full) --- 1904} 1905 1906static int 1907cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) 1908{ 1909 1910 struct cam_periph *periph; 1911 struct cd_softc *softc; | 50 51#include "opt_cd.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/kernel.h> 56#include <sys/bio.h> 57#include <sys/conf.h> --- 1846 unchanged lines hidden (view full) --- 1904} 1905 1906static int 1907cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) 1908{ 1909 1910 struct cam_periph *periph; 1911 struct cd_softc *softc; |
1912 int error; | 1912 int error, nocopyout; |
1913 1914 periph = (struct cam_periph *)dp->d_drv1; 1915 if (periph == NULL) 1916 return(ENXIO); 1917 1918 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdioctl\n")); 1919 1920 softc = (struct cd_softc *)periph->softc; --- 14 unchanged lines hidden (view full) --- 1935 && (cmd != CDIOCEJECT))) { 1936 error = cdcheckmedia(periph); 1937 if (error != 0) { 1938 cam_periph_unlock(periph); 1939 return (error); 1940 } 1941 } 1942 | 1913 1914 periph = (struct cam_periph *)dp->d_drv1; 1915 if (periph == NULL) 1916 return(ENXIO); 1917 1918 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdioctl\n")); 1919 1920 softc = (struct cd_softc *)periph->softc; --- 14 unchanged lines hidden (view full) --- 1935 && (cmd != CDIOCEJECT))) { 1936 error = cdcheckmedia(periph); 1937 if (error != 0) { 1938 cam_periph_unlock(periph); 1939 return (error); 1940 } 1941 } 1942 |
1943 nocopyout = 0; |
|
1943 switch (cmd) { 1944 1945 case CDIOCPLAYTRACKS: 1946 { 1947 struct ioc_play_track *args 1948 = (struct ioc_play_track *) addr; 1949 struct cd_mode_params params; 1950 union cd_pages *page; --- 142 unchanged lines hidden (view full) --- 2093 page->audio.flags |= CD_PA_IMMED; 2094 error = cdsetmode(periph, ¶ms); 2095 free(params.mode_buf, M_TEMP); 2096 if (error) 2097 break; 2098 error = cdplay(periph, args->blk, args->len); 2099 } 2100 break; | 1944 switch (cmd) { 1945 1946 case CDIOCPLAYTRACKS: 1947 { 1948 struct ioc_play_track *args 1949 = (struct ioc_play_track *) addr; 1950 struct cd_mode_params params; 1951 union cd_pages *page; --- 142 unchanged lines hidden (view full) --- 2094 page->audio.flags |= CD_PA_IMMED; 2095 error = cdsetmode(periph, ¶ms); 2096 free(params.mode_buf, M_TEMP); 2097 if (error) 2098 break; 2099 error = cdplay(periph, args->blk, args->len); 2100 } 2101 break; |
2102 case CDIOCREADSUBCHANNEL_SYSSPACE: 2103 nocopyout = 1; 2104 /* Fallthrough */ |
|
2101 case CDIOCREADSUBCHANNEL: 2102 { 2103 struct ioc_read_subchannel *args 2104 = (struct ioc_read_subchannel *) addr; 2105 struct cd_sub_channel_info *data; 2106 u_int32_t len = args->data_len; 2107 2108 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, --- 24 unchanged lines hidden (view full) --- 2133 break; 2134 } 2135 if (softc->quirks & CD_Q_BCD_TRACKS) 2136 data->what.track_info.track_number = 2137 bcd2bin(data->what.track_info.track_number); 2138 len = min(len, ((data->header.data_len[0] << 8) + 2139 data->header.data_len[1] + 2140 sizeof(struct cd_sub_channel_header))); | 2105 case CDIOCREADSUBCHANNEL: 2106 { 2107 struct ioc_read_subchannel *args 2108 = (struct ioc_read_subchannel *) addr; 2109 struct cd_sub_channel_info *data; 2110 u_int32_t len = args->data_len; 2111 2112 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, --- 24 unchanged lines hidden (view full) --- 2137 break; 2138 } 2139 if (softc->quirks & CD_Q_BCD_TRACKS) 2140 data->what.track_info.track_number = 2141 bcd2bin(data->what.track_info.track_number); 2142 len = min(len, ((data->header.data_len[0] << 8) + 2143 data->header.data_len[1] + 2144 sizeof(struct cd_sub_channel_header))); |
2141 if (copyout(data, args->data, len) != 0) { 2142 error = EFAULT; | 2145 if (nocopyout == 0) { 2146 if (copyout(data, args->data, len) != 0) { 2147 error = EFAULT; 2148 } 2149 } else { 2150 bcopy(data, args->data, len); |
2143 } 2144 free(data, M_TEMP); 2145 } 2146 break; 2147 2148 case CDIOREADTOCHEADER: 2149 { 2150 struct ioc_toc_header *th; --- 2070 unchanged lines hidden --- | 2151 } 2152 free(data, M_TEMP); 2153 } 2154 break; 2155 2156 case CDIOREADTOCHEADER: 2157 { 2158 struct ioc_toc_header *th; --- 2070 unchanged lines hidden --- |