diff --git a/stand/libsa/bzipfs.c b/stand/libsa/bzipfs.c --- a/stand/libsa/bzipfs.c +++ b/stand/libsa/bzipfs.c @@ -68,6 +68,7 @@ #ifndef REGRESSION struct fs_ops bzipfs_fsops = { .fs_name = "bzip", + .fs_flags = 0, .fo_open = bzf_open, .fo_close = bzf_close, .fo_read = bzf_read, diff --git a/stand/libsa/cd9660.c b/stand/libsa/cd9660.c --- a/stand/libsa/cd9660.c +++ b/stand/libsa/cd9660.c @@ -81,6 +81,7 @@ struct fs_ops cd9660_fsops = { .fs_name = "cd9660", + .fs_flags = 0, .fo_open = cd9660_open, .fo_close = cd9660_close, .fo_read = cd9660_read, diff --git a/stand/libsa/dosfs.c b/stand/libsa/dosfs.c --- a/stand/libsa/dosfs.c +++ b/stand/libsa/dosfs.c @@ -61,6 +61,7 @@ struct fs_ops dosfs_fsops = { .fs_name = "dosfs", + .fs_flags = 0, .fo_open = dos_open, .fo_close = dos_close, .fo_read = dos_read, diff --git a/stand/libsa/ext2fs.c b/stand/libsa/ext2fs.c --- a/stand/libsa/ext2fs.c +++ b/stand/libsa/ext2fs.c @@ -106,6 +106,7 @@ struct fs_ops ext2fs_fsops = { .fs_name = "ext2fs", + .fs_flags = 0, .fo_open = ext2fs_open, .fo_close = ext2fs_close, .fo_read = ext2fs_read, diff --git a/stand/libsa/gzipfs.c b/stand/libsa/gzipfs.c --- a/stand/libsa/gzipfs.c +++ b/stand/libsa/gzipfs.c @@ -50,6 +50,7 @@ struct fs_ops gzipfs_fsops = { .fs_name = "zip", + .fs_flags = 0, .fo_open = zf_open, .fo_close = zf_close, .fo_read = zf_read, diff --git a/stand/libsa/nfs.c b/stand/libsa/nfs.c --- a/stand/libsa/nfs.c +++ b/stand/libsa/nfs.c @@ -131,6 +131,7 @@ struct fs_ops nfs_fsops = { .fs_name = "nfs", + .fs_flags = 0, .fo_open = nfs_open, .fo_close = nfs_close, .fo_read = nfs_read, diff --git a/stand/libsa/open.c b/stand/libsa/open.c --- a/stand/libsa/open.c +++ b/stand/libsa/open.c @@ -154,27 +154,32 @@ f->f_devdata = NULL; file = NULL; + if (exclusive_file_system == NULL || + (exclusive_file_system->fs_flags & FS_OPS_NO_DEVOPEN) == 0) { + error = devopen(f, fname, &file); + if (error || + (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) + goto err; + + /* see if we opened a raw device; otherwise, 'file' is the file name. */ + if (file == NULL || *file == '\0') { + f->f_flags |= F_RAW; + f->f_rabuf = NULL; + TSEXIT(); + return (fd); + } + } else + file = fname; + if (exclusive_file_system != NULL) { + /* loader is forcing the filesystem to be used */ fs = exclusive_file_system; - error = (fs->fo_open)(fname, f); + error = (fs->fo_open)(file, f); if (error == 0) goto ok; goto err; } - error = devopen(f, fname, &file); - if (error || - (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) - goto err; - - /* see if we opened a raw device; otherwise, 'file' is the file name. */ - if (file == NULL || *file == '\0') { - f->f_flags |= F_RAW; - f->f_rabuf = NULL; - TSEXIT(); - return (fd); - } - /* pass file name to the different filesystem open routines */ besterror = ENOENT; for (i = 0; file_system[i] != NULL; i++) { diff --git a/stand/libsa/pkgfs.c b/stand/libsa/pkgfs.c --- a/stand/libsa/pkgfs.c +++ b/stand/libsa/pkgfs.c @@ -41,6 +41,7 @@ struct fs_ops pkgfs_fsops = { .fs_name = "pkg", + .fs_flags = FS_OPS_NO_DEVOPEN, .fo_open = pkg_open, .fo_close = pkg_close, .fo_read = pkg_read, diff --git a/stand/libsa/splitfs.c b/stand/libsa/splitfs.c --- a/stand/libsa/splitfs.c +++ b/stand/libsa/splitfs.c @@ -50,6 +50,7 @@ struct fs_ops splitfs_fsops = { .fs_name = "split", + .fs_flags = 0, .fo_open = splitfs_open, .fo_close = splitfs_close, .fo_read = splitfs_read, diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -94,6 +94,8 @@ struct open_file; +#define FS_OPS_NO_DEVOPEN 1 + /* * This structure is used to define file system operations in a file system * independent way. @@ -104,6 +106,7 @@ */ struct fs_ops { const char *fs_name; + int fs_flags; int (*fo_open)(const char *path, struct open_file *f); int (*fo_close)(struct open_file *f); int (*fo_read)(struct open_file *f, void *buf, diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -73,6 +73,7 @@ struct fs_ops tftp_fsops = { .fs_name = "tftp", + .fs_flags = 0, .fo_open = tftp_open, .fo_close = tftp_close, .fo_read = tftp_read, diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -93,6 +93,7 @@ struct fs_ops ufs_fsops = { .fs_name = "ufs", + .fs_flags = 0, .fo_open = ufs_open, .fo_close = ufs_close, .fo_read = ufs_read,