[PATCH 03/23] libxfs/frog: remove latform_find{raw,block}path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stop pretending we try to distinguish between the legacy Unix raw and
block devices nodes.  Linux as the only currently support platform never
had them, but other modern Unix variants like FreeBSD also got rid of
this distinction years ago.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 libfrog/linux.c    | 12 ------------
 libfrog/platform.h |  2 --
 libxfs/init.c      | 42 ++++++++++++++----------------------------
 3 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 0d9bd355f..2e4fd316e 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -232,18 +232,6 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz)
 		max_block_alignment = *bsz;
 }
 
-char *
-platform_findrawpath(char *path)
-{
-	return path;
-}
-
-char *
-platform_findblockpath(char *path)
-{
-	return path;
-}
-
 int
 platform_direct_blockdev(void)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 0aef318a8..e3e6b7c71 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -13,8 +13,6 @@ int platform_check_iswritable(char *path, char *block, struct stat *sptr);
 int platform_set_blocksize(int fd, char *path, dev_t device, int bsz,
 		int fatal);
 int platform_flush_device(int fd, dev_t device);
-char *platform_findrawpath(char *path);
-char *platform_findblockpath(char *path);
 int platform_direct_blockdev(void);
 int platform_align_blockdev(void);
 unsigned long platform_physmem(void);	/* in kilobytes */
diff --git a/libxfs/init.c b/libxfs/init.c
index a8603e2fb..9cfd20e3f 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -197,7 +197,7 @@ libxfs_device_close(dev_t dev)
 }
 
 static int
-check_open(char *path, int flags, char **rawfile, char **blockfile)
+check_open(char *path, int flags)
 {
 	int readonly = (flags & LIBXFS_ISREADONLY);
 	int inactive = (flags & LIBXFS_ISINACTIVE);
@@ -208,22 +208,10 @@ check_open(char *path, int flags, char **rawfile, char **blockfile)
 		perror(path);
 		return 0;
 	}
-	if (!(*rawfile = platform_findrawpath(path))) {
-		fprintf(stderr, _("%s: "
-				  "can't find a character device matching %s\n"),
-			progname, path);
-		return 0;
-	}
-	if (!(*blockfile = platform_findblockpath(path))) {
-		fprintf(stderr, _("%s: "
-				  "can't find a block device matching %s\n"),
-			progname, path);
-		return 0;
-	}
-	if (!readonly && !inactive && platform_check_ismounted(path, *blockfile, NULL, 1))
+	if (!readonly && !inactive && platform_check_ismounted(path, path, NULL, 1))
 		return 0;
 
-	if (inactive && check_isactive(path, *blockfile, ((readonly|dangerously)?1:0)))
+	if (inactive && check_isactive(path, path, ((readonly|dangerously)?1:0)))
 		return 0;
 
 	return 1;
@@ -305,11 +293,9 @@ libxfs_close_devices(
 int
 libxfs_init(libxfs_init_t *a)
 {
-	char		*blockfile;
 	char		*dname;
 	int		fd;
 	char		*logname;
-	char		*rawfile;
 	char		*rtname;
 	int		rval = 0;
 	int		flags;
@@ -330,9 +316,9 @@ libxfs_init(libxfs_init_t *a)
 	radix_tree_init();
 
 	if (a->volname) {
-		if(!check_open(a->volname,flags,&rawfile,&blockfile))
+		if (!check_open(a->volname, flags))
 			goto done;
-		fd = open(rawfile, O_RDONLY);
+		fd = open(a->volname, O_RDONLY);
 		dname = a->dname = a->volname;
 		a->volname = NULL;
 	}
@@ -344,12 +330,12 @@ libxfs_init(libxfs_init_t *a)
 			platform_findsizes(dname, a->dfd, &a->dsize,
 					   &a->dbsize);
 		} else {
-			if (!check_open(dname, flags, &rawfile, &blockfile))
+			if (!check_open(dname, flags))
 				goto done;
-			a->ddev = libxfs_device_open(rawfile,
+			a->ddev = libxfs_device_open(dname,
 					a->dcreat, flags, a->setblksize);
 			a->dfd = libxfs_device_to_fd(a->ddev);
-			platform_findsizes(rawfile, a->dfd,
+			platform_findsizes(dname, a->dfd,
 					   &a->dsize, &a->dbsize);
 		}
 	} else
@@ -362,12 +348,12 @@ libxfs_init(libxfs_init_t *a)
 			platform_findsizes(dname, a->logfd, &a->logBBsize,
 					   &a->lbsize);
 		} else {
-			if (!check_open(logname, flags, &rawfile, &blockfile))
+			if (!check_open(logname, flags))
 				goto done;
-			a->logdev = libxfs_device_open(rawfile,
+			a->logdev = libxfs_device_open(logname,
 					a->lcreat, flags, a->setblksize);
 			a->logfd = libxfs_device_to_fd(a->logdev);
-			platform_findsizes(rawfile, a->logfd,
+			platform_findsizes(logname, a->logfd,
 					   &a->logBBsize, &a->lbsize);
 		}
 	} else
@@ -380,12 +366,12 @@ libxfs_init(libxfs_init_t *a)
 			platform_findsizes(dname, a->rtfd, &a->rtsize,
 					   &a->rtbsize);
 		} else {
-			if (!check_open(rtname, flags, &rawfile, &blockfile))
+			if (!check_open(rtname, flags))
 				goto done;
-			a->rtdev = libxfs_device_open(rawfile,
+			a->rtdev = libxfs_device_open(rtname,
 					a->rcreat, flags, a->setblksize);
 			a->rtfd = libxfs_device_to_fd(a->rtdev);
-			platform_findsizes(rawfile, a->rtfd,
+			platform_findsizes(rtname, a->rtfd,
 					   &a->rtsize, &a->rtbsize);
 		}
 	} else
-- 
2.39.2





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux