Commit dac1c5cf448c2bfdb8f6e1fe10a0eec616c34138
Committed by
Jens Axboe
1 parent
e1e60fda48
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
cdrom: Remove cdrom_get_next_writeable prototype
Move the function to the right spot instead. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Showing 1 changed file with 51 additions and 50 deletions Side-by-side Diff
drivers/cdrom/cdrom.c
... | ... | @@ -338,7 +338,6 @@ |
338 | 338 | |
339 | 339 | /* Not-exported routines. */ |
340 | 340 | |
341 | -static int cdrom_get_next_writable(struct cdrom_device_info *, long *); | |
342 | 341 | static void cdrom_count_tracks(struct cdrom_device_info *, tracktype*); |
343 | 342 | |
344 | 343 | static int cdrom_mrw_exit(struct cdrom_device_info *cdi); |
... | ... | @@ -2836,6 +2835,57 @@ |
2836 | 2835 | return 0; |
2837 | 2836 | } |
2838 | 2837 | |
2838 | +/* return the next writable block. also for udf file system. */ | |
2839 | +static int cdrom_get_next_writable(struct cdrom_device_info *cdi, | |
2840 | + long *next_writable) | |
2841 | +{ | |
2842 | + disc_information di; | |
2843 | + track_information ti; | |
2844 | + __u16 last_track; | |
2845 | + int ret, ti_size; | |
2846 | + | |
2847 | + if (!CDROM_CAN(CDC_GENERIC_PACKET)) | |
2848 | + goto use_last_written; | |
2849 | + | |
2850 | + ret = cdrom_get_disc_info(cdi, &di); | |
2851 | + if (ret < 0 || ret < offsetof(typeof(di), last_track_lsb) | |
2852 | + + sizeof(di.last_track_lsb)) | |
2853 | + goto use_last_written; | |
2854 | + | |
2855 | + /* if unit didn't return msb, it's zeroed by cdrom_get_disc_info */ | |
2856 | + last_track = (di.last_track_msb << 8) | di.last_track_lsb; | |
2857 | + ti_size = cdrom_get_track_info(cdi, last_track, 1, &ti); | |
2858 | + if (ti_size < 0 || ti_size < offsetof(typeof(ti), track_start)) | |
2859 | + goto use_last_written; | |
2860 | + | |
2861 | + /* if this track is blank, try the previous. */ | |
2862 | + if (ti.blank) { | |
2863 | + if (last_track == 1) | |
2864 | + goto use_last_written; | |
2865 | + last_track--; | |
2866 | + ti_size = cdrom_get_track_info(cdi, last_track, 1, &ti); | |
2867 | + if (ti_size < 0) | |
2868 | + goto use_last_written; | |
2869 | + } | |
2870 | + | |
2871 | + /* if next recordable address field is valid, use it. */ | |
2872 | + if (ti.nwa_v && ti_size >= offsetof(typeof(ti), next_writable) | |
2873 | + + sizeof(ti.next_writable)) { | |
2874 | + *next_writable = be32_to_cpu(ti.next_writable); | |
2875 | + return 0; | |
2876 | + } | |
2877 | + | |
2878 | +use_last_written: | |
2879 | + ret = cdrom_get_last_written(cdi, next_writable); | |
2880 | + if (ret) { | |
2881 | + *next_writable = 0; | |
2882 | + return ret; | |
2883 | + } else { | |
2884 | + *next_writable += 7; | |
2885 | + return 0; | |
2886 | + } | |
2887 | +} | |
2888 | + | |
2839 | 2889 | static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi, |
2840 | 2890 | void __user *arg, |
2841 | 2891 | struct packet_command *cgc, |
... | ... | @@ -3337,55 +3387,6 @@ |
3337 | 3387 | |
3338 | 3388 | /* return actual fill size */ |
3339 | 3389 | return buflen; |
3340 | -} | |
3341 | - | |
3342 | -/* return the next writable block. also for udf file system. */ | |
3343 | -static int cdrom_get_next_writable(struct cdrom_device_info *cdi, long *next_writable) | |
3344 | -{ | |
3345 | - disc_information di; | |
3346 | - track_information ti; | |
3347 | - __u16 last_track; | |
3348 | - int ret, ti_size; | |
3349 | - | |
3350 | - if (!CDROM_CAN(CDC_GENERIC_PACKET)) | |
3351 | - goto use_last_written; | |
3352 | - | |
3353 | - ret = cdrom_get_disc_info(cdi, &di); | |
3354 | - if (ret < 0 || ret < offsetof(typeof(di), last_track_lsb) | |
3355 | - + sizeof(di.last_track_lsb)) | |
3356 | - goto use_last_written; | |
3357 | - | |
3358 | - /* if unit didn't return msb, it's zeroed by cdrom_get_disc_info */ | |
3359 | - last_track = (di.last_track_msb << 8) | di.last_track_lsb; | |
3360 | - ti_size = cdrom_get_track_info(cdi, last_track, 1, &ti); | |
3361 | - if (ti_size < 0 || ti_size < offsetof(typeof(ti), track_start)) | |
3362 | - goto use_last_written; | |
3363 | - | |
3364 | - /* if this track is blank, try the previous. */ | |
3365 | - if (ti.blank) { | |
3366 | - if (last_track == 1) | |
3367 | - goto use_last_written; | |
3368 | - last_track--; | |
3369 | - ti_size = cdrom_get_track_info(cdi, last_track, 1, &ti); | |
3370 | - if (ti_size < 0) | |
3371 | - goto use_last_written; | |
3372 | - } | |
3373 | - | |
3374 | - /* if next recordable address field is valid, use it. */ | |
3375 | - if (ti.nwa_v && ti_size >= offsetof(typeof(ti), next_writable) | |
3376 | - + sizeof(ti.next_writable)) { | |
3377 | - *next_writable = be32_to_cpu(ti.next_writable); | |
3378 | - return 0; | |
3379 | - } | |
3380 | - | |
3381 | -use_last_written: | |
3382 | - if ((ret = cdrom_get_last_written(cdi, next_writable))) { | |
3383 | - *next_writable = 0; | |
3384 | - return ret; | |
3385 | - } else { | |
3386 | - *next_writable += 7; | |
3387 | - return 0; | |
3388 | - } | |
3389 | 3390 | } |
3390 | 3391 | |
3391 | 3392 | EXPORT_SYMBOL(cdrom_get_last_written); |