summaryrefslogtreecommitdiffstats
path: root/lib/libufs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libufs')
-rw-r--r--lib/libufs/libufs.h1
-rw-r--r--lib/libufs/type.c17
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h
index 7f7f336..34c2439 100644
--- a/lib/libufs/libufs.h
+++ b/lib/libufs/libufs.h
@@ -129,6 +129,7 @@ struct uufsd *ufs_disk_ctor(const char *);
int ufs_disk_close(struct uufsd *);
void ufs_disk_dtor(struct uufsd **);
int ufs_disk_fillout(struct uufsd *, const char *);
+int ufs_disk_fillout_blank(struct uufsd *, const char *);
__END_DECLS
diff --git a/lib/libufs/type.c b/lib/libufs/type.c
index 4b8066c..41eacfd 100644
--- a/lib/libufs/type.c
+++ b/lib/libufs/type.c
@@ -111,6 +111,18 @@ ufs_disk_close(struct uufsd *disk)
int
ufs_disk_fillout(struct uufsd *disk, const char *name)
{
+ if (ufs_disk_fillout_blank(disk, name) == -1) {
+ return -1;
+ }
+ if (sbread(disk) == -1) {
+ ERROR(disk, "could not read superblock to fill out disk");
+ return -1;
+ }
+}
+
+int
+ufs_disk_fillout_blank(struct uufsd *disk, const char *name)
+{
struct stat st;
struct fstab *fs;
const char *oname;
@@ -161,10 +173,5 @@ again: if (stat(name, &st) < 0) {
}
disk->d_name = name;
- if (sbread(disk) == -1) {
- ERROR(disk, "could not read superblock to fill out disk");
- return -1;
- }
-
return 0;
}
OpenPOWER on IntegriCloud