Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
ba3fab24
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ba3fab24
编写于
2月 01, 2008
作者:
B
Bartlomiej Zolnierkiewicz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ide-cd: factor out ioctl handlers from ide_cdrom_audio_ioctl()
Signed-off-by:
N
Bartlomiej Zolnierkiewicz
<
bzolnier@gmail.com
>
上级
972560fb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
75 addition
and
67 deletion
+75
-67
drivers/ide/ide-cd.c
drivers/ide/ide-cd.c
+75
-67
未找到文件。
drivers/ide/ide-cd.c
浏览文件 @
ba3fab24
...
...
@@ -1998,6 +1998,24 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
return
0
;
}
static
int
ide_cd_read_tochdr
(
ide_drive_t
*
drive
,
void
*
arg
)
{
struct
cdrom_info
*
cd
=
drive
->
driver_data
;
struct
cdrom_tochdr
*
tochdr
=
arg
;
struct
atapi_toc
*
toc
;
int
stat
;
/* Make sure our saved TOC is valid. */
stat
=
cdrom_read_toc
(
drive
,
NULL
);
if
(
stat
)
return
stat
;
toc
=
cd
->
toc
;
tochdr
->
cdth_trk0
=
toc
->
hdr
.
first_track
;
tochdr
->
cdth_trk1
=
toc
->
hdr
.
last_track
;
return
0
;
}
static
int
cdrom_read_subchannel
(
ide_drive_t
*
drive
,
int
format
,
char
*
buf
,
int
buflen
,
struct
request_sense
*
sense
)
...
...
@@ -2092,6 +2110,55 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
return
0
;
}
static
int
ide_cd_read_tocentry
(
ide_drive_t
*
drive
,
void
*
arg
)
{
struct
cdrom_tocentry
*
tocentry
=
arg
;
struct
atapi_toc_entry
*
toce
;
int
stat
;
stat
=
cdrom_get_toc_entry
(
drive
,
tocentry
->
cdte_track
,
&
toce
);
if
(
stat
)
return
stat
;
tocentry
->
cdte_ctrl
=
toce
->
control
;
tocentry
->
cdte_adr
=
toce
->
adr
;
if
(
tocentry
->
cdte_format
==
CDROM_MSF
)
{
lba_to_msf
(
toce
->
addr
.
lba
,
&
tocentry
->
cdte_addr
.
msf
.
minute
,
&
tocentry
->
cdte_addr
.
msf
.
second
,
&
tocentry
->
cdte_addr
.
msf
.
frame
);
}
else
tocentry
->
cdte_addr
.
lba
=
toce
->
addr
.
lba
;
return
0
;
}
static
int
ide_cd_fake_play_trkind
(
ide_drive_t
*
drive
,
void
*
arg
)
{
struct
cdrom_ti
*
ti
=
arg
;
struct
atapi_toc_entry
*
first_toc
,
*
last_toc
;
unsigned
long
lba_start
,
lba_end
;
int
stat
;
stat
=
cdrom_get_toc_entry
(
drive
,
ti
->
cdti_trk0
,
&
first_toc
);
if
(
stat
)
return
stat
;
stat
=
cdrom_get_toc_entry
(
drive
,
ti
->
cdti_trk1
,
&
last_toc
);
if
(
stat
)
return
stat
;
if
(
ti
->
cdti_trk1
!=
CDROM_LEADOUT
)
++
last_toc
;
lba_start
=
first_toc
->
addr
.
lba
;
lba_end
=
last_toc
->
addr
.
lba
;
if
(
lba_end
<=
lba_start
)
return
-
EINVAL
;
return
cdrom_play_audio
(
drive
,
lba_start
,
lba_end
);
}
/* the generic packet interface to cdrom.c */
static
int
ide_cdrom_packet
(
struct
cdrom_device_info
*
cdi
,
struct
packet_command
*
cgc
)
...
...
@@ -2123,81 +2190,22 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
return
cgc
->
stat
;
}
static
int
ide_cdrom_audio_ioctl
(
struct
cdrom_device_info
*
cdi
,
unsigned
int
cmd
,
void
*
arg
)
static
int
ide_cdrom_audio_ioctl
(
struct
cdrom_device_info
*
cdi
,
unsigned
int
cmd
,
void
*
arg
)
{
ide_drive_t
*
drive
=
cdi
->
handle
;
struct
cdrom_info
*
info
=
drive
->
driver_data
;
int
stat
;
switch
(
cmd
)
{
/*
* emulate PLAY_AUDIO_TI command with PLAY_AUDIO_10, since
* atapi doesn't support it
*/
case
CDROMPLAYTRKIND
:
{
unsigned
long
lba_start
,
lba_end
;
struct
cdrom_ti
*
ti
=
arg
;
struct
atapi_toc_entry
*
first_toc
,
*
last_toc
;
stat
=
cdrom_get_toc_entry
(
drive
,
ti
->
cdti_trk0
,
&
first_toc
);
if
(
stat
)
return
stat
;
stat
=
cdrom_get_toc_entry
(
drive
,
ti
->
cdti_trk1
,
&
last_toc
);
if
(
stat
)
return
stat
;
if
(
ti
->
cdti_trk1
!=
CDROM_LEADOUT
)
++
last_toc
;
lba_start
=
first_toc
->
addr
.
lba
;
lba_end
=
last_toc
->
addr
.
lba
;
if
(
lba_end
<=
lba_start
)
return
-
EINVAL
;
return
cdrom_play_audio
(
drive
,
lba_start
,
lba_end
);
}
case
CDROMREADTOCHDR
:
{
struct
cdrom_tochdr
*
tochdr
=
arg
;
struct
atapi_toc
*
toc
;
/* Make sure our saved TOC is valid. */
stat
=
cdrom_read_toc
(
drive
,
NULL
);
if
(
stat
)
return
stat
;
toc
=
info
->
toc
;
tochdr
->
cdth_trk0
=
toc
->
hdr
.
first_track
;
tochdr
->
cdth_trk1
=
toc
->
hdr
.
last_track
;
return
0
;
}
case
CDROMREADTOCENTRY
:
{
struct
cdrom_tocentry
*
tocentry
=
arg
;
struct
atapi_toc_entry
*
toce
;
stat
=
cdrom_get_toc_entry
(
drive
,
tocentry
->
cdte_track
,
&
toce
);
if
(
stat
)
return
stat
;
tocentry
->
cdte_ctrl
=
toce
->
control
;
tocentry
->
cdte_adr
=
toce
->
adr
;
if
(
tocentry
->
cdte_format
==
CDROM_MSF
)
{
lba_to_msf
(
toce
->
addr
.
lba
,
&
tocentry
->
cdte_addr
.
msf
.
minute
,
&
tocentry
->
cdte_addr
.
msf
.
second
,
&
tocentry
->
cdte_addr
.
msf
.
frame
);
}
else
tocentry
->
cdte_addr
.
lba
=
toce
->
addr
.
lba
;
return
0
;
}
case
CDROMPLAYTRKIND
:
return
ide_cd_fake_play_trkind
(
drive
,
arg
);
case
CDROMREADTOCHDR
:
return
ide_cd_read_tochdr
(
drive
,
arg
);
case
CDROMREADTOCENTRY
:
return
ide_cd_read_tocentry
(
drive
,
arg
);
default:
return
-
EINVAL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录