Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
gnome-vfs2
gnome-vfs2-183723-unix-mounts-plus-hal-mounts.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-vfs2-183723-unix-mounts-plus-hal-mounts.diff of Package gnome-vfs2
2006-06-16 Federico Mena Quintero <federico@novell.com> Restore the ability to mount volumes with Unix mount(8), instead of only using HAL. Fixes https://bugzilla.novell.com/show_bug.cgi?id=183723 * libgnomevfs/gnome-vfs-volume-ops.c (mount_unmount_with_hal): New function; moved the HAL code from mount_unmount_operation() to here. (mount_unmount_with_unix_mount): Likewise, but for the Unix mounts code. (find_command): Restore function from the original, unpatched source. (mount_unmount_operation): Just dispatch to the right function, mount_unmount_with_hal() or mount_unmount_with_unix_mount(), depending on whether we have a HAL UDI. --- gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c.hal-only 2006-06-16 13:13:37.000000000 -0500 +++ gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c 2006-06-16 13:31:06.000000000 -0500 @@ -56,11 +56,7 @@ static const char *volrmmount_locations #define UMOUNT_COMMAND volrmmount_locations #define UMOUNT_SEPARATOR " -e " -#elif USE_HAL - -static DBusConnection *dbus_ctx = NULL; - -#elif !G_OS_WIN32 +#elif !defined (G_OS_WIN32) static const char *mount_known_locations [] = { "/sbin/mount", "/bin/mount", @@ -80,7 +76,27 @@ static const char *umount_known_location #define UMOUNT_COMMAND umount_known_locations #define UMOUNT_SEPARATOR " " -#endif /* USE_VOLRMMOUNT */ +#endif /* USE_VOLRMMOUNT */ + + +#ifdef USE_HAL + +static DBusConnection *dbus_ctx = NULL; + +#endif + +/* Returns the full path to the queried command */ +static const char * +find_command (const char **known_locations) +{ + int i; + + for (i = 0; known_locations [i]; i++){ + if (g_file_test (known_locations [i], G_FILE_TEST_IS_EXECUTABLE)) + return known_locations [i]; + } + return NULL; +} /* mount_unmount_operation() flags */ enum { @@ -120,7 +136,7 @@ force_probe (void) } } -#if !defined (USE_HAL) && !defined (G_OS_WIN32) +#if !defined (G_OS_WIN32) typedef struct { char *argv[4]; @@ -342,7 +358,7 @@ mount_unmount_thread (void *arg) return NULL; } -#endif /* !USE_HAL && !G_OS_WIN32 */ +#endif struct dispatch_callback_closure { gboolean succeeded; @@ -434,19 +450,17 @@ uid_is_valid_option (DBusConnection *dbu return retval; } -#endif static void -mount_unmount_operation (const char *mount_point, - const char *device_path, - const char *hal_udi, - const char *filesystem_type, - GnomeVFSDeviceType device_type, - guint32 flags, - GnomeVFSVolumeOpCallback callback, - gpointer user_data) +mount_unmount_with_hal (const char *mount_point, + const char *device_path, + const char *hal_udi, + const char *filesystem_type, + GnomeVFSDeviceType device_type, + guint32 flags, + GnomeVFSVolumeOpCallback callback, + gpointer user_data) { -#ifdef USE_HAL DBusMessage *dmesg, *reply; const char *method; DBusError error; @@ -531,8 +545,19 @@ mount_unmount_operation (const char *mou exception: dbus_error_free (&error); - -#elif !defined (G_OS_WIN32) +} +#endif + +static void +mount_unmount_with_unix_mount (const char *mount_point, + const char *device_path, + const char *filesystem_type, + GnomeVFSDeviceType device_type, + guint32 flags, + GnomeVFSVolumeOpCallback callback, + gpointer user_data) +{ +#if !defined (G_OS_WIN32) const char *command = NULL; const char *argument = NULL; MountThreadInfo *mount_info; @@ -550,16 +575,22 @@ mount_unmount_operation (const char *mou #else name = mount_point; #endif /* USE_VOLRMOUNT */ - + + if (flags & MOUNT) { + command = find_command (MOUNT_COMMAND); + #ifdef MOUNT_ARGUMENT - if (operation == MOUNT) argument = MOUNT_ARGUMENT; #endif /* MOUNT_ARGUMENT */ + } + if (flags & UNMOUNT) { + command = find_command (UMOUNT_COMMAND); + #ifdef UNMOUNT_ARGUMENT - if (operation == UNMOUNT) argument = UNMOUNT_ARGUMENT; #endif /* UNMOUNT_ARGUMENT */ + } mount_info = g_new0 (MountThreadInfo, 1); @@ -586,6 +617,29 @@ mount_unmount_operation (const char *mou #endif } +static void +mount_unmount_operation (const char *mount_point, + const char *device_path, + const char *hal_udi, + const char *filesystem_type, + GnomeVFSDeviceType device_type, + guint32 flags, + GnomeVFSVolumeOpCallback callback, + gpointer user_data) +{ +#ifdef USE_HAL + if (hal_udi) { + mount_unmount_with_hal (mount_point, device_path, hal_udi, filesystem_type, device_type, flags, + callback, user_data); + } else { +#endif + mount_unmount_with_unix_mount (mount_point, device_path, filesystem_type, device_type, flags, + callback, user_data); +#ifdef USE_HAL + } +#endif +} + /* TODO: check if already mounted/unmounted, emit pre_unmount, check for mount types */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor