diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -36,6 +36,13 @@ #include <unistd.h> #include <ctype.h> +#if defined BB_FEATURE_MOUNT_LOOP +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/loop.h> +#endif + + #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF # if defined BB_FEATURE_USE_PROCFS const char mtab_file[] = "/proc/mounts"; @@ -1146,4 +1153,22 @@ extern int vdprintf(int d, const char *format, va_list ap) } #endif +#if defined BB_FEATURE_MOUNT_LOOP +extern int del_loop(const char *device) +{ + int fd; + + if ((fd = open(device, O_RDONLY)) < 0) { + perror(device); + return( FALSE); + } + if (ioctl(fd, LOOP_CLR_FD, 0) < 0) { + perror("ioctl: LOOP_CLR_FD"); + return( FALSE); + } + close(fd); + return( TRUE); +} +#endif + /* END CODE */ |