This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mount API in next perl


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]