[coop] Add missing coop checks for WFSO and WFMO.
[mono.git] / mono / metadata / file-io.h
index b3f8b9f48f5455a159edebc29a148525ce1f1224..fc7f9e1231b4b0fd41df143c8b887a0930ab22fc 100644 (file)
@@ -6,6 +6,7 @@
  *     Dan Lewis (dihlewis@yahoo.co.uk)
  *
  * (C) 2001 Ximian, Inc.
+ * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
  */
 
 #ifndef _MONO_METADATA_FILEIO_H_
@@ -16,6 +17,9 @@
 
 #include <mono/metadata/object-internals.h>
 #include <mono/io-layer/io-layer.h>
+#include <mono/utils/mono-compiler.h>
+
+G_BEGIN_DECLS
 
 /* This is a copy of System.IO.FileAccess */
 typedef enum {
@@ -39,9 +43,22 @@ typedef enum {
        FileShare_None=0x0,
        FileShare_Read=0x01,
        FileShare_Write=0x02,
-       FileShare_ReadWrite=FileShare_Read|FileShare_Write
+       FileShare_ReadWrite=FileShare_Read|FileShare_Write,
+       FileShare_Delete=0x04
 } MonoFileShare;
 
+/* This is a copy of System.IO.FileOptions */
+typedef enum {
+       FileOptions_None = 0,
+       FileOptions_Temporary = 1,              // Internal.   See note in System.IO.FileOptions
+       FileOptions_Encrypted = 0x4000,
+       FileOptions_DeleteOnClose = 0x4000000,
+       FileOptions_SequentialScan = 0x8000000,
+       FileOptions_RandomAccess = 0x10000000,
+       FileOptions_Asynchronous = 0x40000000,
+       FileOptions_WriteThrough = 0x80000000
+} MonoFileOptions;
+
 /* This is a copy of System.IO.SeekOrigin */
 typedef enum {
        SeekOrigin_Begin=0,
@@ -51,7 +68,6 @@ typedef enum {
 
 /* This is a copy of System.IO.MonoIOStat */
 typedef struct _MonoIOStat {
-       MonoString *name;
        gint32 attributes;
        gint64 length;
        gint64 creation_time;
@@ -77,7 +93,7 @@ typedef enum {
        FileAttributes_Encrypted=0x04000,
        FileAttributes_MonoExecutable= (int) 0x80000000
 } MonoFileAttributes;
-
+/* This is not used anymore
 typedef struct _MonoFSAsyncResult {
        MonoObject obj;
        MonoObject *state;
@@ -94,7 +110,7 @@ typedef struct _MonoFSAsyncResult {
        gint bytes_read;
        MonoDelegate *real_cb;
 } MonoFSAsyncResult;
-
+*/
 /* System.IO.MonoIO */
 
 extern MonoBoolean
@@ -103,16 +119,23 @@ ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error);
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error);
 
-extern HANDLE 
-ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path, MonoIOStat *stat,
-                                         gint32 *error);
+MonoArray *
+ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
+                                                MonoString *path_with_pattern,
+                                                gint mask, gint attrs,
+                                                gint32 *error);
 
-extern MonoBoolean
-ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat,
-                                        gint32 *error);
+extern MonoString *
+ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
+                                     MonoString *path_with_pattern,
+                                     gint32 *result_mask,
+                                     gint32 *error,
+                                     gpointer *handle);
+extern MonoString *
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error);
 
-extern MonoBoolean
-ves_icall_System_IO_MonoIO_FindClose (HANDLE find, gint32 *error);
+extern int
+ves_icall_System_IO_MonoIO_FindClose (gpointer handle);
 
 extern MonoString *
 ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error);
@@ -148,8 +171,8 @@ ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
 
 extern HANDLE 
 ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
-                                gint32 access_mode, gint32 share,
-                                MonoBoolean async, gint32 *error);
+                                gint32 access_mode, gint32 share, gint32 options,
+                                gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error);
@@ -196,6 +219,10 @@ extern MonoBoolean
 ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
                                       HANDLE *write_handle);
 
+extern MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, 
+                                               HANDLE source_handle, HANDLE target_process_handle, HANDLE *target_handle, 
+                                               gint32 access, gint32 inherit, gint32 options);
+
 extern gunichar2 
 ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void);
 
@@ -219,4 +246,17 @@ extern void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
 extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
                                               gint64 length, gint32 *error);
 
+extern MonoBoolean
+ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
+                                       MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
+                                       gint32 *error);
+
+extern gint64
+mono_filesize_from_path (MonoString *path);
+
+extern gint64
+mono_filesize_from_fd (int fd);
+
+G_END_DECLS
+
 #endif /* _MONO_METADATA_FILEIO_H_ */