aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cdrom/cdrom.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index c8ca3426c5b0..49ac5662585b 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -338,8 +338,6 @@ do { \
338 338
339/* Not-exported routines. */ 339/* Not-exported routines. */
340 340
341static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di);
342
343static void cdrom_sysctl_register(void); 341static void cdrom_sysctl_register(void);
344 342
345static LIST_HEAD(cdrom_list); 343static LIST_HEAD(cdrom_list);
@@ -369,6 +367,42 @@ static int cdrom_flush_cache(struct cdrom_device_info *cdi)
369 return cdi->ops->generic_packet(cdi, &cgc); 367 return cdi->ops->generic_packet(cdi, &cgc);
370} 368}
371 369
370/* requires CD R/RW */
371static int cdrom_get_disc_info(struct cdrom_device_info *cdi,
372 disc_information *di)
373{
374 struct cdrom_device_ops *cdo = cdi->ops;
375 struct packet_command cgc;
376 int ret, buflen;
377
378 /* set up command and get the disc info */
379 init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
380 cgc.cmd[0] = GPCMD_READ_DISC_INFO;
381 cgc.cmd[8] = cgc.buflen = 2;
382 cgc.quiet = 1;
383
384 ret = cdo->generic_packet(cdi, &cgc);
385 if (ret)
386 return ret;
387
388 /* not all drives have the same disc_info length, so requeue
389 * packet with the length the drive tells us it can supply
390 */
391 buflen = be16_to_cpu(di->disc_information_length) +
392 sizeof(di->disc_information_length);
393
394 if (buflen > sizeof(disc_information))
395 buflen = sizeof(disc_information);
396
397 cgc.cmd[8] = cgc.buflen = buflen;
398 ret = cdo->generic_packet(cdi, &cgc);
399 if (ret)
400 return ret;
401
402 /* return actual fill size */
403 return buflen;
404}
405
372/* This macro makes sure we don't have to check on cdrom_device_ops 406/* This macro makes sure we don't have to check on cdrom_device_ops
373 * existence in the run-time routines below. Change_capability is a 407 * existence in the run-time routines below. Change_capability is a
374 * hack to have the capability flags defined const, while we can still 408 * hack to have the capability flags defined const, while we can still
@@ -3360,39 +3394,6 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
3360 return -ENOSYS; 3394 return -ENOSYS;
3361} 3395}
3362 3396
3363/* requires CD R/RW */
3364static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di)
3365{
3366 struct cdrom_device_ops *cdo = cdi->ops;
3367 struct packet_command cgc;
3368 int ret, buflen;
3369
3370 /* set up command and get the disc info */
3371 init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
3372 cgc.cmd[0] = GPCMD_READ_DISC_INFO;
3373 cgc.cmd[8] = cgc.buflen = 2;
3374 cgc.quiet = 1;
3375
3376 if ((ret = cdo->generic_packet(cdi, &cgc)))
3377 return ret;
3378
3379 /* not all drives have the same disc_info length, so requeue
3380 * packet with the length the drive tells us it can supply
3381 */
3382 buflen = be16_to_cpu(di->disc_information_length) +
3383 sizeof(di->disc_information_length);
3384
3385 if (buflen > sizeof(disc_information))
3386 buflen = sizeof(disc_information);
3387
3388 cgc.cmd[8] = cgc.buflen = buflen;
3389 if ((ret = cdo->generic_packet(cdi, &cgc)))
3390 return ret;
3391
3392 /* return actual fill size */
3393 return buflen;
3394}
3395
3396EXPORT_SYMBOL(cdrom_get_last_written); 3397EXPORT_SYMBOL(cdrom_get_last_written);
3397EXPORT_SYMBOL(register_cdrom); 3398EXPORT_SYMBOL(register_cdrom);
3398EXPORT_SYMBOL(unregister_cdrom); 3399EXPORT_SYMBOL(unregister_cdrom);