• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • io
kmountpoint.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
4  * 2007 David Faure <faure@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License version 2 as published by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #include "kmountpoint.h"
22 
23 #include <config.h>
24 #include <stdlib.h>
25 
26 #include <QtCore/QFile>
27 #include <QtCore/QTextIStream>
28 
29 #include "kstandarddirs.h"
30 
31 #ifdef Q_WS_WIN
32 #include <windows.h>
33 #include <QDir>
34 #endif
35 
36 #ifdef Q_OS_WIN
37 static Qt::CaseSensitivity cs = Qt::CaseInsensitive;
38 #else
39 static Qt::CaseSensitivity cs = Qt::CaseSensitive;
40 #endif
41 
42 #ifdef HAVE_VOLMGT
43 #include <volmgt.h>
44 #endif
45 #ifdef HAVE_SYS_MNTTAB_H
46 #include <sys/mnttab.h>
47 #endif
48 #ifdef HAVE_MNTENT_H
49 #include <mntent.h>
50 #elif defined(HAVE_SYS_MNTENT_H)
51 #include <sys/mntent.h>
52 #endif
53 
54 // This is the *BSD branch
55 #ifdef HAVE_SYS_MOUNT_H
56 #ifdef HAVE_SYS_TYPES_H
57 #include <sys/types.h>
58 #endif
59 #ifdef HAVE_SYS_PARAM_H
60 #include <sys/param.h>
61 #endif
62 #include <sys/mount.h>
63 #endif
64 
65 #ifdef HAVE_FSTAB_H
66 #include <fstab.h>
67 #endif
68 #if defined(_AIX)
69 #include <sys/mntctl.h>
70 #include <sys/vmount.h>
71 #include <sys/vfs.h>
72 /* AIX does not prototype mntctl anywhere that I can find */
73 #ifndef mntctl
74 extern "C" int mntctl(int command, int size, void* buffer);
75 #endif
76 extern "C" struct vfs_ent *getvfsbytype(int vfsType);
77 extern "C" void endvfsent( );
78 #endif
79 
80 
81 #ifndef HAVE_GETMNTINFO
82 # ifdef _PATH_MOUNTED
83 // On some Linux, MNTTAB points to /etc/fstab !
84 # undef MNTTAB
85 # define MNTTAB _PATH_MOUNTED
86 # else
87 # ifndef MNTTAB
88 # ifdef MTAB_FILE
89 # define MNTTAB MTAB_FILE
90 # else
91 # define MNTTAB "/etc/mnttab"
92 # endif
93 # endif
94 # endif
95 #endif
96 
97 #include "kdebug.h"
98 
99 
100 #ifdef _OS_SOLARIS_
101 #define FSTAB "/etc/vfstab"
102 #else
103 #define FSTAB "/etc/fstab"
104 #endif
105 
106 class KMountPoint::Private {
107 public:
108  void finalizePossibleMountPoint(DetailsNeededFlags infoNeeded);
109  void finalizeCurrentMountPoint(DetailsNeededFlags infoNeeded);
110 
111  QString mountedFrom;
112  QString device; // Only available when the NeedRealDeviceName flag was set.
113  QString mountPoint;
114  QString mountType;
115  QStringList mountOptions;
116 };
117 
118 KMountPoint::KMountPoint()
119  :d( new Private )
120 {
121 }
122 
123 KMountPoint::~KMountPoint()
124 {
125  delete d;
126 }
127 
128 // There are (at least) four kind of APIs:
129 // setmntent + getmntent + struct mntent (linux...)
130 // getmntent + struct mnttab
131 // mntctl + struct vmount (AIX)
132 // getmntinfo + struct statfs&flags (BSD 4.4 and friends)
133 // getfsent + char* (BSD 4.3 and friends)
134 
135 #ifdef HAVE_SETMNTENT
136 #define SETMNTENT setmntent
137 #define ENDMNTENT endmntent
138 #define STRUCT_MNTENT struct mntent *
139 #define STRUCT_SETMNTENT FILE *
140 #define GETMNTENT(file, var) ((var = getmntent(file)) != 0)
141 #define MOUNTPOINT(var) var->mnt_dir
142 #define MOUNTTYPE(var) var->mnt_type
143 #define MOUNTOPTIONS(var) var->mnt_opts
144 #define FSNAME(var) var->mnt_fsname
145 #else
146 #define SETMNTENT fopen
147 #define ENDMNTENT fclose
148 #define STRUCT_MNTENT struct mnttab
149 #define STRUCT_SETMNTENT FILE *
150 #define GETMNTENT(file, var) (getmntent(file, &var) == 0)
151 #define MOUNTPOINT(var) var.mnt_mountp
152 #define MOUNTTYPE(var) var.mnt_fstype
153 #define MOUNTOPTIONS(var) var.mnt_mntopts
154 #define FSNAME(var) var.mnt_special
155 #endif
156 
161 static QString devNameFromOptions(const QStringList &options)
162 {
163  // Search options to find the device name
164  for ( QStringList::ConstIterator it = options.begin(); it != options.end(); ++it)
165  {
166  if( (*it).startsWith(QLatin1String("dev=")))
167  return (*it).mid(4);
168  }
169  return QString::fromLatin1("none");
170 }
171 
172 void KMountPoint::Private::finalizePossibleMountPoint(DetailsNeededFlags infoNeeded)
173 {
174  if (mountType == QLatin1String("supermount")) {
175  mountedFrom = devNameFromOptions(mountOptions);
176  }
177 
178  if (mountedFrom.startsWith(QLatin1String("UUID="))) {
179  const QString uuid = mountedFrom.mid(5);
180  const QString potentialDevice = QFile::symLinkTarget(QString::fromLatin1("/dev/disk/by-uuid/") + uuid);
181  if (QFile::exists(potentialDevice)) {
182  mountedFrom = potentialDevice;
183  }
184  }
185  if (mountedFrom.startsWith(QLatin1String("LABEL="))) {
186  const QString label = mountedFrom.mid(6);
187  const QString potentialDevice = QFile::symLinkTarget(QString::fromLatin1("/dev/disk/by-label/") + label);
188  if (QFile::exists(potentialDevice)) {
189  mountedFrom = potentialDevice;
190  }
191  }
192 
193  if (infoNeeded & NeedRealDeviceName) {
194  if (mountedFrom.startsWith(QLatin1Char('/')))
195  device = KStandardDirs::realFilePath(mountedFrom);
196  }
197  // TODO: Strip trailing '/' ?
198 }
199 
200 void KMountPoint::Private::finalizeCurrentMountPoint(DetailsNeededFlags infoNeeded)
201 {
202  if (infoNeeded & NeedRealDeviceName) {
203  if (mountedFrom.startsWith(QLatin1Char('/')))
204  device = KStandardDirs::realFilePath(mountedFrom);
205  }
206 }
207 
208 KMountPoint::List KMountPoint::possibleMountPoints(DetailsNeededFlags infoNeeded)
209 {
210 #ifdef Q_WS_WIN
211  return KMountPoint::currentMountPoints(infoNeeded);
212 #endif
213 
214  KMountPoint::List result;
215 
216 #ifdef HAVE_SETMNTENT
217  STRUCT_SETMNTENT fstab;
218  if ((fstab = SETMNTENT(FSTAB, "r")) == 0)
219  return result;
220 
221  STRUCT_MNTENT fe;
222  while (GETMNTENT(fstab, fe))
223  {
224  Ptr mp(new KMountPoint);
225  mp->d->mountedFrom = QFile::decodeName(FSNAME(fe));
226 
227  mp->d->mountPoint = QFile::decodeName(MOUNTPOINT(fe));
228  mp->d->mountType = QFile::decodeName(MOUNTTYPE(fe));
229 
230  //Devices using supermount have their device names in the mount options
231  //instead of the device field. That's why we need to read the mount options
232  if (infoNeeded & NeedMountOptions || (mp->d->mountType == QLatin1String("supermount")))
233  {
234  QString options = QFile::decodeName(MOUNTOPTIONS(fe));
235  mp->d->mountOptions = options.split( QLatin1Char(',') );
236  }
237 
238  mp->d->finalizePossibleMountPoint(infoNeeded);
239 
240  result.append(mp);
241  }
242  ENDMNTENT(fstab);
243 #else
244  QFile f(QLatin1String(FSTAB));
245  if ( !f.open(QIODevice::ReadOnly) )
246  return result;
247 
248  QTextStream t (&f);
249  QString s;
250 
251  while (! t.atEnd())
252  {
253  s=t.readLine().simplified();
254  if ( s.isEmpty() || (s[0] == QLatin1Char('#')))
255  continue;
256 
257  // not empty or commented out by '#'
258  const QStringList item = s.split(QLatin1Char(' '));
259 
260 #ifdef _OS_SOLARIS_
261  if (item.count() < 5)
262  continue;
263 #else
264  if (item.count() < 4)
265  continue;
266 #endif
267 
268  Ptr mp(new KMountPoint);
269 
270  int i = 0;
271  mp->d->mountedFrom = item[i++];
272 #ifdef _OS_SOLARIS_
273  //device to fsck
274  i++;
275 #endif
276  mp->d->mountPoint = item[i++];
277  mp->d->mountType = item[i++];
278  QString options = item[i++];
279 
280  if (infoNeeded & NeedMountOptions)
281  {
282  mp->d->mountOptions = options.split(QLatin1Char(','));
283  }
284 
285  mp->d->finalizePossibleMountPoint(infoNeeded);
286 
287  result.append(mp);
288  } //while
289 
290  f.close();
291 #endif
292  return result;
293 }
294 
295 KMountPoint::List KMountPoint::currentMountPoints(DetailsNeededFlags infoNeeded)
296 {
297  KMountPoint::List result;
298 
299 #ifdef HAVE_GETMNTINFO
300 
301 #ifdef GETMNTINFO_USES_STATVFS
302  struct statvfs *mounted;
303 #else
304  struct statfs *mounted;
305 #endif
306 
307  int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
308 
309  for (int i=0;i< num_fs;i++)
310  {
311  Ptr mp(new KMountPoint);
312  mp->d->mountedFrom = QFile::decodeName(mounted[i].f_mntfromname);
313  mp->d->mountPoint = QFile::decodeName(mounted[i].f_mntonname);
314 
315 #ifdef __osf__
316  mp->d->mountType = QFile::decodeName(mnt_names[mounted[i].f_type]);
317 #else
318  mp->d->mountType = QFile::decodeName(mounted[i].f_fstypename);
319 #endif
320 
321  if (infoNeeded & NeedMountOptions)
322  {
323  struct fstab *ft = getfsfile(mounted[i].f_mntonname);
324  if (ft != 0) {
325  QString options = QFile::decodeName(ft->fs_mntops);
326  mp->d->mountOptions = options.split(QLatin1Char(','));
327  } else {
328  // TODO: get mount options if not mounted via fstab, see mounted[i].f_flags
329  }
330  }
331 
332  mp->d->finalizeCurrentMountPoint(infoNeeded);
333  // TODO: Strip trailing '/' ?
334  result.append(mp);
335  }
336 
337 #elif defined(_AIX)
338 
339  struct vmount *mntctl_buffer;
340  struct vmount *vm;
341  char *mountedfrom;
342  char *mountedto;
343  int fsname_len, num;
344  int buf_sz = 4096;
345 
346  mntctl_buffer = (struct vmount*)malloc(buf_sz);
347  num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
348  if (num == 0)
349  {
350  buf_sz = *(int*)mntctl_buffer;
351  free(mntctl_buffer);
352  mntctl_buffer = (struct vmount*)malloc(buf_sz);
353  num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
354  }
355 
356  if (num > 0)
357  {
358  /* iterate through items in the vmount structure: */
359  vm = (struct vmount *)mntctl_buffer;
360  for ( ; num > 0; --num )
361  {
362  /* get the name of the mounted file systems: */
363  fsname_len = vmt2datasize(vm, VMT_STUB);
364  mountedto = (char*)malloc(fsname_len + 1);
365  mountedto[fsname_len] = '\0';
366  strncpy(mountedto, (char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
367 
368  fsname_len = vmt2datasize(vm, VMT_OBJECT);
369  mountedfrom = (char*)malloc(fsname_len + 1);
370  mountedfrom[fsname_len] = '\0';
371  strncpy(mountedfrom, (char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
372 
373  /* Look up the string for the file system type,
374  * as listed in /etc/vfs.
375  * ex.: nfs,jfs,afs,cdrfs,sfs,cachefs,nfs3,autofs
376  */
377  struct vfs_ent* ent = getvfsbytype(vm->vmt_gfstype);
378 
379  KMountPoint *mp = new KMountPoint;
380  mp->d->mountedFrom = QFile::decodeName(mountedfrom);
381  mp->d->mountPoint = QFile::decodeName(mountedto);
382  mp->d->mountType = QFile::decodeName(ent->vfsent_name);
383 
384  free(mountedfrom);
385  free(mountedto);
386 
387  if (infoNeeded & NeedMountOptions)
388  {
389  // TODO
390  }
391 
392  mp->d->finalizeCurrentMountPoint(infoNeeded);
393  result.append(mp);
394 
395  /* goto the next vmount structure: */
396  vm = (struct vmount *)((char *)vm + vm->vmt_length);
397  }
398 
399  endvfsent( );
400  }
401 
402  free( mntctl_buffer );
403 #elif defined(Q_WS_WIN) && !defined(_WIN32_WCE)
404  //nothing fancy with infoNeeded but it gets the job done
405  DWORD bits = GetLogicalDrives();
406  if(!bits)
407  return result;
408 
409  for(int i = 0; i < 26; i++)
410  {
411  if(bits & (1 << i))
412  {
413  Ptr mp(new KMountPoint);
414  mp->d->mountPoint = QString(QLatin1Char('A' + i) + QLatin1String(":/"));
415  result.append(mp);
416  }
417  }
418 
419 #elif defined(_WIN32_WCE)
420  Ptr mp(new KMountPoint);
421  mp->d->mountPoint = QString("/");
422  result.append(mp);
423 
424 #else
425  STRUCT_SETMNTENT mnttab;
426  if ((mnttab = SETMNTENT(MNTTAB, "r")) == 0)
427  return result;
428 
429  STRUCT_MNTENT fe;
430  while (GETMNTENT(mnttab, fe))
431  {
432  Ptr mp(new KMountPoint);
433  mp->d->mountedFrom = QFile::decodeName(FSNAME(fe));
434 
435  mp->d->mountPoint = QFile::decodeName(MOUNTPOINT(fe));
436  mp->d->mountType = QFile::decodeName(MOUNTTYPE(fe));
437 
438  //Devices using supermount have their device names in the mount options
439  //instead of the device field. That's why we need to read the mount options
440  if (infoNeeded & NeedMountOptions || (mp->d->mountType == QLatin1String("supermount")))
441  {
442  QString options = QFile::decodeName(MOUNTOPTIONS(fe));
443  mp->d->mountOptions = options.split( QLatin1Char(',') );
444  }
445  mp->d->finalizeCurrentMountPoint(infoNeeded);
446 
447  result.append(mp);
448  }
449  ENDMNTENT(mnttab);
450 #endif
451  return result;
452 }
453 
454 QString KMountPoint::mountedFrom() const
455 {
456  return d->mountedFrom;
457 }
458 
459 QString KMountPoint::realDeviceName() const
460 {
461  return d->device;
462 }
463 
464 QString KMountPoint::mountPoint() const
465 {
466  return d->mountPoint;
467 }
468 
469 QString KMountPoint::mountType() const
470 {
471  return d->mountType;
472 }
473 
474 QStringList KMountPoint::mountOptions() const
475 {
476  return d->mountOptions;
477 }
478 
479 KMountPoint::List::List()
480  : QList<Ptr>()
481 {
482 }
483 
484 static bool pathsAreParentAndChildOrEqual(const QString& parent, const QString& child)
485 {
486  const QLatin1Char slash('/');
487  if (child.startsWith(parent, cs)) {
488  // Check if either
489  // (a) both paths are equal, or
490  // (b) parent ends with '/', or
491  // (c) the first character of child that is not shared with parent is '/'.
492  // Note that child is guaranteed to be longer than parent if (a) is false.
493  //
494  // This prevents that we incorrectly consider "/books" a child of "/book".
495  return parent.compare(child, cs) == 0 || parent.endsWith(slash) || child.at(parent.length()) == slash;
496  } else {
497  // Note that "/books" is a child of "/books/".
498  return parent.endsWith(slash) && (parent.length() == child.length() + 1) && parent.startsWith(child, cs);
499  }
500 }
501 
502 KMountPoint::Ptr KMountPoint::List::findByPath(const QString& path) const
503 {
504 #ifndef Q_WS_WIN
505  /* If the path contains symlinks, get the real name */
506  const QString realname = KStandardDirs::realFilePath(path);
507 #else
508  const QString realname = QDir::fromNativeSeparators(QDir(path).absolutePath());
509 #endif
510 
511  int max = 0;
512  KMountPoint::Ptr result;
513  for (const_iterator it = begin(); it != end(); ++it) {
514  const QString mountpoint = (*it)->d->mountPoint;
515  const int length = mountpoint.length();
516  if (length > max && pathsAreParentAndChildOrEqual(mountpoint, realname)) {
517  max = length;
518  result = *it;
519  // keep iterating to check for a better match (bigger max)
520  }
521  }
522  return result;
523 }
524 
525 KMountPoint::Ptr KMountPoint::List::findByDevice(const QString& device) const
526 {
527  const QString realDevice = KStandardDirs::realFilePath(device);
528  if (realDevice.isEmpty()) // d->device can be empty in the loop below, don't match empty with it
529  return Ptr();
530  for (const_iterator it = begin(); it != end(); ++it) {
531  if (realDevice.compare((*it)->d->device, cs) == 0 ||
532  realDevice.compare((*it)->d->mountedFrom, cs) == 0)
533  return *it;
534  }
535  return Ptr();
536 }
537 
538 bool KMountPoint::probablySlow() const
539 {
540  bool nfs = d->mountType == QLatin1String("nfs");
541  bool cifs = d->mountType == QLatin1String("cifs");
542  bool autofs = d->mountType == QLatin1String("autofs") || d->mountType == QLatin1String("subfs");
543  //bool pid = d->mountPoint.contains(":(pid");
544  // The "pid" thing was in kde3's KIO::probably_slow_mounted, with obscure logic
545  // (looks like it used state from the previous line or something...)
546  // This needs to be revised once we have a testcase or explanation about it.
547  // But autofs works already, it shows nfs as mountType in mtab.
548  if (nfs || autofs || cifs) {
549  return true;
550  }
551  return false;
552 }
553 
554 bool KMountPoint::testFileSystemFlag(FileSystemFlag flag) const
555 {
556  const bool isMsDos = ( d->mountType == QLatin1String("msdos") || d->mountType == QLatin1String("fat") || d->mountType == QLatin1String("vfat") );
557  const bool isNtfs = d->mountType.contains(QLatin1String("fuse.ntfs")) || d->mountType.contains(QLatin1String("fuseblk.ntfs"))
558  // fuseblk could really be anything. But its most common use is for NTFS mounts, these days.
559  || d->mountType == QLatin1String("fuseblk");
560  const bool isSmb = d->mountType == QLatin1String("cifs") || d->mountType == QLatin1String("smbfs");
561 
562  switch (flag) {
563  case SupportsChmod:
564  case SupportsChown:
565  case SupportsUTime:
566  case SupportsSymlinks:
567  return !isMsDos && !isNtfs && !isSmb; // it's amazing the number of things Microsoft filesystems don't support :)
568  case CaseInsensitive:
569  return isMsDos;
570  }
571  return false;
572 }
573 
FSTAB
#define FSTAB
Definition: kmountpoint.cpp:103
KSharedPtr
Can be used to control the lifetime of an object that has derived QSharedData.
Definition: kconfiggroup.h:38
KMountPoint::probablySlow
bool probablySlow() const
Checks if the filesystem that is probably slow (network mounts).
Definition: kmountpoint.cpp:538
KMountPoint
The KMountPoint class provides information about mounted and unmounted disks.
Definition: kmountpoint.h:35
kdebug.h
GETMNTENT
#define GETMNTENT(file, var)
Definition: kmountpoint.cpp:150
cs
static Qt::CaseSensitivity cs
Definition: kmountpoint.cpp:37
KStandardDirs::realFilePath
static QString realFilePath(const QString &filename)
Expands all symbolic links and resolves references to '/.
Definition: kstandarddirs.cpp:973
QDir::fromNativeSeparators
QString fromNativeSeparators(const QString &pathName)
QTextStream::readLine
QString readLine(qint64 maxlen)
KSharedPtr::d
T * d
Definition: ksharedptr.h:193
STRUCT_SETMNTENT
#define STRUCT_SETMNTENT
Definition: kmountpoint.cpp:149
STRUCT_MNTENT
#define STRUCT_MNTENT
Definition: kmountpoint.cpp:148
kmountpoint.h
KMountPoint::currentMountPoints
static List currentMountPoints(DetailsNeededFlags infoNeeded=BasicInfoNeeded)
This function gives a list of all currently used mountpoints.
Definition: kmountpoint.cpp:295
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
KMountPoint::mountedFrom
QString mountedFrom() const
Where this filesystem gets mounted from.
Definition: kmountpoint.cpp:454
KMountPoint::~KMountPoint
~KMountPoint()
Destructor.
Definition: kmountpoint.cpp:123
KMountPoint::realDeviceName
QString realDeviceName() const
Canonical name of the device where the filesystem got mounted from.
Definition: kmountpoint.cpp:459
KMountPoint::List::findByDevice
Ptr findByDevice(const QString &device) const
Returns the mount point associated with device, i.e.
Definition: kmountpoint.cpp:525
QString::simplified
QString simplified() const
QFile::exists
bool exists() const
KMountPoint::NeedMountOptions
Definition: kmountpoint.h:70
QFile
SETMNTENT
#define SETMNTENT
Definition: kmountpoint.cpp:146
QTextStream
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
KMountPoint::SupportsUTime
Definition: kmountpoint.h:122
FSNAME
#define FSNAME(var)
Definition: kmountpoint.cpp:154
QTextStream::atEnd
bool atEnd() const
QFile::symLinkTarget
QString symLinkTarget() const
KMountPoint::mountType
QString mountType() const
Type of filesystem.
Definition: kmountpoint.cpp:469
QString::isEmpty
bool isEmpty() const
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KMountPoint::SupportsChown
Definition: kmountpoint.h:122
QString::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QString
QList
Definition: kaboutdata.h:33
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
MOUNTPOINT
#define MOUNTPOINT(var)
Definition: kmountpoint.cpp:151
QStringList
KMountPoint::testFileSystemFlag
bool testFileSystemFlag(FileSystemFlag flag) const
Checks the capabilities of the filesystem.
Definition: kmountpoint.cpp:554
QList::end
iterator end()
QLatin1Char
QFile::close
virtual void close()
ENDMNTENT
#define ENDMNTENT
Definition: kmountpoint.cpp:147
QDir
KMountPoint::CaseInsensitive
Definition: kmountpoint.h:123
devNameFromOptions
static QString devNameFromOptions(const QStringList &options)
When using supermount, the device name is in the options field as dev=/my/device. ...
Definition: kmountpoint.cpp:161
KMountPoint::mountPoint
QString mountPoint() const
Path where the filesystem is mounted or can be mounted.
Definition: kmountpoint.cpp:464
QString::mid
QString mid(int position, int n) const
KMountPoint::List::List
List()
Definition: kmountpoint.cpp:479
QLatin1String
KMountPoint::Ptr
KSharedPtr< KMountPoint > Ptr
Definition: kmountpoint.h:38
KMountPoint::mountOptions
QStringList mountOptions() const
Options used to mount the filesystem.
Definition: kmountpoint.cpp:474
KMountPoint::possibleMountPoints
static List possibleMountPoints(DetailsNeededFlags infoNeeded=BasicInfoNeeded)
This function gives a list of all possible mountpoints.
Definition: kmountpoint.cpp:208
MOUNTOPTIONS
#define MOUNTOPTIONS(var)
Definition: kmountpoint.cpp:153
kstandarddirs.h
KMountPoint::List::findByPath
Ptr findByPath(const QString &path) const
Find the mountpoint on which resides path For instance if /home is a separate partition, findByPath("/home/user/blah") will return /home.
Definition: kmountpoint.cpp:502
QString::at
const QChar at(int position) const
QList::ConstIterator
typedef ConstIterator
QString::length
int length() const
KMountPoint::SupportsSymlinks
Definition: kmountpoint.h:123
QString::fromLatin1
QString fromLatin1(const char *str, int size)
pathsAreParentAndChildOrEqual
static bool pathsAreParentAndChildOrEqual(const QString &parent, const QString &child)
Definition: kmountpoint.cpp:484
KMountPoint::List
List of mount points.
Definition: kmountpoint.h:42
MOUNTTYPE
#define MOUNTTYPE(var)
Definition: kmountpoint.cpp:152
MNTTAB
#define MNTTAB
Definition: kmountpoint.cpp:91
QString::compare
int compare(const QString &other) const
QList::begin
iterator begin()
KMountPoint::SupportsChmod
Definition: kmountpoint.h:122
QFile::decodeName
QString decodeName(const QByteArray &localFileName)
KMountPoint::FileSystemFlag
FileSystemFlag
Definition: kmountpoint.h:122
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal