Lines Matching refs:device
13 usage: losetup [-cdrs] [-o OFFSET] [-S SIZE] {-d DEVICE...|-j FILE|-af|{DEVICE FILE}}
15 Associate a loopback device with a file, or show current file (if any)
16 associated with a loop device.
18 Instead of a device:
20 -f Find first unused loop device (may create one)
25 -d Detach loopback device
28 -s Show device name (alias --show)
53 allocate new loop device:
58 // -f: *device is NULL
60 // Perform requested operation on one device. Returns 1 if handled, 0 if error
61 static void loopback_setup(char *device, char *file)
67 // Open file (ffd) and loop device (lfd)
70 if (!device) {
73 // We assume /dev is devtmpfs so device creation has no lag. Otherwise
76 // mount -o loop depends on found device being at the start of toybuf.
79 sprintf(device = toybuf, "/dev/loop%d", i);
84 if (device) lfd = open(device, TT.openflags);
86 // Stat the loop device to see if there's a current association.
91 perror_msg_raw(device ? device : "-f");
104 perror_msg_raw(device);
107 // Associate file with this device?
112 if (ioctl(lfd, LOOP_SET_FD, ffd)) perror_exit("%s=%s", device, file);
117 if (ioctl(lfd, LOOP_SET_STATUS64, loop)) perror_exit("%s=%s", device, file);
118 if (flags & FLAG_s) printf("%s", device);
120 } else if (flags & FLAG_f) printf("%s", device);
122 xprintf("%s: [%04llx]:%llu (%s)", device, loop->lo_device, loop->lo_inode,
164 // With just device, display current association
165 // -a, -f substitute for device
166 // -j substitute for device
179 // Do we need one DEVICE argument?