rpms/util-linux-ng/devel util-linux-ng-2.13-blockdev-rmpart.patch, NONE, 1.1 util-linux-ng.spec, 1.1, 1.2

Karel Zak (kzak) fedora-extras-commits at redhat.com
Mon Aug 20 11:23:15 UTC 2007


Author: kzak

Update of /cvs/pkgs/rpms/util-linux-ng/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22520

Modified Files:
	util-linux-ng.spec 
Added Files:
	util-linux-ng-2.13-blockdev-rmpart.patch 
Log Message:
* Mon Aug 20 2007 Karel Zak <kzak at redhat.com> 2.13-0.54
- port "blockdev --rmpart" patch from util-linux
- use same Provides/Obsolete setting like in util-linux


util-linux-ng-2.13-blockdev-rmpart.patch:

--- NEW FILE util-linux-ng-2.13-blockdev-rmpart.patch ---
--- util-linux-ng-2.13-rc3/disk-utils/blockdev.c.kzak	2007-08-01 15:40:21.000000000 +0200
+++ util-linux-ng-2.13-rc3/disk-utils/blockdev.c	2007-08-13 12:31:47.000000000 +0200
@@ -32,6 +32,28 @@
 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
 #endif
 
+#ifndef BLKPG
+#define BLKPG _IO(0x12,105)
+#define BLKPG_DEL_PARTITION 2
+#define BLKPG_DEVNAMELTH 64
+#define BLKPG_VOLNAMELTH 64
+
+struct blkpg_partition {
+	long long start;
+	long long length;
+	long long pno;
+	char devname[BLKPG_DEVNAMELTH];
+	char volname[BLKPG_VOLNAMELTH];
+};
+
+struct blkpg_ioctl_arg {
+	int op;
+	int flags;
+	int datalen;
+	void *data;
+};
+#endif
+
 /* Maybe <linux/hdreg.h> could be included */
 #ifndef HDIO_GETGEO
 #define HDIO_GETGEO 0x0301
@@ -104,6 +126,10 @@
 	{ "--rereadpt", "BLKRRPART", BLKRRPART, ARGNONE, 0, NULL,
 	  N_("reread partition table") },
 #endif
+#ifdef BLKPG
+	{ "--rmpart", "BLKPG", BLKPG, ARGINTAP, 0, "PARTNO", N_("disable partition") },
+	{ "--rmparts", "BLKPG", BLKPG, ARGNONE, 0, NULL, N_("disable all partitions") },
+#endif
 };
 
 #define SIZE(a)	(sizeof(a)/sizeof((a)[0]))
@@ -163,6 +189,35 @@
 	return 0;
 }
 
+#ifdef BLKPG
+static int
+disable_partition(int fd, int partno) {
+	struct blkpg_partition part = {
+		.pno = partno,
+	};
+	struct blkpg_ioctl_arg io = {
+		.op = BLKPG_DEL_PARTITION,
+		.datalen = sizeof(part),
+		.data = &part,
+	};
+	int res;
+
+	res = ioctl(fd, BLKPG, &io);
+	if (res < 0)
+		return 0;
+	return 1;
+}
+
+static int
+disable_partitions(int fd) {
+	int p, res = 0;
+
+	for (p = 1; p <= 256; p++)
+		res += disable_partition(fd, p);
+	return res ? 0 : -1;
+}
+#endif
+
 void do_commands(int fd, char **argv, int d);
 void report_header(void);
 void report_device(char *device, int quiet);
@@ -280,6 +335,12 @@
 		switch(bdcms[j].argtype) {
 		default:
 		case ARGNONE:
+#ifdef BLKPG
+			if (bdcms[j].ioc == BLKPG) {
+				res = disable_partitions(fd);
+				break;
+			}
+#endif
 			res = ioctl(fd, bdcms[j].ioc, 0);
 			break;
 		case ARGINTA:
@@ -297,6 +358,13 @@
 					bdcms[j].name);
 				usage();
 			}
+#ifdef BLKPG
+			if (bdcms[j].ioc == BLKPG) {
+				iarg = atoi(argv[++i]);
+				res = disable_partition(fd, iarg) ? 0 : -1;
+				break;
+			}
+#endif
 			iarg = atoi(argv[++i]);
 			res = ioctl(fd, bdcms[j].ioc, &iarg);
 			break;


Index: util-linux-ng.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/devel/util-linux-ng.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util-linux-ng.spec	20 Aug 2007 10:48:20 -0000	1.1
+++ util-linux-ng.spec	20 Aug 2007 11:22:42 -0000	1.2
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux-ng
 Version: 2.13
-Release: 0.53%{?dist}
+Release: 0.54%{?dist}
 License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain
 Group: System Environment/Base
 URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
@@ -53,13 +53,13 @@
 
 # old versions of util-linux have been splited to more sub-packages
 Obsoletes: mount <= 2.11, losetup <= 2.11
-Provides: mount = 2.11, losetup = 2.11
+Provides: mount = %{version}, losetup = ${version}
 # Robert Love's schedutils have been merged to util-linux-2.13-pre1
 Obsoletes: schedutils <= 1.5
-Provides: schedutils = 1.5
+Provides: schedutils = %{version}
 # fork and rename from util-linux to util-linux-ng
 Obsoletes: util-linux <= 2.13.0.99
-Provides: util-linux = 2.13.0.99
+Provides: util-linux = %{version}
 
 Requires(preun): /sbin/install-info
 Requires(post): /sbin/install-info
@@ -95,6 +95,8 @@
 Patch10: util-linux-ng-2.13-swapon-swsuspend.patch
 # add a missing header
 Patch11: util-linux-ng-2.13-floppy-locale.patch
+# remove partitions
+Patch12: util-linux-ng-2.13-blockdev-rmpart.patch
 
 
 %description
@@ -119,6 +121,7 @@
 %patch9 -p1
 %patch10 -p1
 %patch11 -p1
+%patch12 -p1
 
 %build
 unset LINGUAS || :
@@ -510,6 +513,10 @@
 /sbin/losetup
 
 %changelog
+* Mon Aug 20 2007 Karel Zak <kzak at redhat.com> 2.13-0.54
+- port "blockdev --rmpart" patch from util-linux
+- use same Provides/Obsolete setting like in util-linux
+
 * Wed Aug 15 2007 Karel Zak <kzak at redhat.com> 2.13-0.53
 - fix #252046 - review Request: util-linux-ng (util-linux replacement)
 




More information about the fedora-extras-commits mailing list