Пример #1
0
/*
 * Release the current chunk and get the next one.
 * Also used for initialization when gsp->base == NULL.
 */
static int
fault_v1hs(v1hs *gsp, size_t extent)
{
	int status;

	if(gsp->base != NULL)
	{
		const ptrdiff_t incr = (char *)gsp->pos - (char *)gsp->base;
		status = rel_v1hs(gsp);
		if(status)
			return status;
		gsp->offset += incr;
	}
	
	if(extent > gsp->extent)
		gsp->extent = extent;	

	status = ncio_get(gsp->nciop,
		 	gsp->offset, gsp->extent,
			gsp->flags, &gsp->base);
	if(status)
		return status;

	gsp->pos = gsp->base;
	gsp->end = (char *)gsp->base + gsp->extent;

	return ENOERR;
}
Пример #2
0
/*
 * Release the current chunk and get the next one.
 * Also used for initialization when gsp->base == NULL.
 */
static int
fault_v1hs(v1hs *gsp, size_t extent)
{
	int status;

	if(gsp->base != NULL)
	{
#ifdef __arm__
		const ptrdiff_t incr = (signed char *)gsp->pos - (signed char *)gsp->base;
#else
        const ptrdiff_t incr = (char *)gsp->pos - (char *)gsp->base;
#endif
		status = rel_v1hs(gsp);
		if(status)
			return status;
		gsp->offset += incr;
	}

	if(extent > gsp->extent)
		gsp->extent = extent;

	status = ncio_get(gsp->nciop,
		 	gsp->offset, gsp->extent,
			gsp->flags, &gsp->base);
	if(status)
		return status;

	gsp->pos = gsp->base;

#ifdef __arm__
	gsp->end = (signed char *)gsp->base + gsp->extent;
#else
    gsp->end = (char *)gsp->base + gsp->extent;
#endif
    return NC_NOERR;
}