diff options
author | Christoph Hellwig <hch@lst.de> | 2023-12-11 17:37:22 +0100 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2023-12-18 14:57:48 +0100 |
commit | e634be8f18a0f01867f9651fd53f8b2431675d19 (patch) | |
tree | 684ce842ad123d6a8f9d2f0bdb21f536a23f6324 | |
parent | 74c77adf5d377dc0fdbb32d6c40f1d17724fc044 (diff) | |
download | xfsprogs-dev-e634be8f18a0f01867f9651fd53f8b2431675d19.tar.gz |
libxfs/frog: remove latform_find{raw,block}path
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>
-rw-r--r-- | libfrog/linux.c | 12 | ||||
-rw-r--r-- | libfrog/platform.h | 2 | ||||
-rw-r--r-- | libxfs/init.c | 42 |
3 files changed, 14 insertions, 42 deletions
diff --git a/libfrog/linux.c b/libfrog/linux.c index 0d9bd355fc..2e4fd316e7 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 0aef318a81..e3e6b7c71b 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 a8603e2fb3..9cfd20e3fb 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 |