📄 usrtffs.c
字号:
/* usrTffs.c - TFFS initialization *//* Copyright 1992-1997 Wind River Systems, Inc. *//*modification history--------------------01e,02feb99,yp added function usrTffsLnConfig() to support DOS_OPT_LONGNAMES01d,01apr98,hdn moved tffsLoad() back to bootConfig.c.01c,31dec97,yp doc cleanup01b,01dec97,hdn added tffsLoad() to minimize change to bootConfig.c.01a,07nov97,hdn written.*//*DESCRIPTIONThis file is included by bootConfig.c and usrConfig.c. The file containsroutines for configuring a TFFS Flash disk to be used as file system aswith dosFs. The routines are used by the boot process to find and loadvxWorks images. SEE ALSO: usrExtra.cNOMANUAL*/#ifndef __INCusrTffs#define __INCusrTffs/* includes */#include "tffs/tffsDrv.h"#include "tffs/flsocket.h"/* forward declarations *//********************************************************************************* usrTffsConfig - mount the DOS file system on a TFFS Flash disk** This routine mounts the vxWorks DOS file system on a TFFS Flash drive.** The <drive> parameter is the drive number of the TFFS Flash drive;* valid values are 0 through the number of socket interfaces in BSP.** The <fileName> parameter is the mount point, e.g., `/tffs0/'.** RETURNS: OK or ERROR.** SEE ALSO:* .pG "I/O System, Local File Systems"*/STATUS usrTffsConfig ( int drive, /* drive number of TFFS */ int removable, /* 0 - nonremovable flash media */ char * fileName /* mount point */ ) { BLK_DEV * pBootDev; char bootDir [BOOT_FILE_LEN]; if ((UINT)drive >= noOfDrives) { printErr ("drive is out of range (0-%d).\n", noOfDrives - 1); return (ERROR); } /* create a block device spanning entire disk (non-distructive!) */ if ((pBootDev = tffsDevCreate (drive, removable)) == NULL) { printErr ("tffsDevCreate failed.\n"); return (ERROR); } /* split off boot device from boot file */ devSplit (fileName, bootDir); /* initialize the boot block device as a dosFs device named <bootDir> */ if (dosFsDevInit (bootDir, pBootDev, NULL) == NULL) { printErr ("dosFsDevInit failed.\n"); return (ERROR); } return (OK); }/********************************************************************************* usrTffsLnConfig - mount the DOS file system long names support** This routine mounts the vxWorks DOS file system disabling TrueFFS FAT* monitoring and supporting the vxWorks DOS_OPT_LONGNAMES on a TFFS Flash* drive. Disabling FAT monitoring results in considerable ferformance loss* but is required to support the "vxWorks long file names". This is an * alternative to usrTffsConfig.** The <drive> parameter is the drive number of the TFFS Flash drive;* valid values are 0 through the number of socket interfaces in BSP.** The <fileName> parameter is the mount point, e.g., `/tffs0/'.** RETURNS: OK or ERROR.** SEE ALSO:* .pG "I/O System, Local File Systems"*/STATUS usrTffsLnConfig ( int drive, /* drive number of TFFS */ int removable, /* 0 - nonremovable flash media */ char * fileName /* mount point */ ) { BLK_DEV * pBootDev; char bootDir [BOOT_FILE_LEN]; if ((UINT)drive >= noOfDrives) { printErr ("drive is out of range (0-%d).\n", noOfDrives - 1); return (ERROR); } /* create a block device spanning entire disk (non-distructive!) */ if ((pBootDev = tffsDevCreate (drive, removable)) == NULL) { printErr ("tffsDevCreate failed.\n"); return (ERROR); } /* disable FAT monitoring so vxWorks long file names can work */ if (tffsDevOptionsSet ((TFFS_DEV *) pBootDev) != OK) { printErr ("unable to disable FAT monitoring \n"); return (ERROR); } /* split off boot device from boot file */ devSplit (fileName, bootDir); /* Set up long file name support in DOS*/ if (dosFsMkfsOptionsSet (DOS_OPT_LONGNAMES) != OK) { printErr ("failed to set DOS_OPT_LONGNAMES\n"); return (ERROR); } /* initialize the device as a dosFs device named <bootDir> */ if (dosFsMkfs (bootDir, pBootDev) == NULL) { printErr ("dosFsMkfs failed.\n"); return (ERROR); } return (OK); }#endif /* __INCusrTffs */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -