diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-27 22:33:49 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-27 22:33:49 +0000 |
commit | cddf7fee3ba4d993a689a28069ffdbe1beed970f (patch) | |
tree | 831384c1f648516bb6d6e491ea6fec9283d8ec50 /mdk-stage1 | |
parent | ee0e449bd2644dea09bd29565b9be54b0bf5636d (diff) | |
download | drakx-cddf7fee3ba4d993a689a28069ffdbe1beed970f.tar drakx-cddf7fee3ba4d993a689a28069ffdbe1beed970f.tar.gz drakx-cddf7fee3ba4d993a689a28069ffdbe1beed970f.tar.bz2 drakx-cddf7fee3ba4d993a689a28069ffdbe1beed970f.tar.xz drakx-cddf7fee3ba4d993a689a28069ffdbe1beed970f.zip |
holy shotgun method for del_loops as well, or else we'll miss image_always loop hence won't be able to eject cdrom
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/init.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index f05ff62e5..b7b5f6e61 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -238,20 +238,20 @@ void doklog() #define LOOP_CLR_FD 0x4C01 -void del_loop(char *device) +void del_loops(void) { - int fd; - if ((fd = open(device, O_RDONLY, 0)) < 0) - return; - - if (ioctl(fd, LOOP_CLR_FD, 0) < 0) { - close(fd); - return; - } - - printf("\t%s\n", device); - - close(fd); + char loopdev[] = "/dev/loop0"; + int i; + for (i=0; i<8; i++) { + int fd; + loopdev[9] = '0' + i; + fd = open(loopdev, O_RDONLY, 0); + if (fd > 0) { + if (!ioctl(fd, LOOP_CLR_FD, 0)) + printf("\t%s\n", loopdev); + close(fd); + } + } } struct filesystem @@ -316,12 +316,9 @@ void unmount_filesystems(void) nb = 0; for (i = 0; i < numfs; i++) { /*printf("trying with %s\n", fs[i].name);*/ + del_loops(); if (fs[i].mounted && umount(fs[i].name) == 0) { printf("\t%s\n", fs[i].name); - - if (strstr(fs[i].dev, "loop")) - del_loop(fs[i].dev); - fs[i].mounted = 0; nb++; } |