/* * cloop_suspend - Suspend a cloop device until losetup /dev/cloop is * run again. * * Copyright (c) 2007 by Fabian Franz. * * License: GPL, v2. * */ #include #include #include #include #include #include /* We don't use the structure, so that define does not hurt */ #define dev_t int #include #include "cloop.h" int main(int argc, char** argv) { if (argc < 2) { fprintf(stderr, "syntax: %s \n", argv[0]); fprintf(stderr, " suspends and unlocks cloop \n"); fprintf(stderr, " until a new file is loaded via losetup\n"); return 1; } int fd = open(argv[1], O_RDONLY); if (fd < 0) { perror(argv[1]); return 1; } if (ioctl(fd, CLOOP_SUSPEND) < 0) { perror("ioctl: CLOOP_SUSPEND"); return 1; } close(fd); return 0; }