I don't understand the problem you are trying to solve.
Let's try using blkdiscard on a regular file:
# strace ./busybox blkdiscard README
execve("./busybox", ["./busybox", "blkdiscard", "README"], [/* 33 vars */]) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B38400 opost isig icanon echo ...}) = 0
getuid32() = 0
open("README", O_RDWR|O_EXCL|O_LARGEFILE) = 3
ioctl(3, BLKGETSIZE64, 0xffcc5af0) = -1 ENOTTY (Inappropriate
ioctl for device)
brk(0) = 0x8129000
brk(0x812a000) = 0x812a000
write(2, "blkdiscard: ioctl 0x80041272 fai"..., 68blkdiscard: ioctl
0x80041272 failed: Inappropriate ioctl for device
) = 68
_exit(1) = ?
+++ exited with 1 +++
So, open(O_RDWR|O_EXCL) did work in practice, by ignoring O_EXCL.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox