* Syscall.cs: The Statvfs structure should contain a MountFlags enumeration,
authorJonathan Pryor <jpryor@novell.com>
Thu, 12 May 2005 20:40:47 +0000 (20:40 -0000)
committerJonathan Pryor <jpryor@novell.com>
Thu, 12 May 2005 20:40:47 +0000 (20:40 -0000)
    not a ulong (we can "safely" do this since POSIX defines some values for
    f_flag, so we should be kind and expose them).
  * UnixConvert.cs: Add MountFlags conversion functions.

svn path=/trunk/mcs/; revision=44466

mcs/class/Mono.Posix/Mono.Unix/ChangeLog
mcs/class/Mono.Posix/Mono.Unix/Syscall.cs
mcs/class/Mono.Posix/Mono.Unix/UnixConvert.cs

index ecd3a7f2f4b4a443378c9c49554f104a77084f99..34ec5cb9f12fa8d7d9153e4b26cf01e0d3966e30 100644 (file)
@@ -1,3 +1,10 @@
+2005-05-12  Jonathan Pryor <jonpryor@vt.edu>
+
+       * Syscall.cs: The Statvfs structure should contain a MountFlags enumeration,
+         not a ulong (we can "safely" do this since POSIX defines some values for
+         f_flag, so we should be kind and expose them).
+       * UnixConvert.cs: Add MountFlags conversion functions.
+
 2005-05-02  Joe Shaw  <joeshaw@novell.com>
 
        * UnixListener.cs (Init): Remove the call to Cleanup() and the
index bc5317eaeb7a30204b05857486642ad4ae366dc1..feaa7b37d5786d5f1163cc8076cd670feeb33904 100644 (file)
@@ -620,6 +620,20 @@ namespace Mono.Unix {
                XATTR_REPLACE = 2,
        }
 
+       [Map][Flags]
+       public enum MountFlags : ulong {
+               ST_RDONLY      =    1,  // Mount read-only
+               ST_NOSUID      =    2,  // Ignore suid and sgid bits
+               ST_NODEV       =    4,  // Disallow access to device special files
+               ST_SYNCHRONOUS =   16,  // Writes are synced at once
+               ST_MANDLOCK    =   64,  // Allow mandatory locks on an FS
+               ST_WRITE       =  128,  // Write on file/directory/symlink
+               ST_APPEND      =  256,  // Append-only file
+               ST_IMMUTABLE   =  512,  // Immutable file
+               ST_NOATIME     = 1024,  // Do not update access times
+               ST_NODIRATIME  = 2048,  // Do not update directory access times
+       }
+
        #endregion
 
        #region Structures
@@ -666,7 +680,7 @@ namespace Mono.Unix {
                public /* fsfilcnt_t */ ulong f_ffree;    // # free inodes
                public /* fsfilcnt_t */ ulong f_favail;   // # free inodes for non-root
                public                  ulong f_fsid;     // file system id
-               public                  ulong f_flag;     // mount flags
+               public MountFlags             f_flag;     // mount flags
                public                  ulong f_namemax;  // maximum filename length
        }
 
index 18405eb8bccd916e30c3be1d60224a969bf209c6..3831331f0cf5265e87a4450baf487e6bae4682ab 100644 (file)
@@ -695,6 +695,38 @@ namespace Mono.Unix {
                        return rval;
                }
 
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMountFlags")]
+               private static extern int FromMountFlags (MountFlags value, out UInt64 rval);
+
+               public static bool TryFromMountFlags (MountFlags value, out UInt64 rval)
+               {
+                       return FromMountFlags (value, out rval) == 0;
+               }
+
+               public static UInt64 FromMountFlags (MountFlags value)
+               {
+                       UInt64 rval;
+                       if (FromMountFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMountFlags")]
+               private static extern int ToMountFlags (UInt64 value, out MountFlags rval);
+
+               public static bool TryToMountFlags (UInt64 value, out MountFlags rval)
+               {
+                       return ToMountFlags (value, out rval) == 0;
+               }
+
+               public static MountFlags ToMountFlags (UInt64 value)
+               {
+                       MountFlags rval;
+                       if (ToMountFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
                //
                // Non-generated exports
                //