This file is indexed.

/usr/include/libktorrent/util/fileops.h is in libktorrent-dev 1.3.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/***************************************************************************
 *   Copyright (C) 2005 by Joris Guisson                                   *
 *   joris.guisson@gmail.com                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#ifndef BTFILEOPS_H
#define BTFILEOPS_H

#include <util/constants.h>
#include <ktorrent_export.h>

class QString;

#ifdef CopyFile
#undef CopyFile
#endif

namespace bt
{

	/**
	 * Creates a directory.
	 * @param dir The url of the dir
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 * @throw Error upon error
	 */
	KTORRENT_EXPORT void MakeDir(const QString & dir,bool nothrow = false);

	/**
	 * Creates a path. 
	 * @param dir The url of the dir
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 * @throw Error upon error
	 */
	KTORRENT_EXPORT void MakePath(const QString & dir,bool nothrow = false);
	
	/**
	 * Creates the path of a file. 
	 * @param file The full path of the file
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 * @throw Error upon error
	 */
	KTORRENT_EXPORT void MakeFilePath(const QString & file,bool nothrow = false);

	/**
	* Create a symbolic link @a link_url which links to @a link_to 
	 * @param link_to The file to link to
	 * @param link_url The link url
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 */
	KTORRENT_EXPORT void SymLink(const QString & link_to,const QString & link_url,bool nothrow = false);

	/**
	 * Move a file/dir from one location to another
	 * @param src The source file
	 * @param dst The destination file / directory
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 * @param silent Wehter or not to hide progress info
	 */
	KTORRENT_EXPORT void Move(const QString & src,const QString & dst,bool nothrow = false,bool silent = false);

	/**
	 * Copy a file.
	 * @param src The source file
	 * @param dst The destination dir/file
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 */
	KTORRENT_EXPORT void CopyFile(const QString & src,const QString & dst,bool nothrow = false);
	
	/**
	 * Copy a file or directory
	 * @param src The source file
	 * @param dst The destination dir/file
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 */
	KTORRENT_EXPORT void CopyDir(const QString & src,const QString & dst,bool nothrow = false);
	
	/**
	 * Check whether a file/dir exists
	 * @param url The file/dir
	 * @return true if it exits
	 */
	KTORRENT_EXPORT bool Exists(const QString & url);

	/**
	 * Delete a file or directory.
	 * @param url The url of the file/dir
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 */
	KTORRENT_EXPORT void Delete(const QString & url,bool nothrow = false);

	/**
	 * Try to create a file. Doesn't do anything if the file
	 * already exists.
	 * @param url The url of the file
	 * @param nothrow whether or not we shouldn't throw an Error upon failure
	 */
	KTORRENT_EXPORT void Touch(const QString & url,bool nothrow = false);
	
	/**
	 * Calculates the size of a file
	 * @param url Name of the file
	 * @return The size of the file
	 * @throw Error if the file doesn't exist, or something else goes wrong
	 */
	KTORRENT_EXPORT Uint64 FileSize(const QString & url);
	
	/**
	 * Get the size of a file.
	 * @param fd The file descriptor of the file
	 * @return The size
	 * @throw Error if the file doesn't exist, or something else goes wrong
	 */
	KTORRENT_EXPORT Uint64 FileSize(int fd);
	
	/**
	 * Truncate a file (wrapper around ftruncate)
	 * @param fd The file descriptor of the file
	 * @param size The size to truncate to
	 * @param quick Use the quick way (doesn't prevent fragmentationt)
	 * @throw Error if the file doesn't exist, or something else goes wrong
	 */
	KTORRENT_EXPORT void TruncateFile(int fd,Uint64 size,bool quick);
	
	/**
	 * Truncate a file (wrapper around ftruncate)
	 * @param fd Path of the file
	 * @param size The size to truncate to
	 * @throw Error if the file doesn't exist, or something else goes wrong
	 */
	KTORRENT_EXPORT void TruncateFile(const QString & path,Uint64 size);

#ifdef HAVE_XFS_XFS_H
	/**
	 * Special truncate for XFS file systems.
	*/
	KTORRENT_EXPORT bool XfsPreallocate(int fd,Uint64 size);
	
	/**
	 * Special truncate for XFS file systems.
	 */
	KTORRENT_EXPORT bool XfsPreallocate(const QString & path,Uint64 size);

#endif

	/**
	 * Seek in a file, wrapper around lseek
	 * @param fd The file descriptor
	 * @param off Offset
	 * @param whence Position to seek from
	 * @throw Error if something else goes wrong
	 */
	KTORRENT_EXPORT void SeekFile(int fd,Int64 off,int whence);

	/// Calculate the number of bytes free on the filesystem path is located
	KTORRENT_EXPORT bool FreeDiskSpace(const QString & path,Uint64 & bytes_free);
	
	/// Check if a filename is to long
	KTORRENT_EXPORT bool FileNameToLong(const QString & path);
	
	/**
	 * Shorten a filename
	 * @param path Path of the file
	 * @param extra_number Append this number before the extension (if negative or 0, nothing will be appended) This is to handle duplicate shortened names
	 * @return The shortened path
	 */
	KTORRENT_EXPORT QString ShortenFileName(const QString & path,int extra_number = -1);
	
	/// Calculate the amount of space a file is taking up (this is not the filesize!)
	KTORRENT_EXPORT Uint64 DiskUsage(const QString & filename);
	
	/// Calculate the amount of space a file is taking up (this is not the filesize!)
	KTORRENT_EXPORT Uint64 DiskUsage(int fd);
	
	/// Get the mount point of a path
	KTORRENT_EXPORT QString MountPoint(const QString & path);
	
	/// Is there something mounted on a mount point
	KTORRENT_EXPORT bool IsMounted(const QString & mount_point);
}

#endif