Beispiel #1
0
/* Scan for partitions on a given unit. */
USHORT InitScanPartitions (PADDEntryPoint pAddEP)
{
 static MBR	BootRecord= {0};
 NPBaseUnitRec	pBaseUnit;
 USHORT		UnitHandle;
 USHORT		Result;
 int		FoundExt;
 int		NumAdded;
 int		Count;
 PARTITIONENTRY	*pPartInfo;
 ULONG		PartRBA= 0;
 ULONG		ExtPartRBA= 0;

 pBaseUnit= BaseUnits+NumBaseUnits-1;
 UnitHandle= pBaseUnit->UnitHandle;
 NumAdded= 0;					/* Number partitions added */
						/* to partition list */
 InitPrintVerbose ("Reading master boot record.");
 do
 {
  FoundExt= 0;
  if (InitReadSector (pAddEP,UnitHandle,PartRBA,
                      ppDataSeg+((USHORT)&BootRecord)))
  {						/* If error reading sector */
   InitPrint ("Read failure... :-(");
   break;					/* Done with this unit */
  }
  if (BootRecord.Signature!=0xAA55)		/* Test MBR signature */
  {
   InitPrint ("Invalid signature in partition table.");
   break;					/* Done with this unit */
  }
  pPartInfo= BootRecord.PartitionTable;		/* Ptr to partition entry */
  
  for (Count=0;Count<4;Count++)		/* Scan for linux partitions... */
   if (InitIsVirtType(pPartInfo[Count].SysIndicator))
   {
    InitPrintVerbose ("Found a partition to virtualize.");
    NumAdded+= InitAddVirtualUnit (PartRBA+pPartInfo[Count].RelativeSectors,
                                   pPartInfo[Count].NumSectors,
                                   pPartInfo[Count].SysIndicator);
   }
  for (Count=0;Count<4;Count++)		/* Scan for extended partitions... */
   if (pPartInfo[Count].SysIndicator==PARTITION_EXTENDED)
   {
    InitPrintVerbose ("Found an extended partition.");
    FoundExt= 1;
    PartRBA= ExtPartRBA+ pPartInfo[Count].RelativeSectors;
    if (!ExtPartRBA) ExtPartRBA= PartRBA;
   }
 } while (FoundExt);
 return NumAdded;
}
Beispiel #2
0
/*
**    PrintPresentation() prints the presentation stored in the global
**    variable Pres.
*/
void    PrintPresentation(FILE *fp) {
	gen     g;
	int     r;

	InitPrint(fp);

	if (Pres.nragens == 0) return;

	/* Open the presentation. */
	fprintf(OutFp, "< ");

	/* Print the generators first. */
	PrintGen(1);
	for (g = 2; g <= (gen)Pres.nragens; g++) {
		fprintf(OutFp, ", ");
		PrintGen(g);
	}

	if (Pres.nrigens > 0) {
		fprintf(OutFp, "; ");
		PrintGen(Pres.nragens + 1);
		for (g = Pres.nragens + 2; g <= (gen)(Pres.nragens + Pres.nrigens); g++) {
			fprintf(OutFp, ", ");
			PrintGen(g);
		}
	}

	/* Now the delimiter. */
	fprintf(OutFp, " |\n");

	/* Now the relations. */
	if (Pres.rels[0] != (node *)0) {
		fprintf(OutFp, "    ");
		PrintNode(Pres.rels[0]);
	}
	for (r = 1; Pres.rels[r] != (node *)0; r++) {
		fprintf(OutFp, ",\n    ");
		PrintNode(Pres.rels[r]);
	}

	/* And close the presentation. */
	fprintf(OutFp, " >\n");
}
Beispiel #3
0
void InitPrintVerbose (char FAR *Message)
{
 if (InstallFlags&FI_VERBOSE)
  InitPrint (Message);
}
Beispiel #4
0
/* Initialization function for the driver. Only called once. */
void E2Init (PRPINITOUT Req)
{
 int		UnitCount;
 char FAR	*pCmdLine;

 /* Initialize some of the important global variables. */
 DevHelp= ((PRPINITIN) Req)->DevHlpEP;		/* Get pointer to DevHelp */
 pDataSeg= (PVOID) &pDataSeg;			/* Get pointer to data seg */
 OFFSETOF(pDataSeg)= 0;
 VirtToPhys (pDataSeg,&ppDataSeg);		/* Get the physical address */
						/* of the data segment */
 for (MountCount= 0; MountCount<MAX_LINUX_PARTITIONS; MountCount++)
  MountTable[MountCount]= MountCount;
 						/* MountCount= max num of */
						/* partitions to mount. */

 pCmdLine= ((PRPINITIN) Req)->InitArgs;		/* Get command line args */
 OFFSETOF(pCmdLine)=(USHORT) ((PDDD_PARM_LIST) pCmdLine)->cmd_line_args;

 ProcessCmdline (pCmdLine);
 InitPrint ("Linux partition filter. (C) Deon van der Westhuysen. v1.2\n\r"
            "Development version (Alpha).\n\r");

 InitScanDrivers();				/* Scan for partitions... */
 InitGetUnitFS();				/* Determine FS for each unit */
 InitSortUnits();				/* Sort the units */

 if (MountCount>NumVirtUnits)			
  MountCount =NumVirtUnits;			/* Get correct number of */
						/* units to be mounted. */

 /* Check that each entry points to a valid unit. If not valid, point to */
 /* first unit. (Which can only be allocated once, thus one drive letter.) */
 for (UnitCount=0;UnitCount<MountCount;UnitCount++)
  if (MountTable[UnitCount]>=NumVirtUnits)
   MountTable[UnitCount]= 0;

 if (!NumVirtUnits)
 {
  InitPrint ("No Linux partitions were found: filter not installed.");
  Req->Unit= 0;
  Req->CodeEnd= 0;				/* No code to keep */
  Req->DataEnd= 0;				/* No data to keep */
  Req->rph.Status= STDON+STERR+ERROR_I24_QUIET_INIT_FAIL;
						/* Indicate failure */
  return;
 }

 ADDHandle= RegisterADD (E2FilterIORBWrapper,FILTER_ADD_NAME);
						/* Register filter */
 if (!ADDHandle)				/* Check registration */
 {
  InitPrint ("Could't register filter. Installation aborted.");
  while (NumBaseUnits) InitRemoveBaseUnit();	/* Free all base units */
  Req->Unit= 0;
  Req->CodeEnd= 0;				/* No code to keep */
  Req->DataEnd= 0;				/* No data to keep */
  Req->rph.Status= STDON+STERR+ERROR_I24_QUIET_INIT_FAIL;
						/* Indicate failure */
  return;
 }

 for (UnitCount= 0; UnitCount<NumBaseUnits; UnitCount++)
  InitFilterBaseUnit (UnitCount);		/* Filter all base units... */

 InitPrintVerbose ("Filter installed.");
 Req->Unit= 0;

 Req->CodeEnd= ((USHORT)E2Init);		/* Pointer to end of code */
 Req->DataEnd= ((USHORT)&StartInitData);	/* Pointer to end of data */
 Req->rph.Status= STDON;			/* Everything is OK */
}