Click here to Skip to main content
15,911,707 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Win Api
C++
BOOL WINAPI GetVolumeInformation(
  _In_opt_   LPCTSTR lpRootPathName,
  _Out_opt_  LPTSTR lpVolumeNameBuffer,
  _In_       DWORD nVolumeNameSize,
  _Out_opt_  LPDWORD lpVolumeSerialNumber,
  _Out_opt_  LPDWORD lpMaximumComponentLength,
  _Out_opt_  LPDWORD lpFileSystemFlags,
  _Out_opt_  LPTSTR lpFileSystemNameBuffer,
  _In_       DWORD nFileSystemNameSize
);

Hello: I want to port windows api GetVolumeInformation to Linux.

Q1:Does Linux have the same function.
Q2:if not.
Q2.1 what is lpVolumeNameBuffer in linux(is /dev/sda1)? how can i get it in linux?
Q2.2 what is lpVolumeSerialNumber in linux(is )? i use ioctl get it.
C++
struct hd_driveid id;
ioctl(fd, HDIO_GET_IDENTITY, &id);

Q2.3 what is lpMaximumComponentLength in linux? how can i get it in linux?
Q2.4 what is lpFileSystemFlags in linux? how can i get it in linux?
Q2.5 what is lpFileSystemNameBuffer? how can i get it in linux?

If you have any good ideas I would really appreciate it.

Thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 3-Jul-13 9:10am    
Sorry, I don't know exact answers at the moment and don't want to search the APIs, as you can do it yourself.
I only have one advice: if you know some function on Windows, stop looking for something similar in Linux. The systems have a lot in common (mostly because they always borrowed ideas) but still are very different. At first, approach Linux separately and learn it to certain extent; this way should be easier overall.
—SA
Lucky_Girl 4-Jul-13 3:16am    
HI :i have the idear .i find linux api statfs.It can get what i want.

But I have another question : How can i get linux disk label with c function or linux api.Not use command.

Thanks!

This is not so easy in Linux.

Please see: http://stackoverflow.com/questions/9178360/getting-disk-label-in-linux-in-c-c[^].

Pay attention for the advice so use C++ and Boost.Filesystem, referenced.

—SA
 
Share this answer
 
you better ask that question in a linux forum. Here are at most M$-guys...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900