コード例 #1
0
ファイル: ltroots.c プロジェクト: PauloMigAlmeida/cuneiform
Bool RootsLoadFile (char * pFilename)
{
/*    typedef int HANDLE;*/

    HANDLE hFile;
    ROOT   RootRecord;

    RootsFreeData ();

    hFile = (HANDLE)open (pFilename, O_RDONLY | O_BINARY);

    if (hFile == (HANDLE)(-1))
    {
        ErrorFile ();
        return (FALSE);
    }

    while (read (hFile, &RootRecord, sizeof (ROOT)) == sizeof (ROOT))
    {
        RootRecord.bReached   = FALSE;

        if (nRoots % ROOTS_MEMORY_QUANTUM == 0)
        {
            pRoots = realloc (pRoots,
                              (size_t) ((nRoots / ROOTS_MEMORY_QUANTUM + 1)
                                * ROOTS_MEMORY_QUANTUM * sizeof (ROOT)));
        }

        nRoots++;

        if (pRoots == NULL)
        {
            ErrorNoEnoughMemory ("in LTROOTS.C,RootsLoadFile,part 1");
            nRoots = 0;
            close (hFile);
            return (FALSE);
        }

        pRoots [nRoots - 1] = RootRecord;
    }

    close (hFile);
    return (TRUE);
}
コード例 #2
0
ファイル: copyfile.c プロジェクト: BackupTheBerlios/samqfs
/*
 * If number of stream errors exceeded,
 * cancel current file and reject rest
 * of stages in this stream.
 */
static boolean_t
ifMaxStreamErrors(
	FileInfo_t *file)
{
	boolean_t rval;

	rval = B_FALSE;

	if (NumOpenFiles >= MAX_COPY_STREAM_ERRORS) {
		SendCustMsg(HERE, 19017, Stream->vsn);
		if (GET_FLAG(file->flags, FI_DCACHE)) {
			file->error = ECANCELED;
			SET_FLAG(file->flags, FI_NO_RETRY);
			CLEAR_FLAG(file->flags, FI_DCACHE);
			ErrorFile(file);
			Trace(TR_MISC, "Canceled(max stream error) "
			    "inode: %d.%d", file->id.ino, file->id.gen);
		}
		rval = B_TRUE;
	}
	return (rval);
}