473,242 Members | 1,601 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

Getting mount stats for filesystems

Hi, I am trying to find a way to figure out whether a certain remote
filesystem is mounted using tcp vs. udp in Python. I've looked at the
statvfs call and module but they don't give me anything useful (the
F_FLAGS field for both a tcp and a udp filesystem is the same.

I could, of course, get the output of mount and parse that but I would
prefer something more elegant.

Thanks for your help!

--
Mitko Haralanov mi***@qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com

==========================================
Remember, UNIX spelled backwards is XINU.
-- Mt.
Jun 5 '07 #1
7 2801
Mitko Haralanov schrieb:
Hi, I am trying to find a way to figure out whether a certain remote
filesystem is mounted using tcp vs. udp in Python. I've looked at the
statvfs call and module but they don't give me anything useful (the
F_FLAGS field for both a tcp and a udp filesystem is the same.

I could, of course, get the output of mount and parse that but I would
prefer something more elegant.
I'm not quite sure what you want to achieve. You are on machine B,
and you want to find out whether a remote file system (on machine A)
is mounted remotely (say, from machine C)?

How do you answer that question with mount(8)?

Also, what is a tcp filesystem?

Regards,
Martin
Jun 5 '07 #2
On Tue, 05 Jun 2007 09:19:08 +0200
"Martin v. Löwis" <ma****@v.loewis.dewrote:
I'm not quite sure what you want to achieve. You are on machine B,
and you want to find out whether a remote file system (on machine A)
is mounted remotely (say, from machine C)?
Ok, let me try to explain:

I am on machine A, which has a NFS mounted filesystem hosted on machine
B. All I need to find out is whether the NFS filesystem is mounted
using tcp or udp.

--
Mitko Haralanov mi***@qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com

==========================================
Paul: If rubbin' frozen dirt in your crotch is wrong, hey,
I don't wanna be right.
Jun 5 '07 #3
I am on machine A, which has a NFS mounted filesystem hosted on machine
B. All I need to find out is whether the NFS filesystem is mounted
using tcp or udp.
Ah, ok. I recommend to parse /proc/mounts.

Regards,
Martin
Jun 5 '07 #4
On Tue, 05 Jun 2007 20:14:01 +0200
"Martin v. Löwis" <ma****@v.loewis.dewrote:
Ah, ok. I recommend to parse /proc/mounts.
I was looking for something that reminded me less of Perl and more of C
but haven't been able to find such a method.

--
Mitko Haralanov mi***@qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com

==========================================
.... A booming voice says, "Wrong, cretin!", and you notice that you
have turned into a pile of dust.
Jun 5 '07 #5
Mitko Haralanov schrieb:
On Tue, 05 Jun 2007 20:14:01 +0200
"Martin v. Löwis" <ma****@v.loewis.dewrote:
>Ah, ok. I recommend to parse /proc/mounts.

I was looking for something that reminded me less of Perl and more of C
but haven't been able to find such a method.
You could try to invoke getmntent(3). I'm not aware of a Python wrapper
for it, so you either try to write one yourself in C, or use ctypes to
write it in Python.

Regards,
Martin
Jun 5 '07 #6
On Tue, 05 Jun 2007 21:32:21 +0200
"Martin v. Löwis" <ma****@v.loewis.dewrote:
You could try to invoke getmntent(3). I'm not aware of a Python wrapper
for it, so you either try to write one yourself in C, or use ctypes to
write it in Python.
I am looking at ctypes and it might do what I need but I can't figure
out a way to convert a Python File object to a C FILE pointer (which is
the needed argument for getmntent).

Any ideas?

--
Mitko Haralanov mi***@qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com

==========================================
Fry: That clover helped my rat-fink brother steal my dream of going
into space. Now I'll never get there.
Leela: You went there this morning for donuts.
Jun 5 '07 #7
I am looking at ctypes and it might do what I need but I can't figure
out a way to convert a Python File object to a C FILE pointer (which is
the needed argument for getmntent).

Any ideas?
I think you are supposed to pass the pointer to getmntent that you
obtained from setmntent (likely asking for read-only access).

Regards,
Martin
Jun 5 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dan glenn | last post by:
My client wants to see stats which tell him the number of hits he's getting from different countries. I'm coding page hit count stats myself in PHP on his site, which is simple enough, but haven't...
4
by: marklawford | last post by:
Not having earned my DBA badge from the scouts just yet I'm a little lost with an error I'm getting. We've just upgraded our development database from 7.2 to 8.2 as the first step in upgrading...
1
by: tkpmep | last post by:
I installed SciPy and NumPy (0.9.5, because 0.9.6 does not work with the current version of SciPy), and had some teething troubles. I looked around for help and observed that the tutorial is dated...
22
by: Dale Pennington | last post by:
I find myself in the odd situation of trying to determine the name of a file that has been opened somewhere else with an fopen call, so all I have is the FILE * from that fopen call. I perused my...
3
by: Terry Olsen | last post by:
My 5 year old has lots of games that require the CD be in the drive. I would like to come up with a program that will mount the .iso image to a virtual cd-rom drive and then run the game...
3
by: tguclu | last post by:
Hi there, I hope this is the right place for my question if not please accept my apologies. In my application I want to mount/umount file system. From GNU C Library Reference Manual, for...
3
by: m.smith_1999 | last post by:
Hello, I'm a student software developer. As a part of an excerise I'm doing I'm trying to build a program to create "mount files" and mount them. Something like Sarah Dean's OTFE but really...
1
Nepomuk
by: Nepomuk | last post by:
In most modern distributions of Linux and Unix (at least ones with graphical environments like KDE, Gnome or XFCE), you get to mount your partitions easily from the desktop. In some cases however, it...
12
by: tvnaidu | last post by:
Trying to mount windows folder on Linux machine, getting this error. I have a folder called "CheckIn" on windows, I made that folder as Network sharing. ON lInux, I tried to access that folder by...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.