#include <ObjectManager.h>
Public Member Functions | |
~RioDirectory () | |
int | NextObject (int *IsDirectory, int BufferSize, char *ObjectName) |
void | Close () |
Private Member Functions | |
RioDirectory (CObjectManager *mgr) | |
RioDirectory (const RioDirectory &x) | |
RioDirectory & | operator= (const RioDirectory &x) |
Private Attributes | |
CObjectManager * | o_mgr |
DIR * | o_dir |
struct dirent * | o_direntry |
struct dirent | o_work |
char | o_extra [MyReadDirLen] |
char | o_DirectoryName [2 *MaxPathSize+1] |
Static Private Attributes | |
static const int | MyReadDirLen = sizeof( struct dirent ) + NAME_MAX |
Friends | |
class | CObjectManager |
Definition at line 58 of file server/ObjectManager.h.
RioDirectory::RioDirectory | ( | CObjectManager * | mgr | ) | [private] |
Definition at line 1818 of file server/ObjectManager.cpp.
01819 { 01820 o_mgr = mgr; 01821 o_dir = NULL; 01822 // o_work FIXME: Why not make o_direntry a struct instead of a pointer. 01823 // o_work FIXME: to a fixed memory position ? 01824 memset( (char *)&o_work, 0, sizeof( struct dirent ) ); 01825 o_direntry = &o_work; 01826 o_DirectoryName[ 0 ] = '\0'; 01827 o_extra[ 0 ] = '\0'; 01828 }
RioDirectory::RioDirectory | ( | const RioDirectory & | x | ) | [private] |
RioDirectory::~RioDirectory | ( | ) |
Definition at line 1830 of file server/ObjectManager.cpp.
01831 { 01832 Close(); 01833 }
void RioDirectory::Close | ( | void | ) |
Definition at line 1835 of file server/ObjectManager.cpp.
int RioDirectory::NextObject | ( | int * | IsDirectory, | |
int | BufferSize, | |||
char * | ObjectName | |||
) |
Definition at line 1850 of file server/ObjectManager.cpp.
01852 { 01853 struct dirent *dp; 01854 int rc; 01855 01856 while( 1 ) 01857 { 01858 rc = readdir_r( o_dir, o_direntry, &dp ); 01859 if( rc != 0 ) 01860 { 01861 o_mgr->m_log << "NextObject: readdir_r failed " 01862 << strerror( errno ) << endl; 01863 return ERROR_OBJECTMANAGER + ERROR_DIRECTORY_READ_FAILED; 01864 } 01865 01866 if( dp == NULL ) 01867 return ERROR_OBJECTMANAGER + ERROR_NO_MORE_OBJECTS; 01868 01869 if( ( int ) strlen( dp->d_name ) >= BufferSize ) 01870 return ERROR_OBJECTMANAGER + ERROR_NAMEBUFFER_OVERFLOW; 01871 01872 if( ( strcmp( dp->d_name, "." ) == 0 ) || 01873 ( strcmp( dp->d_name, ".." ) == 0 ) ) 01874 continue; 01875 01876 // -------------------------------------------------------------------- 01877 // added to continue if the file contains extension 01878 // .cactimes or .cacinf because it is used by Admission Control so 01879 // these files aren't save at RIO file system but are save 01880 // at the same tree (directories). 01881 char *pos = strrchr( dp->d_name, '.' ); 01882 if( pos ) 01883 if( ( strcmp( pos+1, "cactimes" ) == 0 ) || 01884 ( strcmp( pos+1, "cacinf" ) == 0) ) 01885 continue; 01886 // -------------------------------------------------------------------- 01887 01888 break; 01889 } 01890 01891 strcpy( ObjectName, dp->d_name ); 01892 01893 // need stat to get attributes but 01894 // need full path name to do stat... 01895 // ### can keep full path around from FirstObject!! 01896 //####if(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 01897 if( 0 ) 01898 *IsDirectory = true; 01899 else 01900 *IsDirectory = false; 01901 01902 return S_OK; 01903 }
RioDirectory& RioDirectory::operator= | ( | const RioDirectory & | x | ) | [private] |
friend class CObjectManager [friend] |
Definition at line 84 of file server/ObjectManager.h.
const int RioDirectory::MyReadDirLen = sizeof( struct dirent ) + NAME_MAX [static, private] |
Definition at line 61 of file server/ObjectManager.h.
DIR* RioDirectory::o_dir [private] |
Definition at line 64 of file server/ObjectManager.h.
char RioDirectory::o_DirectoryName[2 *MaxPathSize+1] [private] |
Definition at line 68 of file server/ObjectManager.h.
struct dirent* RioDirectory::o_direntry [private] |
Definition at line 65 of file server/ObjectManager.h.
char RioDirectory::o_extra[MyReadDirLen] [private] |
Definition at line 67 of file server/ObjectManager.h.
CObjectManager* RioDirectory::o_mgr [private] |
Definition at line 63 of file server/ObjectManager.h.
struct dirent RioDirectory::o_work [private] |
Definition at line 66 of file server/ObjectManager.h.