📄 usrdosfsold.c
字号:
) { DOS_VOL_DESC * pVolDesc; /* pointer to dummy volume descriptor */ int options; dosFsDateTimeSet() ; if ( (dosFsMkfsOptions & DOS_OPT_LONGNAMES) == 0 ) options = DOS_OPT_DEFAULT; else options = DOS_OPT_VXLONGNAMES; /* Init as dosFs device */ if ( (pVolDesc = dosFsDevInit (pVolName, pBlkDev, NULL)) == NULL ) return (NULL); /* Init dosFs structures on disk */ if (dosFsVolFormat (pVolName, options, NULL) != OK) return NULL; return (pVolDesc); } /* dosFsMkfs *//********************************************************************************* dosFsMkfsOptionsSet - specify volume options for dosFsMkfs()** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** This routine allows long filenames volume option to be set that will be * enabled by subsequent calls to dosFsMkfs(). The value of <options> * will be used for all volumes that are initialized by dosFsMkfs().** RETURNS: OK always.** SEE ALSO: dosFsMkfs(), dosFsVolOptionsSet()* */STATUS dosFsMkfsOptionsSet ( UINT options /* options for future dosFsMkfs() calls */ ) { dosFsMkfsOptions = options; /* change options */ return (OK); } /* dosFsMkfsOptionsSet *//********************************************************************************* dosFsConfigInit - initialize dosFs volume configuration structure** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** Since dosFsDevInit() routine does not take care about the <pConfig> parameter* now, this routine just return OK.** RETURNS: OK always.** SEE ALSO: dosFsDevInit()*/STATUS dosFsConfigInit ( DOS_VOL_CONFIG * pConfig, /* pointer to volume config structure */ char mediaByte, /* media descriptor byte */ UINT8 secPerClust, /* sectors per cluster */ short nResrvd, /* number of reserved sectors */ char nFats, /* number of FAT copies */ UINT16 secPerFat, /* number of sectors per FAT copy */ short maxRootEnts, /* max number of entries in root dir */ UINT nHidden, /* number of hidden sectors */ UINT options /* volume options */ ) { return (OK); } /* dosFsConfigInit *//********************************************************************************* dosFsConfigGet - obtain dosFs volume configuration values** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** Since dosFsDevInit() routine does not take care about the <pConfig> parameter* now, this routine just return OK.** RETURNS: OK always.**/STATUS dosFsConfigGet ( DOS_VOL_DESC * pVolDesc, /* pointer to volume descriptor */ DOS_VOL_CONFIG * pConfig /* ptr to config structure to fill */ ) { return (OK); } /* dosFsConfigGet *//********************************************************************************* dosFsConfigShow - display dosFs volume configuration data** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** This routine obtains the dosFs volume configuration for the named* device, formats the data, and displays it on the standard output.** If no device name is specified, the current default device is described.** RETURNS: OK or ERROR.**/STATUS dosFsConfigShow ( char *pDevName /* name of device */ ) { return dosFsShow (pDevName, 1); } /* dosFsConfigShow *//********************************************************************************* dosFsModeChange - modify the mode of a dosFs volume** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** This routine do nothing, because O_RDONLY mod is not implemented in the * current release.** RETURNS: N/A* * SEE ALSO: dosFsReadyChange()*/void dosFsModeChange ( DOS_VOL_DESC * pVolDesc, /* pointer to volume descriptor */ int newMod /* O_RDONLY/O_WRONLY/O_RDWR (both) */ ) { return; /* not implemented yet */ } /* dosFsModeChange *//********************************************************************************* dosFsReadyChange - notify dosFs of a change in ready status** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** Since the Disk Cache module takes care about disk removal now, this routine * do nothing.** RETURNS: N/A*/void dosFsReadyChange ( DOS_VOL_DESC * pVolDesc /* pointer to volume descriptor */ ) { return; /* unnecessary in new DosFs design */ } /* dosFsReadyChange *//********************************************************************************* dosFsVolOptionsGet - get current dosFs volume options ** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** The main purpose of this routine is to allow dosFsVolOptionsSet() setting of * the desired options without clearing of another ones.* Since the volume options which might be specified in the dosFsVolOptionsSet() * call are inapplicable now, this routine just stores zero in the field pointed * to by <pOptions> and return OK.** RETURNS: OK, always.** SEE ALSO: dosFsVolOptionsSet()**/STATUS dosFsVolOptionsGet ( DOS_VOL_DESC * pVolDesc, /* pointer to volume descriptor */ UINT * pOptions /* where to put current options value */ ) { *pOptions = 0; return (OK); /* N/A for new DosFs design */ } /* dosFsVolOptionsGet *//********************************************************************************* dosFsVolOptionsSet - set dosFs volume options ** This function is part of the backward compatibility library delivered* with the new MS-DOS file system. It is intended to provide the same* interface as the old version of the MS-DOS file system.** Since the volume options which might be specified in this call are * inapplicable now, this routine just returns OK.* * DOS_OPT_CHANGENOWARN - detection of replaced removable disk is automatically* performed by the Disk Cache module.* DOS_OPT_AUTOSYNC - set <syncInterval> parameter of dcacheDevTune() * procedure to 0 to achieve similar behavior.** RETURNS: OK, always.** SEE ALSO: dosFsDevInitOptionsSet(), dosFsMkfsOptionsSet(), * dosFsVolOptionsGet()**/STATUS dosFsVolOptionsSet ( DOS_VOL_DESC * pVolDesc, /* pointer to volume descriptor */ UINT options /* new options for volume */ ) { return (OK); /* N/A for new DosFs design */ } /* dosFsVolOptionsSet *//********************************************************************************* dosFsDateTimeInstall - set system date and time** This is a stub function for backward compatibility only.* Since the new MS-DOS file system implementation will only use the* system time and date to set modification and creation times on files,* this function will simply get the current time and date, and set the* system time accordingly.* * RETURNS: N/A.** SEE ALSO: dosFsLib, ansiTime*/void dosFsDateTimeInstall (FUNCPTR pDateTimeFunc) { pDosFsDateTimeFunc = pDateTimeFunc ; }/********************************************************************************* dosFsDateTimeSet - set system time using old dosFs type function**/LOCAL void dosFsDateTimeSet (void ) { DOS_DATE_TIME dosdt ; /* old dosFs date time format */ struct tm tm ; /* ANSII time format */ struct timespec tv ; /* POSIX time */ if( pDosFsDateTimeFunc == NULL ) return ; /* call the user-supplied function */ (*pDosFsDateTimeFunc) ( &dosdt ); /* convert this to ANSI time */ tm.tm_sec = dosdt.dosdt_second ; tm.tm_min = dosdt.dosdt_minute ; tm.tm_hour = dosdt.dosdt_hour ; tm.tm_mday = dosdt.dosdt_day ; tm.tm_mon = dosdt.dosdt_month -1 ; tm.tm_year = dosdt.dosdt_year -1900 ; tm.tm_wday = 0 ; tm.tm_yday = 0 ; tm.tm_isdst = 0 ; /* convert ANSI to POSIX */ tv.tv_sec = mktime( &tm ); tv.tv_nsec = 0; /* set system time */ clock_settime( CLOCK_REALTIME, &tv ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -