btrfs-progs: print-tree: Remove btrfs_root parameter
[platform/upstream/btrfs-progs.git] / mkfs / rootdir.c
index a1d223a..ff00bb0 100644 (file)
@@ -249,7 +249,7 @@ static int add_xattr_item(struct btrfs_trans_handle *trans,
                cur_name_len = strlen(cur_name);
                next_location += cur_name_len + 1;
 
-               ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
+               ret = lgetxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
                if (ret < 0) {
                        if (errno == ENOTSUP)
                                return 0;
@@ -696,7 +696,7 @@ out:
 }
 
 static int ftw_add_entry_size(const char *fpath, const struct stat *st,
-                             int type)
+                             int type, struct FTW *ftwbuf)
 {
        /*
         * Failed to read the directory, mostly due to EPERM.  Abort ASAP, so
@@ -731,7 +731,12 @@ u64 btrfs_mkfs_size_dir(const char *dir_name, u32 sectorsize, u64 min_dev_size,
        fs_block_size = sectorsize;
        ftw_data_size = 0;
        ftw_meta_nr_inode = 0;
-       ret = ftw(dir_name, ftw_add_entry_size, 10);
+
+       /*
+        * Symbolic link is not followed when creating files, so no need to
+        * follow them here.
+        */
+       ret = nftw(dir_name, ftw_add_entry_size, 10, FTW_PHYS);
        if (ret < 0) {
                error("ftw subdir walk of %s failed: %s", dir_name,
                        strerror(errno));