delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/12/15:50:59

X-Spam-Check-By: sourceware.org
Message-ID: <46BF64BB.40301@x-ray.at>
Date: Sun, 12 Aug 2007 21:51:23 +0200
From: Reini Urban <rurban AT x-ray DOT at>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4
MIME-Version: 1.0
To: Cygwin List <cygwin AT cygwin DOT com>
Subject: mount API in next perl
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I'm just writing some mount API functions for the next perl-5.10.0, 
which will probably be out in September.
Maybe someone wants to comment.
BTW: A /proc/mounts fhandler would be fine sooner or later. No big deal, 
but I'll get no allowance from my new company to write such a patch.


Cygwin::mount_table()

Returns an array of [mnt_dir, mnt_fsname, mnt_type, mnt_opts].

Note: The cygwin setmntent()/getmntent() iterator ignores its arguments, 
there's no /etc/fstab, /etc/mtab.

$ ./perl -e 'for $i (Cygwin::mount_table) {
              print join " ",@$i; print "\n";}'
/bin f:\cygwin\bin system binmode,cygexec
/usr/bin f:\cygwin\bin system binmode
/usr/lib f:\cygwin\lib system binmode
/ f:\cygwin system binmode
/texttest e:\tmp user textmode
/cygdrive/c c: system binmode,noumount
/cygdrive/d d: system binmode,noumount
/cygdrive/e e: system binmode,noumount

Note: I don't want to return a hash here. This goes to CORE.

Cygwin::mount_flags(mnt_dir)

Returns the mount type and flags for a specified mount point.
A comma-seperated string of mntent->mnt_type (always
"system" or "user"), then the mntent->mnt_opts, where
the first is always "binmode" or "textmode".
 
system|user,binmode|textmode,exec,cygexec,cygdrive,mixed,notexec,managed,nosuid,devfs,proc,noumount

If the argument is "/cygdrive", just the volume mount settings are 
returned.

User mounts override system mounts.

$ ./perl -e 'print Cygwin::mount_flags "/bin"'
system,binmode,cygexec
$ ./perl -e 'print Cygwin::mount_flags "/cygdrive"' 
     binmode,cygdrive


Cygwin::win_to_posix_path  pathname, [absolute]

Translates a Windows path to the corresponding cygwin path respecting
the current mount points. With a second non-null argument returns an
absolute path. Double-byte characters will not be translated.

Cygwin::posix_to_win_path pathname, [absolute]

Translates a cygwin path to the corresponding cygwin path respecting
the current mount points. With a second non-null argument returns an
absolute path. Double-byte characters will not be translated.

Cygwin::is_binmount pathname

Returns true if the given cygwin path is binary mounted, false if the
path is mounted in textmode.

Cygwin::is_textmount pathname

Returns true if the given cygwin path is mounted in textmode ("\r\n" => 
"\n"),
false if the path is mounted binary. The result is complementary to 
Cygwin::is_binmount()

-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019