[Toybox] [PATCH] Use LOOP_CLR_FD instead of a constant.

enh enh at google.com
Sat Mar 28 18:20:47 PDT 2015


Use LOOP_CLR_FD instead of a constant.

losetup.c already uses LOOP_CLR_FD.

diff --git a/toys/lsb/umount.c b/toys/lsb/umount.c
index c7998e4..d688ad2 100644
--- a/toys/lsb/umount.c
+++ b/toys/lsb/umount.c
@@ -30,6 +30,7 @@ config UMOUNT

 #define FOR_umount
 #include "toys.h"
+#include <linux/loop.h>

 GLOBALS(
   struct arg_list *t;
@@ -84,8 +85,7 @@ static void do_umount(char *dir, char *dev, int flags)
       int lfd = open(dev, O_RDONLY);

       if (lfd != -1) {
-        // This is LOOP_CLR_FD, fetching it from headers is awkward
-        if (!ioctl(lfd, 0x4C01) && (toys.optflags & FLAG_v))
+        if (!ioctl(lfd, LOOP_CLR_FD) && (toys.optflags & FLAG_v))
           xprintf("%s cleared\n", dev);
         close(lfd);
       }

 1427592047.0


More information about the Toybox mailing list