aboutsummaryrefslogtreecommitdiff
path: root/mtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mtab.c')
-rw-r--r--mtab.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/mtab.c b/mtab.c
index b6304a174..e855717ce 100644
--- a/mtab.c
+++ b/mtab.c
@@ -59,48 +59,6 @@ erase_mtab(const char * name)
59 perror(mtab_file); 59 perror(mtab_file);
60} 60}
61 61
62/*
63 * Given a block device, find the mount table entry if that block device
64 * is mounted.
65 *
66 * Given any other file (or directory), find the mount table entry for its
67 * filesystem.
68 */
69static struct mntent *
70findMountPoint(const char * name, const char * table)
71{
72 struct stat s;
73 dev_t mountDevice;
74 FILE* mountTable;
75 struct mntent* mountEntry;
76
77 if ( stat(name, &s) != 0 )
78 return 0;
79
80 if ( (s.st_mode & S_IFMT) == S_IFBLK )
81 mountDevice = s.st_rdev;
82 else
83 mountDevice = s.st_dev;
84
85
86 if ( (mountTable = setmntent(table, "r")) == 0 )
87 return 0;
88
89 while ( (mountEntry = getmntent(mountTable)) != 0 ) {
90 if ( strcmp(name, mountEntry->mnt_dir) == 0 ||
91 strcmp(name, mountEntry->mnt_fsname) == 0 ) /* String match. */
92 break;
93 if ( stat(mountEntry->mnt_fsname, &s) == 0 &&
94 s.st_rdev == mountDevice ) /* Match the device. */
95 break;
96 if ( stat(mountEntry->mnt_dir, &s) == 0 &&
97 s.st_dev == mountDevice ) /* Match the directory's mount point. */
98 break;
99 }
100 endmntent(mountTable);
101 return mountEntry;
102}
103
104extern void 62extern void
105write_mtab(char* blockDevice, char* directory, 63write_mtab(char* blockDevice, char* directory,
106 char* filesystemType, long flags, char* string_flags) 64 char* filesystemType, long flags, char* string_flags)