Created
August 29, 2018 13:17
-
-
Save tai/bdfa27f6bdad49c9efafdf66b8be80e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*BINFMTC: -Wall | |
| */ | |
| #include <stdio.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <sys/ioctl.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <linux/loop.h> | |
| int main(int argc, char **argv) { | |
| if (argc != 2) { | |
| fprintf(stderr, "Usage: %s <loop-index>\n", argv[0]); | |
| return 0; | |
| } | |
| int li = atoi(argv[1]); | |
| int fd = open("/dev/loop-control", O_RDWR); | |
| ioctl(fd, LOOP_CTL_REMOVE, li); | |
| close(fd); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment