aboutsummaryrefslogtreecommitdiffstats
path: root/dir-test.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-22 16:01:01 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-22 16:01:01 -0400
commit9fb549a6c1ccc19b2cf7e403aeed51688ff9aa7c (patch)
treed2c94add9b251cf0a6872008c99d0c99fbce7255 /dir-test.c
parent8a2c8123c5ee5b09f3b8265e5e6db2e687d29e99 (diff)
downloadbtrfs-progs-9fb549a6c1ccc19b2cf7e403aeed51688ff9aa7c.tar.gz
btrfs-progs-9fb549a6c1ccc19b2cf7e403aeed51688ff9aa7c.tar.xz
btrfs-progs-9fb549a6c1ccc19b2cf7e403aeed51688ff9aa7c.zip
mkfs and dir-test fixes
Diffstat (limited to 'dir-test.c')
-rw-r--r--dir-test.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/dir-test.c b/dir-test.c
index b673982..6117d22 100644
--- a/dir-test.c
+++ b/dir-test.c
@@ -1,6 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <unistd.h>
#include "kerncompat.h"
#include "radix-tree.h"
@@ -12,7 +14,7 @@
int keep_running = 1;
struct btrfs_super_block super;
-static u64 dir_oid = 44556;
+static u64 dir_oid = 0;
static u64 file_oid = 33778;
static int find_num(struct radix_tree_root *root, unsigned long *num_ret,
@@ -44,6 +46,7 @@ static void initial_inode_init(struct btrfs_root *root,
{
memset(inode_item, 0, sizeof(*inode_item));
btrfs_set_inode_generation(inode_item, root->fs_info->generation);
+ btrfs_set_inode_mode(inode_item, S_IFREG | 0700);
}
static int ins_one(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -425,13 +428,15 @@ int main(int ac, char **av)
struct btrfs_trans_handle *trans;
radix_tree_init();
- root = open_ctree("dbfile", &super);
+ root = open_ctree(av[ac-1], &super);
trans = btrfs_start_transaction(root, 1);
+ dir_oid = btrfs_super_root_dir(&super);
+
signal(SIGTERM, sigstopper);
signal(SIGINT, sigstopper);
- for (i = 1 ; i < ac ; i++) {
+ for (i = 1 ; i < ac - 1; i++) {
if (strcmp(av[i], "-i") == 0) {
initial_only = 1;
} else if (strcmp(av[i], "-c") == 0) {