diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-22 10:04:04 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-22 10:04:04 +0100 |
commit | c9c14a198de1b44462184c03bc3f9be4848adfd8 (patch) | |
tree | 24a8a031b89da6af317bc8dd44c37a3e8ed3e0fe /meta/recipes-devtools/btrfs-tools | |
parent | e803c58ffb05e6d1f5938f1bfe6dfca9e3c26e02 (diff) | |
download | poky-c9c14a198de1b44462184c03bc3f9be4848adfd8.tar.gz |
Sync patches with DOS line endings that became corrupted
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/btrfs-tools')
-rw-r--r-- | meta/recipes-devtools/btrfs-tools/btrfs-tools/mkfs-xin-fixes.patch | 366 |
1 files changed, 183 insertions, 183 deletions
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/mkfs-xin-fixes.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/mkfs-xin-fixes.patch index 47fc97725a..847e870669 100644 --- a/meta/recipes-devtools/btrfs-tools/btrfs-tools/mkfs-xin-fixes.patch +++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/mkfs-xin-fixes.patch | |||
@@ -1,183 +1,183 @@ | |||
1 | Upstream-Status: Pending | 1 | Upstream-Status: Pending |
2 | 2 | ||
3 | This patch is made by xin.zhong@intel.com to implement these supported | 3 | This patch is made by xin.zhong@intel.com to implement these supported |
4 | features in mkfs.btrfs: | 4 | features in mkfs.btrfs: |
5 | * populate fs image from a directory while creating it | 5 | * populate fs image from a directory while creating it |
6 | * reduce minimum size of the created image from 256MB to around 24MB | 6 | * reduce minimum size of the created image from 256MB to around 24MB |
7 | * while creating image use the specified device name rather than output.img | 7 | * while creating image use the specified device name rather than output.img |
8 | 8 | ||
9 | Patch tested and incorporated in poky by: | 9 | Patch tested and incorporated in poky by: |
10 | Nitin A Kamble <nitin.a.kamble@intel.com> 2011/06/20 | 10 | Nitin A Kamble <nitin.a.kamble@intel.com> 2011/06/20 |
11 | 11 | ||
12 | diff --git a/file-item.c b/file-item.c | 12 | diff --git a/file-item.c b/file-item.c |
13 | index 9732282..aed42c3 100644 | 13 | index 9732282..aed42c3 100644 |
14 | --- a/file-item.c | 14 | --- a/file-item.c |
15 | +++ b/file-item.c | 15 | +++ b/file-item.c |
16 | @@ -193,7 +193,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, | 16 | @@ -193,7 +193,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, |
17 | struct btrfs_root *root, u64 alloc_end, | 17 | struct btrfs_root *root, u64 alloc_end, |
18 | u64 bytenr, char *data, size_t len) | 18 | u64 bytenr, char *data, size_t len) |
19 | { | 19 | { |
20 | - int ret; | 20 | - int ret; |
21 | + int ret = 0; | 21 | + int ret = 0; |
22 | struct btrfs_key file_key; | 22 | struct btrfs_key file_key; |
23 | struct btrfs_key found_key; | 23 | struct btrfs_key found_key; |
24 | u64 next_offset = (u64)-1; | 24 | u64 next_offset = (u64)-1; |
25 | diff --git a/mkfs.c b/mkfs.c | 25 | diff --git a/mkfs.c b/mkfs.c |
26 | index 57c88f9..e953a33 100644 | 26 | index 57c88f9..e953a33 100644 |
27 | --- a/mkfs.c | 27 | --- a/mkfs.c |
28 | +++ b/mkfs.c | 28 | +++ b/mkfs.c |
29 | @@ -36,7 +36,7 @@ | 29 | @@ -36,7 +36,7 @@ |
30 | #include <uuid/uuid.h> | 30 | #include <uuid/uuid.h> |
31 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | -#include <attr/xattr.h> | 33 | -#include <attr/xattr.h> |
34 | +#include <sys/xattr.h> | 34 | +#include <sys/xattr.h> |
35 | #include "kerncompat.h" | 35 | #include "kerncompat.h" |
36 | #include "ctree.h" | 36 | #include "ctree.h" |
37 | #include "disk-io.h" | 37 | #include "disk-io.h" |
38 | @@ -517,7 +517,6 @@ static int add_inode_items(struct btrfs_trans_handle *trans, | 38 | @@ -517,7 +517,6 @@ static int add_inode_items(struct btrfs_trans_handle *trans, |
39 | fail: | 39 | fail: |
40 | return ret; | 40 | return ret; |
41 | } | 41 | } |
42 | - | 42 | - |
43 | static int add_xattr_item(struct btrfs_trans_handle *trans, | 43 | static int add_xattr_item(struct btrfs_trans_handle *trans, |
44 | struct btrfs_root *root, u64 objectid, | 44 | struct btrfs_root *root, u64 objectid, |
45 | const char *file_name) | 45 | const char *file_name) |
46 | @@ -532,8 +531,10 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, | 46 | @@ -532,8 +531,10 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, |
47 | 47 | ||
48 | ret = llistxattr(file_name, xattr_list, XATTR_LIST_MAX); | 48 | ret = llistxattr(file_name, xattr_list, XATTR_LIST_MAX); |
49 | if (ret < 0) { | 49 | if (ret < 0) { |
50 | - fprintf(stderr, "get a list of xattr failed for %s\n", | 50 | - fprintf(stderr, "get a list of xattr failed for %s\n", |
51 | - file_name); | 51 | - file_name); |
52 | + if(errno == ENOTSUP) | 52 | + if(errno == ENOTSUP) |
53 | + return 0; | 53 | + return 0; |
54 | + fprintf(stderr, "get a list of xattr failed for %s errno %d\n", | 54 | + fprintf(stderr, "get a list of xattr failed for %s errno %d\n", |
55 | + file_name, errno); | 55 | + file_name, errno); |
56 | return ret; | 56 | return ret; |
57 | } | 57 | } |
58 | if (ret == 0) | 58 | if (ret == 0) |
59 | @@ -546,8 +547,11 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, | 59 | @@ -546,8 +547,11 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, |
60 | 60 | ||
61 | ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX); | 61 | ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX); |
62 | if (ret < 0) { | 62 | if (ret < 0) { |
63 | - fprintf(stderr, "get a xattr value failed for %s\n", | 63 | - fprintf(stderr, "get a xattr value failed for %s\n", |
64 | - cur_name); | 64 | - cur_name); |
65 | + if(errno == ENOTSUP) | 65 | + if(errno == ENOTSUP) |
66 | + return 0; | 66 | + return 0; |
67 | + fprintf(stderr, "get a xattr value failed for %s attr %s errno %d\n", | 67 | + fprintf(stderr, "get a xattr value failed for %s attr %s errno %d\n", |
68 | + file_name, cur_name, errno); | 68 | + file_name, cur_name, errno); |
69 | + return ret; | 69 | + return ret; |
70 | } | 70 | } |
71 | 71 | ||
72 | ret = btrfs_insert_xattr_item(trans, root, cur_name, | 72 | ret = btrfs_insert_xattr_item(trans, root, cur_name, |
73 | @@ -563,7 +567,6 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, | 73 | @@ -563,7 +567,6 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, |
74 | 74 | ||
75 | return ret; | 75 | return ret; |
76 | } | 76 | } |
77 | - | 77 | - |
78 | static int custom_alloc_extent(struct btrfs_root *root, u64 num_bytes, | 78 | static int custom_alloc_extent(struct btrfs_root *root, u64 num_bytes, |
79 | u64 hint_byte, struct btrfs_key *ins) | 79 | u64 hint_byte, struct btrfs_key *ins) |
80 | { | 80 | { |
81 | @@ -923,27 +926,27 @@ static int traverse_directory(struct btrfs_trans_handle *trans, | 81 | @@ -923,27 +926,27 @@ static int traverse_directory(struct btrfs_trans_handle *trans, |
82 | fprintf(stderr, "add_inode_items failed\n"); | 82 | fprintf(stderr, "add_inode_items failed\n"); |
83 | goto fail; | 83 | goto fail; |
84 | } | 84 | } |
85 | - | 85 | - |
86 | ret = add_xattr_item(trans, root, | 86 | ret = add_xattr_item(trans, root, |
87 | cur_inum, cur_file->d_name); | 87 | cur_inum, cur_file->d_name); |
88 | if (ret) { | 88 | if (ret) { |
89 | fprintf(stderr, "add_xattr_item failed\n"); | 89 | fprintf(stderr, "add_xattr_item failed\n"); |
90 | - goto fail; | 90 | - goto fail; |
91 | + if(ret != -ENOTSUP) | 91 | + if(ret != -ENOTSUP) |
92 | + goto fail; | 92 | + goto fail; |
93 | } | 93 | } |
94 | - | 94 | - |
95 | if (S_ISDIR(st.st_mode)) { | 95 | if (S_ISDIR(st.st_mode)) { |
96 | dir_entry = malloc(sizeof(struct directory_name_entry)); | 96 | dir_entry = malloc(sizeof(struct directory_name_entry)); |
97 | dir_entry->dir_name = cur_file->d_name; | 97 | dir_entry->dir_name = cur_file->d_name; |
98 | dir_entry->path = make_path(parent_dir_entry->path, | 98 | dir_entry->path = make_path(parent_dir_entry->path, |
99 | cur_file->d_name); | 99 | cur_file->d_name); |
100 | dir_entry->inum = cur_inum; | 100 | dir_entry->inum = cur_inum; |
101 | - list_add_tail(&dir_entry->list, &dir_head->list); | 101 | - list_add_tail(&dir_entry->list, &dir_head->list); |
102 | + list_add_tail(&dir_entry->list, &dir_head->list); | 102 | + list_add_tail(&dir_entry->list, &dir_head->list); |
103 | } else if (S_ISREG(st.st_mode)) { | 103 | } else if (S_ISREG(st.st_mode)) { |
104 | ret = add_file_items(trans, root, &cur_inode, | 104 | ret = add_file_items(trans, root, &cur_inode, |
105 | cur_inum, parent_inum, &st, | 105 | cur_inum, parent_inum, &st, |
106 | cur_file->d_name, out_fd); | 106 | cur_file->d_name, out_fd); |
107 | if (ret) { | 107 | if (ret) { |
108 | - fprintf(stderr, "add_file_items failed\n"); | 108 | - fprintf(stderr, "add_file_items failed\n"); |
109 | + fprintf(stderr, "add_file_items failed %s\n", | 109 | + fprintf(stderr, "add_file_items failed %s\n", |
110 | + cur_file->d_name); | 110 | + cur_file->d_name); |
111 | goto fail; | 111 | goto fail; |
112 | } | 112 | } |
113 | } else if (S_ISLNK(st.st_mode)) { | 113 | } else if (S_ISLNK(st.st_mode)) { |
114 | @@ -987,7 +990,7 @@ static int create_chunks(struct btrfs_trans_handle *trans, | 114 | @@ -987,7 +990,7 @@ static int create_chunks(struct btrfs_trans_handle *trans, |
115 | u64 chunk_size; | 115 | u64 chunk_size; |
116 | u64 meta_type = BTRFS_BLOCK_GROUP_METADATA; | 116 | u64 meta_type = BTRFS_BLOCK_GROUP_METADATA; |
117 | u64 data_type = BTRFS_BLOCK_GROUP_DATA; | 117 | u64 data_type = BTRFS_BLOCK_GROUP_DATA; |
118 | - u64 minimum_data_chunk_size = 64 * 1024 * 1024; | 118 | - u64 minimum_data_chunk_size = 64 * 1024 * 1024; |
119 | + u64 minimum_data_chunk_size = 8 * 1024 * 1024; | 119 | + u64 minimum_data_chunk_size = 8 * 1024 * 1024; |
120 | u64 i; | 120 | u64 i; |
121 | int ret; | 121 | int ret; |
122 | 122 | ||
123 | @@ -1062,7 +1065,6 @@ static u64 size_sourcedir(char *dir_name, u64 sectorsize, | 123 | @@ -1062,7 +1065,6 @@ static u64 size_sourcedir(char *dir_name, u64 sectorsize, |
124 | char path[512]; | 124 | char path[512]; |
125 | char *file_name = "temp_file"; | 125 | char *file_name = "temp_file"; |
126 | FILE *file; | 126 | FILE *file; |
127 | - u64 minimum_data_size = 256 * 1024 * 1024; /* 256MB */ | 127 | - u64 minimum_data_size = 256 * 1024 * 1024; /* 256MB */ |
128 | u64 default_chunk_size = 8 * 1024 * 1024; /* 8MB */ | 128 | u64 default_chunk_size = 8 * 1024 * 1024; /* 8MB */ |
129 | u64 allocated_meta_size = 8 * 1024 * 1024; /* 8MB */ | 129 | u64 allocated_meta_size = 8 * 1024 * 1024; /* 8MB */ |
130 | u64 allocated_total_size = 20 * 1024 * 1024; /* 20MB */ | 130 | u64 allocated_total_size = 20 * 1024 * 1024; /* 20MB */ |
131 | @@ -1101,9 +1103,6 @@ static u64 size_sourcedir(char *dir_name, u64 sectorsize, | 131 | @@ -1101,9 +1103,6 @@ static u64 size_sourcedir(char *dir_name, u64 sectorsize, |
132 | 132 | ||
133 | *num_of_meta_chunks_ret = num_of_meta_chunks; | 133 | *num_of_meta_chunks_ret = num_of_meta_chunks; |
134 | 134 | ||
135 | - if (total_size < minimum_data_size) | 135 | - if (total_size < minimum_data_size) |
136 | - total_size = minimum_data_size; | 136 | - total_size = minimum_data_size; |
137 | - | 137 | - |
138 | return total_size; | 138 | return total_size; |
139 | } | 139 | } |
140 | 140 | ||
141 | @@ -1158,9 +1157,9 @@ int main(int ac, char **av) | 141 | @@ -1158,9 +1157,9 @@ int main(int ac, char **av) |
142 | 142 | ||
143 | char *source_dir = NULL; | 143 | char *source_dir = NULL; |
144 | int source_dir_set = 0; | 144 | int source_dir_set = 0; |
145 | - char *output = "output.img"; | 145 | - char *output = "output.img"; |
146 | u64 num_of_meta_chunks = 0; | 146 | u64 num_of_meta_chunks = 0; |
147 | u64 size_of_data = 0; | 147 | u64 size_of_data = 0; |
148 | + u64 source_dir_size = 0; | 148 | + u64 source_dir_size = 0; |
149 | 149 | ||
150 | while(1) { | 150 | while(1) { |
151 | int c; | 151 | int c; |
152 | @@ -1224,8 +1223,6 @@ int main(int ac, char **av) | 152 | @@ -1224,8 +1223,6 @@ int main(int ac, char **av) |
153 | fprintf(stderr, "Illegal nodesize %u\n", nodesize); | 153 | fprintf(stderr, "Illegal nodesize %u\n", nodesize); |
154 | exit(1); | 154 | exit(1); |
155 | } | 155 | } |
156 | - if (source_dir_set) | 156 | - if (source_dir_set) |
157 | - ac++; | 157 | - ac++; |
158 | ac = ac - optind; | 158 | ac = ac - optind; |
159 | if (ac == 0) | 159 | if (ac == 0) |
160 | print_usage(); | 160 | print_usage(); |
161 | @@ -1257,17 +1254,19 @@ int main(int ac, char **av) | 161 | @@ -1257,17 +1254,19 @@ int main(int ac, char **av) |
162 | block_count = dev_block_count; | 162 | block_count = dev_block_count; |
163 | } else { | 163 | } else { |
164 | ac = 0; | 164 | ac = 0; |
165 | - fd = open_target(output); | 165 | - fd = open_target(output); |
166 | + file = av[optind++]; | 166 | + file = av[optind++]; |
167 | + fd = open_target(file); | 167 | + fd = open_target(file); |
168 | if (fd < 0) { | 168 | if (fd < 0) { |
169 | fprintf(stderr, "unable to open the %s\n", file); | 169 | fprintf(stderr, "unable to open the %s\n", file); |
170 | exit(1); | 170 | exit(1); |
171 | } | 171 | } |
172 | 172 | ||
173 | - file = output; | 173 | - file = output; |
174 | first_fd = fd; | 174 | first_fd = fd; |
175 | first_file = file; | 175 | first_file = file; |
176 | - block_count = size_sourcedir(source_dir, sectorsize, | 176 | - block_count = size_sourcedir(source_dir, sectorsize, |
177 | + source_dir_size = size_sourcedir(source_dir, sectorsize, | 177 | + source_dir_size = size_sourcedir(source_dir, sectorsize, |
178 | &num_of_meta_chunks, &size_of_data); | 178 | &num_of_meta_chunks, &size_of_data); |
179 | + if(block_count < source_dir_size) | 179 | + if(block_count < source_dir_size) |
180 | + block_count = source_dir_size; | 180 | + block_count = source_dir_size; |
181 | ret = zero_output_file(fd, block_count, sectorsize); | 181 | ret = zero_output_file(fd, block_count, sectorsize); |
182 | if (ret) { | 182 | if (ret) { |
183 | fprintf(stderr, "unable to zero the output file\n"); | 183 | fprintf(stderr, "unable to zero the output file\n"); |