xref: /trunk/main/sal/inc/osl/file.h (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 /** @HTML */
29 
30 #ifndef _OSL_FILE_H_
31 #define _OSL_FILE_H_
32 
33 #include <osl/time.h>
34 #   include <rtl/ustring.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** @file
41 
42 Main goals and usage hints
43 
44 The main intentention of this interface is to provide an universal portable and
45 high performance access to file system issues on any operating system.<p>
46 
47 There are a few main goals:<p>
48 
49 1.The path specifications always has to be absolut. Any usage of relative path
50 specifications is forbidden. Exceptions are <code>osl_getSystemPathFromFileURL</code>,
51 <code>osl_getFileURLFromSystemPath</code> and <code>osl_getAbsoluteFileURL</code>. Most operating systems
52 provide a "Current Directory" per process. This is the reason why relative path
53 specifications can cause problems in multithreading environments.<p>
54 
55 2.Proprietary notations of file paths are not supported. Every path notation
56 must the file URL specification. File URLs must be encoded in UTF8 and
57 after that escaped. Although the URL parameter is a unicode string, the must
58 contain only ASCII characters<p>
59 
60 3.The caller cannot get any information whether a file system is case sensitive,
61 case preserving or not. The operating system implementation itself should
62 determine if it can map case-insensitive paths. The case correct notation of
63 a filename or file path is part of the "File Info". This case correct name
64 can be used as a unique key if neccessary.<p>
65 
66 4. Obtaining information about files or volumes is controlled by a
67 bitmask which specifies which fields are of interest. Due to performance
68 issues it is not recommended to obtain information which is not needed.
69 But if the operating system provides more information anyway the
70 implementation can set more fields on output as were requested. It is in the
71 responsibility of the caller to decide if he uses this additional information
72 or not. But he should do so to prevent further unnecessary calls if the information
73 is already there.<br>
74 
75 The input bitmask supports a flag <code>osl_FileStatus_Mask_Validate</code> which
76 can be used to force retrieving uncached validated information. Setting this flag
77 when calling <code>osl_getFileStatus</code> in combination with no other flag is
78 a synonym for a "FileExists". This should only be done when processing a single file
79 (f.e. before opening) and NEVER during enumeration of directory contents on any step
80 of information processing. This would change the runtime behaviour from O(n) to
81 O(n*n/2) on nearly every file system.<br>
82 On Windows NT reading the contents of an directory with 7000 entries and
83 getting full information about every file only takes 0.6 seconds. Specifying the
84 flag <code>osl_FileStatus_Mask_Validate</code> for each entry will increase the
85 time to 180 seconds (!!!).
86 
87 */
88 
89 
90 
91 /* Error codes according to errno */
92 
93 typedef enum {
94     osl_File_E_None,
95     osl_File_E_PERM,
96     osl_File_E_NOENT,
97     osl_File_E_SRCH,
98     osl_File_E_INTR,
99     osl_File_E_IO,
100     osl_File_E_NXIO,
101     osl_File_E_2BIG,
102     osl_File_E_NOEXEC,
103     osl_File_E_BADF,
104     osl_File_E_CHILD,
105     osl_File_E_AGAIN,
106     osl_File_E_NOMEM,
107     osl_File_E_ACCES,
108     osl_File_E_FAULT,
109     osl_File_E_BUSY,
110     osl_File_E_EXIST,
111     osl_File_E_XDEV,
112     osl_File_E_NODEV,
113     osl_File_E_NOTDIR,
114     osl_File_E_ISDIR,
115     osl_File_E_INVAL,
116     osl_File_E_NFILE,
117     osl_File_E_MFILE,
118     osl_File_E_NOTTY,
119     osl_File_E_FBIG,
120     osl_File_E_NOSPC,
121     osl_File_E_SPIPE,
122     osl_File_E_ROFS,
123     osl_File_E_MLINK,
124     osl_File_E_PIPE,
125     osl_File_E_DOM,
126     osl_File_E_RANGE,
127     osl_File_E_DEADLK,
128     osl_File_E_NAMETOOLONG,
129     osl_File_E_NOLCK,
130     osl_File_E_NOSYS,
131     osl_File_E_NOTEMPTY,
132     osl_File_E_LOOP,
133     osl_File_E_ILSEQ,
134     osl_File_E_NOLINK,
135     osl_File_E_MULTIHOP,
136     osl_File_E_USERS,
137     osl_File_E_OVERFLOW,
138     osl_File_E_NOTREADY,
139     osl_File_E_invalidError,        /* unmapped error: always last entry in enum! */
140     osl_File_E_TIMEDOUT,
141     osl_File_E_NETWORK,
142     osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
143 } oslFileError;
144 
145 typedef void *oslDirectory;
146 typedef void *oslDirectoryItem;
147 
148 
149 /** Open a directory for enumerating its contents.
150 
151     @param  pustrDirectoryURL [in]
152     The full qualified URL of the directory.
153 
154     @param  pDirectory [out]
155     On success it receives a handle used for subsequent calls by osl_getNextDirectoryItem().
156     The handle has to be released by a call to osl_closeDirectory().
157 
158     @return
159     osl_File_E_None on success<br>
160     osl_File_E_INVAL the format of the parameters was not valid<br>
161     osl_File_E_NOENT the specified path doesn't exist<br>
162     osl_File_E_NOTDIR the specified path is not an directory <br>
163     osl_File_E_NOMEM not enough memory for allocating structures <br>
164     osl_File_E_ACCES permission denied<br>
165     osl_File_E_MFILE too many open files used by the process<br>
166     osl_File_E_NFILE too many open files in the system<br>
167     osl_File_E_NAMETOOLONG File name too long<br>
168     osl_File_E_LOOP Too many symbolic links encountered<p>
169 
170     @see osl_getNextDirectoryItem()
171     @see osl_closeDirectory()
172 */
173 
174 oslFileError SAL_CALL osl_openDirectory( rtl_uString *pustrDirectoryURL, oslDirectory *pDirectory);
175 
176 
177 /** Retrieve the next item of a previously opened directory.
178 
179     Retrieves the next item of a previously opened directory.
180     All handles have an initial refcount of 1.
181 
182     @param  Directory [in]
183     A directory handle received from a previous call to osl_openDirectory().
184 
185     @param  pItem [out]
186     On success it receives a handle that can be used for subsequent calls to osl_getFileStatus().
187     The handle has to be released by a call to osl_releaseDirectoryItem().
188 
189     @param  uHint [in]
190     With this parameter the caller can tell the implementation that (s)he
191     is going to call this function uHint times afterwards. This enables the implementation to
192     get the information for more than one file and cache it until the next calls.
193 
194     @return
195     osl_File_E_None on success<br>
196     osl_File_E_INVAL the format of the parameters was not valid<br>
197     osl_File_E_NOMEM not enough memory for allocating structures <br>
198     osl_File_E_NOENT no more entries in this directory<br>
199     osl_File_E_BADF invalid oslDirectory parameter<br>
200     osl_File_E_OVERFLOW the value too large for defined data type
201 
202     @see osl_releaseDirectoryItem()
203     @see osl_acquireDirectoryItem()
204     @see osl_getDirectoryItem()
205     @see osl_getFileStatus()
206 */
207 
208 oslFileError SAL_CALL osl_getNextDirectoryItem(
209     oslDirectory Directory,
210     oslDirectoryItem *pItem,
211     sal_uInt32   uHint
212     );
213 
214 
215 /** Release a directory handle.
216 
217     @param Directory [in]
218     A handle received by a call to osl_openDirectory().
219 
220     @return
221     osl_File_E_None on success<br>
222     osl_File_E_INVAL the format of the parameters was not valid<br>
223     osl_File_E_NOMEM not enough memory for allocating structures<br>
224     osl_File_E_BADF invalid oslDirectory parameter<br>
225     osl_File_E_INTR the function call was interrupted<p>
226 
227     @see osl_openDirectory()
228 */
229 
230 oslFileError SAL_CALL osl_closeDirectory(oslDirectory Directory);
231 
232 
233 /** Retrieve a single directory item.
234 
235     Retrieves a single directory item. The returned handle has an initial refcount of 1.
236     Due to performance issues it is not recommended to use this function while
237     enumerating the contents of a directory. In this case use osl_getNextDirectoryItem() instead.
238 
239     @param pustrFileURL [in]
240     An absolute file URL.
241 
242     @param pItem [out]
243     On success it receives a handle which can be used for subsequent calls to osl_getFileStatus().
244     The handle has to be released by a call to osl_releaseDirectoryItem().
245 
246     @return
247     osl_File_E_None on success<br>
248     osl_File_E_INVAL the format of the parameters was not valid<br>
249     osl_File_E_NOMEM not enough memory for allocating structures <br>
250     osl_File_E_ACCES permission denied<br>
251     osl_File_E_MFILE too many open files used by the process<br>
252     osl_File_E_NFILE too many open files in the system<br>
253     osl_File_E_NOENT no such file or directory<br>
254     osl_File_E_LOOP too many symbolic links encountered<br>
255     osl_File_E_NAMETOOLONG the file name is too long<br>
256     osl_File_E_NOTDIR a component of the path prefix of path is not a directory<br>
257     osl_File_E_IO on I/O errors<br>
258     osl_File_E_MULTIHOP multihop attempted<br>
259     osl_File_E_NOLINK link has been severed<br>
260     osl_File_E_FAULT bad address<br>
261     osl_File_E_INTR the function call was interrupted<p>
262 
263     @see osl_releaseDirectoryItem()
264     @see osl_acquireDirectoryItem()
265     @see osl_getFileStatus()
266     @see osl_getNextDirectoryItem()
267 */
268 
269 oslFileError SAL_CALL osl_getDirectoryItem(
270     rtl_uString *pustrFileURL,
271     oslDirectoryItem *pItem
272     );
273 
274 
275 /** Increase the refcount of a directory item handle.
276 
277     The caller responsible for releasing the directory item handle using osl_releaseDirectoryItem().
278 
279     @param  Item [in]
280     A handle received by a call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
281 
282     @return
283     osl_File_E_None on success<br>
284     osl_File_E_NOMEM not enough memory for allocating structures<br>
285     osl_File_E_INVAL the format of the parameters was not valid<br>
286 
287     @see osl_getDirectoryItem()
288     @see osl_getNextDirectoryItem()
289     @see osl_releaseDirectoryItem()
290 */
291 
292 oslFileError SAL_CALL osl_acquireDirectoryItem( oslDirectoryItem Item );
293 
294 
295 /** Decrease the refcount of a directory item handle.
296 
297     Decreases the refcount of a directory item handle.
298     If the refcount reaches 0 the data associated with
299     this directory item handle will be released.
300 
301     @param  Item [in]
302     A handle received by a call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
303 
304     @return
305     osl_File_E_None on success<br>
306     osl_File_E_NOMEM not enough memory for allocating structures<br>
307     osl_File_E_INVAL the format of the parameters was not valid<br>
308 
309     @see osl_getDirectoryItem()
310     @see osl_getNextDirectoryItem()
311     @see osl_acquireDirectoryItem()
312 */
313 
314 oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item );
315 
316 /* File types */
317 
318 typedef enum {
319     osl_File_Type_Directory,
320     osl_File_Type_Volume,
321     osl_File_Type_Regular,
322     osl_File_Type_Fifo,
323     osl_File_Type_Socket,
324     osl_File_Type_Link,
325     osl_File_Type_Special,
326     osl_File_Type_Unknown
327 } oslFileType;
328 
329 /* File attributes */
330 #define osl_File_Attribute_ReadOnly             0x00000001
331 #define osl_File_Attribute_Hidden               0x00000002
332 #define osl_File_Attribute_Executable           0x00000010
333 #define osl_File_Attribute_GrpWrite             0x00000020
334 #define osl_File_Attribute_GrpRead              0x00000040
335 #define osl_File_Attribute_GrpExe               0x00000080
336 #define osl_File_Attribute_OwnWrite             0x00000100
337 #define osl_File_Attribute_OwnRead              0x00000200
338 #define osl_File_Attribute_OwnExe               0x00000400
339 #define osl_File_Attribute_OthWrite             0x00000800
340 #define osl_File_Attribute_OthRead              0x00001000
341 #define osl_File_Attribute_OthExe               0x00002000
342 
343 /* Flags specifying which fields to retreive by osl_getFileStatus */
344 
345 #define osl_FileStatus_Mask_Type                0x00000001
346 #define osl_FileStatus_Mask_Attributes          0x00000002
347 #define osl_FileStatus_Mask_CreationTime        0x00000010
348 #define osl_FileStatus_Mask_AccessTime          0x00000020
349 #define osl_FileStatus_Mask_ModifyTime          0x00000040
350 #define osl_FileStatus_Mask_FileSize            0x00000080
351 #define osl_FileStatus_Mask_FileName            0x00000100
352 #define osl_FileStatus_Mask_FileURL             0x00000200
353 #define osl_FileStatus_Mask_LinkTargetURL       0x00000400
354 #define osl_FileStatus_Mask_All                 0x7FFFFFFF
355 #define osl_FileStatus_Mask_Validate            0x80000000
356 
357 
358 typedef
359 
360 /** Structure containing information about files and directories
361 
362     @see    osl_getFileStatus()
363     @see    oslFileType
364 */
365 
366 struct _oslFileStatus {
367 /** Must be initialized with the size in bytes of the structure before passing it to any function */
368     sal_uInt32      uStructSize;
369 /** Determines which members of the structure contain valid data */
370     sal_uInt32      uValidFields;
371 /** The type of the file (file, directory, volume). */
372     oslFileType eType;
373 /** File attributes */
374     sal_uInt64  uAttributes;
375 /** First creation time in nanoseconds since 1/1/1970. Can be the last modify time depending on
376     platform or file system. */
377     TimeValue   aCreationTime;
378 /** Last access time in nanoseconds since 1/1/1970. Can be the last modify time depending on
379     platform or file system. */
380     TimeValue   aAccessTime;
381 /** Last modify time in nanoseconds since 1/1/1970. */
382     TimeValue   aModifyTime;
383 /** Size in bytes of the file. Zero for directories and volumes. */
384     sal_uInt64  uFileSize;
385 /** Case correct name of the file. Should be set to zero before calling <code>osl_getFileStatus</code>
386     and released after usage. */
387     rtl_uString *ustrFileName;
388 /** Full URL of the file. Should be set to zero before calling <code>osl_getFileStatus</code>
389     and released after usage. */
390     rtl_uString *ustrFileURL;
391 /** Full URL of the target file if the file itself is a link.
392     Should be set to zero before calling <code>osl_getFileStatus</code>
393     and released after usage. */
394     rtl_uString *ustrLinkTargetURL;
395 } oslFileStatus;
396 
397 
398 /** Retrieve information about a single file or directory.
399 
400     @param  Item [in]
401     A handle received by a previous call to osl_getDirectoryItem() or osl_getNextDirectoryItem().
402 
403     @param  pStatus [in|out]
404     Points to a structure which receives the information of the file or directory
405     represented by the handle Item. The member uStructSize has to be initialized to
406     sizeof(oslFileStatus) before calling this function.
407 
408     @param  uFieldMask [in]
409     Specifies which fields of the structure pointed to by pStatus are of interest to the caller.
410 
411     @return
412     osl_File_E_None on success<br>
413     osl_File_E_NOMEM not enough memory for allocating structures <br>
414     osl_File_E_INVAL the format of the parameters was not valid<br>
415     osl_File_E_LOOP too many symbolic links encountered<br>
416     osl_File_E_ACCES permission denied<br>
417     osl_File_E_NOENT no such file or directory<br>
418     osl_File_E_NAMETOOLONG file name too long<br>
419     osl_File_E_BADF invalid oslDirectoryItem parameter<br>
420     osl_File_E_FAULT bad address<br>
421     osl_File_E_OVERFLOW value too large for defined data type<br>
422     osl_File_E_INTR function call was interrupted<br>
423     osl_File_E_NOLINK link has been severed<br>
424     osl_File_E_MULTIHOP components of path require hopping to multiple remote machines and the file system does not allow it<br>
425     osl_File_E_MFILE too many open files used by the process<br>
426     osl_File_E_NFILE too many open files in the system<br>
427     osl_File_E_NOSPC no space left on device<br>
428     osl_File_E_NXIO no such device or address<br>
429     osl_File_E_IO on I/O errors<br>
430     osl_File_E_NOSYS function not implemented<p>
431 
432     @see osl_getDirectoryItem()
433     @see osl_getNextDirectoryItem()
434     @see oslFileStatus
435 */
436 
437 oslFileError SAL_CALL osl_getFileStatus( oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask );
438 
439 
440 typedef void *oslVolumeDeviceHandle;
441 
442 
443 /** Unmount a volume device.
444 
445     Unmount the volume specified by the given oslVolumeDeviceHandle.
446 
447     @param Handle [in]
448     An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
449 
450     @return
451     osl_File_E_None on success<br>
452 
453     @todo
454     specify all error codes that may be returned
455 
456     @see osl_getVolumeInformation()
457 */
458 
459 oslFileError SAL_CALL osl_unmountVolumeDevice( oslVolumeDeviceHandle Handle );
460 
461 
462 /** Automount a volume device.
463 
464     Automount the volume device specified by the given oslVolumeDeviceHandle.
465 
466     @param Handle [in]
467     An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
468 
469     @return
470     osl_File_E_None on success<br>
471 
472     @todo
473     specify all error codes that may be returned
474 
475     @see osl_getVolumeInformation()
476 */
477 
478 oslFileError SAL_CALL osl_automountVolumeDevice( oslVolumeDeviceHandle Handle );
479 
480 
481 /** Release a volume device handle.
482 
483     Releases the given oslVolumeDeviceHandle which was acquired by a call to
484     osl_getVolumeInformation() or osl_acquireVolumeDeviceHandle().
485 
486     @param Handle [in]
487     An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
488 
489     @return
490     osl_File_E_None on success<br>
491 
492     @todo
493     specify all error codes that may be returned
494 
495     @see osl_acquireVolumeDeviceHandle()
496     @see osl_getVolumeInformation()
497 */
498 
499 oslFileError SAL_CALL osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
500 
501 /** Acquire a volume device handle.
502 
503     Acquires the given oslVolumeDeviceHandle which was acquired by a call to
504     osl_getVolumeInformation(). The caller is responsible for releasing the
505     acquired handle by calling osl_releaseVolumeDeviceHandle().
506 
507     @param Handle [in]
508     An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
509 
510     @return
511     osl_File_E_None on success<br>
512 
513     @todo
514     specify all error codes that may be returned
515 
516     @see osl_getVolumeInformation()
517 */
518 
519 oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
520 
521 
522 /** Get the full qualified URL where a device is mounted to.
523 
524     @param Handle [in]
525     An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
526 
527     @param ppustrDirectoryURL [out]
528     Receives the full qualified URL where the device is mounted to.
529 
530     @return
531     osl_File_E_None on success<br>
532     osl_File_E_NOMEM not enough memory for allocating structures <br>
533     osl_File_E_INVAL the format of the parameters was not valid<br>
534     osl_File_E_ACCES permission denied<br>
535     osl_File_E_NXIO  no such device or address<br>
536     osl_File_E_NODEV no such device<br>
537     osl_File_E_NOENT no such file or directory<br>
538     osl_File_E_FAULT bad address<br>
539     osl_FilE_E_INTR function call was interrupted<br>
540     osl_File_E_IO on I/O errors<br>
541     osl_File_E_MULTIHOP multihop attempted<br>
542     osl_File_E_NOLINK link has been severed<br>
543     osl_File_E_EOVERFLOW value too large for defined data type<br>
544 
545     @see    osl_getVolumeInformation()
546     @see    osl_automountVolumeDevice()
547     @see    osl_unmountVolumeDevice()
548 */
549 
550 oslFileError SAL_CALL osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **ppustrDirectoryURL);
551 
552 /* Volume attributes */
553 
554 #define osl_Volume_Attribute_Removeable            0x00000001L
555 #define osl_Volume_Attribute_Remote                0x00000002L
556 #define osl_Volume_Attribute_CompactDisc           0x00000004L
557 #define osl_Volume_Attribute_FixedDisk             0x00000008L
558 #define osl_Volume_Attribute_RAMDisk               0x00000010L
559 #define osl_Volume_Attribute_FloppyDisk            0x00000020L
560 
561 #define osl_Volume_Attribute_Case_Is_Preserved     0x00000040L
562 #define osl_Volume_Attribute_Case_Sensitive        0x00000080L
563 
564 /* Flags specifying which fields to retreive by osl_getVolumeInfo */
565 
566 #define osl_VolumeInfo_Mask_Attributes             0x00000001L
567 #define osl_VolumeInfo_Mask_TotalSpace             0x00000002L
568 #define osl_VolumeInfo_Mask_UsedSpace              0x00000004L
569 #define osl_VolumeInfo_Mask_FreeSpace              0x00000008L
570 #define osl_VolumeInfo_Mask_MaxNameLength          0x00000010L
571 #define osl_VolumeInfo_Mask_MaxPathLength          0x00000020L
572 #define osl_VolumeInfo_Mask_FileSystemName         0x00000040L
573 #define osl_VolumeInfo_Mask_DeviceHandle           0x00000080L
574 #define osl_VolumeInfo_Mask_FileSystemCaseHandling 0x00000100L
575 
576 typedef
577 
578 /** Structure containing information about volumes
579 
580     @see    osl_getVolumeInformation()
581     @see    oslFileType
582 */
583 
584 struct _oslVolumeInfo {
585 /** Must be initialized with the size in bytes of the structure before passing it to any function */
586     sal_uInt32      uStructSize;
587 /** Determines which members of the structure contain valid data */
588     sal_uInt32      uValidFields;
589 /** Attributes of the volume (remote and/or removable) */
590     sal_uInt32      uAttributes;
591 /** Total availiable space on the volume for the current process/user */
592     sal_uInt64      uTotalSpace;
593 /** Used space on the volume for the current process/user */
594     sal_uInt64      uUsedSpace;
595 /** Free space on the volume for the current process/user */
596     sal_uInt64      uFreeSpace;
597 /** Maximum length of file name of a single item */
598     sal_uInt32      uMaxNameLength;
599 /** Maximum length of a full quallified path in system notation */
600     sal_uInt32      uMaxPathLength;
601 /** Points to a string that receives the name of the file system type. String should be set to zero before calling <code>osl_getVolumeInformation</code>
602     and released after usage. */
603     rtl_uString     *ustrFileSystemName;
604 /** Pointer to handle the receives underlying device. Handle should be set to zero before calling <code>osl_getVolumeInformation</code>*/
605     oslVolumeDeviceHandle   *pDeviceHandle;
606 } oslVolumeInfo;
607 
608 
609 /** Retrieve information about a volume.
610 
611     Retrieves information about a volume. A volume can either be a mount point, a network
612     resource or a drive depending on Operating System and File System. Before calling this
613     function osl_getFileStatus() should be called to determine if the type is
614     osl_file_Type_Volume.
615 
616     @param pustrDirectoryURL [in]
617     Full qualified URL of the volume
618 
619     @param pInfo [out]
620     On success it receives information about the volume.
621 
622     @param uFieldMask [in]
623     Specifies which members of the structure should be filled
624 
625     @return
626     osl_File_E_None on success<br>
627     osl_File_E_NOMEM not enough memory for allocating structures <br>
628     osl_File_E_INVAL the format of the parameters was not valid<br>
629     osl_File_E_NOTDIR not a directory<br>
630     osl_File_E_NAMETOOLONG file name too long<br>
631     osl_File_E_NOENT no such file or directory<br>
632     osl_File_E_ACCES permission denied<br>
633     osl_File_E_LOOP too many symbolic links encountered<br>
634     ols_File_E_FAULT Bad address<br>
635     osl_File_E_IO on I/O errors<br>
636     osl_File_E_NOSYS function not implemented<br>
637     osl_File_E_MULTIHOP multihop attempted<br>
638     osl_File_E_NOLINK link has been severed<br>
639     osl_File_E_INTR function call was interrupted<br>
640 
641     @see    osl_getFileStatus()
642     @see    oslVolumeInfo
643 */
644 
645 oslFileError SAL_CALL osl_getVolumeInformation(
646     rtl_uString *pustrDirectoryURL,
647     oslVolumeInfo *pInfo,
648     sal_uInt32 uFieldMask );
649 
650 typedef void *oslFileHandle;
651 
652 /* Open flags */
653 
654 #define osl_File_OpenFlag_Read      0x00000001L
655 #define osl_File_OpenFlag_Write     0x00000002L
656 #define osl_File_OpenFlag_Create    0x00000004L
657 #define osl_File_OpenFlag_NoLock    0x00000008L
658 
659 /** Open a regular file.
660 
661     Open a file. Only regular files can be openend.
662 
663     @param pustrFileURL [in]
664     The full qualified URL of the file to open.
665 
666     @param pHandle [out]
667     On success it receives a handle to the open file.
668 
669     @param uFlags [in]
670     Specifies the open mode.
671 
672     @return
673     osl_File_E_None on success<br>
674     osl_File_E_NOMEM not enough memory for allocating structures <br>
675     osl_File_E_INVAL the format of the parameters was not valid<br>
676     osl_File_E_NAMETOOLONG pathname was too long<br>
677     osl_File_E_NOENT no such file or directory<br>
678     osl_File_E_ACCES permission denied<br>
679     osl_File_E_AGAIN a write lock could not be established<br>
680     osl_File_E_NOTDIR not a directory<br>
681     osl_File_E_NXIO no such device or address<br>
682     osl_File_E_NODEV no such device<br>
683     osl_File_E_ROFS read-only file system<br>
684     osl_File_E_TXTBSY text file busy<br>
685     osl_File_E_FAULT bad address<br>
686     osl_File_E_LOOP too many symbolic links encountered<br>
687     osl_File_E_NOSPC no space left on device<br>
688     osl_File_E_ISDIR is a directory<br>
689     osl_File_E_MFILE too many open files used by the process<br>
690     osl_File_E_NFILE too many open files in the system<br>
691     osl_File_E_DQUOT quota exceeded<br>
692     osl_File_E_EXIST file exists<br>
693     osl_FilE_E_INTR function call was interrupted<br>
694     osl_File_E_IO on I/O errors<br>
695     osl_File_E_MULTIHOP multihop attempted<br>
696     osl_File_E_NOLINK link has been severed<br>
697     osl_File_E_EOVERFLOW value too large for defined data type<br>
698 
699     @see osl_closeFile()
700     @see osl_setFilePos()
701     @see osl_getFilePos()
702     @see osl_readFile()
703     @see osl_writeFile()
704     @see osl_setFileSize()
705     @see osl_getFileSize()
706 */
707 
708 oslFileError SAL_CALL osl_openFile( rtl_uString *pustrFileURL, oslFileHandle *pHandle, sal_uInt32 uFlags );
709 
710 #define osl_Pos_Absolut 1
711 #define osl_Pos_Current 2
712 #define osl_Pos_End     3
713 
714 /** Set the internal position pointer of an open file.
715 
716     @param Handle [in]
717     Handle to a file received by a previous call to osl_openFile().
718 
719     @param uHow [in]
720     Distance to move the internal position pointer (from uPos).
721 
722     @param uPos [in]
723     Absolute position from the beginning of the file.
724 
725     @return
726     osl_File_E_None on success<br>
727     osl_File_E_INVAL the format of the parameters was not valid<br>
728     osl_File_E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files<br>
729 
730     @see    osl_openFile()
731     @see    osl_getFilePos()
732 */
733 
734 oslFileError SAL_CALL osl_setFilePos( oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos );
735 
736 
737 /** Retrieve the current position of the internal pointer of an open file.
738 
739     @param Handle [in]
740     Handle to a file received by a previous call to osl_openFile().
741 
742     @param pPos [out]
743     On success receives the current position of the file pointer.
744 
745     @return
746     osl_File_E_None on success<br>
747     osl_File_E_INVAL the format of the parameters was not valid<br>
748     osl_File_E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files<br>
749 
750     @see osl_openFile()
751     @see osl_setFilePos()
752     @see osl_readFile()
753     @see osl_writeFile()
754 */
755 
756 oslFileError SAL_CALL osl_getFilePos( oslFileHandle Handle, sal_uInt64 *pPos );
757 
758 
759 /** Set the file size of an open file.
760 
761     Sets the file size of an open file. The file can be truncated or enlarged by the function.
762     The position of the file pointer is not affeced by this function.
763 
764     @param Handle [in]
765     Handle to a file received by a previous call to osl_openFile().
766 
767     @param uSize [in]
768     New size in bytes.
769 
770     @return
771     osl_File_E_None on success<br>
772     osl_File_E_INVAL the format of the parameters was not valid<br>
773     osl_File_E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files<br>
774 
775     @see osl_openFile()
776     @see osl_setFilePos()
777     @see osl_getFileStatus()
778     @see osl_getFileSize()
779 */
780 
781 oslFileError SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize );
782 
783 
784 /** Get the file size of an open file.
785 
786     Gets the file size of an open file.
787     The position of the file pointer is not affeced by this function.
788 
789     @param Handle [in]
790     Handle to a file received by a previous call to osl_openFile().
791 
792     @param pSize [out]
793     Current size in bytes.
794 
795     @return
796     osl_File_E_None on success<br>
797     osl_File_E_INVAL the format of the parameters was not valid<br>
798     osl_File_E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files<br>
799 
800     @see osl_openFile()
801     @see osl_setFilePos()
802     @see osl_getFileStatus()
803 */
804 
805 oslFileError SAL_CALL osl_getFileSize( oslFileHandle Handle, sal_uInt64 *pSize );
806 
807 
808 /** Map flags.
809 
810     @since UDK 3.2.10
811  */
812 #define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1))
813 
814 /** Map flag denoting that the mapped address space will be accessed by the
815     process soon (and it is advantageous for the operating system to already
816     start paging in the data).
817 
818     @since UDK 3.2.12
819  */
820 #define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2))
821 
822 /** Map a shared file into memory.
823 
824     @since UDK 3.2.10
825  */
826 oslFileError
827 SAL_CALL osl_mapFile (
828   oslFileHandle Handle,
829   void**        ppAddr,
830   sal_uInt64    uLength,
831   sal_uInt64    uOffset,
832   sal_uInt32    uFlags
833 );
834 
835 
836 /** Unmap a shared file from memory.
837 
838     @since UDK 3.2.10
839  */
840 oslFileError
841 SAL_CALL osl_unmapFile (
842   void*      pAddr,
843   sal_uInt64 uLength
844 );
845 
846 
847 /** Read a number of bytes from a file.
848 
849     Reads a number of bytes from a file. The internal file pointer is
850     increased by the number of bytes read.
851 
852     @param Handle [in]
853     Handle to a file received by a previous call to osl_openFile().
854 
855     @param pBuffer [out]
856     Points to a buffer which receives data. The buffer must be large enough
857     to hold uBytesRequested bytes.
858 
859     @param uBytesRequested [in]
860     Number of bytes which should be retrieved.
861 
862     @param pBytesRead [out]
863     On success the number of bytes which have actually been retrieved.
864 
865     @return
866     osl_File_E_None on success<br>
867     osl_File_E_INVAL the format of the parameters was not valid<br>
868     osl_File_E_INTR function call was interrupted<br>
869     osl_File_E_IO on I/O errors<br>
870     osl_File_E_ISDIR is a directory<br>
871     osl_File_E_BADF bad file<br>
872     osl_File_E_FAULT bad address<br>
873     osl_File_E_AGAIN operation would block<br>
874     osl_File_E_NOLINK link has been severed<br>
875 
876     @see osl_openFile()
877     @see osl_writeFile()
878     @see osl_readLine()
879     @see osl_setFilePos()
880 */
881 
882 oslFileError SAL_CALL osl_readFile( oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead );
883 
884 
885 /** Test if the end of a file is reached.
886 
887     @param Handle [in]
888     Handle to a file received by a previous call to osl_openFile().
889 
890     @param pIsEOF [out]
891     Points to a variable that receives the end-of-file status.
892 
893     @return
894     osl_File_E_None on success <br>
895     osl_File_E_INVAL the format of the parameters was not valid<br>
896     osl_File_E_INTR function call was interrupted<br>
897     osl_File_E_IO on I/O errors<br>
898     osl_File_E_ISDIR is a directory<br>
899     osl_File_E_BADF bad file<br>
900     osl_File_E_FAULT bad address<br>
901     osl_File_E_AGAIN operation would block<br>
902     osl_File_E_NOLINK link has been severed<p>
903 
904     @see osl_openFile()
905     @see osl_readFile()
906     @see osl_readLine()
907     @see osl_setFilePos()
908 */
909 
910 oslFileError SAL_CALL osl_isEndOfFile( oslFileHandle Handle, sal_Bool *pIsEOF );
911 
912 
913 /** Write a number of bytes to a file.
914 
915     Writes a number of bytes to a file.
916     The internal file pointer is increased by the number of bytes read.
917 
918     @param Handle [in]
919     Handle to a file received by a previous call to osl_openFile().
920 
921     @param pBuffer [in]
922     Points to a buffer which contains the data.
923 
924     @param uBytesToWrite [in]
925     Number of bytes which should be written.
926 
927     @param pBytesWritten [out]
928     On success the number of bytes which have actually been written.
929 
930     @return
931     osl_File_E_None on success<br>
932     osl_File_E_INVAL the format of the parameters was not valid<br>
933     osl_File_E_FBIG file too large<br>
934     osl_File_E_DQUOT quota exceeded<p>
935     osl_File_E_AGAIN operation would block<br>
936     osl_File_E_BADF bad file<br>
937     osl_File_E_FAULT bad address<br>
938     osl_File_E_INTR function call was interrupted<br>
939     osl_File_E_IO on I/O errosr<br>
940     osl_File_E_NOLCK no record locks available<br>
941     osl_File_E_NOLINK link has been severed<br>
942     osl_File_E_NOSPC no space left on device<br>
943     osl_File_E_NXIO no such device or address<br>
944 
945     @see osl_openFile()
946     @see osl_readFile()
947     @see osl_setFilePos()
948 */
949 
950 oslFileError SAL_CALL osl_writeFile( oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten );
951 
952 /** Read a number of bytes from a specified offset in a file.
953 
954     The current position of the internal file pointer may or may not be changed.
955 
956     @since UDK 3.2.10
957  */
958 oslFileError SAL_CALL osl_readFileAt(
959   oslFileHandle Handle,
960   sal_uInt64    uOffset,
961   void*         pBuffer,
962   sal_uInt64    uBytesRequested,
963   sal_uInt64*   pBytesRead
964 );
965 
966 
967 /** Write a number of bytes to a specified offset in a file.
968 
969     The current position of the internal file pointer may or may not be changed.
970 
971     @since UDK 3.2.10
972  */
973 oslFileError SAL_CALL osl_writeFileAt(
974   oslFileHandle Handle,
975   sal_uInt64    uOffset,
976   const void*   pBuffer,
977   sal_uInt64    uBytesToWrite,
978   sal_uInt64*   pBytesWritten
979 );
980 
981 
982 /** Read a line from a file.
983 
984     Reads a line from a file. The new line delimiter is NOT returned!
985 
986     @param Handle [in]
987     Handle to a file received by a previous call to osl_openFile().
988 
989     @param  ppSequence [in/out]
990     A pointer pointer to a sal_Sequence that will hold the line read on success.
991 
992     @return
993     osl_File_E_None on success<br>
994     osl_File_E_INVAL the format of the parameters was not valid<br>
995     osl_File_E_INTR function call was interrupted<br>
996     osl_File_E_IO on I/O errors<br>
997     osl_File_E_ISDIR is a directory<br>
998     osl_File_E_BADF bad file<br>
999     osl_File_E_FAULT bad address<br>
1000     osl_File_E_AGAIN operation would block<br>
1001     osl_File_E_NOLINK link has been severed<p>
1002 
1003     @see osl_openFile()
1004     @see osl_readFile()
1005     @see osl_writeFile()
1006     @see osl_setFilePos()
1007 */
1008 
1009 oslFileError SAL_CALL osl_readLine( oslFileHandle Handle, sal_Sequence** ppSequence );
1010 
1011 /** Synchronize the memory representation of a file with that on the physical medium.
1012 
1013      The function ensures that all modified data and attributes of the file associated with
1014      the given file handle have been written to the physical medium.
1015      In case the hard disk has a write cache enabled, the data may not really be on
1016      permanent storage when osl_syncFile returns.
1017 
1018       @param Handle
1019       [in] Handle to a file received by a previous call to osl_openFile().
1020 
1021       @return
1022       <dl>
1023       <dt>osl_File_E_None</dt>
1024       <dd>On success</dd>
1025       <dt>osl_File_E_INVAL</dt>
1026       <dd>The value of the input parameter is invalid</dd>
1027       </dl>
1028       <br><p><strong>In addition to these error codes others may occur as well, for instance:</strong></p><br>
1029       <dl>
1030       <dt>osl_File_E_BADF</dt>
1031       <dd>The file associated with the given file handle is not open for writing</dd>
1032       <dt>osl_File_E_IO</dt>
1033       <dd>An I/O error occurred</dd>
1034       <dt>osl_File_E_NOSPC</dt>
1035       <dd>There is no enough space on the target device</dd>
1036       <dt>osl_File_E_ROFS</dt>
1037       <dd>The file associated with the given file handle is located on a read only file system</dd>
1038       <dt>osl_File_E_TIMEDOUT</dt>
1039       <dd>A remote connection timed out. This may happen when a file is on a remote location</dd>
1040       </dl>
1041 
1042       @see osl_openFile()
1043       @see osl_writeFile()
1044 */
1045 oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle);
1046 
1047 /** Close an open file.
1048 
1049     @param Handle [in]
1050     Handle to a file received by a previous call to osl_openFile().
1051 
1052     @return
1053     osl_File_E_None on success<br>
1054     osl_File_E_INVAL the format of the parameters was not valid<br>
1055     osl_File_E_BADF Bad file<br>
1056     osl_File_E_INTR function call was interrupted<br>
1057     osl_File_E_NOLINK link has been severed<br>
1058     osl_File_E_NOSPC no space left on device<br>
1059     osl_File_E_IO on I/O errors<br>
1060 
1061     @see osl_openFile()
1062 */
1063 
1064 oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
1065 
1066 
1067 /** Create a directory.
1068 
1069     @param pustrDirectoryURL [in]
1070     Full qualified URL of the directory to create.
1071 
1072     @return
1073     osl_File_E_None on success<br>
1074     osl_File_E_INVAL the format of the parameters was not valid<br>
1075     osl_File_E_NOMEM not enough memory for allocating structures <br>
1076     osl_File_E_EXIST file exists<br>
1077     osl_File_E_ACCES permission denied<br>
1078     osl_File_E_NAMETOOLONG file name too long<br>
1079     osl_File_E_NOENT no such file or directory<br>
1080     osl_File_E_NOTDIR not a directory<br>
1081     osl_File_E_ROFS read-only file system<br>
1082     osl_File_E_NOSPC no space left on device<br>
1083     osl_File_E_DQUOT quota exceeded<br>
1084     osl_File_E_LOOP too many symbolic links encountered<br>
1085     osl_File_E_FAULT bad address<br>
1086     osl_FileE_IO on I/O errors<br>
1087     osl_File_E_MLINK too many links<br>
1088     osl_File_E_MULTIHOP multihop attempted<br>
1089     osl_File_E_NOLINK link has been severed<br>
1090 
1091     @see osl_removeDirectory()
1092 */
1093 
1094 oslFileError SAL_CALL osl_createDirectory( rtl_uString* pustrDirectoryURL );
1095 
1096 
1097 /** Remove an empty directory.
1098 
1099     @param pustrDirectoryURL [in]
1100     Full qualified URL of the directory.
1101 
1102     @return
1103     osl_File_E_None on success<br>
1104     osl_File_E_INVAL the format of the parameters was not valid<br>
1105     osl_File_E_NOMEM not enough memory for allocating structures <br>
1106     osl_File_E_PERM operation not permitted<br>
1107     osl_File_E_ACCES permission denied<br>
1108     osl_File_E_NOENT no such file or directory<br>
1109     osl_File_E_NOTDIR not a directory<br>
1110     osl_File_E_NOTEMPTY directory not empty<br>
1111     osl_File_E_FAULT bad address<br>
1112     osl_File_E_NAMETOOLONG file name too long<br>
1113     osl_File_E_BUSY device or resource busy<br>
1114     osl_File_E_ROFS read-only file system<br>
1115     osl_File_E_LOOP too many symbolic links encountered<br>
1116     osl_File_E_BUSY device or resource busy<br>
1117     osl_File_E_EXIST file exists<br>
1118     osl_File_E_IO on I/O errors<br>
1119     osl_File_E_MULTIHOP multihop attempted<br>
1120     osl_File_E_NOLINK link has been severed<br>
1121 
1122     @see osl_createDirectory()
1123 */
1124 
1125 oslFileError SAL_CALL osl_removeDirectory( rtl_uString* pustrDirectoryURL );
1126 
1127 /** Function pointer representing a function that will be called by osl_createDirectoryPath
1128     if a directory has been created.
1129 
1130     To avoid unpredictable results the callee must not access the directory whose
1131     creation is just notified.
1132 
1133     @param pData
1134     [in] User specified data given in osl_createDirectoryPath.
1135 
1136     @param aDirectoryUrl
1137     [in] The absolute file URL of the directory that was just created by
1138     osl_createDirectoryPath.
1139 
1140     @see osl_createDirectoryPath
1141 */
1142 typedef void (SAL_CALL *oslDirectoryCreationCallbackFunc)(void* pData, rtl_uString* aDirectoryUrl);
1143 
1144 /** Create a directory path.
1145 
1146     The osl_createDirectoryPath function creates a specified directory path.
1147     All nonexisting sub directories will be created.
1148     <p><strong>PLEASE NOTE:</strong> You cannot rely on getting the error code
1149     osl_File_E_EXIST for existing directories. Programming against this error
1150     code is in general a strong indication of a wrong usage of osl_createDirectoryPath.</p>
1151 
1152     @param aDirectoryUrl
1153     [in] The absolute file URL of the directory path to create.
1154     A relative file URL will not be accepted.
1155 
1156     @param aDirectoryCreationFunc
1157     [in] Pointer to a function that will be called synchronously
1158     for each sub directory that was created. The value of this
1159     parameter may be NULL, in this case notifications will not be
1160     sent.
1161 
1162     @param pData
1163     [in] User specified data to be passed to the directory creation
1164     callback function. The value of this parameter may be arbitrary
1165     and will not be interpreted by osl_createDirectoryPath.
1166 
1167     @return
1168     <dl>
1169     <dt>osl_File_E_None</dt>
1170     <dd>On success</dd>
1171     <dt>osl_File_E_INVAL</dt>
1172     <dd>The format of the parameters was not valid</dd>
1173     <dt>osl_File_E_ACCES</dt>
1174     <dd>Permission denied</dd>
1175     <dt>osl_File_E_EXIST</dt>
1176     <dd>The final node of the specified directory path already exist</dd>
1177     <dt>osl_File_E_NAMETOOLONG</dt>
1178     <dd>The name of the specified directory path exceeds the maximum allowed length</dd>
1179     <dt>osl_File_E_NOTDIR</dt>
1180     <dd>A component of the specified directory path already exist as file in any part of the directory path</dd>
1181     <dt>osl_File_E_ROFS</dt>
1182     <dd>Read-only file system</dd>
1183     <dt>osl_File_E_NOSPC</dt>
1184     <dd>No space left on device</dd>
1185     <dt>osl_File_E_DQUOT</dt>
1186     <dd>Quota exceeded</dd>
1187     <dt>osl_File_E_FAULT</dt>
1188     <dd>Bad address</dd>
1189     <dt>osl_File_E_IO</dt>
1190     <dd>I/O error</dd>
1191     <dt>osl_File_E_LOOP</dt>
1192     <dd>Too many symbolic links encountered</dd>
1193     <dt>osl_File_E_NOLINK</dt>
1194     <dd>Link has been severed</dd>
1195     <dt>osl_File_E_invalidError</dt>
1196     <dd>An unknown error occurred</dd>
1197     </dl>
1198 
1199     @see oslDirectoryCreationFunc
1200     @see oslFileError
1201     @see osl_createDirectory
1202 */
1203 oslFileError SAL_CALL osl_createDirectoryPath(
1204     rtl_uString* aDirectoryUrl,
1205     oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc,
1206     void* pData);
1207 
1208 /** Remove a regular file.
1209 
1210     @param pustrFileURL [in]
1211     Full qualified URL of the file to remove.
1212 
1213     @return
1214     osl_File_E_None on success<br>
1215     osl_File_E_INVAL the format of the parameters was not valid<br>
1216     osl_File_E_NOMEM not enough memory for allocating structures <br>
1217     osl_File_E_ACCES permission denied<br>
1218     osl_File_E_PERM operation not permitted<br>
1219     osl_File_E_NAMETOOLONG file name too long<br>
1220     osl_File_E_NOENT no such file or directory<br>
1221     osl_File_E_ISDIR is a directory<br>
1222     osl_File_E_ROFS read-only file system<br>
1223     osl_File_E_FAULT bad address<br>
1224     osl_File_E_LOOP too many symbolic links encountered<br>
1225     osl_File_E_IO on I/O errors<br>
1226     osl_File_E_BUSY device or resource busy<br>
1227     osl_File_E_INTR function call was interrupted<br>
1228     osl_File_E_LOOP too many symbolic links encountered<br>
1229     osl_File_E_MULTIHOP multihop attempted<br>
1230     osl_File_E_NOLINK link has been severed<br>
1231     osl_File_E_TXTBSY text file busy<br>
1232 
1233     @see osl_openFile()
1234 */
1235 
1236 oslFileError SAL_CALL osl_removeFile( rtl_uString* pustrFileURL );
1237 
1238 
1239 /** Copy a file to a new destination.
1240 
1241     Copies a file to a new destination. Copies only files not directories.
1242     No assumptions should be made about preserving attributes or file time.
1243 
1244     @param pustrSourceFileURL [in]
1245     Full qualified URL of the source file.
1246 
1247     @param pustrDestFileURL [in]
1248     Full qualified URL of the destination file. A directory is NOT a valid destination file!
1249 
1250     @return
1251     osl_File_E_None on success<br>
1252     osl_File_E_INVAL the format of the parameters was not valid<br>
1253     osl_File_E_NOMEM not enough memory for allocating structures <br>
1254     osl_File_E_ACCES permission denied<br>
1255     osl_File_E_PERM operation not permitted<br>
1256     osl_File_E_NAMETOOLONG file name too long<br>
1257     osl_File_E_NOENT no such file or directory<br>
1258     osl_File_E_ISDIR is a directory<br>
1259     osl_File_E_ROFS read-only file system<p>
1260 
1261     @see    osl_moveFile()
1262     @see    osl_removeFile()
1263 */
1264 
1265 oslFileError SAL_CALL osl_copyFile( rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
1266 
1267 
1268 /** Move a file or directory to a new destination or renames it.
1269 
1270     Moves a file or directory to a new destination or renames it.
1271     File time and attributes are preserved.
1272 
1273     @param pustrSourceFileURL [in]
1274     Full qualified URL of the source file.
1275 
1276     @param pustrDestFileURL [in]
1277     Full qualified URL of the destination file. An existing directory is NOT a valid destination !
1278 
1279     @return
1280     osl_File_E_None on success<br>
1281     osl_File_E_INVAL the format of the parameters was not valid<br>
1282     osl_File_E_NOMEM not enough memory for allocating structures <br>
1283     osl_File_E_ACCES permission denied<br>
1284     osl_File_E_PERM operation not permitted<br>
1285     osl_File_E_NAMETOOLONG file name too long<br>
1286     osl_File_E_NOENT no such file or directory<br>
1287     osl_File_E_ROFS read-only file system<br>
1288 
1289     @see osl_copyFile()
1290 */
1291 
1292 oslFileError SAL_CALL osl_moveFile( rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
1293 
1294 
1295 /** Determine a valid unused canonical name for a requested name.
1296 
1297     Determines a valid unused canonical name for a requested name.
1298     Depending on the Operating System and the File System the illegal characters are replaced by valid ones.
1299     If a file or directory with the requested name already exists a new name is generated following
1300     the common rules on the actual Operating System and File System.
1301 
1302     @param pustrRequestedURL [in]
1303     Requested name of a file or directory.
1304 
1305     @param ppustrValidURL [out]
1306     On success receives a name which is unused and valid on the actual Operating System and
1307     File System.
1308 
1309     @return
1310     osl_File_E_None on success<br>
1311     osl_File_E_INVAL the format of the parameters was not valid<br>
1312 
1313     @see osl_getFileStatus()
1314 */
1315 
1316 oslFileError SAL_CALL osl_getCanonicalName( rtl_uString *pustrRequestedURL, rtl_uString **ppustrValidURL);
1317 
1318 
1319 /** Convert a path relative to a given directory into an full qualified file URL.
1320 
1321     Convert a path relative to a given directory into an full qualified file URL.
1322     The function resolves symbolic links if possible and path ellipses, so on success
1323     the resulting absolute path is fully resolved.
1324 
1325     @param pustrBaseDirectoryURL [in]
1326     Base directory URL to which the relative path is related to.
1327 
1328     @param pustrRelativeFileURL [in]
1329     An URL of a file or directory relative to the directory path specified by pustrBaseDirectoryURL
1330     or an absolute path.
1331     If pustrRelativeFileURL denotes an absolute path pustrBaseDirectoryURL will be ignored.
1332 
1333     @param ppustrAbsoluteFileURL [out]
1334     On success it receives the full qualified absoulte file URL.
1335 
1336     @return
1337     osl_File_E_None on success<br>
1338     osl_File_E_INVAL the format of the parameters was not valid<br>
1339     osl_File_E_NOMEM not enough memory for allocating structures <br>
1340     osl_File_E_NOTDIR not a directory<br>
1341     osl_File_E_ACCES permission denied<br>
1342     osl_File_E_NOENT no such file or directory<br>
1343     osl_File_E_NAMETOOLONG file name too long<br>
1344     osl_File_E_OVERFLOW value too large for defined data type<br>
1345     osl_File_E_FAULT bad address<br>
1346     osl_File_E_INTR function call was interrupted<br>
1347     osl_File_E_LOOP too many symbolic links encountered<br>
1348     osl_File_E_MULTIHOP multihop attempted<br>
1349     osl_File_E_NOLINK link has been severed<br>
1350 
1351     @see    osl_getFileStatus()
1352 */
1353 
1354 oslFileError SAL_CALL osl_getAbsoluteFileURL(
1355     rtl_uString* pustrBaseDirectoryURL,
1356     rtl_uString *pustrRelativeFileURL,
1357     rtl_uString **ppustrAbsoluteFileURL );
1358 
1359 
1360 /** Convert a system dependend path into a file URL.
1361 
1362     @param pustrSystemPath [in]
1363     A System dependent path of a file or directory.
1364 
1365     @param ppustrFileURL [out]
1366     On success it receives the file URL.
1367 
1368     @return
1369     osl_File_E_None on success<br>
1370     osl_File_E_INVAL the format of the parameters was not valid<br>
1371 
1372     @see osl_getSystemPathFromFileURL()
1373 */
1374 
1375 oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *pustrSystemPath, rtl_uString **ppustrFileURL);
1376 
1377 
1378 /** Searche a full qualified system path or a file URL.
1379 
1380     @param pustrFileName [in]
1381     A system dependent path, a file URL, a file or relative directory.
1382 
1383     @param pustrSearchPath [in]
1384     A list of system paths, in which a given file has to be searched. The Notation of a path list is
1385     system dependend, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH".
1386     These paths are only for the search of a file or a relative path, otherwise it will be ignored.
1387     If pustrSearchPath is NULL or while using the search path the search failed, the function searches for
1388     a matching file in all system directories and in the directories listed in the PATH environment
1389     variable.
1390     The value of an environment variable should be used (e.g. LD_LIBRARY_PATH) if the caller is not
1391     aware of the Operating System and so doesn't know which path list delimiter to use.
1392 
1393     @param ppustrFileURL [out]
1394     On success it receives the full qualified file URL.
1395 
1396     @return
1397     osl_File_E_None on success<br>
1398     osl_File_E_INVAL the format of the parameters was not valid<br>
1399     osl_File_E_NOTDIR not a directory<br>
1400     osl_File_E_NOENT no such file or directory not found<br>
1401 
1402     @see osl_getFileURLFromSystemPath()
1403     @see osl_getSystemPathFromFileURL()
1404 */
1405 
1406 oslFileError SAL_CALL osl_searchFileURL( rtl_uString *pustrFileName, rtl_uString *pustrSearchPath, rtl_uString **ppustrFileURL );
1407 
1408 
1409 /** Convert a file URL into a system dependend path.
1410 
1411     @param pustrFileURL [in]
1412     A File URL.
1413 
1414     @param ppustrSystemPath [out]
1415     On success it receives the system path.
1416 
1417     @return
1418     osl_File_E_None on success
1419     osl_File_E_INVAL the format of the parameters was not valid
1420 
1421     @see osl_getFileURLFromSystemPath()
1422 */
1423 
1424 oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *pustrFileURL, rtl_uString **ppustrSystemPath);
1425 
1426 
1427 /** Function pointer representing the function called back from osl_abbreviateSystemPath
1428 
1429     @param ustrText [in]
1430     Text to calculate the width for
1431 
1432     @return
1433     The width of the text specified by ustrText, e.g. it can return the width in pixel
1434     or the width in character count.
1435 
1436     @see osl_abbreviateSystemPath()
1437 */
1438 
1439 typedef sal_uInt32 (SAL_CALL *oslCalcTextWidthFunc)( rtl_uString *ustrText );
1440 
1441 
1442 /** Abbreviate a system notation path.
1443 
1444     @param ustrSystemPath [in]
1445     The full system path to abbreviate
1446 
1447     @param pustrCompacted [out]
1448     Receives the compacted system path on output
1449 
1450     @param pfnCalcWidth [in]
1451     Function ptr that calculates the width of a string. Can be zero.
1452 
1453     @param uMaxWidth [in]
1454     Maximum width allowed that is retunrned from pfnCalcWidth.
1455     If pfnCalcWidth is zero the character count is assumed as width.
1456 
1457     @return
1458     osl_File_E_None on success<br>
1459 
1460     @see    oslCalcTextWidthFunc
1461 */
1462 
1463 oslFileError SAL_CALL osl_abbreviateSystemPath(
1464     rtl_uString *ustrSystemPath,
1465     rtl_uString **pustrCompacted,
1466     sal_uInt32 uMaxWidth,
1467     oslCalcTextWidthFunc pCalcWidth );
1468 
1469 
1470 /** Set file attributes.
1471 
1472     @param pustrFileURL [in]
1473     The full qualified file URL.
1474 
1475     @param uAttributes [in]
1476     Attributes of the file to be set.
1477 
1478     @return
1479     osl_File_E_None on success<br>
1480     osl_File_E_INVAL the format of the parameters was not valid<br>
1481 
1482     @see osl_getFileStatus()
1483 */
1484 
1485 oslFileError SAL_CALL osl_setFileAttributes( rtl_uString *pustrFileURL, sal_uInt64 uAttributes );
1486 
1487 
1488 /** Set the file time.
1489 
1490     @param pustrFileURL [in]
1491     The full qualified URL of the file.
1492 
1493     @param aCreationTime [in]
1494     Creation time of the given file.
1495 
1496     @param aLastAccessTime [in]
1497     Time of the last access of the given file.
1498 
1499     @param aLastWriteTime [in]
1500     Time of the last modifying of the given file.
1501 
1502     @return
1503     osl_File_E_None on success<br>
1504     osl_File_E_INVAL the format of the parameters was not valid<br>
1505     osl_File_E_NOENT no such file or directory not found<br>
1506 
1507     @see osl_getFileStatus()
1508 */
1509 
1510 oslFileError SAL_CALL osl_setFileTime(
1511     rtl_uString *pustrFileURL,
1512     const TimeValue *aCreationTime,
1513     const TimeValue *aLastAccessTime,
1514     const TimeValue *aLastWriteTime);
1515 
1516 
1517 /** Retrieves the file URL of the system's temporary directory path
1518 
1519     @param pustrTempDirURL[out]
1520     On success receives the URL of system's temporary directory path.
1521 
1522     @return
1523     osl_File_E_None on success
1524     osl_File_E_NOENT no such file or directory not found
1525 */
1526 
1527 oslFileError SAL_CALL osl_getTempDirURL( rtl_uString **pustrTempDirURL );
1528 
1529 
1530 /** Creates a temporary file in the directory provided by the caller or the
1531     directory returned by osl_getTempDirURL.
1532 
1533     Creates a temporary file in the directory provided by the caller or the
1534     directory returned by osl_getTempDirURL.
1535     Under UNIX Operating Systems the file will be created with read and write
1536     access for the user exclusively.
1537     If the caller requests only a handle to the open file but not the name of
1538     it, the file will be automatically removed on close else the caller is
1539     responsible for removing the file on success.
1540 
1541     @param  pustrDirectoryURL [in]
1542     Specifies the full qualified URL where the temporary file should be created.
1543     If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
1544 
1545     @param  pHandle [out]
1546     On success receives a handle to the open file. If pHandle is 0 the file will
1547     be closed on return, in this case ppustrTempFileURL must not be 0.
1548 
1549     @param  ppustrTempFileURL [out]
1550     On success receives the full qualified URL of the temporary file.
1551     If ppustrTempFileURL is 0 the file will be automatically removed on close,
1552     in this case pHandle must not be 0.
1553     If ppustrTempFileURL is not 0 the caller receives the name of the created
1554     file and is responsible for removing the file, in this case
1555     *ppustrTempFileURL must be 0 or must point to a valid rtl_uString.
1556 
1557     @descr
1558     Description of the different pHandle, ppustrTempFileURL parameter combinations.
1559     pHandle is 0 and ppustrTempDirURL is 0 - this combination is invalid
1560     pHandle is not 0 and ppustrTempDirURL is 0 - a handle to the open file
1561     will be returned on success and the file will be automatically removed on close.
1562     pHandle is 0 and ppustrTempDirURL is not 0 - the name of the file will be returned,
1563     the caller is responsible for opening, closing and removing the file.
1564     pHandle is not 0 and ppustrTempDirURL is not 0 - a handle to the open file as well as
1565     the file name will be returned, the caller is responsible for closing and removing
1566     the file.
1567 
1568     @return
1569     osl_File_E_None   on success
1570     osl_File_E_INVAL  the format of the parameter is invalid
1571     osl_File_E_NOMEM  not enough memory for allocating structures
1572     osl_File_E_ACCES  Permission denied
1573     osl_File_E_NOENT  No such file or directory
1574     osl_File_E_NOTDIR Not a directory
1575     osl_File_E_ROFS   Read-only file system
1576     osl_File_E_NOSPC  No space left on device
1577     osl_File_E_DQUOT  Quota exceeded
1578 
1579     @see    osl_getTempDirURL()
1580 */
1581 
1582 oslFileError SAL_CALL osl_createTempFile(
1583     rtl_uString*   pustrDirectoryURL,
1584     oslFileHandle* pHandle,
1585     rtl_uString**  ppustrTempFileURL);
1586 
1587 #ifdef __cplusplus
1588 }
1589 #endif
1590 
1591 #endif  /* _OSL_FILE_H_ */
1592 
1593 
1594