]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs/frog: remove latform_find{raw,block}path
authorChristoph Hellwig <hch@lst.de>
Mon, 11 Dec 2023 16:37:22 +0000 (17:37 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 18 Dec 2023 13:57:48 +0000 (14:57 +0100)
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@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libfrog/linux.c
libfrog/platform.h
libxfs/init.c

index 0d9bd355fc36012d0e809c491f887a214f9eb6e3..2e4fd316e75cb59e0b928dd57f61d6c02fe64e70 100644 (file)
@@ -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)
 {
index 0aef318a81eeaea046a727608b99d35d294744b7..e3e6b7c71b780a7dbe777467277c01a83ca4a6b9 100644 (file)
@@ -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 */
index a8603e2fb330656d6a47ba475e4a126573c5a153..9cfd20e3fb5a8137c3d8c9b0b28a79a1dd0ad100 100644 (file)
@@ -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