void FileSystemApi::read_page_from_disk(DBC &conf, Page &pg) { assert(file.is_open()); file.seekg(get_page_offset(conf, pg), std::ios_base::beg); char *buff = new char[conf.page_size]; file.read(buff, conf.page_size); pg.from_bytes(buff); delete[] buff; }
int init_module(void) #endif { int err; AFS_RWLOCK_INIT(&afs_xosi, "afs_xosi"); #if !defined(AFS_LINUX24_ENV) /* obtain PAGE_OFFSET value */ afs_linux_page_offset = get_page_offset(); #ifndef AFS_S390_LINUX22_ENV if (afs_linux_page_offset == 0) { /* couldn't obtain page offset so can't continue */ printf("afs: Unable to obtain PAGE_OFFSET. Exiting.."); return -EIO; } #endif /* AFS_S390_LINUX22_ENV */ #endif /* !defined(AFS_LINUX24_ENV) */ osi_Init(); #ifndef LINUX_KEYRING_SUPPORT err = osi_syscall_init(); if (err) return err; #endif err = afs_init_inodecache(); if (err) { #ifndef LINUX_KEYRING_SUPPORT osi_syscall_clean(); #endif return err; } err = register_filesystem(&afs_fs_type); if (err) { afs_destroy_inodecache(); #ifndef LINUX_KEYRING_SUPPORT osi_syscall_clean(); #endif return err; } osi_sysctl_init(); #ifdef LINUX_KEYRING_SUPPORT osi_keyring_init(); #endif #ifdef AFS_LINUX24_ENV osi_proc_init(); osi_ioctl_init(); #endif #if defined(AFS_CACHE_BYPASS) afs_warn("Cache bypass patched libafs module init.\n"); #endif afs_init_pagecopy(); return 0; }
void get_page_offset_check_visible( int *ret_page_x, int *ret_page_y, FvwmWindow *fw) { if (IsRectangleOnThisPage(&fw->g.frame, fw->Desk)) { /* maximize on visible page if any part of the window is * visible */ *ret_page_x = 0; *ret_page_y = 0; } else { get_page_offset(ret_page_x, ret_page_y, fw); } return; }
void FileSystemApi::flush_page(DBC &conf, Page &pg) { assert(file.good()); file.seekp(get_page_offset(conf, pg), std::ios_base::beg); assert(pg.num_bytes() <= conf.page_size); file.write(pg.as_bytes((int)conf.page_size), conf.page_size); }