Yup, works good now. Thanks.
> + case BLKFLSBUF:
> + if(!suser()) return -EACCES;
> + fsync_dev(inode->i_rdev);
> + cmd = FDFLUSH; /* flush it */
> + break;
> +
Actually the above is a bit too harsh, as FDFLUSH will call
invalidate_drive() and the kernel will think that the media has actually
changed (see below) when it hasn't.
---------------------------------------
foobar# mount -vt ext2 /dev/fd0 /mnt
/dev/fd0 on /mnt type ext2 (rw)
foobar# ./blkflush /dev/fd0
VFS: Mounted device 02:00 - tssk, tssk
VFS: inode busy on removed device 02:00
Buffers for block device "/dev/fd0" are now flushed.
foobar#
---------------------------------------
It is sufficient to do what the other drivers do, i.e:
- cmd = FDFLUSH; /* flush it */
- break;
+ invalidate_buffers(inode->i_rdev);
+ return 0;
which will dump the buffers, but not trick the VFS into thinking that
the disk was actually changed.
> + /* BLKRRPART is not defined as floppies don't have
> + * partition tables */
----------------------
foobar# fdisk /dev/fd0
Command (m for help): p
Disk /dev/fd0: 2 heads, 18 sectors, 80 cylinders
Units = cylinders of 36 * 512 bytes
Device Boot Begin Start End Blocks Id System
/dev/fd01 * 1 1 69 1233 83 Linux native
/dev/fd02 70 70 80 198 82 Linux swap
Command (m for help): q
foobar#
----------------------
:)
Paul.