Bug#452674: Relies on devfs compatibility

2007-11-26 Thread Otavio Salvador
Martin Michlmayr <[EMAIL PROTECTED]> writes:

> The following patch works for me.  I tested with zero, one and two
> disks.

The patch looks OK .. please commit and upload it :-)

-- 
O T A V I OS A L V A D O R
-
 E-mail: [EMAIL PROTECTED]  UIN: 5906116
 GNU/Linux User: 239058 GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
-
"Microsoft sells you Windows ... Linux gives
 you the whole house."



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#452674: Relies on devfs compatibility

2007-11-24 Thread Otavio Salvador
Martin Michlmayr <[EMAIL PROTECTED]> writes:

> The following patch works for me.  I tested with zero, one and two
> disks.

Cool. Could you commit and upload it?

-- 
O T A V I OS A L V A D O R
-
 E-mail: [EMAIL PROTECTED]  UIN: 5906116
 GNU/Linux User: 239058 GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
-
"Microsoft sells you Windows ... Linux gives
 you the whole house."



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#452674: Relies on devfs compatibility

2007-11-24 Thread Martin Michlmayr
* Martin Michlmayr <[EMAIL PROTECTED]> [2007-11-24 15:41]:
> The following patch works for me.  I tested with zero, one and two
> disks.

The patch looks pretty obvious and works for me, but I'd appreciate it
if someone who actually knows C would review it.
-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#452674: Relies on devfs compatibility

2007-11-24 Thread Frans Pop
On Saturday 24 November 2007, Martin Michlmayr wrote:
> * Martin Michlmayr <[EMAIL PROTECTED]> [2007-11-24 15:41]:
> > The following patch works for me.  I tested with zero, one and two
> > disks.
>
> The patch looks pretty obvious and works for me, but I'd appreciate it
> if someone who actually knows C would review it.

I probably know less C than you do, but after comparing it with somewhat 
similar code in choose-mirror, no problems with the patch jump out at me.


signature.asc
Description: This is a digitally signed message part.


Bug#452674: Relies on devfs compatibility

2007-11-24 Thread Martin Michlmayr
The following patch works for me.  I tested with zero, one and two
disks.

Index: main.c
===
--- main.c  (revision 50232)
+++ main.c  (working copy)
@@ -24,44 +24,28 @@
return PED_EXCEPTION_CANCEL;
 }
 
-/* NOTE:
- * DO NOT base new code in other parts of d-i on this function: it will not
- * work when using udev without devfs compatibility. New code should use
- * 'list-devices disk' from the shell instead.
- */
 static int get_all_disks(PedDevice *discs[], int max_disks) {
-   DIR *devdir;
-   struct dirent *direntry;
+   FILE *fp;
+   char buf[1024];
int disk_count = 0;
 
-   devdir = opendir("/dev/discs");
-   if(devdir == NULL) {
-   di_log(DI_LOG_LEVEL_ERROR, "Failed to open disc directory");
+   fp = popen("list-devices disk", "r");
+   if (fp == NULL) {
+   di_log(DI_LOG_LEVEL_ERROR, "Failed to list disks");
return(0);
}
-
-   while((direntry = readdir(devdir)) != NULL) {
-   char *fullname = NULL;
+   while (fgets(buf, sizeof(buf), fp) != NULL) {
PedDevice *dev;
-
-   if(direntry->d_name[0] == '.')
-   continue;
-
+   if (buf[strlen(buf) - 1] == '\n')
+   buf[strlen(buf) - 1] = '\0';
if (disk_count >= max_disks) {
di_log(DI_LOG_LEVEL_INFO, "More than %d discs", 
max_disks);
break;
}
-
-   asprintf(&fullname, "%s/%s/%s", "/dev/discs",
-   direntry->d_name, "disc");
-
-   if ((dev = ped_device_get(fullname)) && !dev->read_only)
+   if ((dev = ped_device_get(buf)) && !dev->read_only)
discs[disk_count++] = dev;
-   free(fullname);
}
-
-   closedir(devdir);
-
+   fclose(fp);
return(disk_count);
 }
 

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#452674: Relies on devfs compatibility

2007-11-24 Thread Martin Michlmayr
Package: partitioner
Version: 0.41
Severity: serious

partitioner relies on udev with devfs compatibility which we recently
removed.  I now get:

Nov 24 12:59:47 partitioner.postinst[5647]: ERROR **: Failed to open disc 
directory
Nov 24 12:59:47 main-menu[764]: WARNING **: Configuring 'partitioner' failed 
with error code 1

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]