// add flakey data PDISKDATAMARK CDiskImage::AddFD(PDISKTRACKINFO pti, PDISKDATAMARK src, int size, int units) { // cancel if nothing to add if (!src || size<=0) return NULL; // allocate and copy to buffer PDISKDATAMARK alloc=AllocFD(pti, size, units); if (alloc) memcpy(alloc, src, size*sizeof(DiskDataMark)); return alloc; }
// access file or directory, returns file descriptor to use for // READ_OBJ calls, or error code if fails int OpenObj( char *name, int owner, int *fd_p ) { int fd; dir_t *dir_p; fd = AllocFD( owner ); if( fd == NO_FD ) { cons_printf( "FileSystem: no more available File Descriptor!\n" ); return NO_FD; } dir_p = FindName( name ); if( ! dir_p ) return UNFOUND; *fd_p = fd; // fd to return fd_array[fd].item = dir_p; // dir_p is the name return GOOD; }