sys/dev/disk/dm: Remove read/write support for /dev/mapper/control
It's obvious that /dev/mapper/control has nothing to read/write.
Running below results in kernel panic as the code requires properly
initialized a per-table lock while this chrdev has no tables mapped.
(control chrdev and dm blkdevs use the same dm device structures)
-----
[root@]~# cat ./dm1.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(void)
{
int fd;
char buf[1024];
fd = open("/dev/mapper/control", O_RDWR);
if (fd == -1) {
perror("open");
exit(1);
}
if (read(fd, buf, sizeof(buf)) == -1)
perror("read");
if (write(fd, buf, sizeof(buf)) == -1)
perror("write");
close(fd);
return 0;
}
With this commit.
-----
[root@]~# uname
DragonFly
[root@]~# kldload dm
[root@]~# ls -l /dev/mapper/control
crw-r----- 1 root operator 65, 0x00000000 May 1 09:25 /dev/mapper/control
[root@]~# gcc -Wall -g ./dm1.c -o ./dm1
[root@]~# ./dm1
read: Operation not supported by device
write: Operation not supported by device
With Linux kernel.
-----
[root@localhost]~# uname
Linux
[root@localhost]~# ls -l /dev/mapper/control
crw-rw---- 1 root root 10, 236 Apr 25 12:44 /dev/mapper/control
[root@localhost]~# gcc -Wall -g ./dm1.c -o ./dm1
[root@localhost]~# ./dm1
read: Invalid argument
write: Invalid argument