1 /* mkomfs.c - Create an OMFS filesystem
14 #include "create_fs.h"
18 int main(int argc
, char *argv
[])
24 fs_config_t config
= {
34 c
= getopt(argc
, argv
, "b:c:x");
41 config
.block_size
= atoi(optarg
);
44 config
.cluster_size
= atoi(optarg
);
52 if (argc
- optind
< 1)
54 fprintf(stderr
, "Usage: %s [options] <device>\n", argv
[0]);
60 if (!get_disk_size(dev
, &size
))
62 fprintf(stderr
, "Could not get size of disk %s\n",
67 printf("Creating a new fs on dev %s (%lld blks)\n", dev
, size
/512);
69 printf("Warning: this could kill some important data; Are you sure? ");
75 fp
= fopen(dev
, "r+");
82 create_fs(fp
, size
/512, &config
);