Changeset View
Standalone View
src/engine/fsutils.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 101 | if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == -1) { | |||
---|---|---|---|---|---|
102 | qWarning() << "ioctl error: failed to set file flags (" << errno << ")"; | 102 | qWarning() << "ioctl error: failed to set file flags (" << errno << ")"; | ||
103 | close(fd); | 103 | close(fd); | ||
104 | return; | 104 | return; | ||
105 | } | 105 | } | ||
106 | } | 106 | } | ||
107 | close(fd); | 107 | close(fd); | ||
108 | #endif | 108 | #endif | ||
109 | } | 109 | } | ||
110 | | ||||
111 | const QVector<FSUtils::DeviceInfo> FSUtils::attachedDevices() | ||||
bruns: Use of Solid would be preferred. | |||||
Sure? We would have to add Solid as a dependency for libKF5BalooEngine.so. The true reason for 'fsutils`'s existence is to disable CoW on btrfs. Can Solid do that? If so we can drop fsutils. michaelh: Sure? We would have to add Solid as a dependency for `libKF5BalooEngine.so`. | |||||
The question is if this really belongs in the library then. IMHO the whole printDevices() function should be moved into baloodb.cpp, The DatabaseSanitizer should export either createList or a function returning QVector<DeviceId, Count>. Going from the DeviceId to the DeviceInfo should happen in baloodb. bruns: The question is if this really belongs in the library then.
IMHO the whole `printDevices()`… | |||||
I agree completely and followed your suggestion. Currently I'm stuck, though. michaelh: I agree completely and followed your suggestion. Currently I'm stuck, though.
Using Solid to… | |||||
While implementing your "I can not come up with a reason ..." suggestion, I realized, the 'clean' command also needs DeviceInfo to exclude unmounted devices. michaelh: While implementing your "I can not come up with a reason ..." suggestion, I realized, the… | |||||
Which is good, as the device id is completely bogus, and changes dependent on mount order. Also the inode is not generally stable for at least smb, as not every server supports inodes exported from the server, and can not when several server filesystems are exported as a single share. baloo on network shares will likely never work. bruns: Which is good, as the device id is completely bogus, and changes dependent on mount order. | |||||
112 | { | ||||
113 | QVector<DeviceInfo> result; | ||||
114 | #ifndef Q_OS_LINUX | ||||
115 | return result; | ||||
116 | #else | ||||
117 | FILE *mtab = setmntent("/etc/mtab", "r"); | ||||
118 | if (!mtab) { | ||||
119 | return result; | ||||
120 | } | ||||
121 | while (mntent *mnt = getmntent(mtab)) { | ||||
122 | if (qstrcmp(mnt->mnt_type, MNTTYPE_IGNORE) == 0) { | ||||
123 | continue; | ||||
124 | } | ||||
125 | DeviceInfo info; | ||||
126 | info.mountpoint = QString::fromLocal8Bit(mnt->mnt_dir); | ||||
127 | info.filesystem = QString::fromLocal8Bit(mnt->mnt_type); | ||||
128 | info.name = QString::fromLocal8Bit(mnt->mnt_fsname); | ||||
129 | info.options = QString::fromLocal8Bit(mnt->mnt_opts).split(QLatin1Char(',')); | ||||
130 | result.append(info); | ||||
131 | } | ||||
132 | | ||||
133 | endmntent(mtab); | ||||
134 | | ||||
135 | return result; | ||||
136 | #endif | ||||
137 | } |
Use of Solid would be preferred.