diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:24 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:24 -0500 |
commit | a1bb9457f06439f22571e93bddcca63144a08296 (patch) | |
tree | c4b250183a7b552918fb0b001205d0b81b8ca46d /include/linux/cdrom.h | |
parent | 5c68429dfe8256c6069555e5851838f8e3175f78 (diff) |
ide-cd: move lba_to_msf() and msf_to_lba() to <linux/cdrom.h>
* Move lba_to_msf() and msf_to_lba() to <linux/cdrom.h>
(use 'u8' type instead of 'byte' while at it).
* Remove msf_to_lba() copy from drivers/cdrom/cdrom.c.
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/cdrom.h')
-rw-r--r-- | include/linux/cdrom.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index fcdc11b9609b..a5cd2047624e 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -1187,6 +1187,20 @@ struct media_event_desc { | |||
1187 | 1187 | ||
1188 | extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med); | 1188 | extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med); |
1189 | 1189 | ||
1190 | static inline void lba_to_msf(int lba, u8 *m, u8 *s, u8 *f) | ||
1191 | { | ||
1192 | lba += CD_MSF_OFFSET; | ||
1193 | lba &= 0xffffff; /* negative lbas use only 24 bits */ | ||
1194 | *m = lba / (CD_SECS * CD_FRAMES); | ||
1195 | lba %= (CD_SECS * CD_FRAMES); | ||
1196 | *s = lba / CD_FRAMES; | ||
1197 | *f = lba % CD_FRAMES; | ||
1198 | } | ||
1199 | |||
1200 | static inline int msf_to_lba(u8 m, u8 s, u8 f) | ||
1201 | { | ||
1202 | return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; | ||
1203 | } | ||
1190 | #endif /* End of kernel only stuff */ | 1204 | #endif /* End of kernel only stuff */ |
1191 | 1205 | ||
1192 | #endif /* _LINUX_CDROM_H */ | 1206 | #endif /* _LINUX_CDROM_H */ |