From d934deeff98d3d201cf2a3a015fdd447019762cc Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Thu, 23 Jan 2003 21:32:56 +0000 Subject: API to fillout a blank disk. For e.g. newfs. --- lib/libufs/libufs.h | 1 + lib/libufs/type.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/libufs') diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h index 7f7f3361b233..34c2439d6701 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 4b8066ce2e3a..41eacfd6a977 100644 --- a/lib/libufs/type.c +++ b/lib/libufs/type.c @@ -110,6 +110,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; @@ -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; } -- cgit v1.2.3