3297 ret = ret2;
3298 raw_cmd_free(&my_raw_cmd);
3299 return ret;
3300}
3301
3302static int invalidate_drive(struct block_device *bdev)
3303{
3304
3305 set_bit((long)bdev->bd_disk->private_data, &fake_change);
3306 process_fd_request();
3307 check_disk_change(bdev);
3308 return 0;
3309}
3310
3311static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
3312 int drive, int type, struct block_device *bdev)
3313{
3314 int cnt;
3315
3316
3317 if (g->sect <= 0 ||
3318 g->head <= 0 ||
3319 g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||
3320
3321 (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)
3322 return -EINVAL;
3323 if (type) {
3324 if (!capable(CAP_SYS_ADMIN))
3325 return -EPERM;
3326 mutex_lock(&open_lock);
3327 LOCK_FDC(drive, 1);
3328 floppy_type[type] = *g;
3329 floppy_type[type].name = "user format";
3330 for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)
3331 floppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =
3332 floppy_type[type].size + 1;
3333 process_fd_request();
3334 for (cnt = 0; cnt < N_DRIVE; cnt++) {
3335 struct block_device *bdev = opened_bdev[cnt];
3336 if (!bdev || ITYPE(drive_state[cnt].fd_device) != type)
3337 continue;