|
|
903fa7 |
commit 0d5b21adc867da3c738474ec2bcd1cfa625f8bb6
|
|
|
903fa7 |
Author: Andrew Price <anprice@redhat.com>
|
|
|
903fa7 |
Date: Sat Nov 16 02:21:36 2013 -0600
|
|
|
903fa7 |
|
|
|
903fa7 |
libgfs2: Remove is_pathname_mounted
|
|
|
903fa7 |
|
|
|
903fa7 |
All callers are now using lgfs2_open_mnt* instead.
|
|
|
903fa7 |
|
|
|
903fa7 |
Resolves: bz#991204
|
|
|
903fa7 |
|
|
|
903fa7 |
Signed-off-by: Andrew Price <anprice@redhat.com>
|
|
|
903fa7 |
|
|
|
903fa7 |
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
|
|
|
903fa7 |
index 3e5d09c..e785017 100644
|
|
|
903fa7 |
--- a/gfs2/libgfs2/libgfs2.h
|
|
|
903fa7 |
+++ b/gfs2/libgfs2/libgfs2.h
|
|
|
903fa7 |
@@ -715,7 +715,6 @@ extern int metafs_interrupted;
|
|
|
903fa7 |
extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
|
|
|
903fa7 |
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
|
|
|
903fa7 |
extern int compute_constants(struct gfs2_sbd *sdp);
|
|
|
903fa7 |
-extern int is_pathname_mounted(char *path_name, char *device_name, int *ro_mount);
|
|
|
903fa7 |
extern int lgfs2_open_mnt(const char *path, int dirflags, int *dirfd, int devflags, int *devfd, struct mntent **mnt);
|
|
|
903fa7 |
extern int lgfs2_open_mnt_dev(const char *path, int flags, struct mntent **mnt);
|
|
|
903fa7 |
extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
|
|
|
903fa7 |
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
|
|
|
903fa7 |
index 195b983..c4ed722 100644
|
|
|
903fa7 |
--- a/gfs2/libgfs2/misc.c
|
|
|
903fa7 |
+++ b/gfs2/libgfs2/misc.c
|
|
|
903fa7 |
@@ -102,67 +102,6 @@ int compute_constants(struct gfs2_sbd *sdp)
|
|
|
903fa7 |
return 0;
|
|
|
903fa7 |
}
|
|
|
903fa7 |
|
|
|
903fa7 |
-int is_pathname_mounted(char *path_name, char *device_name, int *ro_mount)
|
|
|
903fa7 |
-{
|
|
|
903fa7 |
- FILE *fp;
|
|
|
903fa7 |
- struct mntent *mnt;
|
|
|
903fa7 |
- dev_t file_dev=0, file_rdev=0;
|
|
|
903fa7 |
- ino_t file_ino=0;
|
|
|
903fa7 |
- struct stat st_buf;
|
|
|
903fa7 |
-
|
|
|
903fa7 |
- *ro_mount = 0;
|
|
|
903fa7 |
- if ((fp = setmntent("/proc/mounts", "r")) == NULL) {
|
|
|
903fa7 |
- perror("open: /proc/mounts");
|
|
|
903fa7 |
- return 0;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- if (stat(path_name, &st_buf) == 0) {
|
|
|
903fa7 |
- if (S_ISBLK(st_buf.st_mode)) {
|
|
|
903fa7 |
-#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
|
|
|
903fa7 |
- file_rdev = st_buf.st_rdev;
|
|
|
903fa7 |
-#endif /* __GNU__ */
|
|
|
903fa7 |
- } else {
|
|
|
903fa7 |
- file_dev = st_buf.st_dev;
|
|
|
903fa7 |
- file_ino = st_buf.st_ino;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- while ((mnt = getmntent (fp)) != NULL) {
|
|
|
903fa7 |
- /* Check if they specified the device instead of mnt point */
|
|
|
903fa7 |
- if (strcmp(device_name, mnt->mnt_fsname) == 0) {
|
|
|
903fa7 |
- strcpy(path_name, mnt->mnt_dir); /* fix it */
|
|
|
903fa7 |
- break;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- if (strcmp(path_name, mnt->mnt_dir) == 0) {
|
|
|
903fa7 |
- strcpy(device_name, mnt->mnt_fsname); /* fix it */
|
|
|
903fa7 |
- break;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- if (stat(mnt->mnt_fsname, &st_buf) == 0) {
|
|
|
903fa7 |
- if (S_ISBLK(st_buf.st_mode)) {
|
|
|
903fa7 |
-#ifndef __GNU__
|
|
|
903fa7 |
- if (file_rdev && (file_rdev == st_buf.st_rdev))
|
|
|
903fa7 |
- break;
|
|
|
903fa7 |
-#endif /* __GNU__ */
|
|
|
903fa7 |
- } else {
|
|
|
903fa7 |
- if (file_dev && ((file_dev == st_buf.st_dev) &&
|
|
|
903fa7 |
- (file_ino == st_buf.st_ino)))
|
|
|
903fa7 |
- break;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- endmntent (fp);
|
|
|
903fa7 |
- if (mnt == NULL)
|
|
|
903fa7 |
- return 0;
|
|
|
903fa7 |
- if (stat(mnt->mnt_dir, &st_buf) < 0) {
|
|
|
903fa7 |
- if (errno == ENOENT)
|
|
|
903fa7 |
- return 0;
|
|
|
903fa7 |
- }
|
|
|
903fa7 |
- /* Can't trust fstype because / has "rootfs". */
|
|
|
903fa7 |
- if (file_rdev && (st_buf.st_dev != file_rdev))
|
|
|
903fa7 |
- return 0;
|
|
|
903fa7 |
- if (hasmntopt(mnt, MNTOPT_RO))
|
|
|
903fa7 |
- *ro_mount = 1;
|
|
|
903fa7 |
- return 1; /* mounted */
|
|
|
903fa7 |
-}
|
|
|
903fa7 |
-
|
|
|
903fa7 |
/* Returns 0 if fd1 and fd2 refer to the same device/file, 1 otherwise, or -1 on error */
|
|
|
903fa7 |
static int fdcmp(int fd1, int fd2)
|
|
|
903fa7 |
{
|