Lines Matching defs:loop
16 associated with a loop device.
20 -f Find first unused loop device (may create one)
37 #include <linux/loop.h>
54 struct loop_info64 *loop = (void *)(toybuf+32);
58 // Open file (ffd) and loop device (lfd)
62 int i, cfd = open("/dev/loop-control", O_RDWR);
65 // just preallocate loop devices and stay within them.
67 // mount -o loop depends on found device being at the start of toybuf.
70 sprintf(device = toybuf, "%s/loop%d", TT.dir, i);
78 // Stat the loop device to see if there's a current association.
79 memset(loop, 0, sizeof(struct loop_info64));
80 if (-1 == lfd || ioctl(lfd, LOOP_GET_STATUS64, loop)) {
94 if (TT.j && (loop->lo_device != TT.jdev || loop->lo_inode != TT.jino))
114 xstrncpy((char *)loop->lo_file_name, f_path, LO_NAME_SIZE);
116 loop->lo_offset = TT.o;
117 loop->lo_sizelimit = TT.S;
118 if (ioctl(lfd, LOOP_SET_STATUS64, loop)) perror_exit("%s=%s", device, file);
122 xprintf("%s: [%lld]:%llu (%s)", device, (long long)loop->lo_device,
123 (long long)loop->lo_inode, loop->lo_file_name);
124 if (loop->lo_offset) xprintf(", offset %llu",
125 (unsigned long long)loop->lo_offset);
126 if (loop->lo_sizelimit) xprintf(", sizelimit %llu",
127 (unsigned long long)loop->lo_sizelimit);
137 // Perform an action on all currently existing loop devices
142 // Initial /dev node needs to recurse down one level, then only loop[0-9]*
144 if (strncmp(s, "loop", 4) || !isdigit(s[4])) return 0;