add arm patch

Package-Manager: portage-2.2.0_alpha142
RepoMan-Options: --force
This commit is contained in:
Mario Fetka 2012-12-04 18:17:14 +01:00
parent 331deb6f80
commit 400a86c256
7 changed files with 512 additions and 0 deletions

View File

@ -0,0 +1,6 @@
AUX 0001-btrfs-progs-unstable-darksatanic-repo-fix-arg-checki.patch 1134 SHA256 ff60cc070419b79060b44453c87e079cf55f25b4e4c12191f0f1188a1529da26 SHA512 ca20b5e8ac6fcb8cb53eebbfea6ee016b362626850c9414118d8f971aec7d5884936a9aa16b32c84368aa73986eb5a21291117f428b62a39782c163ffdb25592 WHIRLPOOL c164f2afe9c895fb25bc940e216c206271a7950327fc1ae8a77dcda07948512a6bf06677f7dc01c8000218465fc3cf9995867011a090dabffab56c10f4ebe560
AUX 0002-btrfs-progs-ignore-unavailable-loop-device-source-files.patch 1854 SHA256 ba9b505ce439db0446dad0624a18bea18873edb46f2ceab38af595d3c536892b SHA512 74802b92fe537df3fe21dfd4c1aa6f0a21eabf68307162246947ed088dca0feae5f72fd5b0a31a2f1b980eca3a9c9aa6faa1beeb7a4f863845867ccc7cb7e11d WHIRLPOOL c4678da21e822f0671f0a4b576fe4d81febe42de5ef59459f9812f4cfd787ee197e363a0865d4050a578f7282c584fe66d3b9299b8b1517f1270b2af58a0c4eb
AUX btrfs-progs-Modify-Makefile-to-allow-optional-ACL-dependency.patch 1202 SHA256 7531469b262250d24198e853ce4b042f47fe23bc226d56af58e0bbc14e255ca7 SHA512 0f92d6e272b9c9c294040f902fed94f512a3cff6798d846cc4f095b0059fa5cff9eef7a6708a18950c37df1a566170ba53783543a1ef9492f921b4b207803ab1 WHIRLPOOL 605432f47fa8ea5be9203749477fd7c38231a490004da4573ea8563c616586fe38dce91c2aaf9dd8f774eb5c2a9c5e0fb5cc11be31059203ad9c6db6269c9957
AUX v2-Btrfs-progs-fix-unaligned-accesses.patch 7864 SHA256 7d1b12bc5b7a53b533be2ebffef85d4a52c0f5783e106792ab545a119d5268db SHA512 d15fb6cee4e11177b463f65ea348a4f2bc3c3f6266746a3bb7be462d823e0fd97424f45e424f19889921371a5375f893600deb95e12114011da71d2f960af763 WHIRLPOOL 00258832256a29670aa7e0bd55afc37d8fdcec7e919d50fb45a1381f658863e6ca83f5c3e284a91d7037c33d8c93e223061c598f798cd2189ed4ec1432f4c5ba
EBUILD btrfs-progs-0.19_p120221.ebuild 2643 SHA256 c7beaf743f022989c47ee6abccd98faa90860dc2516ad3cea699190a525ce1fb SHA512 4853b4e2bfacc470505ec30b45bd57dc1551d4d5929512d83fab001c66fec8800eb45f7a26e203bdc6aecc8d30fc322c669e7a5ad1d38fb2867eba9a10fbb42a WHIRLPOOL 768fbc61fa2a5841581ed10eb912af1240d333bc2fddb5b3cdf2d4cbbc058a1ad0155114559fa3b0d72fc524acbfcc40ccabf096aca087dd6c8130fbaf47176f
MISC metadata.xml 332 SHA256 9bfca7447ff362e4b98047c151d4bf4251051ad503387e49129bbbd1b96fd4c2 SHA512 cf679f23c0b6999c2a6e346b645db770197ef56bb9321c5978b1827e5289df32e1cb73822e0f11424ec6bbe76ff1e0702abbe4e9089fb30b4ae3227cc6cf24d5 WHIRLPOOL d5f888e6a516106307caf667944582e2fa2d38d353ec0f4b6ce3bab3bcff7a160085052da7b7d1fe9b427ae8826a534da14a69d4c1d4f1d72002c8b4984bad35

View File

@ -0,0 +1,96 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/btrfs-progs/btrfs-progs-9999.ebuild,v 1.15 2011/10/29 05:17:45 slyfox Exp $
EAPI="4"
inherit eutils git-2
DESCRIPTION="Btrfs filesystem utilities"
HOMEPAGE="http://btrfs.wiki.kernel.org/"
SRC_URI=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~ppc64 ~x86"
IUSE="acl debug-utils"
DEPEND="debug-utils? ( dev-python/matplotlib )
acl? (
sys-apps/acl
sys-fs/e2fsprogs
)"
RDEPEND="${DEPEND}"
EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git"
EGIT_COMMIT="1957076ab4fefa47b6efed3da541bc974c83eed7"
src_unpack() {
git-2_src_unpack
}
src_prepare() {
epatch "${FILESDIR}"/${PN}-Modify-Makefile-to-allow-optional-ACL-dependency.patch
# See Sabayon ML -- DO NOT DROP THIS !!!!!!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# http://lists.sabayon.org/pipermail/devel/2011-October/007155.html
epatch "${FILESDIR}"/0002-btrfs-progs-ignore-unavailable-loop-device-source-files.patch
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
# DO NOT DROP THIS !!!!!!!!!!!!!!
epatch "${FILESDIR}"/v2-Btrfs-progs-fix-unaligned-accesses.patch
# Fix hardcoded "gcc" and "make"
sed -i -e 's:gcc $(CFLAGS):$(CC) $(CFLAGS):' Makefile
sed -i -e 's:make:$(MAKE):' Makefile
}
src_compile() {
emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
all || die
emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
btrfs-image || die
if use acl; then
emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
btrfs-convert || die
fi
}
src_install() {
emake mandir="/usr/share/man" bindir="/sbin" install DESTDIR="${D}"
# fsck will segfault if invoked at boot, so do not make this link
#dosym btrfsck /sbin/fsck.btrfs
# newsbin mkfs.btrfs mkbtrfs
dosym mkfs.btrfs /sbin/mkbtrfs
if ! use acl; then
ewarn "Note: btrfs-convert not built/installed (requires acl USE flag)"
fi
into /usr
newbin bcp btrfs-bcp
if use debug-utils; then
newbin show-blocks btrfs-show-blocks
else
ewarn "Note: btrfs-show-blocks not installed (requires debug-utils USE flag)"
fi
dodoc INSTALL
# emake prefix="${D}/usr/share" install-man
}
pkg_postinst() {
ewarn "WARNING: This version of btrfs-progs uses the latest unstable code,"
ewarn " and care should be taken that it is compatible with the"
ewarn " version of btrfs in your kernel!"
}

View File

@ -0,0 +1,39 @@
From 6e1f3e7611187a31280fa2d1bd571e20ad067b41 Mon Sep 17 00:00:00 2001
From: Mitch Harder <mitch.harder@sabayonlinux.org>
Date: Mon, 12 Sep 2011 12:07:41 -0500
Subject: [btrfs-progs-unstable (darksatanic repo)] fix arg checking.
The argument checking code for snapshots was modified in a patch
titled:
fix incorrect argument checking for "btrfs sub snap -r"
This patch was commited by Hugo Mills <hugo@carfax.org.uk> to his
development repository for btrf-progs which is being used to
collect and test the range of btrfs-progs patches submitted to the
project.
This hotfix addresses a problem in the above referrenced patch.
---
btrfs_cmds.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 699dfc2..26a4e6f 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -370,11 +370,11 @@ int do_clone(int argc, char **argv)
"Invalid arguments for subvolume snapshot\n");
free(argv);
return 1;
}
}
- if (argc - optind != 2) {
+ if (argc - optind != 3) {
fprintf(stderr, "Invalid arguments for subvolume snapshot\n");
free(argv);
return 1;
}
--
1.7.3.4

View File

@ -0,0 +1,70 @@
--- btrfs-progs-0.19.orig/utils.c
+++ btrfs-progs-0.19/utils.c
@@ -708,6 +708,21 @@ int is_same_blk_file(const char* a, cons
return 0;
}
+/* Checks if a file exists and is a block or regular file*/
+int is_existing_blk_or_reg_file(const char* filename)
+{
+ struct stat st_buf;
+
+ if(stat(filename, &st_buf) < 0) {
+ if(errno == ENOENT)
+ return 0;
+ else
+ return -errno;
+ }
+
+ return (S_ISBLK(st_buf.st_mode) || S_ISREG(st_buf.st_mode));
+}
+
/* checks if a and b are identical or device
* files associated with the same block device or
* if one file is a loop device that uses the other
@@ -727,7 +742,10 @@ int is_same_loop_file(const char* a, con
} else if(ret) {
if((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
return ret;
-
+ /* if the resolved path is not available, there is nothing
+ we can do */
+ if((ret = is_existing_blk_or_reg_file(res_a)) == 0)
+ return ret;
final_a = res_a;
} else {
final_a = a;
@@ -739,6 +757,10 @@ int is_same_loop_file(const char* a, con
} else if(ret) {
if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0)
return ret;
+ /* if the resolved path is not available, there is nothing
+ we can do */
+ if((ret = is_existing_blk_or_reg_file(res_b)) == 0)
+ return ret;
final_b = res_b;
} else {
@@ -748,21 +770,6 @@ int is_same_loop_file(const char* a, con
return is_same_blk_file(final_a, final_b);
}
-/* Checks if a file exists and is a block or regular file*/
-int is_existing_blk_or_reg_file(const char* filename)
-{
- struct stat st_buf;
-
- if(stat(filename, &st_buf) < 0) {
- if(errno == ENOENT)
- return 0;
- else
- return -errno;
- }
-
- return (S_ISBLK(st_buf.st_mode) || S_ISREG(st_buf.st_mode));
-}
-
/* Checks if a file is used (directly or indirectly via a loop device)
* by a device in fs_devices
*/

View File

@ -0,0 +1,42 @@
From 8283877390fcf6c6682921d5c9f4743a0fc41112 Mon Sep 17 00:00:00 2001
From: Mitch Harder <mitch.harder@sabayonlinux.org>
Date: Sun, 13 May 2012 12:16:26 -0500
Subject: Modify Makefile to allow optional ACL dependency.
Modify the Makefile to make the 'btrfs-convert' build optional
since this is the only program depending on ACL.
---
Makefile | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 79818e6..3b25220 100644
--- a/Makefile
+++ b/Makefile
@@ -17,11 +17,11 @@ prefix ?= /usr/local
bindir = $(prefix)/bin
LIBS=-luuid
RESTORE_LIBS=-lz
progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
- btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
+ btrfs btrfs-map-logical btrfs-image btrfs-zero-log \
btrfs-find-root btrfs-restore btrfstune
# make C=1 to enable sparse
ifdef C
check = sparse $(CHECKFLAGS)
@@ -112,7 +112,10 @@ clean :
cd man; make clean
install: $(progs) install-man
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
$(INSTALL) $(progs) $(DESTDIR)$(bindir)
+ if [ -e btrfs-convert ]; \
+ then $(INSTALL) btrfs-convert $(DESTDIR)$(bindir); \
+ fi
-include .*.d
--
1.7.3.4

View File

@ -0,0 +1,248 @@
From patchwork Sun Oct 21 14:34:33 2012
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v2] Btrfs-progs: fix unaligned accesses
Date: Sun, 21 Oct 2012 14:34:33 -0000
From: Arne Jansen <sensille@gmx.net>
X-Patchwork-Id: 1622631
Message-Id: <1350830073-20944-1-git-send-email-sensille@gmx.net>
To: linux-btrfs@vger.kernel.org
There are some unaligned accesses in progs that cause malfunction or
crashes on ARM.
This patch fixes the ones we stumbled upon.
Signed-off-by: Arne Jansen <sensille@gmx.net>
tested-by: Andre Diekwisch <andred <at> mail.upb.de>
---
Change v1->v2:
Somehow sent the wrong patch without the patch to the setget functions.
---
btrfs-list.c | 69 +++++++++++++++++++++++++++------------------------------
ctree.h | 8 +++++-
volumes.c | 8 ++++--
3 files changed, 44 insertions(+), 41 deletions(-)
diff --git a/btrfs-list.c b/btrfs-list.c
index e5f0f96..cb42fbc 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -720,7 +720,7 @@ static u64 find_root_gen(int fd)
int ret;
struct btrfs_ioctl_search_args args;
struct btrfs_ioctl_search_key *sk = &args.key;
- struct btrfs_ioctl_search_header *sh;
+ struct btrfs_ioctl_search_header sh;
unsigned long off = 0;
u64 max_found = 0;
int i;
@@ -771,22 +771,21 @@ static u64 find_root_gen(int fd)
off = 0;
for (i = 0; i < sk->nr_items; i++) {
struct btrfs_root_item *item;
- sh = (struct btrfs_ioctl_search_header *)(args.buf +
- off);
- off += sizeof(*sh);
+ memcpy(&sh, args.buf + off, sizeof(sh));
+ off += sizeof(sh);
item = (struct btrfs_root_item *)(args.buf + off);
- off += sh->len;
+ off += sh.len;
- sk->min_objectid = sh->objectid;
- sk->min_type = sh->type;
- sk->min_offset = sh->offset;
+ sk->min_objectid = sh.objectid;
+ sk->min_type = sh.type;
+ sk->min_offset = sh.offset;
- if (sh->objectid > ino_args.treeid)
+ if (sh.objectid > ino_args.treeid)
break;
- if (sh->objectid == ino_args.treeid &&
- sh->type == BTRFS_ROOT_ITEM_KEY) {
+ if (sh.objectid == ino_args.treeid &&
+ sh.type == BTRFS_ROOT_ITEM_KEY) {
max_found = max(max_found,
btrfs_root_generation(item));
}
@@ -1009,7 +1008,7 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
int ret;
struct btrfs_ioctl_search_args args;
struct btrfs_ioctl_search_key *sk = &args.key;
- struct btrfs_ioctl_search_header *sh;
+ struct btrfs_ioctl_search_header sh;
struct btrfs_root_ref *ref;
struct btrfs_root_item *ri;
unsigned long off = 0;
@@ -1064,23 +1063,22 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
* read the root_ref item it contains
*/
for (i = 0; i < sk->nr_items; i++) {
- sh = (struct btrfs_ioctl_search_header *)(args.buf +
- off);
- off += sizeof(*sh);
- if (sh->type == BTRFS_ROOT_BACKREF_KEY) {
+ memcpy(&sh, args.buf + off, sizeof(sh));
+ off += sizeof(sh);
+ if (sh.type == BTRFS_ROOT_BACKREF_KEY) {
ref = (struct btrfs_root_ref *)(args.buf + off);
name_len = btrfs_stack_root_ref_name_len(ref);
name = (char *)(ref + 1);
dir_id = btrfs_stack_root_ref_dirid(ref);
- add_root(root_lookup, sh->objectid, sh->offset,
+ add_root(root_lookup, sh.objectid, sh.offset,
0, 0, dir_id, name, name_len, 0, 0, 0,
NULL);
- } else if (sh->type == BTRFS_ROOT_ITEM_KEY) {
+ } else if (sh.type == BTRFS_ROOT_ITEM_KEY) {
ri = (struct btrfs_root_item *)(args.buf + off);
gen = btrfs_root_generation(ri);
flags = btrfs_root_flags(ri);
- if(sh->len >
+ if(sh.len >
sizeof(struct btrfs_root_item_v0)) {
t = ri->otime.sec;
ogen = btrfs_root_otransid(ri);
@@ -1091,20 +1089,20 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
memset(uuid, 0, BTRFS_UUID_SIZE);
}
- add_root(root_lookup, sh->objectid, 0,
- sh->offset, flags, 0, NULL, 0, ogen,
+ add_root(root_lookup, sh.objectid, 0,
+ sh.offset, flags, 0, NULL, 0, ogen,
gen, t, uuid);
}
- off += sh->len;
+ off += sh.len;
/*
* record the mins in sk so we can make sure the
* next search doesn't repeat this root
*/
- sk->min_objectid = sh->objectid;
- sk->min_type = sh->type;
- sk->min_offset = sh->offset;
+ sk->min_objectid = sh.objectid;
+ sk->min_type = sh.type;
+ sk->min_offset = sh.offset;
}
sk->nr_items = 4096;
sk->min_offset++;
@@ -1556,7 +1554,7 @@ int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen)
int ret;
struct btrfs_ioctl_search_args args;
struct btrfs_ioctl_search_key *sk = &args.key;
- struct btrfs_ioctl_search_header *sh;
+ struct btrfs_ioctl_search_header sh;
struct btrfs_file_extent_item *item;
unsigned long off = 0;
u64 found_gen;
@@ -1606,35 +1604,34 @@ int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen)
* read the root_ref item it contains
*/
for (i = 0; i < sk->nr_items; i++) {
- sh = (struct btrfs_ioctl_search_header *)(args.buf +
- off);
- off += sizeof(*sh);
+ memcpy(&sh, args.buf + off, sizeof(sh));
+ off += sizeof(sh);
/*
* just in case the item was too big, pass something other
* than garbage
*/
- if (sh->len == 0)
+ if (sh.len == 0)
item = &backup;
else
item = (struct btrfs_file_extent_item *)(args.buf +
off);
found_gen = btrfs_stack_file_extent_generation(item);
- if (sh->type == BTRFS_EXTENT_DATA_KEY &&
+ if (sh.type == BTRFS_EXTENT_DATA_KEY &&
found_gen >= oldest_gen) {
- print_one_extent(fd, sh, item, found_gen,
+ print_one_extent(fd, &sh, item, found_gen,
&cache_dirid, &cache_dir_name,
&cache_ino, &cache_full_name);
}
- off += sh->len;
+ off += sh.len;
/*
* record the mins in sk so we can make sure the
* next search doesn't repeat this root
*/
- sk->min_objectid = sh->objectid;
- sk->min_offset = sh->offset;
- sk->min_type = sh->type;
+ sk->min_objectid = sh.objectid;
+ sk->min_offset = sh.offset;
+ sk->min_type = sh.type;
}
sk->nr_items = 4096;
if (sk->min_offset < (u64)-1)
diff --git a/ctree.h b/ctree.h
index 293b24f..0675989 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1086,15 +1086,19 @@ static inline u##bits btrfs_##name(struct extent_buffer *eb, \
type *s) \
{ \
unsigned long offset = (unsigned long)s; \
+ u##bits m; \
type *p = (type *) (eb->data + offset); \
- return le##bits##_to_cpu(p->member); \
+ memcpy(&m, &p->member, sizeof(m)); \
+ return le##bits##_to_cpu(m); \
} \
static inline void btrfs_set_##name(struct extent_buffer *eb, \
type *s, u##bits val) \
{ \
unsigned long offset = (unsigned long)s; \
+ u##bits m; \
type *p = (type *) (eb->data + offset); \
- p->member = cpu_to_le##bits(val); \
+ m = cpu_to_le##bits(val); \
+ memcpy(&p->member, &m, sizeof(m)); \
}
#define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits) \
diff --git a/volumes.c b/volumes.c
index 8dca5e1..581c298 100644
--- a/volumes.c
+++ b/volumes.c
@@ -652,6 +652,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
int index;
int stripe_len = 64 * 1024;
struct btrfs_key key;
+ u64 offset;
if (list_empty(dev_list)) {
return -ENOSPC;
@@ -757,12 +758,13 @@ again:
}
return -ENOSPC;
}
- key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
- key.type = BTRFS_CHUNK_ITEM_KEY;
ret = find_next_chunk(chunk_root, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
- &key.offset);
+ &offset);
if (ret)
return ret;
+ key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
+ key.type = BTRFS_CHUNK_ITEM_KEY;
+ key.offset = offset;
chunk = kmalloc(btrfs_chunk_item_size(num_stripes), GFP_NOFS);
if (!chunk)

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>no-herd</herd>
<maintainer>
<email>mitch.harder@sabayonlinux.org</email>
</maintainer>
<use>
<flag name='debug-utils'>Build additional utils for debugging</flag>
</use>
</pkgmetadata>