--- /dev/null
+CC = gcc
+OPTFLAGS= -O2 -g $(EXTFLAGS)
+CFLAGS = -Wall -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(OPTFLAGS)
+PROGS = bbind bdel
+
+all: $(PROGS)
+
+bbind: bbind.o
+
+bdel: bdel.o
+
+clean:
+ -rm -f .depend *.o $(PROGS) core.* core
--- /dev/null
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#define B_NAME_LEN 32
+
+struct b_ioctl_cmd {
+ int fd;
+ char name[B_NAME_LEN];
+};
+
+int main(int argc, char *argv[])
+{
+ struct b_ioctl_cmd bic;
+ int fd, fdb;
+
+ if (argc < 2) {
+ printf("%s: <dev>\n", argv[0]);
+ return 1;
+ }
+
+ fd = open(argv[1], O_RDWR);
+ if (fd < 0) {
+ perror("open dev");
+ return 1;
+ }
+ fdb = open("/dev/binject-ctl", O_RDWR);
+ if (fdb < 0) {
+ perror("open binject");
+ return 1;
+ }
+
+ bic.fd = fd;
+ strcpy(bic.name, argv[1]);
+
+ if (ioctl(fdb, 0, &bic) < 0)
+ perror("ioctl");
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+struct b_ioctl_cmd {
+ int fd;
+ int minor;
+};
+
+int main(int argc, char *argv[])
+{
+ struct b_ioctl_cmd bic;
+ struct stat sb;
+ int fd;
+
+ if (argc < 2) {
+ printf("%s: <dev>\n", argv[0]);
+ return 1;
+ }
+
+ if (stat(argv[1], &sb) < 0) {
+ perror("stat");
+ return 1;
+ }
+
+ fd = open("/dev/binject-ctl", O_RDWR);
+ if (fd < 0) {
+ perror("open binject");
+ return 1;
+ }
+
+ bic.minor = minor(sb.st_rdev);
+ printf("will delete minor %d\n", bic.minor);
+
+ if (ioctl(fd, 1, &bic) < 0)
+ perror("ioctl");
+
+ close(fd);
+ return 0;
+}