Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 May 2007 03:14:24 +0400 (MSD)
From:      Maxim Samsonov <xors@mne.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/112874: [PATCH]: x11/kdebase3 Fix HALbackend: D-BUS crash, more mount options
Message-ID:  <200705222314.l4MNEOSi005410@xors.pg.org>
Resent-Message-ID: <200705222340.l4MNe4Bl093102@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         112874
>Category:       ports
>Synopsis:       [PATCH]: x11/kdebase3 Fix HALbackend: D-BUS crash, more mount options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 22 23:40:04 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Maxim Samsonov
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
>Description:
Prevent D-BUS from crash when "HALBackend::mountoptions" 
or "HALBackend::setMountoptions" is invoked with incorrectly formed udi.
Processing more FreeBSD specific mount options: "-u", "-m", "-M", "-C", 
"-L", "-D", "shortnames", "longnames", "nowin95". 
Adding support for the "automount_enabled_hint" and now obsolete 
but very handy "mount_option" HAL policy.

For consistency "-u" option is used as "uid" option
and various combination of "shortnames", "longnames", "nowin95" options 
imitate standard "shortname" option values in the following way:
"shortname" "longnames" "shortnames" "nowin95"
  'winnt'      set         not set    not set
  'win95'    not set         set      not set
  'mixed'      set           set      not set
  'lower'    not set       not set      set
Generally the "uid" and "shortname" options can be set through the GUI.

Other options do not have standard counterpart in KDE media manager, so
to simplify access to these options through DCOP
the following human-readable names are assigned:
"-m" : "filemask"
"-M" : "dirmask"
"-C" : "charset"
"-L" : "locale"
"-D" : "doscodepage".

Adding ability to set/unset the default mount options 
for all medias through DCOP per user account.
For example, to set by default dir mask to 755,
file mask to 644, DOS code page to CP866, 
and locale to ru_RU.KOI8-R; 
for all medias which support these options:

$ dcop kded mediamanager setMountoptions general \
  '[' dirmask=755 filemask=644 doscodepage=CP866 locale=ru_RU.KOI8-R ']'

To reset these options:

$ dcop kded mediamanager setMountoptions general \
  '[' dirmask= filemask= doscodepage= locale= ']'

To view the default options:

$ dcop kded mediamanager mountoptions general

On the other hand, any other option can be set
through HAL's "mount_option" policy system wide.
In this case media manager validates this option and
prevents clash with options set through the DCOP/GUI.
Precedence rule [ 1 - highest priority ]:
 1. Options set from DCOP/GUI (mediamanagerrc).
 2. HAL policy.
 3. Default KDE or system value.

For now default value for "locale" option is determined
according to the value of "LANG" or "LC_ALL" environment variables.
>How-To-Repeat:
>Fix:
--- kdebase3.diff begins here ---
diff -urN kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp
--- kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp	Wed May 23 03:00:39 2007
+++ kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp	Wed May 23 03:01:05 2007
@@ -1,5 +1,5 @@
 --- kioslave/media/mediamanager/halbackend.cpp.orig	Mon Jan 15 14:31:32 2007
-+++ kioslave/media/mediamanager/halbackend.cpp	Sun Apr  8 02:18:14 2007
++++ kioslave/media/mediamanager/halbackend.cpp	Wed May 23 02:58:26 2007
 @@ -17,9 +17,15 @@
  */
  
@@ -165,7 +165,40 @@
          QString fstype = medium->fsType();
          if ( fstype.isNull() )
              fstype = "auto";
-@@ -794,7 +820,7 @@
+@@ -783,7 +809,32 @@
+     if (medium && !isInFstab(medium).isNull())
+         return QStringList(); // not handled by HAL - fstab entry
+ 
++		const char *boolOptionNames[] = { "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 };
++		const char *stringOptionNames[] = { "shortname", "journaling", "mountpoint", "automount",
++#ifdef Q_OS_FREEBSD
++				"filemask", "dirmask", "charset", "locale", "doscodepage",
++#endif
++				0 };
++
+     KConfig config("mediamanagerrc");
++    config.setGroup("General");
++    QMap<QString,QString> options;
++    for (int index = 0; boolOptionNames[index]; ++index)
++        if (config.hasKey(boolOptionNames[index]))
++            options.insert(boolOptionNames[index],
++                config.readBoolEntry(boolOptionNames[index]) ? "true" : "false");
++    for (int index = 0; stringOptionNames[index]; ++index)
++        if (config.hasKey(stringOptionNames[index]))
++            options.insert(stringOptionNames[index],
++                config.readEntry(stringOptionNames[index]));
++    if (!libhal_device_exists(m_halContext, name.latin1(), NULL))
++    {
++        QStringList result;
++        if (name.lower() == "general")
++        for (QMap<QString,QString>::ConstIterator it = options.begin(); it != options.end(); ++it)
++            result << it.key() + '=' + it.data();
++        return result;
++    }		
+     config.setGroup(name);
+ 
+     char ** array = libhal_device_get_property_strlist(m_halContext, name.latin1(), "volume.mount.valid_options", NULL);
+@@ -794,25 +845,68 @@
          if (t.endsWith("="))
              t = t.left(t.length() - 1);
          valids[t] = true;
@@ -174,20 +207,311 @@
      }
      libhal_free_string_array(array);
      QStringList result;
-@@ -915,12 +941,20 @@
-             result << "journaling=ordered";
+     QString tmp;
+ 
++    QMap<QString,QString> halOptions;
++    LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, name.latin1());
++    if (!halVolume)
++    {
++        LibHalDrive *halDrive  = libhal_drive_from_udi(m_halContext, name.latin1());
++        if (halDrive)
++        {
++            tmp = QString::fromLatin1(libhal_drive_policy_get_mount_options(halDrive, NULL));
++            libhal_drive_free(halDrive);
++        }
++    }
++    else
++    {
++        const char *driveUdi = libhal_volume_get_storage_device_udi(halVolume);
++        LibHalDrive *halDrive  = !driveUdi ? 0 : libhal_drive_from_udi(m_halContext, driveUdi);
++        if (halDrive)
++        {
++            tmp = QString::fromLatin1(libhal_volume_policy_get_mount_options(halDrive, halVolume, NULL));
++            libhal_drive_free(halDrive);
++        }
++        libhal_volume_free(halVolume);
++    }
++    if (!tmp.isEmpty())
++    {
++        uint start = 0;
++        while(start < tmp.length())
++        {
++            int end = tmp.find(',', start);
++            if (end == -1) end = tmp.length();
++            QString opt = tmp.mid( start, end - start );
++            start = end + 1;
++            end = opt.find('=');
++            QString key = opt.left(end);
++            if (valids.contains(key))
++                halOptions.insert(key, end == -1 ? QString::null : opt.mid(end + 1));
++        }
++    }
++
+     QString fstype = libhal_device_get_property_QString(m_halContext, name.latin1(), "volume.fstype");
+     if (fstype.isNull())
+         fstype = libhal_device_get_property_QString(m_halContext, name.latin1(), "volume.policy.mount_filesystem");
+ 
+     QString drive_udi = libhal_device_get_property_QString(m_halContext, name.latin1(), "block.storage_device");
+ 
++    bool value = false;
+     bool removable = false;
+     if ( !drive_udi.isNull() )
++    {
++        value = libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.automount_enabled_hint", NULL);
+         removable = libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.removable", NULL)
+-                     || libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.hotpluggable", NULL);
++                     || libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.hotpluggable", NULL);				
++    }
+ 
+     config.setGroup(drive_udi);
+-    bool value = config.readBoolEntry("automount", false);
++    value = config.readBoolEntry("automount",
++        !options.contains("automount") ? value : options["automount"] == "true" );
+     config.setGroup(name);
+ 
+     if (libhal_device_get_property_bool(m_halContext, name.latin1(), "volume.disc.is_blank", NULL)
+@@ -826,44 +920,98 @@
+ 
+     if (valids.contains("ro"))
+     {
+-        value = config.readBoolEntry("ro", false);
++        value = options.contains("ro") ? options["ro"] == "true"
++            : halOptions.contains("ro");
++        value = config.readBoolEntry("ro", value);
+         tmp = QString("ro=%1").arg(value ? "true" : "false");
+         if (fstype != "iso9660") // makes no sense
+             result << tmp;
++        halOptions.remove("ro");
+     }
+ 
+     if (valids.contains("quiet"))
+     {
+-        value = config.readBoolEntry("quiet", false);
++        value = options.contains("quiet") ? options["quiet"] == "true"
++            : halOptions.contains("quiet");
++        value = config.readBoolEntry("quiet",  value);
+         tmp = QString("quiet=%1").arg(value ? "true" : "false");
+         if (fstype != "iso9660") // makes no sense
+             result << tmp;
++        halOptions.remove("quiet");
+     }
+ 
+     if (valids.contains("flush"))
+     {
+-        value = config.readBoolEntry("flush", fstype.endsWith("fat"));
++        value = options.contains("flush") ? options["flush"] == "true"
++            : (halOptions.contains("flush") || fstype.endsWith("fat"));
++        value = config.readBoolEntry("flush", value);
+         tmp = QString("flush=%1").arg(value ? "true" : "false");
+         result << tmp;
++        halOptions.remove("flush");
+     }
+ 
++#ifdef Q_OS_FREEBSD
++    if (valids.contains("-u"))
++#else
+     if (valids.contains("uid"))
++#endif
+     {
+-        value = config.readBoolEntry("uid", true);
++        value = !options.contains("uid") ? true : options["uid"] == "true";
++        value = config.readBoolEntry("uid", value);
+         tmp = QString("uid=%1").arg(value ? "true" : "false");
+         result << tmp;
++#ifdef Q_OS_FREEBSD
++        halOptions.remove("-u");
++#else
++        halOptions.remove("uid");
++#endif
+     }
+ 
+     if (valids.contains("utf8"))
+     {
+-        value = config.readBoolEntry("utf8", true);
++        value = !options.contains("iocharset") && !halOptions.contains("iocharset") 
++            && (options.contains("utf8") ? options["utf8"] == "true"
++            : halOptions.contains("utf8"));
++        value = config.readBoolEntry("utf8", value);
+         tmp = QString("utf8=%1").arg(value ? "true" : "false");
+         result << tmp;
++        halOptions.remove("utf8");
      }
  
 +#ifdef Q_OS_FREEBSD
++    if (valids.contains("nowin95")
++        && valids.contains("longnames")
++        && valids.contains("shortnames"))
++    {
++        QString svalue = "winnt";
++        if (halOptions.contains("longnames") && !halOptions.contains("shortnames") && !halOptions.contains("nowin95"))
++            svalue = "winnt";
++        else if (!halOptions.contains("longnames") && halOptions.contains("shortnames") && !halOptions.contains("nowin95"))
++            svalue = "win95";
++        else if (halOptions.contains("longnames") && halOptions.contains("shortnames") && !halOptions.contains("nowin95"))
++            svalue = "mixed";
++        else if (halOptions.contains("nowin95"))
++            svalue = "lower";
++        svalue = config.readEntry("shortname",
++            options.contains("shortname") ? options["shortname"] : svalue);
++        if (svalue == "winnt")
++            result << "shortname=winnt";
++        else if (svalue == "win95")
++            result << "shortname=win95";
++        else if (svalue == "mixed")
++            result << "shortname=mixed";
++        else
++            result << "shortname=lower";
++        halOptions.remove("nowin95");
++        halOptions.remove("longnames");
++        halOptions.remove("shortnames");
++    }
++#else
+     if (valids.contains("shortname"))
+     {
+-        QString svalue = config.readEntry("shortname", "lower").lower();
++        QString svalue = options.contains("shortname") ? options["shortname"]
++						: (halOptions.contains("shortname") ? halOptions["shortname"] : "winnt");
++        svalue = config.readEntry("shortname", svalue).lower();
+         if (svalue == "winnt")
+             result << "shortname=winnt";
+         else if (svalue == "win95")
+@@ -872,29 +1020,38 @@
+             result << "shortname=mixed";
+         else
+             result << "shortname=lower";
++        halOptions.remove("shortname");
+     }
++#endif
+ 
+     if (valids.contains("sync"))
+     {
+-        value = config.readBoolEntry("sync", !fstype.endsWith("fat") && removable);
++        value = options.contains("sync") ? options["sync"] == "true"
++						: (halOptions.contains("sync") || (!fstype.endsWith("fat") && removable));
++        value = config.readBoolEntry("sync", value);
+         tmp = QString("sync=%1").arg(value ? "true" : "false");
+         if (fstype != "iso9660") // makes no sense
+             result << tmp;
++        halOptions.remove("sync");
+     }
+ 
+     if (valids.contains("noatime"))
+     {
+-        value = config.readBoolEntry("atime", !fstype.endsWith("fat"));
++        value = options.contains("atime") ? options["atime"] == "true"
++						: (halOptions.contains("noatime") ? false : !fstype.endsWith("fat"));
++        value = config.readBoolEntry("atime", value);
+         tmp = QString("atime=%1").arg(value ? "true" : "false");
+         if (fstype != "iso9660") // makes no sense
+             result << tmp;
++        halOptions.remove("noatime");
+     }
+ 
+     QString mount_point = libhal_device_get_property_QString(m_halContext, name.latin1(), "volume.mount_point");
+     if (mount_point.isEmpty())
+         mount_point = libhal_device_get_property_QString(m_halContext, name.latin1(), "volume.policy.desired_mount_point");
+ 
+-    mount_point = config.readEntry("mountpoint", mount_point);
++    mount_point = config.readEntry("mountpoint",
++        options.contains("mountpoint") ? options["mountpoint"] : mount_point);
+ 
+     if (!mount_point.startsWith("/"))
+         mount_point = "/media/" + mount_point;
+@@ -904,7 +1061,9 @@
+ 
+     if (valids.contains("data"))
+     {
+-        QString svalue = config.readEntry("journaling").lower();
++        QString svalue = options.contains("journaling") ? options["journaling"]
++						: (halOptions.contains("data") ? halOptions["data"] : "ordered");
++        svalue = config.readEntry("journaling", svalue).lower();
+         if (svalue == "ordered")
+             result << "journaling=ordered";
+         else if (svalue == "writeback")
+@@ -913,6 +1072,82 @@
+             result << "journaling=data";
+         else
+             result << "journaling=ordered";
++        halOptions.remove("data");
++    }
++
++#ifdef Q_OS_FREEBSD
++    if (valids.contains("-m"))
++    {
++        QString svalue = options.contains("filemask") ? options["filemask"]
++            : (halOptions.contains("-m") ? halOptions["-m"] : QString::null);
++        svalue = config.readEntry("filemask", svalue);
++        if (!svalue.isEmpty())
++            result << QString("filemask=%1").arg(svalue);
++        halOptions.remove("-m");
++        kdDebug(1219) << "mount properties " << result << " " << endl;
++    }
++
++    if (valids.contains("-M"))
++    {
++        QString svalue = options.contains("dirmask") ? options["dirmask"]
++            : (halOptions.contains("-M") ? halOptions["-M"] : QString::null);
++        svalue = config.readEntry("dirmask", svalue);
++        if (!svalue.isEmpty())
++            result << QString("dirmask=%1").arg(svalue);
++        halOptions.remove("-M");
++        kdDebug(1219) << "mount properties " << result << " " << endl;
++    }
++
 +    if (valids.contains("-C"))
 +    {
-+        result << QString("charset=%1").arg(nl_langinfo(CODESET));
++        QString svalue = options.contains("charset") ? options["charset"]
++            : (halOptions.contains("-C") ? halOptions["-C"] : nl_langinfo(CODESET));
++        svalue = config.readEntry("charset", svalue);
++        if (!svalue.isEmpty())
++            result << QString("charset=%1").arg(svalue);
++        halOptions.remove("-C");
++        kdDebug(1219) << "mount properties " << result << " " << endl;
++    }
++
++    if (valids.contains("-L"))
++    {
++        QString locale = getenv("LANG");
++        if (locale.isEmpty()) locale = getenv("LC_ALL");
++        QString svalue = options.contains("locale") ? options["locale"]
++            : (halOptions.contains("-L") ? halOptions["-L"] : locale );
++        svalue = config.readEntry("locale", svalue);
++        if (!svalue.isEmpty())
++            result << QString("locale=%1").arg(svalue);
++        halOptions.remove("-L");
++        kdDebug(1219) << "mount properties " << result << " " << endl;
++    }
++
++    if (valids.contains("-D"))
++    {
++        QString svalue = options.contains("doscodepage") ? options["doscodepage"]
++            : (halOptions.contains("-D") ? halOptions["-D"] : nl_langinfo(CODESET));
++        svalue = config.readEntry("doscodepage", svalue);
++        if (!svalue.isEmpty())
++            result << QString("doscodepage=%1").arg(svalue);
++        halOptions.remove("-D");
 +        kdDebug(1219) << "mount properties " << result << " " << endl;
 +    }
 +#endif
 +
++    if (!halOptions.isEmpty())
++    {
++        QString svalue;
++        for (QMap<QString,QString>::ConstIterator it = halOptions.begin(); it != halOptions.end(); ++it)
++        {
++            if (it != halOptions.begin())
++								svalue += ',';
++            svalue += it.key();
++            if (!it.data().isEmpty())
++            svalue += '=' + it.data();
++        }
++        if (!svalue.isEmpty())
++            result << QString("options=%1").arg(svalue);
++        kdDebug(1219) << "mount properties " << result << " " << endl;
+     }
+ 
      return result;
- }
+@@ -920,32 +1155,82 @@
  
  bool HALBackend::setMountoptions(const QString &name, const QStringList &options )
  {
@@ -195,8 +519,94 @@
 +    kdDebug(1219) << "setMountoptions " << name << " " << options << endl;
  
      KConfig config("mediamanagerrc");
-     config.setGroup(name);
-@@ -960,7 +994,7 @@
+-    config.setGroup(name);
++    config.setGroup(name.lower() == "general" ? "General" : name);
+ 
+     QMap<QString,QString> valids = MediaManagerUtils::splitOptions(options);
+ 
+     const char *names[] = { "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 };
+     for (int index = 0; names[index]; ++index)
+         if (valids.contains(names[index]))
+-            config.writeEntry(names[index], valids[names[index]] == "true");
++            if (valids[names[index]].isEmpty())
++                config.deleteEntry(names[index]);
++            else
++                config.writeEntry(names[index], valids[names[index]] == "true");
+ 
+     if (valids.contains("shortname"))
+-        config.writeEntry("shortname", valids["shortname"]);
++        if (valids["shortname"].isEmpty())
++            config.deleteEntry("shortname");
++        else
++            config.writeEntry("shortname", valids["shortname"]);
+ 
+     if (valids.contains("journaling"))
+-        config.writeEntry("journaling", valids["journaling"]);
++        if (valids["journaling"].isEmpty())
++            config.deleteEntry("journaling");
++        else
++            config.writeEntry("journaling", valids["journaling"]);
+ 
+-    if (!mountoptions(name).contains(QString("mountpoint=%1").arg(valids["mountpoint"])))
+-        config.writeEntry("mountpoint", valids["mountpoint"]);
++        if (valids.contains("mountpoint"))
++        if (valids["mountpoint"].isEmpty())
++            config.deleteEntry("mountpoint");
++        else if (!mountoptions(name).contains(QString("mountpoint=%1").arg(valids["mountpoint"])))
++            config.writeEntry("mountpoint", valids["mountpoint"]);
++
++        if (valids.contains("automount"))
++            if (valids["automount"].isEmpty())
++                config.deleteEntry("automount");
++            else
++            {
++                QString drive_udi = libhal_device_exists(m_halContext, name.latin1(), NULL)
++                    ? libhal_device_get_property_QString(m_halContext, name.latin1(), "block.storage_device")
++                    : (name.lower() == "general" ? "General" : name);
++                config.setGroup(drive_udi);
++                config.writeEntry("automount", valids["automount"]);
++            }
+ 
+-    if (valids.contains("automount")) {
+-        QString drive_udi = libhal_device_get_property_QString(m_halContext, name.latin1(), "block.storage_device");
+-        config.setGroup(drive_udi);
+-        config.writeEntry("automount", valids["automount"]);
+-    }
++#ifdef Q_OS_FREEBSD
++    if (valids.contains("filemask"))
++        if (valids["filemask"].isEmpty())
++						config.deleteEntry("filemask");
++        else
++						config.writeEntry("filemask", valids["filemask"]);
++
++    if (valids.contains("dirmask"))
++        if (valids["dirmask"].isEmpty())
++						config.deleteEntry("dirmask");
++        else
++						config.writeEntry("dirmask", valids["dirmask"]);
++
++    if (valids.contains("charset"))
++        if (valids["charset"].isEmpty())
++						config.deleteEntry("charset");
++        else
++						config.writeEntry("charset", valids["charset"]);
++
++    if (valids.contains("locale"))
++        if (valids["locale"].isEmpty())
++						config.deleteEntry("locale");
++        else
++						config.writeEntry("locale", valids["locale"]);
++
++    if (valids.contains("doscodepage"))
++        if (valids["doscodepage"].isEmpty())
++						config.deleteEntry("doscodepage");
++        else
++						config.writeEntry("doscodepage", valids["doscodepage"]);
++#endif
+ 
+     return true;
+ }
+@@ -960,7 +1245,7 @@
      if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
                                                  "org.freedesktop.Hal.Device.Volume",
                                                  "Mount"))) {
@@ -205,7 +615,7 @@
          return i18n("Internal Error");
      }
  
-@@ -968,7 +1002,7 @@
+@@ -968,7 +1253,7 @@
                                     DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &poptions, noptions,
                                     DBUS_TYPE_INVALID))
      {
@@ -214,7 +624,7 @@
          dbus_message_unref (dmesg);
          return i18n("Internal Error");
      }
-@@ -996,7 +1030,7 @@
+@@ -996,7 +1281,7 @@
          return qerror;
      }
  
@@ -223,7 +633,7 @@
  
      dbus_message_unref (dmesg);
      dbus_message_unref (reply);
-@@ -1008,8 +1042,13 @@
+@@ -1008,8 +1293,13 @@
  QString HALBackend::listUsingProcesses(const Medium* medium)
  {
      QString proclist, fullmsg;
@@ -238,7 +648,7 @@
  
      uint counter = 0;
      if (fuser) {
-@@ -1044,7 +1083,7 @@
+@@ -1044,7 +1334,7 @@
  
  void HALBackend::slotResult(KIO::Job *job)
  {
@@ -247,7 +657,7 @@
  
      struct mount_job_data *data = mount_jobs[job];
      QString& qerror = data->errorMessage;
-@@ -1071,7 +1110,6 @@
+@@ -1071,7 +1361,6 @@
          qerror = job->errorText();
      }
  
@@ -255,7 +665,7 @@
      mount_jobs.remove(job);
  
      /* Job completed. Notify the caller */
-@@ -1080,6 +1118,25 @@
+@@ -1080,6 +1369,25 @@
      kapp->eventLoop()->exitLoop();
  }
  
@@ -281,7 +691,7 @@
  QString HALBackend::isInFstab(const Medium *medium)
  {
      KMountPoint::List fstab = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions|KMountPoint::NeedRealDeviceName);
-@@ -1092,11 +1149,13 @@
+@@ -1092,11 +1400,13 @@
          QString reald = (*it)->realDeviceName();
          if ( reald.endsWith( "/" ) )
              reald = reald.left( reald.length() - 1 );
@@ -296,7 +706,7 @@
                  return (*it)->mountPoint();
          }
      }
-@@ -1116,7 +1175,7 @@
+@@ -1116,7 +1426,7 @@
          data.completed = false;
          data.medium = medium;
  
@@ -305,7 +715,7 @@
          KIO::Job *job = KIO::mount( false, 0, medium->deviceNode(), mountPoint );
          connect(job, SIGNAL( result (KIO::Job *)),
                  SLOT( slotResult( KIO::Job *)));
-@@ -1134,7 +1193,7 @@
+@@ -1134,7 +1444,7 @@
  
      QStringList soptions;
  
@@ -314,7 +724,16 @@
  
      QMap<QString,QString> valids = MediaManagerUtils::splitOptions(mountoptions(medium->id()));
      if (valids["flush"] == "true")
-@@ -1147,10 +1206,10 @@
+@@ -1142,15 +1452,19 @@
+ 
+     if (valids["uid"] == "true")
+     {
++#ifdef Q_OS_FREEBSD
++        soptions << QString("-u=%1").arg(getuid());
++#else
+         soptions << QString("uid=%1").arg(getuid());
++#endif
+     }
  
      if (valids["ro"] == "true")
          soptions << "ro";
@@ -327,21 +746,69 @@
      if (valids["quiet"] == "true")
          soptions << "quiet";
  
-@@ -1180,6 +1239,13 @@
+@@ -1166,7 +1480,19 @@
+ 
+     if (valids.contains("shortname"))
+     {
++#ifdef Q_OS_FREEBSD
++        QString option = valids["shortname"];
++        if (option == "win95")
++						soptions << QString("shortnames");
++        else if (option == "mixed")
++						soptions << QString("shortnames") << QString("longnames");
++        else if (option == "lower")
++						soptions << QString("nowin95");
++        else
++						soptions << QString("longnames");
++#else
+         soptions << QString("shortname=%1").arg(valids["shortname"]);
++#endif
+     }
+ 
+     if (valids.contains("journaling"))
+@@ -1180,6 +1506,41 @@
              soptions << QString("data=ordered");
      }
  
 +#ifdef Q_OS_FREEBSD
++    if (valids.contains("filemask"))
++    {
++        soptions << QString("-m=%1").arg(valids["filemask"]);
++    }
++    if (valids.contains("dirmask"))
++    {
++        soptions << QString("-M=%1").arg(valids["dirmask"]);
++    }
 +    if (valids.contains("charset"))
 +    {
 +        soptions << QString("-C=%1").arg(valids["charset"]);
 +    }
++    if (valids.contains("locale"))
++    {
++        soptions << QString("-L=%1").arg(valids["locale"]);
++    }
++    if (valids.contains("doscodepage"))
++    {
++        soptions << QString("-D=%1").arg(valids["doscodepage"]);
++    }
 +#endif
++    if (valids.contains("options"))
++    {
++        uint start = 0;
++        QString tmp = valids["options"];
++        while(start < tmp.length())
++        {
++        		int end = tmp.find(',', start);
++        		if (end == -1) end = tmp.length();
++        		soptions << tmp.mid( start, end - start );
++        		start = end + 1;
++        }
++    }
 +
      const char **options = new const char*[soptions.size() + 1];
      uint noptions = 0;
      for (QStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions)
-@@ -1192,9 +1258,6 @@
+@@ -1192,9 +1553,6 @@
          return qerror;
      }
  
@@ -351,7 +818,7 @@
      return QString();
  }
  
-@@ -1255,7 +1318,7 @@
+@@ -1255,7 +1613,7 @@
      const char *options[2];
  
      const char *udi = medium->id().latin1();
@@ -360,7 +827,7 @@
  
      dbus_error_init(&error);
      DBusConnection *dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-@@ -1268,7 +1331,7 @@
+@@ -1268,7 +1626,7 @@
      if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
                                                  "org.freedesktop.Hal.Device.Volume",
                                                  "Unmount"))) {
@@ -369,7 +836,7 @@
          return i18n("Internal Error");
      }
  
-@@ -1278,7 +1341,7 @@
+@@ -1278,7 +1636,7 @@
      if (!dbus_message_append_args (dmesg, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, 0,
                                     DBUS_TYPE_INVALID))
      {
@@ -378,7 +845,7 @@
          dbus_message_unref (dmesg);
          return i18n("Internal Error");
      }
-@@ -1288,7 +1351,7 @@
+@@ -1288,7 +1646,7 @@
      {
          QString qerror, reason;
  
@@ -387,7 +854,7 @@
          qerror = "<qt>";
          qerror += i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and "
                         "currently mounted at <b>%4</b> could not be unmounted. ").arg(
-@@ -1318,13 +1381,10 @@
+@@ -1318,13 +1676,10 @@
          return qerror;
      }
  
--- kdebase3.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705222314.l4MNEOSi005410>