#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"
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,
{
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,
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) {
btrfs_set_inode_size(&inode_item, 3);
btrfs_set_inode_nlink(&inode_item, 1);
btrfs_set_inode_nblocks(&inode_item, 1);
- btrfs_set_inode_mode(&inode_item, S_IFDIR | 0711);
+ btrfs_set_inode_mode(&inode_item, S_IFDIR | 0755);
btrfs_set_super_root_dir(&super, objectid);