parted/parted-btrfs-support.patch
Petr Uzel b5a4ceef04 - update to parted-3.1 (fate#316110)
- changes in parted-3.1:
  * Changes in behavior
    - Floppy drives are no longer scanned on linux: they cannot be
      partitioned anyhow, and some users have a misconfigured BIOS
      that claims to have a floppy when they don't, and scanning
      gets hung up.
    - parted: the mkpart command has changed semantics with regard
      to specifying the end of the partition.  If the end is
      specified using units of MiB, GiB, etc., parted subtracts one
      sector from the specified value.  With this change, it is now
      possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and
      so on.
  * Many bugfixes (see changelog)
- changes in parted-3.0:
  * Changes in behavior
    - Remove all FS-related (file system-related) sub-commands;
      these commands are no longer recognized because they were all
      dependent on parted "knowing" too much about file system:
      mkpartfs, mkfs, cp, move, check.
    - 'resize' command changed semantics:
      it no longer resizes the filesystem, but only moves end
      sector of the partition
- libparted-devel contains libparted-fs-resize library 
- add ability to change size of the partition (ignoring contained
  filesystem) with 'resize' command; this command has different
  semantics than the former 'resize' command which upstream
  decided to drop
  - parted-resize-command.patch (fate#316110)
- when using syncmbr on POWER, make the first partition type 0x41

OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=79
2014-01-09 16:35:35 +00:00

168 lines
4.6 KiB
Diff

commit 85e5fcd1bb0fe91d8908e8a638e9827979b6feff
Author: Luca Bruno <lucab@debian.org>
Date: Thu Feb 12 15:15:30 2009 +0100
Initial btrfs support, only recognize it for now
Add initial btrfs support to libparted; just discovering
the declared magic entry at the right place to recognize
filesystem type, for the moment.
Signed-off-by: Luca Bruno <lucab@debian.org>
---
libparted/fs/Makefile.am | 1
libparted/fs/btrfs/btrfs.c | 96 ++
libparted/libparted.c | 4
4 files changed, 1933 insertions(+)
Index: parted-3.1/libparted/fs/Makefile.am
===================================================================
--- parted-3.1.orig/libparted/fs/Makefile.am
+++ parted-3.1/libparted/fs/Makefile.am
@@ -25,6 +25,7 @@ libfs_la_SOURCES = \
amiga/asfs.c \
amiga/asfs.h \
amiga/a-interface.c \
+ btrfs/btrfs.c \
ext2/ext2.h \
ext2/ext2_fs.h \
ext2/interface.c \
Index: parted-3.1/libparted/fs/btrfs/btrfs.c
===================================================================
--- /dev/null
+++ parted-3.1/libparted/fs/btrfs/btrfs.c
@@ -0,0 +1,96 @@
+/*
+ libparted - a library for manipulating disk partitions
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/endian.h>
+
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) dgettext (PACKAGE, String)
+#else
+# define _(String) (String)
+#endif /* ENABLE_NLS */
+
+#include <unistd.h>
+
+#define BTRFS_BLOCK_SIZES ((int[2]){1024, 0})
+#define BTRFS_SUPER_INFO_SIZE 4096
+#define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
+
+//Should be definitive, as of v0.18
+#define BTRFS_SIGNATURE 0x4D5F53665248425F
+
+static PedGeometry*
+btrfs_probe (PedGeometry* geom)
+{
+ char buf[BTRFS_SUPER_INFO_SIZE];
+
+ uint64_t magic;
+
+ if (!ped_geometry_read (geom, buf,
+ (BTRFS_SUPER_INFO_OFFSET / 512),
+ (BTRFS_SUPER_INFO_SIZE / 512)))
+ return 0;
+
+ memcpy(&magic, buf + 64, sizeof(uint64_t));
+
+ if (magic == PED_CPU_TO_LE64(BTRFS_SIGNATURE))
+ return ped_geometry_new (geom->dev, geom->start, geom->length);
+ else
+ return NULL;
+}
+
+#ifndef DISCOVER_ONLY
+static int
+btrfs_clobber (PedGeometry* geom)
+{
+ char buf[BTRFS_SUPER_INFO_SIZE];
+
+ memset (buf, 0, BTRFS_SUPER_INFO_SIZE);
+ return ped_geometry_write (geom, buf,
+ (BTRFS_SUPER_INFO_OFFSET / 512),
+ (BTRFS_SUPER_INFO_SIZE / 512));
+}
+#endif /* !DISCOVER_ONLY */
+
+static PedFileSystemOps btrfs_ops = {
+ probe: btrfs_probe,
+};
+
+static PedFileSystemType btrfs_type = {
+ next: NULL,
+ ops: &btrfs_ops,
+ name: "btrfs",
+ block_sizes: BTRFS_BLOCK_SIZES
+};
+
+void
+ped_file_system_btrfs_init ()
+{
+ ped_file_system_type_register (&btrfs_type);
+}
+
+void
+ped_file_system_btrfs_done ()
+{
+ ped_file_system_type_unregister (&btrfs_type);
+}
+
+
Index: parted-3.1/libparted/libparted.c
===================================================================
--- parted-3.1.orig/libparted/libparted.c
+++ parted-3.1/libparted/libparted.c
@@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (vo
extern void ped_file_system_fat_init (void);
extern void ped_file_system_ext2_init (void);
extern void ped_file_system_nilfs2_init (void);
+extern void ped_file_system_btrfs_init (void);
static void
init_file_system_types ()
@@ -124,6 +125,7 @@ init_file_system_types ()
ped_file_system_fat_init ();
ped_file_system_ext2_init ();
ped_file_system_nilfs2_init ();
+ ped_file_system_btrfs_init ();
}
extern void ped_disk_aix_done ();
@@ -185,6 +187,7 @@ extern void ped_file_system_ntfs_done (v
extern void ped_file_system_reiserfs_done (void);
extern void ped_file_system_ufs_done (void);
extern void ped_file_system_xfs_done (void);
+extern void ped_file_system_btrfs_done (void);
extern void ped_file_system_amiga_done (void);
static void
@@ -200,6 +203,7 @@ done_file_system_types ()
ped_file_system_reiserfs_done ();
ped_file_system_ufs_done ();
ped_file_system_xfs_done ();
+ ped_file_system_btrfs_done ();
ped_file_system_amiga_done ();
}