aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index 8139f38d9..643c3b5f2 100644
--- a/utility.c
+++ b/utility.c
@@ -36,6 +36,13 @@
36#include <unistd.h> 36#include <unistd.h>
37#include <ctype.h> 37#include <ctype.h>
38 38
39#if defined BB_FEATURE_MOUNT_LOOP
40#include <fcntl.h>
41#include <sys/ioctl.h>
42#include <linux/loop.h>
43#endif
44
45
39#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF 46#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
40# if defined BB_FEATURE_USE_PROCFS 47# if defined BB_FEATURE_USE_PROCFS
41const char mtab_file[] = "/proc/mounts"; 48const char mtab_file[] = "/proc/mounts";
@@ -1146,4 +1153,22 @@ extern int vdprintf(int d, const char *format, va_list ap)
1146} 1153}
1147#endif 1154#endif
1148 1155
1156#if defined BB_FEATURE_MOUNT_LOOP
1157extern int del_loop(const char *device)
1158{
1159 int fd;
1160
1161 if ((fd = open(device, O_RDONLY)) < 0) {
1162 perror(device);
1163 return( FALSE);
1164 }
1165 if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
1166 perror("ioctl: LOOP_CLR_FD");
1167 return( FALSE);
1168 }
1169 close(fd);
1170 return( TRUE);
1171}
1172#endif
1173
1149/* END CODE */ 1174/* END CODE */