0

I have to test the given folder path is a mount point or it is in local to my system with c code.

I read on net that /etc/mtab file have entry for mounted point. I can check that file but is their any system call or any function to check mount point.

My kernel version is 2.6.28.10.

Abhitesh khatri
  • 2,911
  • 3
  • 20
  • 29

2 Answers2

0

On linux, getmntent() is suitable for parsing /etc/mtab.

user3303729
  • 284
  • 1
  • 6
0

These functions can be used for data structure access the mtab file:

FILE * setmntent(const char *file, const char *mode)

int endmntent (FILE *stream)

struct mntent * getmntent (FILE *stream)

struct mntent * getmntent_r (FILE *stream, struct mentent *result, char *buffer, int bufsize)

int addmntent (FILE *stream, const struct mntent *mnt)

char * hasmntopt (const struct mntent *mnt, const char *opt)

For more details about these functions refer the man page.

Q_SaD
  • 355
  • 1
  • 11