Fix some bad memory stuff, add more logging.
This commit is contained in:
parent
db0f419193
commit
88677ca45a
@ -87,14 +87,11 @@ struct _Ecdb_Drive_Info
|
||||
/* Mark this as being stale */
|
||||
unsigned char fresh_info:1;
|
||||
|
||||
/* Capacity */
|
||||
unsigned long long capacity;
|
||||
|
||||
/* Disc status */
|
||||
unsigned int status;
|
||||
|
||||
/* Disc type */
|
||||
/* Disc info */
|
||||
char *type;
|
||||
char *disc_udi;
|
||||
unsigned int status;
|
||||
unsigned long long capacity;
|
||||
|
||||
BurnDriveInfo *tangible;
|
||||
};
|
||||
|
@ -25,13 +25,9 @@ _ecdb_drive_set_capabilities(Ecdb_Drive_Info *drive,
|
||||
|
||||
int
|
||||
ecdb_update_drive_info(Ecdb_Drive_Info *drive,
|
||||
E_Hal_Device_Get_All_Properties_Return *ret,
|
||||
char *udi)
|
||||
E_Hal_Device_Get_All_Properties_Return *ret)
|
||||
{
|
||||
/* Assume that nothing about the physical hardware has changed */
|
||||
drive->udi = udi;
|
||||
|
||||
/* Update the drive directories */
|
||||
/* Assume that the physical hardware hasn't changed */
|
||||
FREE(drive->write_speeds);
|
||||
_ecdb_drive_set_capabilities(drive, ret);
|
||||
|
||||
|
@ -3,10 +3,9 @@
|
||||
#define ECDB_DRIVES_H
|
||||
|
||||
int ecdb_aquire_drive_info(E_Hal_Device_Get_All_Properties_Return *ret,
|
||||
char *mnt, char *udi);
|
||||
char *mnt, char *udi);
|
||||
int ecdb_update_drive_info(Ecdb_Drive_Info *drive,
|
||||
E_Hal_Device_Get_All_Properties_Return *ret,
|
||||
char *udi);
|
||||
E_Hal_Device_Get_All_Properties_Return *ret);
|
||||
void ecdb_print_drive_info(void);
|
||||
int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx);
|
||||
void ecdb_drive_info_list_free(Eina_List *list);
|
||||
|
@ -6,7 +6,6 @@ void _ecdb_hal_volume_all_cb(void *data, void *reply_data, DBusError *error);
|
||||
void _ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error);
|
||||
void _ecdb_hal_volume_removed_cb(void *data, DBusMessage *msg);
|
||||
void _ecdb_hal_volume_added_cb(void *data, DBusMessage *msg);
|
||||
void _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error);
|
||||
void _ecdb_hal_volume_cb(void *data, void *reply_data, DBusError *error);
|
||||
void _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error);
|
||||
void _ecdb_hal_unmount_cb(void *data, void *reply_data, DBusError *error);
|
||||
@ -32,7 +31,7 @@ _ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error)
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
/* XXX Handle this here */
|
||||
EINA_ERROR_PWARN("DBus error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
return;
|
||||
}
|
||||
@ -48,12 +47,11 @@ _ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error)
|
||||
{
|
||||
if (!strcmp(drive->location, str))
|
||||
{
|
||||
if (!ecdb_update_drive_info(drive, ret, udi))
|
||||
if (!ecdb_update_drive_info(drive, ret))
|
||||
{
|
||||
EINA_ERROR_PWARN("Couldn't update old drive info!\n");
|
||||
}
|
||||
|
||||
printf("Recreating old...\n");
|
||||
ecdb_print_drive_info();
|
||||
return;
|
||||
}
|
||||
@ -69,7 +67,6 @@ _ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating new...\n");
|
||||
ecdb_print_drive_info();
|
||||
|
||||
/* Check to see if we have acquired all of the drives */
|
||||
@ -93,10 +90,9 @@ _ecdb_hal_volume_removed_cb(void *data __UNUSED__, DBusMessage *msg)
|
||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
printf("Removed: %s\n", udi);
|
||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||
{
|
||||
if (!strcmp(drive->udi, udi))
|
||||
if (!strcmp(drive->disc_udi, udi))
|
||||
{
|
||||
drive->fresh_info = FALSE;
|
||||
drive->status = 0;
|
||||
@ -131,11 +127,14 @@ _ecdb_hal_volume_cb(void *data, void *reply_data, DBusError *error)
|
||||
ret = reply_data;
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
EINA_ERROR_PWARN("No DBus data!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
/* XXX Handle this here */
|
||||
EINA_ERROR_PWARN("DBus error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
return;
|
||||
}
|
||||
@ -158,11 +157,14 @@ _ecdb_hal_device_all_cb(void *data __UNUSED__, void *reply_data,
|
||||
ret = reply_data;
|
||||
|
||||
if ((!ret) || (!ret->strings))
|
||||
{
|
||||
EINA_ERROR_PWARN("No DBus data!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
/* XXX Handle this here */
|
||||
EINA_ERROR_PWARN("DBus error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
return;
|
||||
}
|
||||
@ -215,7 +217,7 @@ _ecdb_hal_unmount_cb(void *data, void *reply_data __UNUSED__, DBusError *error)
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
EINA_ERROR_PWARN("Cannot unmount volume!\n");
|
||||
EINA_ERROR_PWARN("Unmount Error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
}
|
||||
}
|
||||
@ -252,11 +254,14 @@ _ecdb_hal_volume_all_cb(void *data __UNUSED__, void *reply_data,
|
||||
ret = reply_data;
|
||||
|
||||
if ((!ret) || (!ret->strings))
|
||||
{
|
||||
EINA_ERROR_PWARN("No DBus data!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
/* XXX Handle this here */
|
||||
EINA_ERROR_PWARN("DBus error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
return;
|
||||
}
|
||||
@ -264,7 +269,7 @@ _ecdb_hal_volume_all_cb(void *data __UNUSED__, void *reply_data,
|
||||
EINA_LIST_FOREACH(ret->strings, l, udi)
|
||||
{
|
||||
e_hal_device_get_all_properties(em->conn, udi, _ecdb_hal_volume_handle,
|
||||
NULL);
|
||||
(void *)strdup(udi));
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,17 +279,21 @@ _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error)
|
||||
E_Hal_Device_Get_All_Properties_Return *ret;
|
||||
Ecdb_Drive_Info *drive;
|
||||
Eina_List *l;
|
||||
char *udi;
|
||||
char *udi, *disc_udi;
|
||||
int err;
|
||||
|
||||
ret = reply_data;
|
||||
disc_udi = data;
|
||||
|
||||
if (!ret)
|
||||
if ((!ret) || (!disc_udi))
|
||||
{
|
||||
EINA_ERROR_PWARN("No DBus data or volume data!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set(error))
|
||||
{
|
||||
/* XXX Handle this better */
|
||||
EINA_ERROR_PWARN("DBus error: %s %s\n", error->name, error->message);
|
||||
dbus_error_free(error);
|
||||
return;
|
||||
}
|
||||
@ -301,6 +310,7 @@ _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error)
|
||||
{
|
||||
if (!strcmp(udi, drive->udi))
|
||||
{
|
||||
drive->disc_udi = disc_udi;
|
||||
drive->capacity = e_hal_property_uint64_get(ret,
|
||||
"volume.disc.capacity", NULL);
|
||||
|
||||
@ -323,7 +333,6 @@ _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error)
|
||||
}
|
||||
}
|
||||
|
||||
FREE(data);
|
||||
FREE(udi);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user