Beispiel #1
0
int mount( int argc, char **argv )
{
  /* show a little bit of information */
  printf( "trying to initalize device %s\n", devname );

  /* init the ATA Device (Bus 0, Device 0 => Primary Master) */
  ata_device= ataDevCreate( 0, 0, 0, 63 );

  /*
  dosFsMkfsOptionsSet(DOS_OPT_LONGNAMES);
  hd_volume= dosFsMkfs( devname, ata_device );
  */
 
  /* init the Dos FS on the newly created device */
  hd_volume= dosFsDevInit( devname, ata_device, NULL );

  /* display the configuration data of the newly createtd device on stdio */
  dosFsShow( devname, 0 );
 
  return 0;
}
Beispiel #2
0
STATUS
flashFsLibInit(void)
{
#ifndef BUILD_VXBOOT
    CBIO_DEV_ID pCbio;
    int    dosFsCacheSizeDefault       = 128 * 1024 ;
#endif
    int         bootSize, bootOffset;

    /* 
     * We are considered initialized once flashDosVolDesc is non-NULL.
     */    
    if (flashDosVolDesc) {
	return OK;
    }

    if (flashDrvLibInit() == ERROR) {
	printf("flashFsLibInit(): flashDrvLibInit() failed\n");
	return (ERROR);
    }

#ifndef BUILD_VXBOOT
    /* All Keystone platform are the same */
        flsh_boot_size = 1024;
#endif

    /* Find boot partition */
    flashFsFindBootPartition(&bootSize, &bootOffset);
    /* Find vxworks filesystem partition */
    flashFsFindVxworksPartition(&bootSize, &bootOffset);

    /* 
     * Set up BLK DEV structure
     */

    flashBlkDev.bd_blkRd = flashFsBlkRead;
    flashBlkDev.bd_blkWrt = flashFsBlkWrite;
    flashBlkDev.bd_ioctl = flashFsIoctl;
    flashBlkDev.bd_reset = NULL;
    flashBlkDev.bd_statusChk = NULL;
    flashBlkDev.bd_removable = FALSE;
    flashBlkDev.bd_nBlocks = FLASH_FS_SIZE_BLOCKS;
    flashBlkDev.bd_bytesPerBlk = FLASH_FS_BLOCK_SIZE;
    flashBlkDev.bd_blksPerTrack = 1;
    flashBlkDev.bd_nHeads = 1;
    flashBlkDev.bd_retry = 1;
    flashBlkDev.bd_mode = O_RDWR;
    flashBlkDev.bd_readyChanged = FALSE;

    if (flashFsVerbose) {
	printf("flashFsLibInit: Initializing\n");
    }
#if !defined(BUILD_VXBOOT)
    if (!flashDosFormat) {
        
        if ( (pCbio = dcacheDevCreate( (CBIO_DEV_ID) &flashBlkDev, NULL,
            dosFsCacheSizeDefault, FLASH_FS_NAME)) == NULL )
            return (ERROR);
        
        if (dosFsDevCreate(FLASH_FS_NAME, pCbio, 
                           NUM_DOSFS_FILES, NONE)) {
            printf("Failed to create DOS file device \n");
            return (ERROR);
        }
    
        flashDosVolDesc = dosFsVolDescGet(FLASH_FS_NAME, NULL);
    
        if (flashDosVolDesc == NULL) {
            if (flashFsVerbose) {
                printf("\nflashFsLibInit: first time initialization...\n");
            }
    
            dosFsVolFormat(FLASH_FS_NAME, DOS_OPT_DEFAULT, NULL);
            flashDosVolDesc = dosFsVolDescGet(FLASH_FS_NAME, NULL);
            if (flashDosVolDesc == NULL) {
                printf("Failed to Format DOS file device \n");
                return (ERROR);
            }
        }
        
        if (flashFsVerbose) {
            dosFsShow(FLASH_FS_NAME, DOS_CHK_VERB_2);
        } 
    }
#endif 
   if (flashFsVerbose) {
	printf("done\n");
    }

    flashFsSync();
 
    return OK;
}