f->offline_state = OFFLINE_JOINED;
- if (mmap_cache_got_sigbus(f->cache_fd))
+ if (mmap_cache_fd_got_sigbus(f->cache_fd))
return -EIO;
return 0;
}
}
- if (mmap_cache_got_sigbus(f->cache_fd))
+ if (mmap_cache_fd_got_sigbus(f->cache_fd))
return -EIO;
switch (f->header->state) {
journal_file_set_offline(f, true);
if (f->mmap && f->cache_fd)
- mmap_cache_free_fd(f->cache_fd);
+ mmap_cache_fd_free(f->cache_fd);
if (f->fd >= 0 && f->defrag_on_close) {
if (size > PAGE_ALIGN_DOWN(UINT64_MAX) - offset)
return -EINVAL;
- if (mmap_cache_got_sigbus(f->cache_fd))
+ if (mmap_cache_fd_got_sigbus(f->cache_fd))
return -EIO;
old_header_size = le64toh(READ_NOW(f->header->header_size));
return -EADDRNOTAVAIL;
}
- return mmap_cache_get(f->cache_fd, type_to_context(type), keep_always, offset, size, &f->last_stat, ret);
+ return mmap_cache_fd_get(f->cache_fd, type_to_context(type), keep_always, offset, size, &f->last_stat, ret);
}
static uint64_t minimum_header_size(Object *o) {
* it is very likely just an effect of a nullified replacement
* mapping page */
- if (mmap_cache_got_sigbus(f->cache_fd))
+ if (mmap_cache_fd_got_sigbus(f->cache_fd))
r = -EIO;
if (f->post_change_timer)
goto fail;
}
- r = mmap_cache_get(f->cache_fd, CONTEXT_HEADER, true, 0, PAGE_ALIGN(sizeof(Header)), &f->last_stat, &h);
+ r = mmap_cache_fd_get(f->cache_fd, CONTEXT_HEADER, true, 0, PAGE_ALIGN(sizeof(Header)), &f->last_stat, &h);
if (r == -EINVAL) {
/* Some file systems (jffs2 or p9fs) don't support mmap() properly (or only read-only
* mmap()), and return EINVAL in that case. Let's propagate that as a more recognizable error
#endif
}
- if (mmap_cache_got_sigbus(f->cache_fd)) {
+ if (mmap_cache_fd_got_sigbus(f->cache_fd)) {
r = -EIO;
goto fail;
}
return 0;
fail:
- if (f->cache_fd && mmap_cache_got_sigbus(f->cache_fd))
+ if (f->cache_fd && mmap_cache_fd_got_sigbus(f->cache_fd))
r = -EIO;
(void) journal_file_close(f);
r = journal_file_append_entry_internal(to, &ts, boot_id, xor_hash, items, n,
NULL, NULL, NULL);
- if (mmap_cache_got_sigbus(to->cache_fd))
+ if (mmap_cache_fd_got_sigbus(to->cache_fd))
return -EIO;
return r;
c = (a + b) / 2;
- r = mmap_cache_get(f, 0, false, c * sizeof(uint64_t), sizeof(uint64_t), NULL, (void **) &z);
+ r = mmap_cache_fd_get(f, 0, false, c * sizeof(uint64_t), sizeof(uint64_t), NULL, (void **) &z);
if (r < 0)
return r;
if (show_progress)
flush_progress();
- mmap_cache_free_fd(cache_data_fd);
- mmap_cache_free_fd(cache_entry_fd);
- mmap_cache_free_fd(cache_entry_array_fd);
+ mmap_cache_fd_free(cache_data_fd);
+ mmap_cache_fd_free(cache_entry_fd);
+ mmap_cache_fd_free(cache_entry_array_fd);
if (first_contained)
*first_contained = le64toh(f->header->head_entry_realtime);
100 * p / f->last_stat.st_size);
if (cache_data_fd)
- mmap_cache_free_fd(cache_data_fd);
+ mmap_cache_fd_free(cache_data_fd);
if (cache_entry_fd)
- mmap_cache_free_fd(cache_entry_fd);
+ mmap_cache_fd_free(cache_entry_fd);
if (cache_entry_array_fd)
- mmap_cache_free_fd(cache_entry_array_fd);
+ mmap_cache_fd_free(cache_entry_array_fd);
return r;
}
return -ENOMEM;
}
-int mmap_cache_get(
+int mmap_cache_fd_get(
MMapFileDescriptor *f,
unsigned context,
bool keep_always,
}
}
-bool mmap_cache_got_sigbus(MMapFileDescriptor *f) {
+bool mmap_cache_fd_got_sigbus(MMapFileDescriptor *f) {
assert(f);
mmap_cache_process_sigbus(f->cache);
return f;
}
-void mmap_cache_free_fd(MMapFileDescriptor *f) {
+void mmap_cache_fd_free(MMapFileDescriptor *f) {
assert(f);
assert(f->cache);
MMapCache* mmap_cache_ref(MMapCache *m);
MMapCache* mmap_cache_unref(MMapCache *m);
-int mmap_cache_get(
+int mmap_cache_fd_get(
MMapFileDescriptor *f,
unsigned context,
bool keep_always,
struct stat *st,
void **ret);
MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd, int prot);
-void mmap_cache_free_fd(MMapFileDescriptor *f);
+void mmap_cache_fd_free(MMapFileDescriptor *f);
void mmap_cache_stats_log_debug(MMapCache *m);
-bool mmap_cache_got_sigbus(MMapFileDescriptor *f);
+bool mmap_cache_fd_got_sigbus(MMapFileDescriptor *f);
assert_se(z >= 0);
unlink(pz);
- r = mmap_cache_get(fx, 0, false, 1, 2, NULL, &p);
+ r = mmap_cache_fd_get(fx, 0, false, 1, 2, NULL, &p);
assert_se(r >= 0);
- r = mmap_cache_get(fx, 0, false, 2, 2, NULL, &q);
+ r = mmap_cache_fd_get(fx, 0, false, 2, 2, NULL, &q);
assert_se(r >= 0);
assert_se((uint8_t*) p + 1 == (uint8_t*) q);
- r = mmap_cache_get(fx, 1, false, 3, 2, NULL, &q);
+ r = mmap_cache_fd_get(fx, 1, false, 3, 2, NULL, &q);
assert_se(r >= 0);
assert_se((uint8_t*) p + 2 == (uint8_t*) q);
- r = mmap_cache_get(fx, 0, false, 16ULL*1024ULL*1024ULL, 2, NULL, &p);
+ r = mmap_cache_fd_get(fx, 0, false, 16ULL*1024ULL*1024ULL, 2, NULL, &p);
assert_se(r >= 0);
- r = mmap_cache_get(fx, 1, false, 16ULL*1024ULL*1024ULL+1, 2, NULL, &q);
+ r = mmap_cache_fd_get(fx, 1, false, 16ULL*1024ULL*1024ULL+1, 2, NULL, &q);
assert_se(r >= 0);
assert_se((uint8_t*) p + 1 == (uint8_t*) q);
- mmap_cache_free_fd(fx);
+ mmap_cache_fd_free(fx);
mmap_cache_unref(m);
safe_close(x);