"max one 'fat' allowed as child of whole"

Walt Haynes whaynes at ptd.net
Thu Dec 23 08:45:00 PST 2004


    I found the following as the result of a search for the string "max one 'fat' allowed" at the following URL:

http://www.watson.org/~arr/sri-audit/src/lib/libdisk/rules.c


/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk at login.dknet.dk> wrote this file.  As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $FreeBSD$
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/diskslice.h>
#include <sys/disklabel.h>
#include <err.h>
#include "libdisk.h"

int
Track_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect)
return 1;
if (offset % d->bios_sect)
return 0;
return 1;
}

u_long
Prev_Track_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect)
return offset;
return (offset / d->bios_sect) * d->bios_sect;
}

u_long
Next_Track_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect)
return offset;
return Prev_Track_Aligned(d,offset + d->bios_sect-1);
}

int
Cyl_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect || !d->bios_hd)
return 1;
if (offset % (d->bios_sect * d->bios_hd))
return 0;
return 1;
}

u_long
Prev_Cyl_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect || !d->bios_hd)
return offset;
return (offset / (d->bios_sect*d->bios_hd)) * d->bios_sect * d->bios_hd;
}

u_long
Next_Cyl_Aligned(struct disk *d, u_long offset)
{
if (!d->bios_sect || !d->bios_hd)
return offset;
return Prev_Cyl_Aligned(d,offset + (d->bios_sect * d->bios_hd)-1);
}

/*



/*
* 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");
}
}

/*


I don't understand what this means; does it imply that you can't have a multiple operating system with a non-FreeBSD OS ? I have Windows XP Professional in primary partition 1 of 4 primary partitions on my hard drive. Partitions 2 and 4 are available to accept FreeBSD but won't because of that "max one 'fat' allowed as child of whole" message. Is there a circumvention to this problem ?


More information about the freebsd-questions mailing list