summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-10-10 08:00:19 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-10-10 08:00:19 +0000
commit7cefd9e944d4b9d786487a3adaaa6afdc7bc84db (patch)
tree8c315ebd7bb305186926cf56bbdff8e86e5445a2 /debian/patches
parent77040b11124d436e36c03ed94080c15684e6349b (diff)
removing superblock overlap patch
Diffstat (limited to 'debian/patches')
-rwxr-xr-xdebian/patches/50-superblock-partition-limit.dpatch128
1 files changed, 0 insertions, 128 deletions
diff --git a/debian/patches/50-superblock-partition-limit.dpatch b/debian/patches/50-superblock-partition-limit.dpatch
deleted file mode 100755
index 6e5df0a7..00000000
--- a/debian/patches/50-superblock-partition-limit.dpatch
+++ /dev/null
@@ -1,128 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 50-superblock-partition-limit.dpatch by martin f. krafft <madduck@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
-@DPATCH@
-diff -urNad mdadm.git~/config.c mdadm.git/config.c
---- mdadm.git~/config.c 2006-09-20 17:53:00.863178469 +0200
-+++ mdadm.git/config.c 2006-09-21 15:35:17.513157034 +0200
-@@ -219,31 +219,105 @@
- char *name;
- } *cdevlist = NULL;
-
-+char* skipblanks(char* buf)
-+{
-+ if (!buf) return buf;
-+ while (*buf != '\0' && isblank(*buf)) ++buf;
-+ return buf;
-+}
-+
-+char* skipnonblanks(char* buf)
-+{
-+ if (!buf) return buf;
-+ while (*buf != '\0' && !isblank(*buf)) ++buf;
-+ return buf;
-+}
-+
-+char* skipdigits(char* buf)
-+{
-+ if (!buf) return buf;
-+ while (*buf != '\0' && isdigit(*buf)) ++buf;
-+ return buf;
-+}
-+
- mddev_dev_t load_partitions(void)
- {
- FILE *f = fopen("/proc/partitions", "r");
-- char buf[1024];
-+ char buf[1024], last_device_name[1024];
-+ int last_major = -1;
- mddev_dev_t rv = NULL;
- if (f == NULL) {
- fprintf(stderr, Name ": cannot open /proc/partitions\n");
- return NULL;
- }
-- while (fgets(buf, 1024, f)) {
-- int major, minor;
-- char *name, *mp;
-+ while (!feof(f) && fgets(buf, 1024, f)) {
-+ unsigned long major, minor;
-+ char *name, *kernel_name, *mp, *ptr;
- mddev_dev_t d;
-
-- buf[1023] = '\0';
-- if (buf[0] != ' ')
-- continue;
-+ /*
-+ * All partition lines start with a space.
-+ */
-+ if (buf[0] != ' ') continue;
-+
-+ /*
-+ * Chop at the end of each line.
-+ */
-+ ptr = strchr(buf, '\n');
-+ if (ptr) *ptr = '\0';
-+
-+ /*
-+ * Extract the major and minor numbers and obtain the device node name.
-+ * 10 is the max number of digits expected in a major/minor number
-+ * (32bit).
-+ */
- major = strtoul(buf, &mp, 10);
-- if (mp == buf || *mp != ' ')
-- continue;
-- minor = strtoul(mp, NULL, 10);
-+ if (mp == buf || *mp != ' ') continue;
-+ mp = skipblanks(mp);
-+ minor = strtoul(mp, &mp, 10);
-+ mp = skipblanks(mp);
-
- name = map_dev(major, minor, 1);
-- if (!name)
-- continue;
-+ if (!name) continue;
-+
-+ /*
-+ * mp now points at the third field, which is digits only. We thus skip
-+ * all spaces and digits to reach the forth field.
-+ */
-+ mp = skipdigits(mp);
-+ mp = skipblanks(mp);
-+
-+ /*
-+ * Now the cursor is at the beginning to the kernel name, so we point
-+ * there and terminate the string on the first space character.
-+ */
-+ kernel_name = mp;
-+ mp = skipnonblanks(mp);
-+ *mp = '\0';
-+
-+ /*
-+ * Check if this could be a partition of the previous device
-+ * (the disk _always_ comes just before the first partition, cf.
-+ * /usr/src/linux/fs/partitions/check.c)
-+ */
-+ if (major == last_major && strlen(kernel_name) > strlen(last_device_name) &&
-+ strncmp(kernel_name, last_device_name, strlen(last_device_name)) == 0 &&
-+ isdigit(kernel_name[strlen(kernel_name) - 1])) {
-+ /*
-+ * The previous device appears to have a partition table, so delete it
-+ * so it isn't scanned for a superblock. This makes sure we don't get
-+ * confused when a partition with an md superblock lives very close to
-+ * the end of a disk.
-+ */
-+ d = rv->next;
-+ free(rv->devname);
-+ free(rv);
-+ rv = d;
-+ }
-+
-+ last_major = major;
-+ strcpy(last_device_name, kernel_name);
-+
- d = malloc(sizeof(*d));
- d->devname = strdup(name);
- d->next = rv;