Displaying 2 results from an estimated 2 matches for "loop_formats".
2019 Nov 05
0
[klibc:master] losetup: Use LOOP_CTL_GET_FREE to find free device
...utils/losetup.c
@@ -95,51 +95,26 @@ is_loop_device (const char *device) {
char * find_unused_loop_device (void)
{
- /* Just creating a device, say in /tmp, is probably a bad idea -
- people might have problems with backup or so.
- So, we just try /dev/loop[0-7]. */
char dev[20];
- char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };
- int i, j, fd, somedev = 0, someloop = 0, permission = 0;
- struct stat statbuf;
- struct loop_info loopinfo;
-
- for (j = 0; j < SIZE(loop_formats); j++) {
- for(i = 0; i < 256; i++) {
- sprintf(dev, loop_formats[j], i);
- if (...
2010 Mar 14
0
[patches] klibc review unsorted patch queue
...uf.st_rdev) == LOOPMAJOR);
+}
+
+#define SIZE(a) (sizeof(a)/sizeof(a[0]))
+
+char * find_unused_loop_device (void)
+{
+ /* Just creating a device, say in /tmp, is probably a bad idea -
+ people might have problems with backup or so.
+ So, we just try /dev/loop[0-7]. */
+ char dev[20];
+ char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };
+ int i, j, fd, somedev = 0, someloop = 0, permission = 0;
+ struct stat statbuf;
+ struct loop_info loopinfo;
+
+ for (j = 0; j < SIZE(loop_formats); j++) {
+ for(i = 0; i < 256; i++) {
+ sprintf(dev, loop_formats[j], i);
+ if (...