132 KMountPoint::List result;
135 STRUCT_SETMNTENT fstab;
136 if ((fstab = SETMNTENT(FSTAB,
"r")) == 0)
140 while (GETMNTENT(fstab, fe))
143 mp->m_mountedFrom = TQFile::decodeName(FSNAME(fe));
145 mp->m_mountPoint = TQFile::decodeName(MOUNTPOINT(fe));
146 mp->m_mountType = TQFile::decodeName(MOUNTTYPE(fe));
150 if (infoNeeded & NeedMountOptions || (mp->m_mountType ==
"supermount"))
152 TQString options = TQFile::decodeName(MOUNTOPTIONS(fe));
153 mp->m_mountOptions = TQStringList::split(
',', options);
156 if(mp->m_mountType ==
"supermount")
159 if (infoNeeded & NeedRealDeviceName)
161 if (mp->m_mountedFrom.startsWith(
"/"))
170 if ( !f.open(IO_ReadOnly) )
178 s=t.readLine().simplifyWhiteSpace();
179 if ( s.isEmpty() || (s[0] ==
'#'))
183 TQStringList item = TQStringList::split(
' ', s);
186 if (item.count() < 5)
189 if (item.count() < 4)
196 mp->m_mountedFrom = item[i++];
201 mp->m_mountPoint = item[i++];
202 mp->m_mountType = item[i++];
203 TQString options = item[i++];
205 if (infoNeeded & NeedMountOptions)
207 mp->m_mountOptions = TQStringList::split(
',', options);
210 if (infoNeeded & NeedRealDeviceName)
212 if (mp->m_mountedFrom.startsWith(
"/"))
226 KMountPoint::List result;
228#ifdef HAVE_GETMNTINFO
230#ifdef GETMNTINFO_USES_STATVFS
231 struct statvfs *mounted;
233 struct statfs *mounted;
236 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
238 for (
int i=0;i<num_fs;i++)
241 mp->m_mountedFrom = TQFile::decodeName(mounted[i].f_mntfromname);
242 mp->m_mountPoint = TQFile::decodeName(mounted[i].f_mntonname);
243 mp->m_mountType = TQFile::decodeName(mounted[i].f_fstypename);
245 if (infoNeeded & NeedMountOptions)
247 struct fstab *ft = getfsfile(mounted[i].f_mntonname);
248 TQString options = TQFile::decodeName(ft->fs_mntops);
249 mp->m_mountOptions = TQStringList::split(
',', options);
252 if (infoNeeded & NeedRealDeviceName)
254 if (mp->m_mountedFrom.startsWith(
"/"))
263 struct vmount *mntctl_buffer;
270 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
271 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
274 buf_sz = *(
int*)mntctl_buffer;
276 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
277 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
283 vm = (
struct vmount *)mntctl_buffer;
284 for ( ; num > 0; num-- )
287 fsname_len = vmt2datasize(vm, VMT_STUB);
288 mountedto = (
char*)malloc(fsname_len + 1);
289 mountedto[fsname_len] =
'\0';
290 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
292 fsname_len = vmt2datasize(vm, VMT_OBJECT);
293 mountedfrom = (
char*)malloc(fsname_len + 1);
294 mountedfrom[fsname_len] =
'\0';
295 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
301 struct vfs_ent* ent = getvfsbytype(vm->vmt_gfstype);
304 mp->m_mountedFrom = TQFile::decodeName(mountedfrom);
305 mp->m_mountPoint = TQFile::decodeName(mountedto);
306 mp->m_mountType = TQFile::decodeName(ent->vfsent_name);
311 if (infoNeeded & NeedMountOptions)
316 if (infoNeeded & NeedRealDeviceName)
318 if (mp->m_mountedFrom.startsWith(
"/"))
325 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
331 free( mntctl_buffer );
332#elif defined(TQ_WS_WIN)
335 STRUCT_SETMNTENT mnttab;
336 if ((mnttab = SETMNTENT(MNTTAB,
"r")) == 0)
340 while (GETMNTENT(mnttab, fe))
343 mp->m_mountedFrom = TQFile::decodeName(FSNAME(fe));
345 mp->m_mountPoint = TQFile::decodeName(MOUNTPOINT(fe));
346 mp->m_mountType = TQFile::decodeName(MOUNTTYPE(fe));
350 if (infoNeeded & NeedMountOptions || (mp->m_mountType ==
"supermount"))
352 TQString options = TQFile::decodeName(MOUNTOPTIONS(fe));
353 mp->m_mountOptions = TQStringList::split(
',', options);
356 if (mp->m_mountType ==
"supermount")
359 if (infoNeeded & NeedRealDeviceName)
361 if (mp->m_mountedFrom.startsWith(
"/"))