API to fillout a blank disk. For e.g. newfs.

This commit is contained in:
Juli Mallett 2003-01-23 21:32:56 +00:00
parent e0c2da42ec
commit d934deeff9
2 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -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;
}