diff options
author | Matthew Macy <[email protected]> | 2019-10-02 10:39:48 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-02 10:39:48 -0700 |
commit | d31277abb1db51dece836dd47628ca42c07e528c (patch) | |
tree | b2635f2c39d2315d21af445522203dffbae57851 /cmd/zinject | |
parent | 6360e2779e47f4bf2233071b427ad522eca9bdd4 (diff) |
OpenZFS restructuring - libspl
Factor Linux specific pieces out of libspl.
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Sean Eric Fagan <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9336
Diffstat (limited to 'cmd/zinject')
-rw-r--r-- | cmd/zinject/Makefile.am | 4 | ||||
-rw-r--r-- | cmd/zinject/translate.c | 32 |
2 files changed, 1 insertions, 35 deletions
diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index ab7f4de12..71b48255e 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -1,9 +1,5 @@ include $(top_srcdir)/config/Rules.am -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/libspl/include - sbin_PROGRAMS = zinject zinject_SOURCES = \ diff --git a/cmd/zinject/translate.c b/cmd/zinject/translate.c index d4795d071..8542d37c5 100644 --- a/cmd/zinject/translate.c +++ b/cmd/zinject/translate.c @@ -85,8 +85,6 @@ parse_pathname(const char *inpath, char *dataset, char *relpath, struct stat64 *statbuf) { struct extmnttab mp; - FILE *fp; - int match; const char *rel; char fullpath[MAXPATHLEN]; @@ -99,35 +97,7 @@ parse_pathname(const char *inpath, char *dataset, char *relpath, return (-1); } - if (strlen(fullpath) >= MAXPATHLEN) { - (void) fprintf(stderr, "invalid object; pathname too long\n"); - return (-1); - } - - if (stat64(fullpath, statbuf) != 0) { - (void) fprintf(stderr, "cannot open '%s': %s\n", - fullpath, strerror(errno)); - return (-1); - } - -#ifdef HAVE_SETMNTENT - if ((fp = setmntent(MNTTAB, "r")) == NULL) { -#else - if ((fp = fopen(MNTTAB, "r")) == NULL) { -#endif - (void) fprintf(stderr, "cannot open %s\n", MNTTAB); - return (-1); - } - - match = 0; - while (getextmntent(fp, &mp, sizeof (mp)) == 0) { - if (makedev(mp.mnt_major, mp.mnt_minor) == statbuf->st_dev) { - match = 1; - break; - } - } - - if (!match) { + if (getextmntent(fullpath, &mp, statbuf) != 0) { (void) fprintf(stderr, "cannot find mountpoint for '%s'\n", fullpath); return (-1); |