mountmgr: Remove the obsolete libhal support.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-11-25 11:21:14 +01:00
parent dbe3269c9d
commit 37b7259f07
4 changed files with 1 additions and 495 deletions

116
configure vendored
View File

@ -700,8 +700,6 @@ SANE_LIBS
SANE_CFLAGS
GNUTLS_LIBS
GNUTLS_CFLAGS
HAL_LIBS
HAL_CFLAGS
DBUS_LIBS
DBUS_CFLAGS
INOTIFY_LIBS
@ -898,7 +896,6 @@ with_gphoto
with_gnutls
with_gssapi
with_gstreamer
with_hal
with_inotify
with_krb5
with_ldap
@ -1990,8 +1987,6 @@ INOTIFY_CFLAGS
INOTIFY_LIBS
DBUS_CFLAGS
DBUS_LIBS
HAL_CFLAGS
HAL_LIBS
GNUTLS_CFLAGS
GNUTLS_LIBS
SANE_CFLAGS
@ -2686,7 +2681,6 @@ Optional Packages:
--without-gnutls do not use GnuTLS (schannel support)
--without-gssapi do not use GSSAPI (Kerberos SSP support)
--without-gstreamer do not use GStreamer (codecs support)
--without-hal do not use HAL (dynamic device support)
--without-inotify do not use inotify (filesystem change notifications)
--without-krb5 do not use krb5 (Kerberos)
--without-ldap do not use LDAP
@ -2794,8 +2788,6 @@ Some influential environment variables:
Linker flags for libinotify, overriding pkg-config
DBUS_CFLAGS C compiler flags for dbus-1, overriding pkg-config
DBUS_LIBS Linker flags for dbus-1, overriding pkg-config
HAL_CFLAGS C compiler flags for hal, overriding pkg-config
HAL_LIBS Linker flags for hal, overriding pkg-config
GNUTLS_CFLAGS
C compiler flags for gnutls, overriding pkg-config
GNUTLS_LIBS Linker flags for gnutls, overriding pkg-config
@ -4531,13 +4523,6 @@ then :
fi
# Check whether --with-hal was given.
if test ${with_hal+y}
then :
withval=$with_hal;
fi
# Check whether --with-inotify was given.
if test ${with_inotify+y}
then :
@ -15178,105 +15163,6 @@ esac
fi
if test "x$with_hal" != "xno" -a "x$ac_cv_lib_soname_dbus_1" != x
then
if ${HAL_CFLAGS:+false} :
then :
if test ${PKG_CONFIG+y}
then :
HAL_CFLAGS=`$PKG_CONFIG --cflags hal 2>/dev/null`
fi
fi
if ${HAL_LIBS:+false} :
then :
if test ${PKG_CONFIG+y}
then :
HAL_LIBS=`$PKG_CONFIG --libs hal 2>/dev/null`
fi
fi
HAL_LIBS=${HAL_LIBS:-"-ldbus-1"}
printf "%s\n" "$as_me:${as_lineno-$LINENO}: hal cflags: $HAL_CFLAGS" >&5
printf "%s\n" "$as_me:${as_lineno-$LINENO}: hal libs: $HAL_LIBS" >&5
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $HAL_CFLAGS"
ac_fn_c_check_header_compile "$LINENO" "hal/libhal.h" "ac_cv_header_hal_libhal_h" "$ac_includes_default"
if test "x$ac_cv_header_hal_libhal_h" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lhal" >&5
printf %s "checking for -lhal... " >&6; }
if test ${ac_cv_lib_soname_hal+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_soname_save_LIBS=$LIBS
LIBS="-lhal $HAL_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char libhal_ctx_new ();
int
main (void)
{
return libhal_ctx_new ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_hal=`$ac_cv_path_LDD conftest.exe | grep "hal" | sed -e "s/dll.*/dll/"';2,$d'` ;;
dylib) ac_cv_lib_soname_hal=`$OTOOL -L conftest$ac_exeext | grep "libhal\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libhal\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_hal=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libhal\\.$LIBEXT" | sed -e "s/^.*\\[\\(libhal\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_hal:+false} :
then :
ac_cv_lib_soname_hal=`$LDD conftest$ac_exeext | grep "libhal\\.$LIBEXT" | sed -e "s/^.*\(libhal\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
else $as_nop
ac_cv_lib_soname_hal=
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
fi
if ${ac_cv_lib_soname_hal:+false} :
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
HAL_CFLAGS=""
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_hal" >&5
printf "%s\n" "$ac_cv_lib_soname_hal" >&6; }
printf "%s\n" "#define SONAME_LIBHAL \"$ac_cv_lib_soname_hal\"" >>confdefs.h
fi
else $as_nop
HAL_CFLAGS=""
fi
CPPFLAGS=$ac_save_CPPFLAGS
if test "x$ac_cv_lib_soname_hal" = "x" -a \
"x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"
then :
case "x$with_hal" in
x) as_fn_append wine_notices "|libhal ${notice_platform}development files not found, no legacy dynamic device support." ;;
xno) ;;
*) as_fn_error $? "libhal ${notice_platform}development files not found, no legacy dynamic device support.
This is an error since --with-hal was requested." "$LINENO" 5 ;;
esac
fi
fi
if test "x$with_gnutls" != "xno"
then
if ${GNUTLS_CFLAGS:+false} :
@ -23166,8 +23052,6 @@ INOTIFY_CFLAGS = $INOTIFY_CFLAGS
INOTIFY_LIBS = $INOTIFY_LIBS
DBUS_CFLAGS = $DBUS_CFLAGS
DBUS_LIBS = $DBUS_LIBS
HAL_CFLAGS = $HAL_CFLAGS
HAL_LIBS = $HAL_LIBS
GNUTLS_CFLAGS = $GNUTLS_CFLAGS
GNUTLS_LIBS = $GNUTLS_LIBS
SANE_CFLAGS = $SANE_CFLAGS

View File

@ -39,7 +39,6 @@ AC_ARG_WITH(gphoto, AS_HELP_STRING([--without-gphoto],[do not use gphoto (Dig
AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls],[do not use GnuTLS (schannel support)]))
AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Kerberos SSP support)]))
AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)]))
AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)]))
AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (filesystem change notifications)]))
AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)]))
AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]),
@ -1324,18 +1323,6 @@ WINE_NOTICE_WITH(dbus,[test "x$ac_cv_lib_soname_dbus_1" = "x" -a \
"x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"],
[libdbus ${notice_platform}development files not found, no dynamic device support.])
dnl **** Check for libhal ****
if test "x$with_hal" != "xno" -a "x$ac_cv_lib_soname_dbus_1" != x
then
WINE_PACKAGE_FLAGS(HAL,[hal],[-ldbus-1],,,
[AC_CHECK_HEADER([hal/libhal.h],
[WINE_CHECK_SONAME(hal, libhal_ctx_new,,[HAL_CFLAGS=""],[$HAL_LIBS])],
[HAL_CFLAGS=""])])
WINE_NOTICE_WITH(hal,[test "x$ac_cv_lib_soname_hal" = "x" -a \
"x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"],
[libhal ${notice_platform}development files not found, no legacy dynamic device support.])
fi
dnl **** Check for libgnutls ****
if test "x$with_gnutls" != "xno"
then

View File

@ -28,9 +28,6 @@
#ifdef SONAME_LIBDBUS_1
# include <dbus/dbus.h>
#endif
#ifdef SONAME_LIBHAL
# include <hal/libhal.h>
#endif
#include "mountmgr.h"
#include "winnls.h"
@ -85,59 +82,6 @@ DBUS_FUNCS;
static int udisks_timeout = -1;
static DBusConnection *connection;
#ifdef SONAME_LIBHAL
#define HAL_FUNCS \
DO_FUNC(libhal_ctx_free); \
DO_FUNC(libhal_ctx_init); \
DO_FUNC(libhal_ctx_new); \
DO_FUNC(libhal_ctx_set_dbus_connection); \
DO_FUNC(libhal_ctx_set_device_added); \
DO_FUNC(libhal_ctx_set_device_property_modified); \
DO_FUNC(libhal_ctx_set_device_removed); \
DO_FUNC(libhal_ctx_shutdown); \
DO_FUNC(libhal_device_get_property_bool); \
DO_FUNC(libhal_device_get_property_int); \
DO_FUNC(libhal_device_get_property_string); \
DO_FUNC(libhal_device_add_property_watch); \
DO_FUNC(libhal_device_remove_property_watch); \
DO_FUNC(libhal_free_string); \
DO_FUNC(libhal_free_string_array); \
DO_FUNC(libhal_get_all_devices)
#define DO_FUNC(f) static typeof(f) * p_##f
HAL_FUNCS;
#undef DO_FUNC
static BOOL load_hal_functions(void)
{
void *hal_handle;
/* Load libhal with RTLD_GLOBAL so that the dbus symbols are available.
* We can't load libdbus directly since libhal may have been built against a
* different version but with the same soname. Binary compatibility is for wimps. */
if (!(hal_handle = dlopen( SONAME_LIBHAL, RTLD_NOW | RTLD_GLOBAL )))
goto failed;
#define DO_FUNC(f) if (!(p_##f = dlsym( RTLD_DEFAULT, #f ))) goto failed
DBUS_FUNCS;
#undef DO_FUNC
#define DO_FUNC(f) if (!(p_##f = dlsym( hal_handle, #f ))) goto failed
HAL_FUNCS;
#undef DO_FUNC
udisks_timeout = 3000; /* don't try for too long if we can fall back to HAL */
return TRUE;
failed:
WARN( "failed to load HAL support: %s\n", dlerror() );
return FALSE;
}
#endif /* SONAME_LIBHAL */
static LONG WINAPI assert_fault(EXCEPTION_POINTERS *eptr)
{
if (eptr->ExceptionRecord->ExceptionCode == EXCEPTION_WINE_ASSERTION)
@ -578,299 +522,6 @@ static DBusHandlerResult udisks_filter( DBusConnection *ctx, DBusMessage *msg, v
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
#ifdef SONAME_LIBHAL
static BOOL hal_get_ide_parameters( LibHalContext *ctx, const char *udi, SCSI_ADDRESS *scsi_addr, UCHAR *devtype, char *ident, size_t ident_size )
{
DBusError error;
char *parent = NULL;
char *type = NULL;
char *model = NULL;
int host, chan;
BOOL ret = FALSE;
p_dbus_error_init( &error );
if (!(parent = p_libhal_device_get_property_string( ctx, udi, "info.parent", &error )))
goto done;
if ((host = p_libhal_device_get_property_int( ctx, parent, "ide.host", &error )) < 0)
goto done;
if ((chan = p_libhal_device_get_property_int( ctx, parent, "ide.channel", &error )) < 0)
goto done;
ret = TRUE;
if (devtype)
{
if (!(type = p_libhal_device_get_property_string( ctx, udi, "storage.drive_type", &error )))
*devtype = SCSI_UNKNOWN_PERIPHERAL;
else if (!strcmp( type, "disk" ) || !strcmp( type, "floppy" ))
*devtype = SCSI_DISK_PERIPHERAL;
else if (!strcmp( type, "tape" ))
*devtype = SCSI_TAPE_PERIPHERAL;
else if (!strcmp( type, "cdrom" ))
*devtype = SCSI_CDROM_PERIPHERAL;
else if (!strcmp( type, "raid" ))
*devtype = SCSI_ARRAY_PERIPHERAL;
else
*devtype = SCSI_UNKNOWN_PERIPHERAL;
}
if (ident)
{
if (!(model = p_libhal_device_get_property_string( ctx, udi, "storage.model", &error )))
p_dbus_error_free( &error ); /* ignore error */
else
lstrcpynA( ident, model, ident_size );
}
scsi_addr->PortNumber = host;
scsi_addr->PathId = 0;
scsi_addr->TargetId = chan;
scsi_addr->Lun = 0;
done:
if (model) p_libhal_free_string( model );
if (type) p_libhal_free_string( type );
if (parent) p_libhal_free_string( parent );
p_dbus_error_free( &error );
return ret;
}
static BOOL hal_get_scsi_parameters( LibHalContext *ctx, const char *udi, SCSI_ADDRESS *scsi_addr, UCHAR *devtype, char *ident, size_t ident_size )
{
DBusError error;
char *type = NULL;
char *vendor = NULL;
char *model = NULL;
int host, bus, target, lun;
BOOL ret = FALSE;
p_dbus_error_init( &error );
if ((host = p_libhal_device_get_property_int( ctx, udi, "scsi.host", &error )) < 0)
goto done;
if ((bus = p_libhal_device_get_property_int( ctx, udi, "scsi.bus", &error )) < 0)
goto done;
if ((target = p_libhal_device_get_property_int( ctx, udi, "scsi.target", &error )) < 0)
goto done;
if ((lun = p_libhal_device_get_property_int( ctx, udi, "scsi.lun", &error )) < 0)
goto done;
ret = TRUE;
scsi_addr->PortNumber = host;
scsi_addr->PathId = bus;
scsi_addr->TargetId = target;
scsi_addr->Lun = lun;
if (ident)
{
if (!(vendor = p_libhal_device_get_property_string( ctx, udi, "scsi.vendor", &error )))
p_dbus_error_free( &error ); /* ignore error */
if (!(model = p_libhal_device_get_property_string( ctx, udi, "scsi.model", &error )))
p_dbus_error_free( &error ); /* ignore error */
snprintf( ident, ident_size, "%-8s%-16s", vendor ? vendor : "WINE", model ? model : "SCSI" );
}
if (devtype)
{
if (!(type = p_libhal_device_get_property_string( ctx, udi, "scsi.type", &error )))
{
*devtype = SCSI_UNKNOWN_PERIPHERAL;
goto done;
}
if (!strcmp( type, "disk" ))
*devtype = SCSI_DISK_PERIPHERAL;
else if (!strcmp( type, "tape" ))
*devtype = SCSI_TAPE_PERIPHERAL;
else if (!strcmp( type, "printer" ))
*devtype = SCSI_PRINTER_PERIPHERAL;
else if (!strcmp( type, "processor" ))
*devtype = SCSI_PROCESSOR_PERIPHERAL;
else if (!strcmp( type, "cdrom" ))
*devtype = SCSI_CDROM_PERIPHERAL;
else if (!strcmp( type, "scanner" ))
*devtype = SCSI_SCANNER_PERIPHERAL;
else if (!strcmp( type, "medium_changer" ))
*devtype = SCSI_MEDIUM_CHANGER_PERIPHERAL;
else if (!strcmp( type, "comm" ))
*devtype = SCSI_COMMS_PERIPHERAL;
else if (!strcmp( type, "raid" ))
*devtype = SCSI_ARRAY_PERIPHERAL;
else
*devtype = SCSI_UNKNOWN_PERIPHERAL;
}
done:
if (type) p_libhal_free_string( type );
if (vendor) p_libhal_free_string( vendor );
if (model) p_libhal_free_string( model );
p_dbus_error_free( &error );
return ret;
}
static void hal_new_ide_device( LibHalContext *ctx, const char *udi )
{
SCSI_ADDRESS scsi_addr;
UCHAR devtype;
char ident[40];
if (!hal_get_ide_parameters( ctx, udi, &scsi_addr, &devtype, ident, sizeof(ident) )) return;
create_scsi_entry( &scsi_addr, 255, devtype == SCSI_CDROM_PERIPHERAL ? "atapi" : "WINE SCSI", devtype, ident, NULL );
}
static void hal_set_device_name( LibHalContext *ctx, const char *udi, const UNICODE_STRING *devname )
{
DBusError error;
SCSI_ADDRESS scsi_addr;
char *parent = NULL;
p_dbus_error_init( &error );
if (!hal_get_ide_parameters( ctx, udi, &scsi_addr, NULL, NULL, 0 ))
{
if (!(parent = p_libhal_device_get_property_string( ctx, udi, "info.parent", &error )))
goto done;
if (!hal_get_scsi_parameters( ctx, parent, &scsi_addr, NULL, NULL, 0 ))
goto done;
}
set_scsi_device_name( &scsi_addr, devname );
done:
if (parent) p_libhal_free_string( parent );
p_dbus_error_free( &error );
}
static void hal_new_scsi_device( LibHalContext *ctx, const char *udi )
{
SCSI_ADDRESS scsi_addr;
UCHAR devtype;
char ident[40];
if (!hal_get_scsi_parameters( ctx, udi, &scsi_addr, &devtype, ident, sizeof(ident) )) return;
/* FIXME: get real controller Id for SCSI */
create_scsi_entry( &scsi_addr, 255, "WINE SCSI", devtype, ident, NULL );
}
/* HAL callback for new device */
static void hal_new_device( LibHalContext *ctx, const char *udi )
{
DBusError error;
char *parent = NULL;
char *mount_point = NULL;
char *device = NULL;
char *type = NULL;
char *uuid_str = NULL;
GUID guid, *guid_ptr = NULL;
enum device_type drive_type;
p_dbus_error_init( &error );
hal_new_scsi_device( ctx, udi );
hal_new_ide_device( ctx, udi );
if (!(device = p_libhal_device_get_property_string( ctx, udi, "block.device", &error )))
goto done;
if (!(mount_point = p_libhal_device_get_property_string( ctx, udi, "volume.mount_point", &error )))
goto done;
if (!(parent = p_libhal_device_get_property_string( ctx, udi, "info.parent", &error )))
goto done;
if (!(uuid_str = p_libhal_device_get_property_string( ctx, udi, "volume.uuid", &error )))
p_dbus_error_free( &error ); /* ignore error */
else
guid_ptr = parse_uuid( &guid, uuid_str );
if (!(type = p_libhal_device_get_property_string( ctx, parent, "storage.drive_type", &error )))
p_dbus_error_free( &error ); /* ignore error */
if (type && !strcmp( type, "cdrom" )) drive_type = DEVICE_CDROM;
else if (type && !strcmp( type, "floppy" )) drive_type = DEVICE_FLOPPY;
else drive_type = DEVICE_UNKNOWN;
if (p_libhal_device_get_property_bool( ctx, parent, "storage.removable", &error ))
{
UNICODE_STRING devname;
add_dos_device( -1, udi, device, mount_point, drive_type, guid_ptr, &devname );
hal_set_device_name( ctx, parent, &devname );
/* add property watch for mount point */
p_libhal_device_add_property_watch( ctx, udi, &error );
}
else if (guid_ptr) add_volume( udi, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr, NULL );
done:
if (type) p_libhal_free_string( type );
if (parent) p_libhal_free_string( parent );
if (device) p_libhal_free_string( device );
if (uuid_str) p_libhal_free_string( uuid_str );
if (mount_point) p_libhal_free_string( mount_point );
p_dbus_error_free( &error );
}
/* HAL callback for removed device */
static void hal_removed_device( LibHalContext *ctx, const char *udi )
{
DBusError error;
TRACE( "removed %s\n", wine_dbgstr_a(udi) );
if (!remove_dos_device( -1, udi ))
{
p_dbus_error_init( &error );
p_libhal_device_remove_property_watch( ctx, udi, &error );
p_dbus_error_free( &error );
}
else remove_volume( udi );
}
/* HAL callback for property changes */
static void hal_property_modified (LibHalContext *ctx, const char *udi,
const char *key, dbus_bool_t is_removed, dbus_bool_t is_added)
{
TRACE( "udi %s key %s %s\n", wine_dbgstr_a(udi), wine_dbgstr_a(key),
is_added ? "added" : is_removed ? "removed" : "modified" );
if (!strcmp( key, "volume.mount_point" )) hal_new_device( ctx, udi );
}
static BOOL hal_enumerate_devices(void)
{
LibHalContext *ctx;
DBusError error;
int i, num;
char **list;
if (!p_libhal_ctx_new) return FALSE;
if (!(ctx = p_libhal_ctx_new())) return FALSE;
p_libhal_ctx_set_dbus_connection( ctx, connection );
p_libhal_ctx_set_device_added( ctx, hal_new_device );
p_libhal_ctx_set_device_removed( ctx, hal_removed_device );
p_libhal_ctx_set_device_property_modified( ctx, hal_property_modified );
p_dbus_error_init( &error );
if (!p_libhal_ctx_init( ctx, &error ))
{
WARN( "HAL context init failed: %s\n", error.message );
p_dbus_error_free( &error );
return FALSE;
}
/* retrieve all existing devices */
if (!(list = p_libhal_get_all_devices( ctx, &num, &error ))) p_dbus_error_free( &error );
else
{
for (i = 0; i < num; i++) hal_new_device( ctx, list[i] );
p_libhal_free_string_array( list );
}
return TRUE;
}
#endif /* SONAME_LIBHAL */
static DWORD WINAPI dbus_thread( void *arg )
{
static const char udisks_match[] = "type='signal',"
@ -909,16 +560,6 @@ static DWORD WINAPI dbus_thread( void *arg )
p_dbus_bus_remove_match( connection, udisks_match, &error );
p_dbus_connection_remove_filter( connection, udisks_filter, NULL );
/* then finally HAL */
#ifdef SONAME_LIBHAL
if (!hal_enumerate_devices())
{
p_dbus_error_free( &error );
return 1;
}
#endif
found:
__TRY
{
@ -938,10 +579,7 @@ void initialize_dbus(void)
{
HANDLE handle;
#ifdef SONAME_LIBHAL
if (!load_hal_functions())
#endif
if (!load_dbus_functions()) return;
if (!load_dbus_functions()) return;
if (!(handle = CreateThread( NULL, 0, dbus_thread, NULL, 0, NULL ))) return;
CloseHandle( handle );
}

View File

@ -901,9 +901,6 @@
/* Define to the soname of the libgssapi_krb5 library. */
#undef SONAME_LIBGSSAPI_KRB5
/* Define to the soname of the libhal library. */
#undef SONAME_LIBHAL
/* Define to the soname of the libkrb5 library. */
#undef SONAME_LIBKRB5