12 #include "blocktree.h"
15 int main(int argc, char **argv)
26 fprintf(stderr, "usage; mkfs.vc DIR\n");
31 if((st = newfstore(argv[1])) == NULL)
36 memset(&dots, 0, sizeof(dots));
39 root.mode = S_IFDIR | 0755;
40 root.mtime = root.ctime = now;
47 strcpy(dots.name, ".");
48 if(btput(st, &root.data, 0, &dots, sizeof(dots) - sizeof(dots.name) + 2)) {
49 fprintf(stderr, "mkfs.vc: could not create root directory entries: %s\n", strerror(errno));
52 strcpy(dots.name, "..");
53 if(btput(st, &root.data, 1, &dots, sizeof(dots) - sizeof(dots.name) + 3)) {
54 fprintf(stderr, "mkfs.vc: could not create root directory entries: %s\n", strerror(errno));
60 if(btput(st, &frev.root, 0, &root, sizeof(root))) {
61 fprintf(stderr, "mkfs.vc: could not store root directory inode: %s\n", strerror(errno));
66 snprintf(tbuf, sizeof(tbuf), "%s/revs", argv[1]);
67 if((fd = open(tbuf, O_WRONLY | O_CREAT | O_EXCL, 0600)) < 0) {
68 fprintf(stderr, "mkfs.vc: could not create revision database: %s\n", strerror(errno));
71 if(writeall(fd, &frev, sizeof(frev), 0)) {
72 fprintf(stderr, "mkfs.vc: could not write initial revision: %s\n", strerror(errno));