summaryrefslogtreecommitdiffstats
path: root/lib/libdisk/rules.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1995-04-29 07:21:14 +0000
committerphk <phk@FreeBSD.org>1995-04-29 07:21:14 +0000
commit9684e60aa333602d99d67bf4386e5ea09dd26530 (patch)
treefa70e13b20375cea9c33bb00b43511f4b3042b5e /lib/libdisk/rules.c
parent5cc2dacd0f6917d2ba5808d3171283232acad395 (diff)
downloadFreeBSD-src-9684e60aa333602d99d67bf4386e5ea09dd26530.zip
FreeBSD-src-9684e60aa333602d99d67bf4386e5ea09dd26530.tar.gz
Names are assigned when chunks are created.
Rules for only one fat & one extended in MBR.
Diffstat (limited to 'lib/libdisk/rules.c')
-rw-r--r--lib/libdisk/rules.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/lib/libdisk/rules.c b/lib/libdisk/rules.c
index 447c6de..9a53b4e 100644
--- a/lib/libdisk/rules.c
+++ b/lib/libdisk/rules.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: rules.c,v 1.1 1995/04/29 01:55:24 phk Exp $
+ * $Id: rules.c,v 1.2 1995/04/29 04:00:56 phk Exp $
*
*/
@@ -97,11 +97,59 @@ Rule_001(struct disk *d, struct chunk *c, char *msg)
}
}
+/*
+ * Rule#2:
+ * Max one 'fat' as child of 'whole'
+ */
+void
+Rule_002(struct disk *d, struct chunk *c, char *msg)
+{
+ int i;
+ struct chunk *c1;
+
+ if (c->type != whole)
+ return;
+ for (i=0, c1=c->part; c1; c1=c1->next) {
+ if (c1->type != fat)
+ continue;
+ i++;
+ }
+ if (i > 1) {
+ sprintf(msg+strlen(msg),
+ "Max one 'fat' allowed as child of 'whole'\n");
+ }
+}
+
+/*
+ * Rule#3:
+ * Max one extended as child of 'whole'
+ */
+void
+Rule_003(struct disk *d, struct chunk *c, char *msg)
+{
+ int i;
+ struct chunk *c1;
+
+ if (c->type != whole)
+ return;
+ for (i=0, c1=c->part; c1; c1=c1->next) {
+ if (c1->type != extended)
+ continue;
+ i++;
+ }
+ if (i > 1) {
+ sprintf(msg+strlen(msg),
+ "Max one 'extended' allowed as child of 'whole'\n");
+ }
+}
+
void
Check_Chunk(struct disk *d, struct chunk *c, char *msg)
{
Rule_000(d,c,msg);
Rule_001(d,c,msg);
+ Rule_002(d,c,msg);
+ Rule_003(d,c,msg);
if (c->part)
Check_Chunk(d,c->part,msg);
if (c->next)
OpenPOWER on IntegriCloud