jwstric2 Posted February 25, 2005 Report Share Posted February 25, 2005 I haven't had much luck concerning programming questions in this forum and definately don't get answers related to windows in the linux forum but I'll try again. Im looking for or perhaps my call is supported, that returns information about a mounted file system. Basically in other word I could return how much information is available on C:\The first bit determines a mount point for a given directory name while the second refreshes this mountpoint.Thanks in advance guysstatic char *find_mount_point (const char *file){ char saved_cwd[MAXFILEPATH]; static char mp[MAXFILEPATH]; struct stat last_stat; getcwd (saved_cwd, MAXFILEPATH); if (chdir (file) < 0){ log_message(LOG_ERROR, "Unable to change to dir/file %s\n", file); return NULL; } if (stat (".", &last_stat) < 0){ log_message(LOG_ERROR, "Unable to get stat for dir/file %s\n", file); goto done; } /* Now walk up FILE's parents until we find another filesystem or /, chdiring as we go. LAST_STAT holds stat information for the last place we visited. */ for (;;) { struct stat st; if (stat ("..", &st) < 0) goto done; if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) /* cwd is the mount point. */ break; if (chdir ("..") < 0) goto done; last_stat = st; } /* Finally reached a mount point, see what it's called. */ getcwd (mp, MAXFILEPATH);done: /* Restore the original cwd. */ { int save_errno = errno; chdir(saved_cwd); errno = save_errno; } return mp;}void refreshMount(struct userMount *mount){ struct statfs s; if (statfs(mount->mountPoint, &s) != 0) { log_message(LOG_ERROR, "Unable to get stats on mount %s : %s\n", mount->mountPoint, strerror(errno)); return; } mount->usedSize = (long long)((((long long)s.f_blocks) - s.f_bfree)* s.f_bsize); mount->freeSize = (long long)(((long long)s.f_bavail) * s.f_bsize); log_message(LOG_DEBUG, "Mount %s : used=%llu free=%llu\n", mount->mountPoint, mount->usedSize, mount->freeSize);} Quote Link to comment Share on other sites More sharing options...
draggin Posted February 25, 2005 Report Share Posted February 25, 2005 Not sure what langauge you are programming in but why not ask on a forum related to your programming langauge???Tim Quote Link to comment Share on other sites More sharing options...
jwstric2 Posted February 26, 2005 Author Report Share Posted February 26, 2005 Is there a place to get hold of windows header files which are presented in a somewhat organized fashion then. Even some of the posix calls, windows really seemed to have screwed up. And the language is Ansi C.ThanksJohn Quote Link to comment Share on other sites More sharing options...
trackrat Posted February 26, 2005 Report Share Posted February 26, 2005 Try posting in this forum.http://www.computing.net/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.