Exemple #1
0
bool_t
FSFH_release_window(FSFileHandle *self, FileWindow *window)
{
    if ( !SI_unmap(self, window->buf, window->len) ) { return false; }
    FileWindow_Set_Window(window, NULL, 0, 0);
    return true;
}
Exemple #2
0
static INLINE bool_t
SI_window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len)
{
	// Release the previously mmap'd region, if any. 
	FSFH_release_window(self, window);

	{
		// Start map on a page boundary.  Ensure that the window is at
		// least wide enough to view all the data spec'd in the original
		// request.
		const int64_t remainder       = offset % self->page_size;
		const int64_t adjusted_offset = offset - remainder;
		const int64_t adjusted_len    = len + remainder;
		char *const buf 
			= (char*)SI_map(self, adjusted_offset, adjusted_len);
		if (len && buf == NULL) {
			return false;
		}
		else {
			FileWindow_Set_Window(window, buf, adjusted_offset, 
				adjusted_len);
		}
	}

	return true;
}
Exemple #3
0
bool_t
FSFH_release_window(FSFileHandle *self, FileWindow *window)
{
    UNUSED_VAR(self);
    FileWindow_Set_Window(window, NULL, 0, 0);
    return true;
}
Exemple #4
0
static INLINE bool
SI_window(FSFileHandle *self, FSFileHandleIVARS *ivars, FileWindow *window,
          int64_t offset, int64_t len) {
    UNUSED_VAR(self);
    FileWindow_Set_Window(window, ivars->buf + offset, offset, len);
    return true;
}
Exemple #5
0
bool
FSFH_release_window(FSFileHandle *self, FileWindow *window) {
    char *buf = FileWindow_Get_Buf(window);
    int64_t len = FileWindow_Get_Len(window);
    if (!SI_unmap(self, buf, len)) { return false; }
    FileWindow_Set_Window(window, NULL, 0, 0);
    return true;
}
Exemple #6
0
static INLINE bool_t
SI_window(FSFileHandle *self, FileWindow *window, int64_t offset,
          int64_t len) {
    FileWindow_Set_Window(window, self->buf + offset, offset, len);
    return true;
}