Lines Matching refs:loop
16 associated with a loop device.
20 -f Find first unused loop device (may create one)
36 #include <linux/loop.h>
53 allocate new loop device:
54 /dev/loop-control
63 struct loop_info64 *loop = (void *)(toybuf+32);
67 // Open file (ffd) and loop device (lfd)
71 int i, cfd = open("/dev/loop-control", O_RDWR);
74 // just preallocate loop devices and stay within them.
76 // mount -o loop depends on found device being at the start of toybuf.
79 sprintf(device = toybuf, "/dev/loop%d", i);
86 // Stat the loop device to see if there's a current association.
87 memset(loop, 0, sizeof(struct loop_info64));
88 if (-1 == lfd || ioctl(lfd, LOOP_GET_STATUS64, loop)) {
97 if (TT.jfile && (loop->lo_device != TT.jdev || loop->lo_inode != TT.jino))
113 loop->lo_offset = TT.offset;
114 loop->lo_sizelimit = TT.size;
115 xstrncpy((char *)loop->lo_file_name, s, LO_NAME_SIZE);
117 if (ioctl(lfd, LOOP_SET_STATUS64, loop)) perror_exit("%s=%s", device, file);
122 xprintf("%s: [%04llx]:%llu (%s)", device, loop->lo_device, loop->lo_inode,
123 loop->lo_file_name);
124 if (loop->lo_offset) xprintf(", offset %llu", loop->lo_offset);
125 if (loop->lo_sizelimit) xprintf(", sizelimit %llu", loop->lo_sizelimit);
134 // Perform an action on all currently existing loop devices
139 // Initial /dev node needs to recurse down one level, then only loop[0-9]*
141 if (strncmp(s, "loop", 4) || !isdigit(s[4])) return 0;