コード例 #1
0
ファイル: basic.c プロジェクト: chutzimir/coda
int
main(int argc, char **argv)
{
    struct DiskPartition *dp;
    Inode testcreate;
    Device devno;
    int fd, count;
    char *buff="This is a test string";

    InitPartitions("vicetab");
    dp = VGetPartition("simpled");
    devno = dp->device;

    testcreate = icreate(devno, 0, 0, 0, 0, 0);
    printf("icreate returned: %d\n", testcreate);
    if ( testcreate == 0 )
	exit(1);
    
    fd = iopen(devno, testcreate, O_RDONLY);
    printf("iopen returned: %d\n", fd);
    if ( fd != -1 ) 
	close(fd);
    else 
	exit(2);

    count = iwrite(devno, testcreate, 0, 0, buff, strlen(buff));
    printf("iwrite returned %d (of %d)\n", count, strlen(buff));

    printnames(VGetPartition("/tmp/f"), 0, 1, 64);
    dp = VGetPartition("/tmp/f");
    devno = dp->device;
    testcreate = icreate(devno, 0, 0, 0, 0, 0);
    printf("icreate returned: %d\n", testcreate);
    if ( testcreate == 0 )
	exit(1);
    
    fd = iopen(devno, testcreate, O_RDONLY);
    printf("iopen returned: %d\n", fd);
    if ( fd != -1 ) 
	close(fd);
    else 
	exit(2);

    count = iwrite(devno, testcreate, 0, 0, buff, strlen(buff));
    printf("iwrite returned %d (of %d)\n", count, strlen(buff));
    
    return 0;
}
コード例 #2
0
ファイル: IDEHD.C プロジェクト: jdsm81/HelloX_Kernel
//The main entry point of WINHD driver.
BOOL IDEHdDriverEntry(__DRIVER_OBJECT* lpDrvObj)
{
	__PARTITION_EXTENSION *pPe = NULL;
	UCHAR Buff[512];

	//Set operating functions for lpDrvObj first.
	lpDrvObj->DeviceRead    = DeviceRead;
	lpDrvObj->DeviceWrite   = DeviceWrite;
	lpDrvObj->DeviceCtrl    = DeviceCtrl;

	//Read the MBR from first HD.
	if(!ReadSector(0,0,1,(BYTE*)&Buff[0]))
	{
		_hx_printf("Can not read MBR from HD [0].\r\n");
		return FALSE;
	}

	//Analyze the MBR and try to find any file partitions in HD.
	InitPartitions(0,(BYTE*)&Buff[0],lpDrvObj);
	return TRUE;
}
コード例 #3
0
ファイル: scaninodes.c プロジェクト: chutzimir/coda
int
main(int argc, char **argv)
{
    struct DiskPartition *dp;
    Inode testcreate;
    Device devno;
    int fd, count, i, rc;
    char *buff="This is a test string";

    InitPartitions("vicetab");
    
    if ( argc != 2 ) {
	printf("Usage %s dir.\n", argv[1]);
	exit(1);
    }

    dp = VGetPartition(argv[1]);
    devno = dp->device;

    rc = dp->ops->ListCodaInodes(dp, "/tmp/inodeinfo", NULL, 0);
    
    return rc;
}