summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hfsplus-Add-an-ioctl-to-bless-files.patch98
-rw-r--r--hfsplus-Change-finder_info-to-u32.patch26
-rw-r--r--kernel.spec12
-rw-r--r--sources2
4 files changed, 136 insertions, 2 deletions
diff --git a/hfsplus-Add-an-ioctl-to-bless-files.patch b/hfsplus-Add-an-ioctl-to-bless-files.patch
new file mode 100644
index 000000000..082627f91
--- /dev/null
+++ b/hfsplus-Add-an-ioctl-to-bless-files.patch
@@ -0,0 +1,98 @@
+Making an hfsplus partition bootable requires the ability to "bless" a
+file by putting its inode number in the volume header. Doing this from
+userspace on a mounted filesystem is impractical since the kernel will
+write back the original values on unmount. Add an ioctl to allow userspace
+to update the volume header information based on the target file.
+
+Signed-off-by: Matthew Garrett <mjg@redhat.com>
+---
+Kept the ioctl in the hfs code, but moved it to a different range to reduce
+reduce the chances of someone stepping on it with another filesystem.
+ Documentation/ioctl/ioctl-number.txt | 1 +
+ fs/hfsplus/hfsplus_fs.h | 5 +++++
+ fs/hfsplus/ioctl.c | 34 ++++++++++++++++++++++++++++++++++
+ 3 files changed, 40 insertions(+), 0 deletions(-)
+diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
+index 4840334..37a4248 100644
+--- a/Documentation/ioctl/ioctl-number.txt
++++ b/Documentation/ioctl/ioctl-number.txt
+@@ -218,6 +218,7 @@ Code Seq#(hex) Include File Comments
+ 'h' 00-7F conflict! Charon filesystem
+ <mailto:zapman@interlan.net>
+ 'h' 00-1F linux/hpet.h conflict!
++'h' 80-8F fs/hfsplus/ioctl.c
+ 'i' 00-3F linux/i2o-dev.h conflict!
+ 'i' 0B-1F linux/ipmi.h conflict!
+ 'i' 80-8F linux/i8k.h
+diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
+index 21a5b7f..4e75ac6 100644
+--- a/fs/hfsplus/hfsplus_fs.h
++++ b/fs/hfsplus/hfsplus_fs.h
+@@ -317,6 +317,11 @@ static inline unsigned short hfsplus_min_io_size(struct super_block *sb)
+
+
+ /*
++ * hfs+-specific ioctl for making the filesystem bootable
++ */
++#define HFSPLUS_IOC_BLESS _IO('h', 0x80)
++
++/*
+ * Functions in any *.c used in other files
+ */
+
+diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
+index f66c765..c640ba5 100644
+--- a/fs/hfsplus/ioctl.c
++++ b/fs/hfsplus/ioctl.c
+@@ -20,6 +20,38 @@
+ #include <asm/uaccess.h>
+ #include "hfsplus_fs.h"
+
++/*
++ * "Blessing" an HFS+ filesystem writes metadata to the superblock informing
++ * the platform firmware which file to boot from
++ */
++static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
++{
++ struct dentry *dentry = file->f_path.dentry;
++ struct inode *inode = dentry->d_inode;
++ struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
++ struct hfsplus_vh *vh = sbi->s_vhdr;
++ struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
++
++ if (!capable(CAP_SYS_ADMIN))
++ return -EPERM;
++
++ mutex_lock(&sbi->vh_mutex);
++
++ /* Directory containing the bootable system */
++ vh->finder_info[0] = bvh->finder_info[0] =
++ cpu_to_be32(parent_ino(dentry));
++
++ /* Bootloader */
++ vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(inode->i_ino);
++
++ /* Per spec, the OS X system folder - same as finder_info[0] here */
++ vh->finder_info[5] = bvh->finder_info[5] =
++ cpu_to_be32(parent_ino(dentry));
++
++ mutex_unlock(&sbi->vh_mutex);
++ return 0;
++}
++
+ static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
+ {
+ struct inode *inode = file->f_path.dentry->d_inode;
+@@ -108,6 +140,8 @@ long hfsplus_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+ return hfsplus_ioctl_getflags(file, argp);
+ case HFSPLUS_IOC_EXT2_SETFLAGS:
+ return hfsplus_ioctl_setflags(file, argp);
++ case HFSPLUS_IOC_BLESS:
++ return hfsplus_ioctl_bless(file, argp);
+ default:
+ return -ENOTTY;
+ }
+--
+1.7.7.6
+
+
diff --git a/hfsplus-Change-finder_info-to-u32.patch b/hfsplus-Change-finder_info-to-u32.patch
new file mode 100644
index 000000000..15e3e67d8
--- /dev/null
+++ b/hfsplus-Change-finder_info-to-u32.patch
@@ -0,0 +1,26 @@
+The finder_info block in the hfsplus volume header is currently defined as
+an array of 8 bit values, but TN1150 defines it as being an array of 32 bit
+values. Fix for convenience.
+
+Signed-off-by: Matthew Garrett <mjg@redhat.com>
+---
+ fs/hfsplus/hfsplus_raw.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
+index 927cdd6..921967e 100644
+--- a/fs/hfsplus/hfsplus_raw.h
++++ b/fs/hfsplus/hfsplus_raw.h
+@@ -117,7 +117,7 @@ struct hfsplus_vh {
+ __be32 write_count;
+ __be64 encodings_bmp;
+
+- u8 finder_info[32];
++ u32 finder_info[8];
+
+ struct hfsplus_fork_raw alloc_file;
+ struct hfsplus_fork_raw ext_file;
+--
+1.7.7.1
+
+
diff --git a/kernel.spec b/kernel.spec
index 50a1a266c..5bb2e1be8 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -87,7 +87,7 @@ Summary: The Linux kernel
# The rc snapshot level
%define rcrev 2
# The git snapshot level
-%define gitrev 4
+%define gitrev 5
# Set rpm version accordingly
%define rpmversion 3.%{upstream_sublevel}.0
%endif
@@ -743,6 +743,9 @@ Patch21093: rt2x00_fix_MCU_request_failures.patch
Patch21094: power-x86-destdir.patch
+Patch21095: hfsplus-Change-finder_info-to-u32.patch
+Patch21096: hfsplus-Add-an-ioctl-to-bless-files.patch
+
# compat-wireless patches
Patch50000: compat-wireless-config-fixups.patch
Patch50001: compat-wireless-pr_fmt-warning-avoidance.patch
@@ -1434,6 +1437,9 @@ ApplyPatch rt2x00_fix_MCU_request_failures.patch
ApplyPatch power-x86-destdir.patch
+ApplyPatch hfsplus-Change-finder_info-to-u32.patch
+ApplyPatch hfsplus-Add-an-ioctl-to-bless-files.patch
+
# END OF PATCH APPLICATIONS
%endif
@@ -2299,6 +2305,10 @@ fi
# ||----w |
# || ||
%changelog
+* Tue Feb 07 2012 Josh Boyer <jwboyer@redhat.com>
+- Linux 3.3-rc2-git5 (upstream 8597559a78e1cde158b999212bc9543682638eb1)
+- Add hfsplus file blessing patches from Matthew Garrett
+
* Mon Feb 6 2012 Peter Robinson <pbrobinson@fedoraproject.org>
- Build an ARM hardfp base versatile/qemu kernel
diff --git a/sources b/sources
index 7dc0dab02..3523c657f 100644
--- a/sources
+++ b/sources
@@ -1,4 +1,4 @@
364066fa18767ec0ae5f4e4abcf9dc51 linux-3.2.tar.xz
465f9cf994d5c94b15ba167fae8e60fb patch-3.3-rc2.xz
02c210a8fd24acca8c1ac93f6f1d3913 compat-wireless-2012-02-05.tar.bz2
-6fb8657a48ee783f62211ead8c5b9977 patch-3.3-rc2-git4.xz
+6923fa025f1718e31c4977ed6f9f9814 patch-3.3-rc2-git5.xz