Otavio Salvador ha scritto: > Looks fine however there's a wrong indentation on the static vars to > hold the uuid values. Please take a look and resend. I'll then use > your patch to commit on parted git and prepare an upload. Fixed. Giuseppe.
reverted:
--- parted-1.8.8.git.2008.03.24/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/.gitignore
@@ -1,35 +0,0 @@
-*.o
-*~
-.deps
-.libs
-ABOUT-NLS
-ChangeLog
-INSTALL
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.cache
-config.h
-config.hin
-config.log
-config.status
-configure
-doc/C/po/parted.8.pot
-doc/pt_BR/parted.8.pt_BR.po
-gnulib/
-libparted.pc
-libparted/tests/init.sh
-libparted/tests/label
-libtool
-m4
-parted-*.tar.bz2
-parted-*.tar.bz2.sig
-parted-*.tar.gz
-parted-*.tar.gz.sig
-parted-*.xdelta
-parted-*.xdelta.sig
-parted.spec
-partprobe/partprobe
-stamp-h1
-tests/init.sh
reverted:
--- parted-1.8.8.git.2008.03.24/lib/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/lib/.gitignore
@@ -1,94 +0,0 @@
-*.la
-*.lo
-__fpending.c
-__fpending.h
-alloca.c
-alloca.h
-alloca_.h
-atexit.c
-basename.c
-calloc.c
-charset.alias
-close-stream.c
-close-stream.h
-closeout.c
-closeout.h
-config.charset
-config.h.in
-configmake.h
-dirname.c
-dirname.h
-error.c
-error.h
-exitfail.c
-exitfail.h
-free.c
-full-write.c
-full-write.h
-getopt.c
-getopt.h
-getopt1.c
-getopt_.h
-getopt_int.h
-gettext.h
-gnulib.mk
-inttypes.h
-inttypes_.h
-localcharset.c
-localcharset.h
-long-options.c
-long-options.h
-malloc.c
-memchr.c
-memcmp.c
-memcpy.c
-memmove.c
-memset.c
-quotearg.c
-quotearg.h
-realloc.c
-ref-add.sed
-ref-add.sin
-ref-del.sed
-ref-del.sin
-regcomp.c
-regex.c
-regex.h
-regex_internal.c
-regex_internal.h
-regexec.c
-rename.c
-rpmatch.c
-safe-read.c
-safe-read.h
-safe-write.c
-safe-write.h
-stdbool.h
-stdbool_.h
-stdint.h
-stdint_.h
-stdlib.h
-stdlib_.h
-strcspn.c
-string.h
-string_.h
-stripslash.c
-strndup.c
-strnlen.c
-strtod.c
-strtol.c
-unistd.h
-unistd_.h
-utime.c
-version-etc-fsf.c
-version-etc.c
-version-etc.h
-wchar.h
-wchar_.h
-wctype.h
-wctype_.h
-xalloc-die.c
-xalloc.h
-xmalloc.c
-xstrndup.c
-xstrndup.h
diff -u parted-1.8.8.git.2008.03.24/debian/changelog parted-1.8.8.git.2008.03.24/debian/changelog
--- parted-1.8.8.git.2008.03.24/debian/changelog
+++ parted-1.8.8.git.2008.03.24/debian/changelog
@@ -1,3 +1,13 @@
+parted (1.8.8.git.2008.03.24-9.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Merge from Ubuntu: debian/patches/parted-dmraid.dpatch: Patch to educate
+ libparted about dmraid arrays, which use device mapper. Libparted was
+ naming new partition nodes incorrectly, and not setting the UUIDs for
+ dmraid device nodes. (Closes: #497110)
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it> Sat, 06 Sep 2008 15:02:11 +0200
+
parted (1.8.8.git.2008.03.24-9) unstable; urgency=low
[ Otavio Salvador ]
diff -u parted-1.8.8.git.2008.03.24/debian/patches/00list parted-1.8.8.git.2008.03.24/debian/patches/00list
--- parted-1.8.8.git.2008.03.24/debian/patches/00list
+++ parted-1.8.8.git.2008.03.24/debian/patches/00list
@@ -5,6 +5,7 @@
# Patch susceptible to be merged upstream
devfs
#kfreebsd-gnu
+parted-dmraid
# Will also stay debian specific, but depends on some of the above :/
sparc-fix-raid
reverted:
--- parted-1.8.8.git.2008.03.24/build-aux/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/build-aux/.gitignore
@@ -1,14 +0,0 @@
-announce-gen
-compile
-config.guess
-config.rpath
-config.sub
-depcomp
-gnupload
-install-sh
-link-warning.h
-ltmain.sh
-mdate-sh
-missing
-mkinstalldirs
-texinfo.tex
reverted:
--- parted-1.8.8.git.2008.03.24/debug/clearfat/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/debug/clearfat/.gitignore
@@ -1 +0,0 @@
-clearfat
reverted:
--- parted-1.8.8.git.2008.03.24/parted/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/parted/.gitignore
@@ -1 +0,0 @@
-parted
reverted:
--- parted-1.8.8.git.2008.03.24/doc/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/doc/.gitignore
@@ -1,9 +0,0 @@
-C/log
-C/sync.1
-C/x.1
-C/x.pot
-parted.info
-pt_BR/parted.8
-pt_BR/partprobe.8
-stamp-vti
-version.texi
reverted:
--- parted-1.8.8.git.2008.03.24/libparted/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/libparted/.gitignore
@@ -1,2 +0,0 @@
-*.lo
-*.la
reverted:
--- parted-1.8.8.git.2008.03.24/po/.gitignore
+++ parted-1.8.8.git.2008.03.24.orig/po/.gitignore
@@ -1,18 +0,0 @@
-*.gmo
-*.po
-LINGUAS
-Makefile.in
-Makefile.in.in
-Makevars
-Makevars.template
-POTFILES
-Rules-quot
-boldquot.sed
-en@boldquot.header
-en@quot.header
-insert-header.sin
-parted.pot
-quot.sed
-remove-potcdate.sed
-remove-potcdate.sin
-stamp-po
only in patch2:
unchanged:
--- parted-1.8.8.git.2008.03.24.orig/debian/patches/parted-dmraid.dpatch
+++ parted-1.8.8.git.2008.03.24/debian/patches/parted-dmraid.dpatch
@@ -0,0 +1,171 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## parted-dmraid.dpatch by Luke Yelavich <themuso@ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch to ensure that device mapper devices for dmraid arrays do not
+## DP: have extra nodes created needlessly, as well as making sure that
+## DP: partition nodes for dmraid devices are not probed.
+
+@DPATCH@
+diff -urNad parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c parted-1.8.8.git.2008.03.24/libparted/arch/linux.c
+--- parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c 2006-05-08 20:08:37.000000000 +0200
++++ parted-1.8.8.git.2008.03.24/libparted/arch/linux.c 2008-09-06 21:20:09.000000000 +0200
+@@ -263,6 +263,10 @@
+
+ static char* _device_get_part_path (PedDevice* dev, int num);
+ static int _partition_is_mounted_by_path (const char* path);
++#ifdef ENABLE_DEVICE_MAPPER
++static int _is_dmraid_device (char* devpath);
++static int _is_dmraid_major(char* devpath);
++#endif
+
+ static int
+ _is_ide_major (int major)
+@@ -455,8 +459,16 @@
+ if (stat (buf, &st) != 0)
+ continue;
+
+- if (_is_dm_major(major(st.st_rdev)))
+- _ped_device_probe (buf);
++ if (_is_dm_major(major(st.st_rdev))) {
++ if (_is_dmraid_device(buf)) {
++ if (_is_dmraid_major(buf)) {
++ _ped_device_probe (buf);
++ }
++ } else {
++ _ped_device_probe (buf);
++ }
++ }
++
+ }
+ closedir (mapper_dir);
+
+@@ -2056,6 +2068,11 @@
+ * a pure userpace (udev) decision! */
+ snprintf (result, result_len, "%s-part%d", dev->path, num);
+ #endif
++#ifdef ENABLE_DEVICE_MAPPER
++ } else if (dev->type == PED_DEVICE_DM && _is_dmraid_device (dev->path)) {
++ snprintf (result, result_len, "%s%d", dev->path, num);
++#endif
++
+ } else if (dev->type == PED_DEVICE_DAC960
+ || dev->type == PED_DEVICE_CPQARRAY
+ || dev->type == PED_DEVICE_ATARAID
+@@ -2410,6 +2427,8 @@
+ char* vol_name = NULL;
+ char* dev_name = NULL;
+ char* params = NULL;
++ char* dm_uuid = NULL;
++ int uuid_len;
+
+ dev_name = _device_get_part_path (disk->dev, part->num);
+ if (!dev_name)
+@@ -2440,6 +2459,12 @@
+ dm_task_set_name (task, vol_name);
+ dm_task_add_target (task, 0, part->geom.length,
+ "linear", params);
++ if (_is_dmraid_device (disk->dev->path)) {
++ uuid_len = (strlen (vol_name) + 8);
++ dm_uuid = (char*) ped_malloc (uuid_len);
++ snprintf(dm_uuid, uuid_len, "DMRAID-%s", vol_name);
++ dm_task_set_uuid(task, dm_uuid);
++ }
+ rc = dm_task_run(task);
+ if (rc >= 0) {
+ //printf("0 %ld linear %s\n", part->geom.length, params);
+@@ -2447,6 +2472,8 @@
+ dm_task_destroy(task);
+ free(params);
+ free(vol_name);
++ if (dm_uuid)
++ ped_free(dm_uuid);
+ return 1;
+ } else {
+ _dm_remove_map_name(vol_name);
+@@ -2484,6 +2511,85 @@
+ }
+ return rc;
+ }
++
++/* Checks whether the given device-mapper device is part of a dmraid array,
++ * by checking for the string "DMRAID-" at the start of the UUID.
++ */
++static int
++_is_dmraid_device (char* devpath)
++{
++ struct dm_task* task = NULL;
++ int rc = 0;
++ const char* dmraid_uuid;
++ char* dm_name = NULL;
++
++ dm_name = strrchr (devpath, '/');
++ if (dm_name && *dm_name && *(++dm_name))
++ dm_name = strdup (dm_name);
++ else
++ dm_name = strdup (devpath);
++ if (!dm_name)
++ return 0;
++
++ task = dm_task_create(DM_DEVICE_DEPS);
++ if (!task)
++ return 0;
++
++ dm_task_set_name(task, dm_name);
++ rc = dm_task_run(task);
++ if (rc < 0) {
++ rc = 0;
++ goto err;
++ }
++ rc = 0;
++
++ dmraid_uuid = dm_task_get_uuid(task);
++ if (strncmp (dmraid_uuid, "DMRAID-", 7) == 0) {
++ rc = 1;
++ }
++
++err:
++ free (dm_name);
++ dm_task_destroy(task);
++ return rc;
++}
++
++/* Checks whether the given dmraid device node is a partition node, or the
++ * master node. This is done by checking the /sys/block directory for the node
++ * in question, to determine whether it is a slave of another device-mapper
++ * device. The node should be confirmed as a dmraid device by calling
++ * _is_dmraid_device first.
++ */
++static int
++_is_dmraid_major(char* devpath)
++{
++ DIR* sysfs_dir;
++ struct dirent* dent;
++ char dmraid_devpath [32];
++ struct stat st;
++
++ if (stat (devpath, &st) != 0)
++ return 0;
++
++ snprintf(dmraid_devpath, 32, "/sys/block/dm-%d/slaves", minor(st.st_rdev));
++
++ sysfs_dir = opendir (dmraid_devpath);
++ if (!sysfs_dir)
++ return 0;
++
++ while ((dent = readdir (sysfs_dir))) {
++ if (strcmp (dent->d_name, ".") == 0 ||
++ strcmp (dent->d_name, "..") == 0)
++ continue;
++
++ if (strncmp(dent->d_name, "dm-", 3) == 0)
++ return 0;
++ }
++ closedir (sysfs_dir);
++
++ return 1;
++}
++
+ #endif
+
+ static int
Attachment:
signature.asc
Description: OpenPGP digital signature