SHA256
1
0
forked from pool/grub2

Accepting request 311124 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/311124
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=118
This commit is contained in:
Dominique Leuenberger 2015-06-09 10:24:32 +00:00 committed by Git OBS Bridge
parent b9c87e7831
commit 273a5ae78f
4 changed files with 31 additions and 24 deletions

View File

@ -21,10 +21,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
grub-core/fs/btrfs.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 518 insertions(+), 11 deletions(-)
Index: grub-2.00/grub-core/fs/btrfs.c
Index: grub-2.02~beta2/grub-core/fs/btrfs.c
===================================================================
--- grub-2.00.orig/grub-core/fs/btrfs.c
+++ grub-2.00/grub-core/fs/btrfs.c
--- grub-2.02~beta2.orig/grub-core/fs/btrfs.c
+++ grub-2.02~beta2/grub-core/fs/btrfs.c
@@ -29,6 +29,9 @@
#include <minilzo.h>
#include <grub/i18n.h>
@ -125,7 +125,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
+ if (err)
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
+
+ if (key.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0)
+ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0)
+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path);
+
+ data->fs_tree = tree;
@ -164,7 +164,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
return data;
}
@@ -1216,6 +1301,91 @@ get_root (struct grub_btrfs_data *data,
@@ -1226,6 +1311,91 @@ get_root (struct grub_btrfs_data *data,
}
static grub_err_t
@ -217,21 +217,21 @@ Index: grub-2.00/grub-core/fs/btrfs.c
+ if (err)
+ return grub_error(err, "read_logical caught %d\n", err);
+
+ alloc += inode_ref->n + 2;
+ alloc += grub_le_to_cpu16 (inode_ref->n) + 2;
+ new = grub_malloc(alloc);
+ if (!new)
+ return grub_error(GRUB_ERR_OUT_OF_MEMORY,
+ "couldn't allocate memory for name (%"PRIuGRUB_SIZE")\n", alloc);
+
+ grub_memcpy(new, inode_ref->name, inode_ref->n);
+ grub_memcpy(new, inode_ref->name, grub_le_to_cpu16 (inode_ref->n));
+ if (p)
+ {
+ new[inode_ref->n] = '/';
+ grub_strcpy (new + inode_ref->n + 1, p);
+ new[grub_le_to_cpu16 (inode_ref->n)] = '/';
+ grub_strcpy (new + grub_le_to_cpu16 (inode_ref->n) + 1, p);
+ grub_free(p);
+ }
+ else
+ new[inode_ref->n] = 0;
+ new[grub_le_to_cpu16 (inode_ref->n)] = 0;
+ grub_free(inode_ref);
+
+ p = new;
@ -256,7 +256,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
find_path (struct grub_btrfs_data *data,
const char *path, struct grub_btrfs_key *key,
grub_uint64_t *tree, grub_uint8_t *type)
@@ -1233,14 +1403,26 @@ find_path (struct grub_btrfs_data *data,
@@ -1243,14 +1413,26 @@ find_path (struct grub_btrfs_data *data,
char *origpath = NULL;
unsigned symlinks_max = 32;
@ -287,7 +287,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
while (1)
{
while (path[0] == '/')
@@ -1413,9 +1595,21 @@ find_path (struct grub_btrfs_data *data,
@@ -1423,9 +1605,21 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
@ -312,7 +312,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
}
continue;
}
@@ -1656,6 +1850,20 @@ grub_btrfs_read (grub_file_t file, char
@@ -1666,6 +1860,20 @@ grub_btrfs_read (grub_file_t file, char
data->tree, file->offset, buf, len);
}
@ -333,7 +333,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
static grub_err_t
grub_btrfs_uuid (grub_device_t device, char **uuid)
{
@@ -1667,15 +1875,7 @@ grub_btrfs_uuid (grub_device_t device, c
@@ -1677,15 +1885,7 @@ grub_btrfs_uuid (grub_device_t device, c
if (!data)
return grub_errno;
@ -350,7 +350,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
grub_btrfs_unmount (data);
@@ -1732,6 +1932,242 @@ grub_btrfs_embed (grub_device_t device _
@@ -1742,6 +1942,242 @@ grub_btrfs_embed (grub_device_t device _
}
#endif
@ -453,7 +453,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
+ char *devname;
+ grub_uint64_t tree;
+ struct grub_btrfs_key key_in = {
+ .object_id = grub_cpu_to_le64(GRUB_BTRFS_FS_TREE_OBJECTID),
+ .object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID),
+ .type = GRUB_BTRFS_ROOT_REF_KEY,
+ .offset = 0,
+ }, key_out;
@ -492,8 +492,8 @@ Index: grub-2.00/grub-core/fs/btrfs.c
+ if (!data)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "could not open device");
+
+ tree = grub_le_to_cpu64(data->sblock.root_tree);
+ err = get_fs_root(data, tree, grub_cpu_to_le64(GRUB_BTRFS_FS_TREE_OBJECTID),
+ tree = data->sblock.root_tree;
+ err = get_fs_root(data, tree, grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID),
+ 0, &fs_root);
+ if (err)
+ goto out;
@ -593,7 +593,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.dir = grub_btrfs_dir,
@@ -1747,12 +2183,88 @@ static struct grub_fs grub_btrfs_fs = {
@@ -1757,12 +2193,88 @@ static struct grub_fs grub_btrfs_fs = {
#endif
};
@ -682,10 +682,10 @@ Index: grub-2.00/grub-core/fs/btrfs.c
}
+
+// vim: si et sw=2:
Index: grub-2.00/include/grub/btrfs.h
Index: grub-2.02~beta2/include/grub/btrfs.h
===================================================================
--- grub-2.00.orig/include/grub/btrfs.h
+++ grub-2.00/include/grub/btrfs.h
--- grub-2.02~beta2.orig/include/grub/btrfs.h
+++ grub-2.02~beta2/include/grub/btrfs.h
@@ -29,6 +29,7 @@ enum
GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84,
GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90,

View File

@ -185,7 +185,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c
+ if (err)
+ goto err_out;
+
+ if (key_in.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0)
+ if (key_in.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0)
+ {
+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol);
+ goto err_out;

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jun 5 03:46:33 UTC 2015 - mchang@suse.com
- Fix btrfs patch on BigEndian systems (bsc#933541)
* modified grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
* modified grub2-btrfs-06-subvol-mount.patch
-------------------------------------------------------------------
Wed Jun 3 20:07:33 UTC 2015 - agraf@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed