public UnixDriveInfo (string mountPoint)
		{
			if (mountPoint == null)
				throw new ArgumentNullException ("mountPoint");
			fstab = Syscall.getfsfile (mountPoint);
			if (fstab == null)
				throw new ArgumentException ("mountPoint isn't valid: " + mountPoint);
			// throws ArgumentException if driveName isn't valid
			// though .NET also has a DriveNotFoundException class, so maybe that's
			// more appropriate?
		}
Пример #2
0
		public static Fstab getfsspec (string special_file)
		{
			_Fstab fsbuf;
			int r;
			lock (fstab_lock) {
				r = sys_getfsspec (special_file, out fsbuf);
			}
			if (r != 0)
				return null;
			Fstab fs = new Fstab ();
			CopyFstab (fs, ref fsbuf);
			return fs;
		}
Пример #3
0
		public static Fstab getfsfile (string mount_point)
		{
			_Fstab fsbuf;
			int r;
			lock (fstab_lock) {
				r = sys_getfsfile (mount_point, out fsbuf);
			}
			if (r != 0)
				return null;
			Fstab fs = new Fstab ();
			CopyFstab (fs, ref fsbuf);
			return fs;
		}
Пример #4
0
		public static Fstab getfsent ()
		{
			_Fstab fsbuf;
			int r;
			lock (fstab_lock) {
				r = sys_getfsent (out fsbuf);
			}
			if (r != 0)
				return null;
			Fstab fs = new Fstab ();
			CopyFstab (fs, ref fsbuf);
			return fs;
		}
Пример #5
0
		private static void CopyFstab (Fstab to, ref _Fstab from)
		{
			try {
				to.fs_spec     = UnixMarshal.PtrToString (from.fs_spec);
				to.fs_file     = UnixMarshal.PtrToString (from.fs_file);
				to.fs_vfstype  = UnixMarshal.PtrToString (from.fs_vfstype);
				to.fs_mntops   = UnixMarshal.PtrToString (from.fs_mntops);
				to.fs_type     = UnixMarshal.PtrToString (from.fs_type);
				to.fs_freq     = from.fs_freq;
				to.fs_passno   = from.fs_passno;
			}
			finally {
				Stdlib.free (from._fs_buf_);
				from._fs_buf_ = IntPtr.Zero;
			}
		}
		private UnixDriveInfo (Fstab fstab)
		{
			this.fstab = fstab;
		}