aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2003-01-23 21:32:56 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2003-01-23 21:32:56 +0000
commitd934deeff98d3d201cf2a3a015fdd447019762cc (patch)
tree6eb6853728a2a0d0fab5107f2f3030b022c1a9a9 /lib
parente0c2da42ecff6f4cfa4c677fa99b3b30ff7ffe5e (diff)
downloadsrc-d934deeff98d3d201cf2a3a015fdd447019762cc.tar.gz
src-d934deeff98d3d201cf2a3a015fdd447019762cc.zip
API to fillout a blank disk. For e.g. newfs.
Notes
Notes: svn path=/head/; revision=109755
Diffstat (limited to 'lib')
-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 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
@@ -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;
}