FX_DNT.C
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:8k
源码类别:

DVD

开发平台:

Others

  1. /**************************************************************************/ 
  2. /*                                                                        */ 
  3. /*            Copyright (c) 1996-2002 by Express Logic Inc.               */ 
  4. /*                                                                        */ 
  5. /*  This software is copyrighted by and is the sole property of Express   */ 
  6. /*  Logic, Inc.  All rights, title, ownership, or other interests         */ 
  7. /*  in the software remain the property of Express Logic, Inc.  This      */ 
  8. /*  software may only be used in accordance with the corresponding        */ 
  9. /*  license agreement.  Any unauthorized use, duplication, transmission,  */ 
  10. /*  distribution, or disclosure of this software is expressly forbidden.  */ 
  11. /*                                                                        */
  12. /*  This Copyright notice may not be removed or modified without prior    */ 
  13. /*  written consent of Express Logic, Inc.                                */ 
  14. /*                                                                        */ 
  15. /*  Express Logic, Inc. reserves the right to modify this software        */ 
  16. /*  without notice.                                                       */ 
  17. /*                                                                        */ 
  18. /*  Express Logic, Inc.                     info@expresslogic.com         */
  19. /*  11423 West Bernardo Court               http://www.expresslogic.com   */
  20. /*  San Diego, CA  92127                                                  */
  21. /*                                                                        */
  22. /**************************************************************************/
  23. /**************************************************************************/
  24. /**************************************************************************/
  25. /**                                                                       */ 
  26. /** FileX Component                                                       */ 
  27. /**                                                                       */
  28. /**   Directory (DIR)                                                     */
  29. /**                                                                       */
  30. /**************************************************************************/
  31. /**************************************************************************/
  32. #include "Config.h" // Global Configuration - do not remove!
  33. #ifdef ENABLE_FILEX
  34. #ifdef _DEBUG
  35. #undef IFTRACE
  36. #define IFTRACE if (gTraceFileSys)
  37. #include "DebugDbgMain.h"
  38. #endif //_DEBUG
  39. #define FX_SOURCE_CODE
  40. /* Include necessary system files.  */
  41. #include "PlaycoreFileSysFileXfx_api.h"
  42. #include "PlaycoreFileSysFileXfx_sys.h"
  43. #include "PlaycoreFileSysFileXfx_dir.h"
  44. #include "PlaycoreFileSysFileXfx_fil.h"
  45. #include "PlaycoreFileSysFileXfx_uti.h"
  46. /**************************************************************************/ 
  47. /*                                                                        */ 
  48. /*  FUNCTION                                               RELEASE        */ 
  49. /*                                                                        */ 
  50. /*    _fx_directory_name_test                             PORTABLE C      */ 
  51. /*                                                           3.0          */ 
  52. /*  AUTHOR                                                                */ 
  53. /*                                                                        */ 
  54. /*    William E. Lamie, Express Logic, Inc.                               */ 
  55. /*                                                                        */ 
  56. /*  DESCRIPTION                                                           */ 
  57. /*                                                                        */ 
  58. /*    This function first attempts to find the specified directory name.  */ 
  59. /*    If found, the attributes are checked to see if the entry is a       */ 
  60. /*    directory.  If not, the appropriate error code is returned to the   */ 
  61. /*    caller.                                                             */ 
  62. /*                                                                        */ 
  63. /*  INPUT                                                                 */ 
  64. /*                                                                        */ 
  65. /*    media_ptr                             Media control block pointer   */ 
  66. /*    directory_name                        Directory name pointer        */ 
  67. /*                                                                        */ 
  68. /*  OUTPUT                                                                */ 
  69. /*                                                                        */ 
  70. /*    return status                                                       */ 
  71. /*                                                                        */ 
  72. /*  CALLS                                                                 */ 
  73. /*                                                                        */ 
  74. /*    _fx_directory_search                  Search for the file name in   */ 
  75. /*                                          the directory structure       */ 
  76. /*                                                                        */ 
  77. /*  CALLED BY                                                             */ 
  78. /*                                                                        */ 
  79. /*    Application Code                                                    */ 
  80. /*                                                                        */ 
  81. /*  RELEASE HISTORY                                                       */ 
  82. /*                                                                        */ 
  83. /*    DATE              NAME                      DESCRIPTION             */ 
  84. /*                                                                        */ 
  85. /*  01-01-1999     William E. Lamie         Initial Version 1.0           */ 
  86. /*  03-01-2000     William E. Lamie         Modified comment(s),          */ 
  87. /*                                            resulting in version 1.0b.  */ 
  88. /*  01-28-2001     William E. Lamie         Modified comment(s),          */ 
  89. /*                                            resulting in version 2.0.   */ 
  90. /*  03-01-2002     William E. Lamie         Modified comment(s),          */ 
  91. /*                                            resulting in version 3.0.   */ 
  92. /*                                                                        */ 
  93. /**************************************************************************/ 
  94. UINT  _fx_directory_name_test(FX_MEDIA *media_ptr, CHAR *directory_name)
  95. {
  96. UINT            status;
  97. FX_DIR_ENTRY    dir_entry;
  98.     /* Check the media to make sure it is open.  */
  99.     if (media_ptr -> fx_media_id != FX_MEDIA_ID)
  100.     {
  101.         /* Return the media not opened error.  */
  102.         return(FX_MEDIA_NOT_OPEN);
  103.     }
  104.     /* Protect against other threads accessing the media.  */
  105.     FX_PROTECT
  106.     /* Search the system for the supplied directory name.  */
  107.     status =  _fx_directory_search(media_ptr, directory_name, &dir_entry, FX_NULL, FX_NULL);
  108.     /* Determine if the search was successful.  */
  109.     if (status != FX_SUCCESS)
  110.     {
  111.         /* Release media protection.  */
  112.         FX_UNPROTECT
  113.         /* Return the error code.  */
  114.         return(status);
  115.     }
  116.     /* Check to see if the entry is a directory.  */
  117.     if (!(dir_entry.fx_dir_entry_attributes & (UCHAR) FX_DIRECTORY))
  118.     {
  119.         /* Release media protection.  */
  120.         FX_UNPROTECT
  121.         /* Return the not a directory error code.  */
  122.         return(FX_NOT_DIRECTORY);
  123.     }
  124.     /* Release media protection.  */
  125.     FX_UNPROTECT
  126.     /* Directory name test is complete, return successful status.  */
  127.     return(FX_SUCCESS);
  128. }
  129. #endif