aboutsummaryrefslogtreecommitdiff
path: root/x11/kdebase4-workspace/files
diff options
context:
space:
mode:
authorMichael Nottebrock <lofi@FreeBSD.org>2007-02-10 03:32:52 +0000
committerMichael Nottebrock <lofi@FreeBSD.org>2007-02-10 03:32:52 +0000
commitc1b494c191d87ccd6df52c7b821bbfde1a9f8ed3 (patch)
tree0363872df50481d3896dc64571a329f68a8594c7 /x11/kdebase4-workspace/files
parent3974a8ae1bf0ee0b15b16e634d88e8cc55d8e9fb (diff)
downloadports-c1b494c191d87ccd6df52c7b821bbfde1a9f8ed3.tar.gz
ports-c1b494c191d87ccd6df52c7b821bbfde1a9f8ed3.zip
Fix various problems in the media kioslave:
- Correct ejecting of mounted volumes (unmount before eject). - Mounting of removable media drives (such as CD-ROM drives) listed in /etc/fstab (removes checking linux's "user" mount option). - Polling floppy drives over the mount state (FreeBSD HAL doesn't do this). - Informing the fileview when HAL notifies that mounting is completed. - Mounting cdrom volume in locale charset. Note: Requires cd9660_iconv! PR: ports/108949 Submitted by: Maxim Samsonov <xors@sendmail.ru> - Disable polling of nfs shares in the fstabbackend. Mounting/Unmounting is broken and the polling can cause DBus aborts that take kded with them.
Notes
Notes: svn path=/head/; revision=184746
Diffstat (limited to 'x11/kdebase4-workspace/files')
-rw-r--r--x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp199
-rw-r--r--x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.h33
-rw-r--r--x11/kdebase4-workspace/files/patch-kioslave_media_mediamanager-fstabbackend.cpp10
-rw-r--r--x11/kdebase4-workspace/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp32
4 files changed, 250 insertions, 24 deletions
diff --git a/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp b/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp
index b4d8ef83056b..00685d0fd8a2 100644
--- a/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp
+++ b/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp
@@ -1,14 +1,44 @@
---- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 19:31:54 2006
-+++ kioslave/media/mediamanager/halbackend.cpp Wed Dec 20 20:22:28 2006
-@@ -17,7 +17,6 @@
+--- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 21:31:54 2006
++++ kioslave/media/mediamanager/halbackend.cpp Fri Feb 9 22:01:27 2007
+@@ -17,9 +17,14 @@
*/
#include "halbackend.h"
-#include "linuxcdpolling.h"
#include <stdlib.h>
++#ifdef Q_OS_FREEBSD
++#include <sys/param.h>
++#include <sys/ucred.h>
++#include <sys/mount.h>
++#include <langinfo.h>
++#endif
+
+ #include <qfile.h>
+ #include <klocale.h>
+@@ -66,6 +71,10 @@
+ /* Close HAL connection */
+ if (m_halContext)
+ {
++#ifdef Q_OS_FREEBSD
++ m_pollTimer.stop();
++ m_pollMediaList.clear();
++#endif
+ const QPtrList<Medium> medlist = m_mediaList.list();
+ QPtrListIterator<Medium> it (medlist);
+ for ( const Medium *current_medium = it.current(); current_medium; current_medium = ++it)
+@@ -185,6 +194,10 @@
+
+ libhal_free_string_array( halDeviceList );
+
++#ifdef Q_OS_FREEBSD
++ connect(&m_pollTimer, SIGNAL(timeout()),
++ this, SLOT(pollMediaList()));
++#endif
+ return true;
+ }
-@@ -242,11 +241,11 @@
+@@ -242,11 +255,11 @@
Medium* medium = new Medium(udi, "");
QMap<QString,QString> options = MediaManagerUtils::splitOptions(mountoptions(udi));
@@ -22,7 +52,44 @@
}
setVolumeProperties(medium);
m_mediaList.addMedium(medium, allowNotification);
-@@ -326,7 +325,7 @@
+@@ -264,6 +277,11 @@
+ Medium* medium = new Medium(udi, "");
+ setFloppyProperties(medium);
+ m_mediaList.addMedium(medium, allowNotification);
++#ifdef Q_OS_FREEBSD
++ m_pollTimer.stop();
++ m_pollMediaList.append(medium);
++ m_pollTimer.start(250);
++#endif
+ return;
+ }
+
+@@ -285,12 +303,23 @@
+
+ void HALBackend::RemoveDevice(const char *udi)
+ {
++#ifdef Q_OS_FREEBSD
++ m_pollMediaList.remove(m_mediaList.findById(udi));
++ if (m_pollMediaList.isEmpty())
++ m_pollTimer.stop();
++#endif
+ m_mediaList.removeMedium(udi, true);
+ }
+
+ void HALBackend::ModifyDevice(const char *udi, const char* key)
+ {
+- Q_UNUSED(key);
++ if (
++ !( strcmp(key, "info.hal_mount.created_mount_point")
++ && strcmp(key, "info.hal_mount.mounted_by_uid")
++ && strcmp(key, "volume.mount_point")
++ && strcmp(key, "volume.is_mounted_read_only")))
++ return;
++
+ const char* mediumUdi = findMediumUdiFromUdi(udi);
+ if (!mediumUdi)
+ return;
+@@ -326,7 +355,7 @@
}
const char* mediumUdi = findMediumUdiFromUdi(udi);
@@ -31,7 +98,7 @@
if (!mediumUdi)
return;
-@@ -384,7 +383,7 @@
+@@ -384,7 +413,7 @@
{
Medium m( *cmedium );
if ( setFstabProperties( &m ) ) {
@@ -40,7 +107,15 @@
m_mediaList.changeMediumState(m, false);
}
return;
-@@ -469,28 +468,23 @@
+@@ -399,6 +428,7 @@
+ setFloppyProperties(m);
+ if (libhal_device_query_capability(m_halContext, mediumUdi, "camera", NULL))
+ setCameraProperties(m);
++ m->setHalMounted(libhal_device_get_property_string(m_halContext, mediumUdi, "info.hal_mount.created_mount_point", NULL));
+
+ m_mediaList.changeMediumState(*m, false);
+
+@@ -469,28 +499,23 @@
else
mimeType = "media/dvd" + MOUNT_SUFFIX;
@@ -80,7 +155,7 @@
}
else
{
-@@ -575,7 +569,7 @@
+@@ -575,7 +600,7 @@
}
}
@@ -89,7 +164,7 @@
QString fstype = medium->fsType();
if ( fstype.isNull() )
fstype = "auto";
-@@ -762,7 +756,7 @@
+@@ -762,7 +787,7 @@
if (t.endsWith("="))
t = t.left(t.length() - 1);
valids[t] = true;
@@ -98,7 +173,20 @@
}
libhal_free_string_array(array);
QStringList result;
-@@ -887,7 +881,7 @@
+@@ -882,12 +908,20 @@
+ result << "journaling=ordered";
+ }
+
++#ifdef Q_OS_FREEBSD
++ if (valids.contains("-C"))
++ {
++ result << QString("charset=%1").arg(nl_langinfo(CODESET));
++ kdDebug(1219) << "mount properties " << result << " " << endl;
++ }
++#endif
++
+ return result;
+ }
bool HALBackend::setMountoptions(const QString &name, const QStringList &options )
{
@@ -107,7 +195,7 @@
KConfig config("mediamanagerrc");
config.setGroup(name);
-@@ -927,7 +921,7 @@
+@@ -927,7 +959,7 @@
if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device.Volume",
"Mount"))) {
@@ -116,7 +204,7 @@
return i18n("Internal Error");
}
-@@ -935,7 +929,7 @@
+@@ -935,7 +967,7 @@
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &poptions, noptions,
DBUS_TYPE_INVALID))
{
@@ -125,7 +213,7 @@
dbus_message_unref (dmesg);
return i18n("Internal Error");
}
-@@ -963,7 +957,7 @@
+@@ -963,7 +995,7 @@
return qerror;
}
@@ -134,7 +222,7 @@
dbus_message_unref (dmesg);
dbus_message_unref (reply);
-@@ -974,7 +968,7 @@
+@@ -974,15 +1006,33 @@
void HALBackend::slotResult(KIO::Job *job)
{
@@ -143,7 +231,34 @@
if (job->error())
{
KMessageBox::error(0, job->errorText());
-@@ -992,7 +986,7 @@
+ }
+- ResetProperties( mount_jobs[job].latin1() );
+ mount_jobs.remove(job);
+ }
+
++#ifdef Q_OS_FREEBSD
++void HALBackend::pollMediaList()
++{
++ struct statfs *mntBuf;
++ int mntNum = getmntinfo(&mntBuf, MNT_NOWAIT);
++ QPtrList<Medium>::iterator it = m_pollMediaList.begin();
++ QPtrList<Medium>::iterator end = m_pollMediaList.end();
++ for (; it!=end; ++it)
++ {
++ bool mounted = false;
++ const char *dev = (*it)->deviceNode().ascii();
++ for (int n = mntNum-1; n >= 0 && !mounted; n--)
++ mounted = !strcmp(dev, mntBuf[n].f_mntfromname);
++ if ((*it)->isMounted() != mounted)
++ ResetProperties((*it)->id().latin1());
++ }
++}
++#endif
++
+ QString HALBackend::isInFstab(const Medium *medium)
+ {
+ KMountPoint::List fstab = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions|KMountPoint::NeedRealDeviceName);
+@@ -992,11 +1042,13 @@
for (; it!=end; ++it)
{
@@ -151,8 +266,14 @@
+ kdDebug(1219) << "isInFstab -" << medium->deviceNode() << "- -" << (*it)->realDeviceName() << "- -" << (*it)->mountedFrom() << endl;
if ((*it)->mountedFrom() == medium->deviceNode() || ( !medium->deviceNode().isEmpty() && (*it)->realDeviceName() == medium->deviceNode() ) )
{
++#ifndef Q_OS_FREEBSD
QStringList opts = (*it)->mountOptions();
-@@ -1012,7 +1006,7 @@
+ if (opts.contains("user") || opts.contains("users"))
++#endif
+ return (*it)->mountPoint();
+ }
+ }
+@@ -1012,7 +1064,7 @@
QString mountPoint = isInFstab(medium);
if (!mountPoint.isNull())
{
@@ -161,7 +282,7 @@
KIO::Job *job = KIO::mount( false, 0, medium->deviceNode(), mountPoint );
connect(job, SIGNAL( result (KIO::Job *)),
SLOT( slotResult( KIO::Job *)));
-@@ -1023,7 +1017,7 @@
+@@ -1023,7 +1075,7 @@
QStringList soptions;
@@ -170,7 +291,7 @@
QMap<QString,QString> valids = MediaManagerUtils::splitOptions(mountoptions(medium->id()));
if (valids["flush"] == "true")
-@@ -1036,10 +1030,10 @@
+@@ -1036,10 +1088,10 @@
if (valids["ro"] == "true")
soptions << "ro";
@@ -183,7 +304,31 @@
if (valids["quiet"] == "true")
soptions << "quiet";
-@@ -1121,7 +1115,7 @@
+@@ -1069,6 +1121,13 @@
+ soptions << QString("data=ordered");
+ }
+
++#ifdef Q_OS_FREEBSD
++ if (valids.contains("charset"))
++ {
++ soptions << QString("-C=%1").arg(valids["charset"]);
++ }
++#endif
++
+ const char **options = new const char*[soptions.size() + 1];
+ uint noptions = 0;
+ for (QStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions)
+@@ -1081,9 +1140,6 @@
+ return qerror;
+ }
+
+- medium->setHalMounted(true);
+- ResetProperties(medium->id().latin1());
+-
+ return QString();
+ }
+
+@@ -1121,7 +1177,7 @@
QString mountPoint = isInFstab(medium);
if (!mountPoint.isNull())
{
@@ -192,7 +337,7 @@
KIO::Job *job = KIO::unmount( medium->mountPoint(), false );
connect(job, SIGNAL( result (KIO::Job *)),
SLOT( slotResult( KIO::Job *)));
-@@ -1134,7 +1128,7 @@
+@@ -1134,7 +1190,7 @@
const char *options[2];
const char *udi = medium->id().latin1();
@@ -201,7 +346,7 @@
dbus_error_init(&error);
DBusConnection *dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-@@ -1147,7 +1141,7 @@
+@@ -1147,7 +1203,7 @@
if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device.Volume",
"Unmount"))) {
@@ -210,7 +355,7 @@
return i18n("Internal Error");
}
-@@ -1157,7 +1151,7 @@
+@@ -1157,7 +1213,7 @@
if (!dbus_message_append_args (dmesg, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, 0,
DBUS_TYPE_INVALID))
{
@@ -219,7 +364,7 @@
dbus_message_unref (dmesg);
return i18n("Internal Error");
}
-@@ -1165,7 +1159,7 @@
+@@ -1165,7 +1221,7 @@
dbus_error_init (&error);
if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, dmesg, -1, &error)))
{
@@ -228,7 +373,7 @@
QString qerror = error.message;
if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.Busy")) {
qerror = QString("<qt>") + i18n("Device is Busy:");
-@@ -1201,7 +1195,7 @@
+@@ -1201,13 +1257,10 @@
return qerror;
}
@@ -237,3 +382,9 @@
dbus_message_unref (dmesg);
dbus_message_unref (reply);
+-
+- medium->setHalMounted(false);
+- ResetProperties(udi);
+
+ return QString();
+ }
diff --git a/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.h b/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.h
new file mode 100644
index 000000000000..df548eb39905
--- /dev/null
+++ b/x11/kdebase4-workspace/files/extrapatch-kioslave_media_mediamanager-halbackend.h
@@ -0,0 +1,33 @@
+--- kioslave/media/mediamanager/halbackend.h.orig Sun Jan 28 23:58:13 2007
++++ kioslave/media/mediamanager/halbackend.h Thu Feb 1 02:51:48 2007
+@@ -34,6 +34,9 @@
+ #include <qobject.h>
+ #include <qstringlist.h>
+ #include <qstring.h>
++#ifdef Q_OS_FREEBSD
++#include <qtimer.h>
++#endif
+
+ #include <config.h>
+
+@@ -154,6 +157,9 @@
+
+ private slots:
+ void slotResult(KIO::Job *job);
++#ifdef Q_OS_FREEBSD
++ void pollMediaList();
++#endif
+
+ /* Hal call-backs -- from gvm*/
+ public:
+@@ -217,6 +223,10 @@
+ DBusConnection *dbus_connection;
+
+ QMap<KIO::Job *, QString> mount_jobs;
++#ifdef Q_OS_FREEBSD
++ QTimer m_pollTimer;
++ QPtrList<Medium> m_pollMediaList;
++#endif
+ };
+
+ #endif /* _HALBACKEND_H_ */
diff --git a/x11/kdebase4-workspace/files/patch-kioslave_media_mediamanager-fstabbackend.cpp b/x11/kdebase4-workspace/files/patch-kioslave_media_mediamanager-fstabbackend.cpp
new file mode 100644
index 000000000000..0db28e1e2ce6
--- /dev/null
+++ b/x11/kdebase4-workspace/files/patch-kioslave_media_mediamanager-fstabbackend.cpp
@@ -0,0 +1,10 @@
+--- kioslave/media/mediamanager/fstabbackend.cpp.orig Fri Feb 9 04:11:01 2007
++++ kioslave/media/mediamanager/fstabbackend.cpp Fri Feb 9 04:11:10 2007
+@@ -154,7 +154,6 @@
+ || ( networkSharesOnly
+ && mount->mountType().find( "smb" ) == -1
+ && mount->mountType().find( "cifs" ) == -1
+- && mount->mountType().find( "nfs" ) == -1
+ )
+ )
+ {
diff --git a/x11/kdebase4-workspace/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp b/x11/kdebase4-workspace/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp
new file mode 100644
index 000000000000..508019a14f3c
--- /dev/null
+++ b/x11/kdebase4-workspace/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp
@@ -0,0 +1,32 @@
+--- kioslave/media/mounthelper/kio_media_mounthelper.cpp.orig Sat Jan 27 01:58:24 2007
++++ kioslave/media/mounthelper/kio_media_mounthelper.cpp Sat Jan 27 02:35:28 2007
+@@ -77,7 +77,9 @@
+ m_isCdrom = medium.mimeType().find("dvd")!=-1
+ || medium.mimeType().find("cd")!=-1;
+
+- if (args->isSet("u"))
++ bool do_eject = args->isSet("s") || args->isSet("e");
++
++ if (args->isSet("u") || do_eject)
+ {
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call( "unmount", medium.id());
+@@ -85,13 +87,14 @@
+ reply.get(m_errorStr);
+ kdDebug() << "medium unmount " << m_errorStr << endl;
+ if (m_errorStr.isNull())
++ {
++ if( do_eject )
++ invokeEject(device, true);
++ else
+ ::exit(0);
++ }
+ else
+ error();
+- }
+- else if (args->isSet("s") || args->isSet("e"))
+- {
+- invokeEject(device, true);
+ }
+ else
+ {