diff --git a/archive_old_fs_versions/bbfs/.gitignore b/archive_old_fs_versions/bbfs/.gitignore deleted file mode 100644 index e0b331f92ff3a0be3b9f29d23566f16a186060ab..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ - - -# IDEA FILES # -##################### -.idea/ - -# BUILD # -######### - -build/ - -# DEBUG # -######### - -cmake-build-debug/ -playground/ diff --git a/archive_old_fs_versions/bbfs/CMake/FindFUSE.cmake b/archive_old_fs_versions/bbfs/CMake/FindFUSE.cmake deleted file mode 100644 index bd178e26a6e28d63df43a43181df9b6279e224d8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/CMake/FindFUSE.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Find the FUSE includes and library -# -# FUSE_INCLUDE_DIR - where to find fuse.h, etc. -# FUSE_LIBRARIES - List of libraries when using FUSE. -# FUSE_FOUND - True if FUSE lib is found. - -# check if already in cache, be silent -IF (FUSE_INCLUDE_DIR) - SET (FUSE_FIND_QUIETLY TRUE) -ENDIF (FUSE_INCLUDE_DIR) - -# find includes -FIND_PATH (FUSE_INCLUDE_DIR fuse.h - /usr/local/include/osxfuse - /usr/local/include - /usr/include - ) - -# find lib -if (APPLE) - SET(FUSE_NAMES libosxfuse.dylib fuse) -else (APPLE) - SET(FUSE_NAMES fuse) -endif (APPLE) -FIND_LIBRARY(FUSE_LIBRARIES - NAMES ${FUSE_NAMES} - PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu - ) - -include ("FindPackageHandleStandardArgs") -find_package_handle_standard_args ("FUSE" DEFAULT_MSG - FUSE_INCLUDE_DIR FUSE_LIBRARIES) - -mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES) \ No newline at end of file diff --git a/archive_old_fs_versions/bbfs/CMakeLists.txt b/archive_old_fs_versions/bbfs/CMakeLists.txt deleted file mode 100644 index 0cd84271f26ae1dcaf4fb9d15b896d45a567e8cf..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.4 FATAL_ERROR) -project(bbfs VERSION 0.0.1 LANGUAGES C) - -#set(CMAKE_CXX_STANDARD 11) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall --pedantic -g") -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -find_package(FUSE REQUIRED) - -include_directories(${FUSE_INCLUDE_DIR}) -set(SOURCE_FILES src/bbfs.c src/log.c src/log.h src/bbfs.h) -add_executable(adafs ${SOURCE_FILES} src/bbfs.c) -target_link_libraries(adafs ${FUSE_LIBRARIES}) diff --git a/archive_old_fs_versions/bbfs/fuse_libs/fuse.c b/archive_old_fs_versions/bbfs/fuse_libs/fuse.c deleted file mode 100644 index ab5a593e85fff9bbc29d993dfd9e5b1691707c6b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/fuse_libs/fuse.c +++ /dev/null @@ -1,4798 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - Implementation of the high-level FUSE API on top of the low-level - API. - - This program can be distributed under the terms of the GNU LGPLv2. - See the file COPYING.LIB -*/ - - -/* For pthread_rwlock_t */ -#define _GNU_SOURCE - -#include "config.h" -#include "fuse_i.h" -#include "fuse_lowlevel.h" -#include "fuse_opt.h" -#include "fuse_misc.h" -#include "fuse_kernel.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define FUSE_NODE_SLAB 1 - -#ifndef MAP_ANONYMOUS -#undef FUSE_NODE_SLAB -#endif - -#ifndef RENAME_EXCHANGE -#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ -#endif - -#define FUSE_DEFAULT_INTR_SIGNAL SIGUSR1 - -#define FUSE_UNKNOWN_INO 0xffffffff -#define OFFSET_MAX 0x7fffffffffffffffLL - -#define NODE_TABLE_MIN_SIZE 8192 - -struct fuse_fs { - struct fuse_operations op; - struct fuse_module *m; - void *user_data; - int debug; -}; - -struct fusemod_so { - void *handle; - int ctr; -}; - -struct lock_queue_element { - struct lock_queue_element *next; - pthread_cond_t cond; - fuse_ino_t nodeid1; - const char *name1; - char **path1; - struct node **wnode1; - fuse_ino_t nodeid2; - const char *name2; - char **path2; - struct node **wnode2; - int err; - bool first_locked : 1; - bool second_locked : 1; - bool done : 1; -}; - -struct node_table { - struct node **array; - size_t use; - size_t size; - size_t split; -}; - -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -struct list_head { - struct list_head *next; - struct list_head *prev; -}; - -struct node_slab { - struct list_head list; /* must be the first member */ - struct list_head freelist; - int used; -}; - -struct fuse { - struct fuse_session *se; - struct node_table name_table; - struct node_table id_table; - struct list_head lru_table; - fuse_ino_t ctr; - unsigned int generation; - unsigned int hidectr; - pthread_mutex_t lock; - struct fuse_config conf; - int intr_installed; - struct fuse_fs *fs; - struct lock_queue_element *lockq; - int pagesize; - struct list_head partial_slabs; - struct list_head full_slabs; - pthread_t prune_thread; -}; - -struct lock { - int type; - off_t start; - off_t end; - pid_t pid; - uint64_t owner; - struct lock *next; -}; - -struct node { - struct node *name_next; - struct node *id_next; - fuse_ino_t nodeid; - unsigned int generation; - int refctr; - struct node *parent; - char *name; - uint64_t nlookup; - int open_count; - struct timespec stat_updated; - struct timespec mtime; - off_t size; - struct lock *locks; - unsigned int is_hidden : 1; - unsigned int cache_valid : 1; - int treelock; - char inline_name[32]; -}; - -#define TREELOCK_WRITE -1 -#define TREELOCK_WAIT_OFFSET INT_MIN - -struct node_lru { - struct node node; - struct list_head lru; - struct timespec forget_time; -}; - -struct fuse_direntry { - struct stat stat; - char *name; - struct fuse_direntry *next; -}; - -struct fuse_dh { - pthread_mutex_t lock; - struct fuse *fuse; - fuse_req_t req; - char *contents; - struct fuse_direntry *first; - struct fuse_direntry **last; - int allocated; - unsigned len; - unsigned size; - unsigned needlen; - int filled; - uint64_t fh; - int error; - fuse_ino_t nodeid; -}; - -struct fuse_context_i { - struct fuse_context ctx; - fuse_req_t req; -}; - -/* Defined by FUSE_REGISTER_MODULE() in lib/modules/subdir.c and iconv.c. */ -extern fuse_module_factory_t fuse_module_subdir_factory; -extern fuse_module_factory_t fuse_module_iconv_factory; - -static pthread_key_t fuse_context_key; -static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER; -static int fuse_context_ref; -static struct fuse_module *fuse_modules = NULL; - -static int fuse_register_module(const char *name, - fuse_module_factory_t factory, - struct fusemod_so *so) -{ - struct fuse_module *mod; - - mod = calloc(1, sizeof(struct fuse_module)); - if (!mod) { - fprintf(stderr, "fuse: failed to allocate module\n"); - return -1; - } - mod->name = strdup(name); - if (!mod->name) { - fprintf(stderr, "fuse: failed to allocate module name\n"); - free(mod); - return -1; - } - mod->factory = factory; - mod->ctr = 0; - mod->so = so; - if (mod->so) - mod->so->ctr++; - mod->next = fuse_modules; - fuse_modules = mod; - - return 0; -} - - -static int fuse_load_so_module(const char *module) -{ - int ret = -1; - char *tmp; - struct fusemod_so *so; - fuse_module_factory_t factory; - - tmp = malloc(strlen(module) + 64); - if (!tmp) { - fprintf(stderr, "fuse: memory allocation failed\n"); - return -1; - } - sprintf(tmp, "libfusemod_%s.so", module); - so = calloc(1, sizeof(struct fusemod_so)); - if (!so) { - fprintf(stderr, "fuse: failed to allocate module so\n"); - goto out; - } - - so->handle = dlopen(tmp, RTLD_NOW); - if (so->handle == NULL) { - fprintf(stderr, "fuse: dlopen(%s) failed: %s\n", - tmp, dlerror()); - goto out_free_so; - } - - sprintf(tmp, "fuse_module_%s_factory", module); - factory = dlsym(so->handle, tmp); - if (factory == NULL) { - fprintf(stderr, "fuse: symbol <%s> not found in module: %s\n", - tmp, dlerror()); - goto out_dlclose; - } - ret = fuse_register_module(module, factory, so); - if (ret) - goto out_dlclose; - -out: - free(tmp); - return ret; - -out_dlclose: - dlclose(so->handle); -out_free_so: - free(so); - goto out; -} - -static struct fuse_module *fuse_find_module(const char *module) -{ - struct fuse_module *m; - for (m = fuse_modules; m; m = m->next) { - if (strcmp(module, m->name) == 0) { - m->ctr++; - break; - } - } - return m; -} - -static struct fuse_module *fuse_get_module(const char *module) -{ - struct fuse_module *m; - - pthread_mutex_lock(&fuse_context_lock); - m = fuse_find_module(module); - if (!m) { - int err = fuse_load_so_module(module); - if (!err) - m = fuse_find_module(module); - } - pthread_mutex_unlock(&fuse_context_lock); - return m; -} - -static void fuse_put_module(struct fuse_module *m) -{ - pthread_mutex_lock(&fuse_context_lock); - assert(m->ctr > 0); - m->ctr--; - if (!m->ctr && m->so) { - struct fusemod_so *so = m->so; - assert(so->ctr > 0); - so->ctr--; - if (!so->ctr) { - struct fuse_module **mp; - for (mp = &fuse_modules; *mp;) { - if ((*mp)->so == so) - *mp = (*mp)->next; - else - mp = &(*mp)->next; - } - dlclose(so->handle); - free(so); - } - } - pthread_mutex_unlock(&fuse_context_lock); -} - -static void init_list_head(struct list_head *list) -{ - list->next = list; - list->prev = list; -} - -static int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -static void list_add(struct list_head *new, struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -static inline void list_add_head(struct list_head *new, struct list_head *head) -{ - list_add(new, head, head->next); -} - -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - list_add(new, head->prev, head); -} - -static inline void list_del(struct list_head *entry) -{ - struct list_head *prev = entry->prev; - struct list_head *next = entry->next; - - next->prev = prev; - prev->next = next; -} - -static inline int lru_enabled(struct fuse *f) -{ - return f->conf.remember > 0; -} - -static struct node_lru *node_lru(struct node *node) -{ - return (struct node_lru *) node; -} - -static size_t get_node_size(struct fuse *f) -{ - if (lru_enabled(f)) - return sizeof(struct node_lru); - else - return sizeof(struct node); -} - -#ifdef FUSE_NODE_SLAB -static struct node_slab *list_to_slab(struct list_head *head) -{ - return (struct node_slab *) head; -} - -static struct node_slab *node_to_slab(struct fuse *f, struct node *node) -{ - return (struct node_slab *) (((uintptr_t) node) & ~((uintptr_t) f->pagesize - 1)); -} - -static int alloc_slab(struct fuse *f) -{ - void *mem; - struct node_slab *slab; - char *start; - size_t num; - size_t i; - size_t node_size = get_node_size(f); - - mem = mmap(NULL, f->pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - - if (mem == MAP_FAILED) - return -1; - - slab = mem; - init_list_head(&slab->freelist); - slab->used = 0; - num = (f->pagesize - sizeof(struct node_slab)) / node_size; - - start = (char *) mem + f->pagesize - num * node_size; - for (i = 0; i < num; i++) { - struct list_head *n; - - n = (struct list_head *) (start + i * node_size); - list_add_tail(n, &slab->freelist); - } - list_add_tail(&slab->list, &f->partial_slabs); - - return 0; -} - -static struct node *alloc_node(struct fuse *f) -{ - struct node_slab *slab; - struct list_head *node; - - if (list_empty(&f->partial_slabs)) { - int res = alloc_slab(f); - if (res != 0) - return NULL; - } - slab = list_to_slab(f->partial_slabs.next); - slab->used++; - node = slab->freelist.next; - list_del(node); - if (list_empty(&slab->freelist)) { - list_del(&slab->list); - list_add_tail(&slab->list, &f->full_slabs); - } - memset(node, 0, sizeof(struct node)); - - return (struct node *) node; -} - -static void free_slab(struct fuse *f, struct node_slab *slab) -{ - int res; - - list_del(&slab->list); - res = munmap(slab, f->pagesize); - if (res == -1) - fprintf(stderr, "fuse warning: munmap(%p) failed\n", slab); -} - -static void free_node_mem(struct fuse *f, struct node *node) -{ - struct node_slab *slab = node_to_slab(f, node); - struct list_head *n = (struct list_head *) node; - - slab->used--; - if (slab->used) { - if (list_empty(&slab->freelist)) { - list_del(&slab->list); - list_add_tail(&slab->list, &f->partial_slabs); - } - list_add_head(n, &slab->freelist); - } else { - free_slab(f, slab); - } -} -#else -static struct node *alloc_node(struct fuse *f) -{ - return (struct node *) calloc(1, get_node_size(f)); -} - -static void free_node_mem(struct fuse *f, struct node *node) -{ - (void) f; - free(node); -} -#endif - -static size_t id_hash(struct fuse *f, fuse_ino_t ino) -{ - uint64_t hash = ((uint32_t) ino * 2654435761U) % f->id_table.size; - uint64_t oldhash = hash % (f->id_table.size / 2); - - if (oldhash >= f->id_table.split) - return oldhash; - else - return hash; -} - -static struct node *get_node_nocheck(struct fuse *f, fuse_ino_t nodeid) -{ - size_t hash = id_hash(f, nodeid); - struct node *node; - - for (node = f->id_table.array[hash]; node != NULL; node = node->id_next) - if (node->nodeid == nodeid) - return node; - - return NULL; -} - -static struct node *get_node(struct fuse *f, fuse_ino_t nodeid) -{ - struct node *node = get_node_nocheck(f, nodeid); - if (!node) { - fprintf(stderr, "fuse internal error: node %llu not found\n", - (unsigned long long) nodeid); - abort(); - } - return node; -} - -static void curr_time(struct timespec *now); -static double diff_timespec(const struct timespec *t1, - const struct timespec *t2); - -static void remove_node_lru(struct node *node) -{ - struct node_lru *lnode = node_lru(node); - list_del(&lnode->lru); - init_list_head(&lnode->lru); -} - -static void set_forget_time(struct fuse *f, struct node *node) -{ - struct node_lru *lnode = node_lru(node); - - list_del(&lnode->lru); - list_add_tail(&lnode->lru, &f->lru_table); - curr_time(&lnode->forget_time); -} - -static void free_node(struct fuse *f, struct node *node) -{ - if (node->name != node->inline_name) - free(node->name); - free_node_mem(f, node); -} - -static void node_table_reduce(struct node_table *t) -{ - size_t newsize = t->size / 2; - void *newarray; - - if (newsize < NODE_TABLE_MIN_SIZE) - return; - - newarray = realloc(t->array, sizeof(struct node *) * newsize); - if (newarray != NULL) - t->array = newarray; - - t->size = newsize; - t->split = t->size / 2; -} - -static void remerge_id(struct fuse *f) -{ - struct node_table *t = &f->id_table; - int iter; - - if (t->split == 0) - node_table_reduce(t); - - for (iter = 8; t->split > 0 && iter; iter--) { - struct node **upper; - - t->split--; - upper = &t->array[t->split + t->size / 2]; - if (*upper) { - struct node **nodep; - - for (nodep = &t->array[t->split]; *nodep; - nodep = &(*nodep)->id_next); - - *nodep = *upper; - *upper = NULL; - break; - } - } -} - -static void unhash_id(struct fuse *f, struct node *node) -{ - struct node **nodep = &f->id_table.array[id_hash(f, node->nodeid)]; - - for (; *nodep != NULL; nodep = &(*nodep)->id_next) - if (*nodep == node) { - *nodep = node->id_next; - f->id_table.use--; - - if(f->id_table.use < f->id_table.size / 4) - remerge_id(f); - return; - } -} - -static int node_table_resize(struct node_table *t) -{ - size_t newsize = t->size * 2; - void *newarray; - - newarray = realloc(t->array, sizeof(struct node *) * newsize); - if (newarray == NULL) - return -1; - - t->array = newarray; - memset(t->array + t->size, 0, t->size * sizeof(struct node *)); - t->size = newsize; - t->split = 0; - - return 0; -} - -static void rehash_id(struct fuse *f) -{ - struct node_table *t = &f->id_table; - struct node **nodep; - struct node **next; - size_t hash; - - if (t->split == t->size / 2) - return; - - hash = t->split; - t->split++; - for (nodep = &t->array[hash]; *nodep != NULL; nodep = next) { - struct node *node = *nodep; - size_t newhash = id_hash(f, node->nodeid); - - if (newhash != hash) { - next = nodep; - *nodep = node->id_next; - node->id_next = t->array[newhash]; - t->array[newhash] = node; - } else { - next = &node->id_next; - } - } - if (t->split == t->size / 2) - node_table_resize(t); -} - -static void hash_id(struct fuse *f, struct node *node) -{ - size_t hash = id_hash(f, node->nodeid); - node->id_next = f->id_table.array[hash]; - f->id_table.array[hash] = node; - f->id_table.use++; - - if (f->id_table.use >= f->id_table.size / 2) - rehash_id(f); -} - -static size_t name_hash(struct fuse *f, fuse_ino_t parent, - const char *name) -{ - uint64_t hash = parent; - uint64_t oldhash; - - for (; *name; name++) - hash = hash * 31 + (unsigned char) *name; - - hash %= f->name_table.size; - oldhash = hash % (f->name_table.size / 2); - if (oldhash >= f->name_table.split) - return oldhash; - else - return hash; -} - -static void unref_node(struct fuse *f, struct node *node); - -static void remerge_name(struct fuse *f) -{ - struct node_table *t = &f->name_table; - int iter; - - if (t->split == 0) - node_table_reduce(t); - - for (iter = 8; t->split > 0 && iter; iter--) { - struct node **upper; - - t->split--; - upper = &t->array[t->split + t->size / 2]; - if (*upper) { - struct node **nodep; - - for (nodep = &t->array[t->split]; *nodep; - nodep = &(*nodep)->name_next); - - *nodep = *upper; - *upper = NULL; - break; - } - } -} - -static void unhash_name(struct fuse *f, struct node *node) -{ - if (node->name) { - size_t hash = name_hash(f, node->parent->nodeid, node->name); - struct node **nodep = &f->name_table.array[hash]; - - for (; *nodep != NULL; nodep = &(*nodep)->name_next) - if (*nodep == node) { - *nodep = node->name_next; - node->name_next = NULL; - unref_node(f, node->parent); - if (node->name != node->inline_name) - free(node->name); - node->name = NULL; - node->parent = NULL; - f->name_table.use--; - - if (f->name_table.use < f->name_table.size / 4) - remerge_name(f); - return; - } - fprintf(stderr, - "fuse internal error: unable to unhash node: %llu\n", - (unsigned long long) node->nodeid); - abort(); - } -} - -static void rehash_name(struct fuse *f) -{ - struct node_table *t = &f->name_table; - struct node **nodep; - struct node **next; - size_t hash; - - if (t->split == t->size / 2) - return; - - hash = t->split; - t->split++; - for (nodep = &t->array[hash]; *nodep != NULL; nodep = next) { - struct node *node = *nodep; - size_t newhash = name_hash(f, node->parent->nodeid, node->name); - - if (newhash != hash) { - next = nodep; - *nodep = node->name_next; - node->name_next = t->array[newhash]; - t->array[newhash] = node; - } else { - next = &node->name_next; - } - } - if (t->split == t->size / 2) - node_table_resize(t); -} - -static int hash_name(struct fuse *f, struct node *node, fuse_ino_t parentid, - const char *name) -{ - size_t hash = name_hash(f, parentid, name); - struct node *parent = get_node(f, parentid); - if (strlen(name) < sizeof(node->inline_name)) { - strcpy(node->inline_name, name); - node->name = node->inline_name; - } else { - node->name = strdup(name); - if (node->name == NULL) - return -1; - } - - parent->refctr ++; - node->parent = parent; - node->name_next = f->name_table.array[hash]; - f->name_table.array[hash] = node; - f->name_table.use++; - - if (f->name_table.use >= f->name_table.size / 2) - rehash_name(f); - - return 0; -} - -static void delete_node(struct fuse *f, struct node *node) -{ - if (f->conf.debug) - fprintf(stderr, "DELETE: %llu\n", - (unsigned long long) node->nodeid); - - assert(node->treelock == 0); - unhash_name(f, node); - if (lru_enabled(f)) - remove_node_lru(node); - unhash_id(f, node); - free_node(f, node); -} - -static void unref_node(struct fuse *f, struct node *node) -{ - assert(node->refctr > 0); - node->refctr --; - if (!node->refctr) - delete_node(f, node); -} - -static fuse_ino_t next_id(struct fuse *f) -{ - do { - f->ctr = (f->ctr + 1) & 0xffffffff; - if (!f->ctr) - f->generation ++; - } while (f->ctr == 0 || f->ctr == FUSE_UNKNOWN_INO || - get_node_nocheck(f, f->ctr) != NULL); - return f->ctr; -} - -static struct node *lookup_node(struct fuse *f, fuse_ino_t parent, - const char *name) -{ - size_t hash = name_hash(f, parent, name); - struct node *node; - - for (node = f->name_table.array[hash]; node != NULL; node = node->name_next) - if (node->parent->nodeid == parent && - strcmp(node->name, name) == 0) - return node; - - return NULL; -} - -static void inc_nlookup(struct node *node) -{ - if (!node->nlookup) - node->refctr++; - node->nlookup++; -} - -static struct node *find_node(struct fuse *f, fuse_ino_t parent, - const char *name) -{ - struct node *node; - - pthread_mutex_lock(&f->lock); - if (!name) - node = get_node(f, parent); - else - node = lookup_node(f, parent, name); - if (node == NULL) { - node = alloc_node(f); - if (node == NULL) - goto out_err; - - node->nodeid = next_id(f); - node->generation = f->generation; - if (f->conf.remember) - inc_nlookup(node); - - if (hash_name(f, node, parent, name) == -1) { - free_node(f, node); - node = NULL; - goto out_err; - } - hash_id(f, node); - if (lru_enabled(f)) { - struct node_lru *lnode = node_lru(node); - init_list_head(&lnode->lru); - } - } else if (lru_enabled(f) && node->nlookup == 1) { - remove_node_lru(node); - } - inc_nlookup(node); -out_err: - pthread_mutex_unlock(&f->lock); - return node; -} - -static char *add_name(char **buf, unsigned *bufsize, char *s, const char *name) -{ - size_t len = strlen(name); - - if (s - len <= *buf) { - unsigned pathlen = *bufsize - (s - *buf); - unsigned newbufsize = *bufsize; - char *newbuf; - - while (newbufsize < pathlen + len + 1) { - if (newbufsize >= 0x80000000) - newbufsize = 0xffffffff; - else - newbufsize *= 2; - } - - newbuf = realloc(*buf, newbufsize); - if (newbuf == NULL) - return NULL; - - *buf = newbuf; - s = newbuf + newbufsize - pathlen; - memmove(s, newbuf + *bufsize - pathlen, pathlen); - *bufsize = newbufsize; - } - s -= len; - strncpy(s, name, len); - s--; - *s = '/'; - - return s; -} - -static void unlock_path(struct fuse *f, fuse_ino_t nodeid, struct node *wnode, - struct node *end) -{ - struct node *node; - - if (wnode) { - assert(wnode->treelock == TREELOCK_WRITE); - wnode->treelock = 0; - } - - for (node = get_node(f, nodeid); - node != end && node->nodeid != FUSE_ROOT_ID; node = node->parent) { - assert(node->treelock != 0); - assert(node->treelock != TREELOCK_WAIT_OFFSET); - assert(node->treelock != TREELOCK_WRITE); - node->treelock--; - if (node->treelock == TREELOCK_WAIT_OFFSET) - node->treelock = 0; - } -} - -static int try_get_path(struct fuse *f, fuse_ino_t nodeid, const char *name, - char **path, struct node **wnodep, bool need_lock) -{ - unsigned bufsize = 256; - char *buf; - char *s; - struct node *node; - struct node *wnode = NULL; - int err; - - *path = NULL; - - err = -ENOMEM; - buf = malloc(bufsize); - if (buf == NULL) - goto out_err; - - s = buf + bufsize - 1; - *s = '\0'; - - if (name != NULL) { - s = add_name(&buf, &bufsize, s, name); - err = -ENOMEM; - if (s == NULL) - goto out_free; - } - - if (wnodep) { - assert(need_lock); - wnode = lookup_node(f, nodeid, name); - if (wnode) { - if (wnode->treelock != 0) { - if (wnode->treelock > 0) - wnode->treelock += TREELOCK_WAIT_OFFSET; - err = -EAGAIN; - goto out_free; - } - wnode->treelock = TREELOCK_WRITE; - } - } - - for (node = get_node(f, nodeid); node->nodeid != FUSE_ROOT_ID; - node = node->parent) { - err = -ENOENT; - if (node->name == NULL || node->parent == NULL) - goto out_unlock; - - err = -ENOMEM; - s = add_name(&buf, &bufsize, s, node->name); - if (s == NULL) - goto out_unlock; - - if (need_lock) { - err = -EAGAIN; - if (node->treelock < 0) - goto out_unlock; - - node->treelock++; - } - } - - if (s[0]) - memmove(buf, s, bufsize - (s - buf)); - else - strcpy(buf, "/"); - - *path = buf; - if (wnodep) - *wnodep = wnode; - - return 0; - - out_unlock: - if (need_lock) - unlock_path(f, nodeid, wnode, node); - out_free: - free(buf); - - out_err: - return err; -} - -static void queue_element_unlock(struct fuse *f, struct lock_queue_element *qe) -{ - struct node *wnode; - - if (qe->first_locked) { - wnode = qe->wnode1 ? *qe->wnode1 : NULL; - unlock_path(f, qe->nodeid1, wnode, NULL); - qe->first_locked = false; - } - if (qe->second_locked) { - wnode = qe->wnode2 ? *qe->wnode2 : NULL; - unlock_path(f, qe->nodeid2, wnode, NULL); - qe->second_locked = false; - } -} - -static void queue_element_wakeup(struct fuse *f, struct lock_queue_element *qe) -{ - int err; - bool first = (qe == f->lockq); - - if (!qe->path1) { - /* Just waiting for it to be unlocked */ - if (get_node(f, qe->nodeid1)->treelock == 0) - pthread_cond_signal(&qe->cond); - - return; - } - - if (!qe->first_locked) { - err = try_get_path(f, qe->nodeid1, qe->name1, qe->path1, - qe->wnode1, true); - if (!err) - qe->first_locked = true; - else if (err != -EAGAIN) - goto err_unlock; - } - if (!qe->second_locked && qe->path2) { - err = try_get_path(f, qe->nodeid2, qe->name2, qe->path2, - qe->wnode2, true); - if (!err) - qe->second_locked = true; - else if (err != -EAGAIN) - goto err_unlock; - } - - if (qe->first_locked && (qe->second_locked || !qe->path2)) { - err = 0; - goto done; - } - - /* - * Only let the first element be partially locked otherwise there could - * be a deadlock. - * - * But do allow the first element to be partially locked to prevent - * starvation. - */ - if (!first) - queue_element_unlock(f, qe); - - /* keep trying */ - return; - -err_unlock: - queue_element_unlock(f, qe); -done: - qe->err = err; - qe->done = true; - pthread_cond_signal(&qe->cond); -} - -static void wake_up_queued(struct fuse *f) -{ - struct lock_queue_element *qe; - - for (qe = f->lockq; qe != NULL; qe = qe->next) - queue_element_wakeup(f, qe); -} - -static void debug_path(struct fuse *f, const char *msg, fuse_ino_t nodeid, - const char *name, bool wr) -{ - if (f->conf.debug) { - struct node *wnode = NULL; - - if (wr) - wnode = lookup_node(f, nodeid, name); - - if (wnode) { - fprintf(stderr, "%s %llu (w)\n", - msg, (unsigned long long) wnode->nodeid); - } else { - fprintf(stderr, "%s %llu\n", - msg, (unsigned long long) nodeid); - } - } -} - -static void queue_path(struct fuse *f, struct lock_queue_element *qe) -{ - struct lock_queue_element **qp; - - qe->done = false; - qe->first_locked = false; - qe->second_locked = false; - pthread_cond_init(&qe->cond, NULL); - qe->next = NULL; - for (qp = &f->lockq; *qp != NULL; qp = &(*qp)->next); - *qp = qe; -} - -static void dequeue_path(struct fuse *f, struct lock_queue_element *qe) -{ - struct lock_queue_element **qp; - - pthread_cond_destroy(&qe->cond); - for (qp = &f->lockq; *qp != qe; qp = &(*qp)->next); - *qp = qe->next; -} - -static int wait_path(struct fuse *f, struct lock_queue_element *qe) -{ - queue_path(f, qe); - - do { - pthread_cond_wait(&qe->cond, &f->lock); - } while (!qe->done); - - dequeue_path(f, qe); - - return qe->err; -} - -static int get_path_common(struct fuse *f, fuse_ino_t nodeid, const char *name, - char **path, struct node **wnode) -{ - int err; - - pthread_mutex_lock(&f->lock); - err = try_get_path(f, nodeid, name, path, wnode, true); - if (err == -EAGAIN) { - struct lock_queue_element qe = { - .nodeid1 = nodeid, - .name1 = name, - .path1 = path, - .wnode1 = wnode, - }; - debug_path(f, "QUEUE PATH", nodeid, name, !!wnode); - err = wait_path(f, &qe); - debug_path(f, "DEQUEUE PATH", nodeid, name, !!wnode); - } - pthread_mutex_unlock(&f->lock); - - return err; -} - -static int get_path(struct fuse *f, fuse_ino_t nodeid, char **path) -{ - return get_path_common(f, nodeid, NULL, path, NULL); -} - -static int get_path_nullok(struct fuse *f, fuse_ino_t nodeid, char **path) -{ - int err = 0; - - if (f->conf.nullpath_ok) { - *path = NULL; - } else { - err = get_path_common(f, nodeid, NULL, path, NULL); - if (err == -ENOENT) - err = 0; - } - - return err; -} - -static int get_path_name(struct fuse *f, fuse_ino_t nodeid, const char *name, - char **path) -{ - return get_path_common(f, nodeid, name, path, NULL); -} - -static int get_path_wrlock(struct fuse *f, fuse_ino_t nodeid, const char *name, - char **path, struct node **wnode) -{ - return get_path_common(f, nodeid, name, path, wnode); -} - -static int try_get_path2(struct fuse *f, fuse_ino_t nodeid1, const char *name1, - fuse_ino_t nodeid2, const char *name2, - char **path1, char **path2, - struct node **wnode1, struct node **wnode2) -{ - int err; - - /* FIXME: locking two paths needs deadlock checking */ - err = try_get_path(f, nodeid1, name1, path1, wnode1, true); - if (!err) { - err = try_get_path(f, nodeid2, name2, path2, wnode2, true); - if (err) { - struct node *wn1 = wnode1 ? *wnode1 : NULL; - - unlock_path(f, nodeid1, wn1, NULL); - free(*path1); - } - } - return err; -} - -static int get_path2(struct fuse *f, fuse_ino_t nodeid1, const char *name1, - fuse_ino_t nodeid2, const char *name2, - char **path1, char **path2, - struct node **wnode1, struct node **wnode2) -{ - int err; - - pthread_mutex_lock(&f->lock); - err = try_get_path2(f, nodeid1, name1, nodeid2, name2, - path1, path2, wnode1, wnode2); - if (err == -EAGAIN) { - struct lock_queue_element qe = { - .nodeid1 = nodeid1, - .name1 = name1, - .path1 = path1, - .wnode1 = wnode1, - .nodeid2 = nodeid2, - .name2 = name2, - .path2 = path2, - .wnode2 = wnode2, - }; - - debug_path(f, "QUEUE PATH1", nodeid1, name1, !!wnode1); - debug_path(f, " PATH2", nodeid2, name2, !!wnode2); - err = wait_path(f, &qe); - debug_path(f, "DEQUEUE PATH1", nodeid1, name1, !!wnode1); - debug_path(f, " PATH2", nodeid2, name2, !!wnode2); - } - pthread_mutex_unlock(&f->lock); - - return err; -} - -static void free_path_wrlock(struct fuse *f, fuse_ino_t nodeid, - struct node *wnode, char *path) -{ - pthread_mutex_lock(&f->lock); - unlock_path(f, nodeid, wnode, NULL); - if (f->lockq) - wake_up_queued(f); - pthread_mutex_unlock(&f->lock); - free(path); -} - -static void free_path(struct fuse *f, fuse_ino_t nodeid, char *path) -{ - if (path) - free_path_wrlock(f, nodeid, NULL, path); -} - -static void free_path2(struct fuse *f, fuse_ino_t nodeid1, fuse_ino_t nodeid2, - struct node *wnode1, struct node *wnode2, - char *path1, char *path2) -{ - pthread_mutex_lock(&f->lock); - unlock_path(f, nodeid1, wnode1, NULL); - unlock_path(f, nodeid2, wnode2, NULL); - wake_up_queued(f); - pthread_mutex_unlock(&f->lock); - free(path1); - free(path2); -} - -static void forget_node(struct fuse *f, fuse_ino_t nodeid, uint64_t nlookup) -{ - struct node *node; - if (nodeid == FUSE_ROOT_ID) - return; - pthread_mutex_lock(&f->lock); - node = get_node(f, nodeid); - - /* - * Node may still be locked due to interrupt idiocy in open, - * create and opendir - */ - while (node->nlookup == nlookup && node->treelock) { - struct lock_queue_element qe = { - .nodeid1 = nodeid, - }; - - debug_path(f, "QUEUE PATH (forget)", nodeid, NULL, false); - queue_path(f, &qe); - - do { - pthread_cond_wait(&qe.cond, &f->lock); - } while (node->nlookup == nlookup && node->treelock); - - dequeue_path(f, &qe); - debug_path(f, "DEQUEUE_PATH (forget)", nodeid, NULL, false); - } - - assert(node->nlookup >= nlookup); - node->nlookup -= nlookup; - if (!node->nlookup) { - unref_node(f, node); - } else if (lru_enabled(f) && node->nlookup == 1) { - set_forget_time(f, node); - } - pthread_mutex_unlock(&f->lock); -} - -static void unlink_node(struct fuse *f, struct node *node) -{ - if (f->conf.remember) { - assert(node->nlookup > 1); - node->nlookup--; - } - unhash_name(f, node); -} - -static void remove_node(struct fuse *f, fuse_ino_t dir, const char *name) -{ - struct node *node; - - pthread_mutex_lock(&f->lock); - node = lookup_node(f, dir, name); - if (node != NULL) - unlink_node(f, node); - pthread_mutex_unlock(&f->lock); -} - -static int rename_node(struct fuse *f, fuse_ino_t olddir, const char *oldname, - fuse_ino_t newdir, const char *newname, int hide) -{ - struct node *node; - struct node *newnode; - int err = 0; - - pthread_mutex_lock(&f->lock); - node = lookup_node(f, olddir, oldname); - newnode = lookup_node(f, newdir, newname); - if (node == NULL) - goto out; - - if (newnode != NULL) { - if (hide) { - fprintf(stderr, "fuse: hidden file got created during hiding\n"); - err = -EBUSY; - goto out; - } - unlink_node(f, newnode); - } - - unhash_name(f, node); - if (hash_name(f, node, newdir, newname) == -1) { - err = -ENOMEM; - goto out; - } - - if (hide) - node->is_hidden = 1; - -out: - pthread_mutex_unlock(&f->lock); - return err; -} - -static int exchange_node(struct fuse *f, fuse_ino_t olddir, const char *oldname, - fuse_ino_t newdir, const char *newname) -{ - struct node *oldnode; - struct node *newnode; - int err; - - pthread_mutex_lock(&f->lock); - oldnode = lookup_node(f, olddir, oldname); - newnode = lookup_node(f, newdir, newname); - - if (oldnode) - unhash_name(f, oldnode); - if (newnode) - unhash_name(f, newnode); - - err = -ENOMEM; - if (oldnode) { - if (hash_name(f, oldnode, newdir, newname) == -1) - goto out; - } - if (newnode) { - if (hash_name(f, newnode, olddir, oldname) == -1) - goto out; - } - err = 0; -out: - pthread_mutex_unlock(&f->lock); - return err; -} - -static void set_stat(struct fuse *f, fuse_ino_t nodeid, struct stat *stbuf) -{ - if (!f->conf.use_ino) - stbuf->st_ino = nodeid; - if (f->conf.set_mode) - stbuf->st_mode = (stbuf->st_mode & S_IFMT) | - (0777 & ~f->conf.umask); - if (f->conf.set_uid) - stbuf->st_uid = f->conf.uid; - if (f->conf.set_gid) - stbuf->st_gid = f->conf.gid; -} - -static struct fuse *req_fuse(fuse_req_t req) -{ - return (struct fuse *) fuse_req_userdata(req); -} - -static void fuse_intr_sighandler(int sig) -{ - (void) sig; - /* Nothing to do */ -} - -struct fuse_intr_data { - pthread_t id; - pthread_cond_t cond; - int finished; -}; - -static void fuse_interrupt(fuse_req_t req, void *d_) -{ - struct fuse_intr_data *d = d_; - struct fuse *f = req_fuse(req); - - if (d->id == pthread_self()) - return; - - pthread_mutex_lock(&f->lock); - while (!d->finished) { - struct timeval now; - struct timespec timeout; - - pthread_kill(d->id, f->conf.intr_signal); - gettimeofday(&now, NULL); - timeout.tv_sec = now.tv_sec + 1; - timeout.tv_nsec = now.tv_usec * 1000; - pthread_cond_timedwait(&d->cond, &f->lock, &timeout); - } - pthread_mutex_unlock(&f->lock); -} - -static void fuse_do_finish_interrupt(struct fuse *f, fuse_req_t req, - struct fuse_intr_data *d) -{ - pthread_mutex_lock(&f->lock); - d->finished = 1; - pthread_cond_broadcast(&d->cond); - pthread_mutex_unlock(&f->lock); - fuse_req_interrupt_func(req, NULL, NULL); - pthread_cond_destroy(&d->cond); -} - -static void fuse_do_prepare_interrupt(fuse_req_t req, struct fuse_intr_data *d) -{ - d->id = pthread_self(); - pthread_cond_init(&d->cond, NULL); - d->finished = 0; - fuse_req_interrupt_func(req, fuse_interrupt, d); -} - -static inline void fuse_finish_interrupt(struct fuse *f, fuse_req_t req, - struct fuse_intr_data *d) -{ - if (f->conf.intr) - fuse_do_finish_interrupt(f, req, d); -} - -static inline void fuse_prepare_interrupt(struct fuse *f, fuse_req_t req, - struct fuse_intr_data *d) -{ - if (f->conf.intr) - fuse_do_prepare_interrupt(req, d); -} - -static const char* file_info_string(struct fuse_file_info *fi, - char* buf, size_t len) -{ - if(fi == NULL) - return "NULL"; - snprintf(buf, len, "%llu", (unsigned long long) fi->fh); - return buf; -} - -int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.getattr) { - if (fs->debug) { - char buf[10]; - fprintf(stderr, "getattr[%s] %s\n", - file_info_string(fi, buf, sizeof(buf)), - path); - } - return fs->op.getattr(path, buf, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath, - const char *newpath, unsigned int flags) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.rename) { - if (fs->debug) - fprintf(stderr, "rename %s %s 0x%x\n", oldpath, newpath, - flags); - - return fs->op.rename(oldpath, newpath, flags); - } else { - return -ENOSYS; - } -} - -int fuse_fs_unlink(struct fuse_fs *fs, const char *path) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.unlink) { - if (fs->debug) - fprintf(stderr, "unlink %s\n", path); - - return fs->op.unlink(path); - } else { - return -ENOSYS; - } -} - -int fuse_fs_rmdir(struct fuse_fs *fs, const char *path) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.rmdir) { - if (fs->debug) - fprintf(stderr, "rmdir %s\n", path); - - return fs->op.rmdir(path); - } else { - return -ENOSYS; - } -} - -int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname, const char *path) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.symlink) { - if (fs->debug) - fprintf(stderr, "symlink %s %s\n", linkname, path); - - return fs->op.symlink(linkname, path); - } else { - return -ENOSYS; - } -} - -int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.link) { - if (fs->debug) - fprintf(stderr, "link %s %s\n", oldpath, newpath); - - return fs->op.link(oldpath, newpath); - } else { - return -ENOSYS; - } -} - -int fuse_fs_release(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.release) { - if (fs->debug) - fprintf(stderr, "release%s[%llu] flags: 0x%x\n", - fi->flush ? "+flush" : "", - (unsigned long long) fi->fh, fi->flags); - - return fs->op.release(path, fi); - } else { - return 0; - } -} - -int fuse_fs_opendir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.opendir) { - int err; - - if (fs->debug) - fprintf(stderr, "opendir flags: 0x%x %s\n", fi->flags, - path); - - err = fs->op.opendir(path, fi); - - if (fs->debug && !err) - fprintf(stderr, " opendir[%llu] flags: 0x%x %s\n", - (unsigned long long) fi->fh, fi->flags, path); - - return err; - } else { - return 0; - } -} - -int fuse_fs_open(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.open) { - int err; - - if (fs->debug) - fprintf(stderr, "open flags: 0x%x %s\n", fi->flags, - path); - - err = fs->op.open(path, fi); - - if (fs->debug && !err) - fprintf(stderr, " open[%llu] flags: 0x%x %s\n", - (unsigned long long) fi->fh, fi->flags, path); - - return err; - } else { - return 0; - } -} - -static void fuse_free_buf(struct fuse_bufvec *buf) -{ - if (buf != NULL) { - size_t i; - - for (i = 0; i < buf->count; i++) - free(buf->buf[i].mem); - free(buf); - } -} - -int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, - struct fuse_bufvec **bufp, size_t size, off_t off, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.read || fs->op.read_buf) { - int res; - - if (fs->debug) - fprintf(stderr, - "read[%llu] %zu bytes from %llu flags: 0x%x\n", - (unsigned long long) fi->fh, - size, (unsigned long long) off, fi->flags); - - if (fs->op.read_buf) { - res = fs->op.read_buf(path, bufp, size, off, fi); - } else { - struct fuse_bufvec *buf; - void *mem; - - buf = malloc(sizeof(struct fuse_bufvec)); - if (buf == NULL) - return -ENOMEM; - - mem = malloc(size); - if (mem == NULL) { - free(buf); - return -ENOMEM; - } - *buf = FUSE_BUFVEC_INIT(size); - buf->buf[0].mem = mem; - *bufp = buf; - - res = fs->op.read(path, mem, size, off, fi); - if (res >= 0) - buf->buf[0].size = res; - } - - if (fs->debug && res >= 0) - fprintf(stderr, " read[%llu] %zu bytes from %llu\n", - (unsigned long long) fi->fh, - fuse_buf_size(*bufp), - (unsigned long long) off); - if (res >= 0 && fuse_buf_size(*bufp) > (int) size) - fprintf(stderr, "fuse: read too many bytes\n"); - - if (res < 0) - return res; - - return 0; - } else { - return -ENOSYS; - } -} - -int fuse_fs_read(struct fuse_fs *fs, const char *path, char *mem, size_t size, - off_t off, struct fuse_file_info *fi) -{ - int res; - struct fuse_bufvec *buf = NULL; - - res = fuse_fs_read_buf(fs, path, &buf, size, off, fi); - if (res == 0) { - struct fuse_bufvec dst = FUSE_BUFVEC_INIT(size); - - dst.buf[0].mem = mem; - res = fuse_buf_copy(&dst, buf, 0); - } - fuse_free_buf(buf); - - return res; -} - -int fuse_fs_write_buf(struct fuse_fs *fs, const char *path, - struct fuse_bufvec *buf, off_t off, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.write_buf || fs->op.write) { - int res; - size_t size = fuse_buf_size(buf); - - assert(buf->idx == 0 && buf->off == 0); - if (fs->debug) - fprintf(stderr, - "write%s[%llu] %zu bytes to %llu flags: 0x%x\n", - fi->writepage ? "page" : "", - (unsigned long long) fi->fh, - size, - (unsigned long long) off, - fi->flags); - - if (fs->op.write_buf) { - res = fs->op.write_buf(path, buf, off, fi); - } else { - void *mem = NULL; - struct fuse_buf *flatbuf; - struct fuse_bufvec tmp = FUSE_BUFVEC_INIT(size); - - if (buf->count == 1 && - !(buf->buf[0].flags & FUSE_BUF_IS_FD)) { - flatbuf = &buf->buf[0]; - } else { - res = -ENOMEM; - mem = malloc(size); - if (mem == NULL) - goto out; - - tmp.buf[0].mem = mem; - res = fuse_buf_copy(&tmp, buf, 0); - if (res <= 0) - goto out_free; - - tmp.buf[0].size = res; - flatbuf = &tmp.buf[0]; - } - - res = fs->op.write(path, flatbuf->mem, flatbuf->size, - off, fi); -out_free: - free(mem); - } -out: - if (fs->debug && res >= 0) - fprintf(stderr, " write%s[%llu] %u bytes to %llu\n", - fi->writepage ? "page" : "", - (unsigned long long) fi->fh, res, - (unsigned long long) off); - if (res > (int) size) - fprintf(stderr, "fuse: wrote too many bytes\n"); - - return res; - } else { - return -ENOSYS; - } -} - -int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *mem, - size_t size, off_t off, struct fuse_file_info *fi) -{ - struct fuse_bufvec bufv = FUSE_BUFVEC_INIT(size); - - bufv.buf[0].mem = (void *) mem; - - return fuse_fs_write_buf(fs, path, &bufv, off, fi); -} - -int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.fsync) { - if (fs->debug) - fprintf(stderr, "fsync[%llu] datasync: %i\n", - (unsigned long long) fi->fh, datasync); - - return fs->op.fsync(path, datasync, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.fsyncdir) { - if (fs->debug) - fprintf(stderr, "fsyncdir[%llu] datasync: %i\n", - (unsigned long long) fi->fh, datasync); - - return fs->op.fsyncdir(path, datasync, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_flush(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.flush) { - if (fs->debug) - fprintf(stderr, "flush[%llu]\n", - (unsigned long long) fi->fh); - - return fs->op.flush(path, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.statfs) { - if (fs->debug) - fprintf(stderr, "statfs %s\n", path); - - return fs->op.statfs(path, buf); - } else { - buf->f_namemax = 255; - buf->f_bsize = 512; - return 0; - } -} - -int fuse_fs_releasedir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.releasedir) { - if (fs->debug) - fprintf(stderr, "releasedir[%llu] flags: 0x%x\n", - (unsigned long long) fi->fh, fi->flags); - - return fs->op.releasedir(path, fi); - } else { - return 0; - } -} - -int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf, - fuse_fill_dir_t filler, off_t off, - struct fuse_file_info *fi, - enum fuse_readdir_flags flags) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.readdir) { - if (fs->debug) { - fprintf(stderr, "readdir%s[%llu] from %llu\n", - (flags & FUSE_READDIR_PLUS) ? "plus" : "", - (unsigned long long) fi->fh, - (unsigned long long) off); - } - - return fs->op.readdir(path, buf, filler, off, fi, flags); - } else { - return -ENOSYS; - } -} - -int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.create) { - int err; - - if (fs->debug) - fprintf(stderr, - "create flags: 0x%x %s 0%o umask=0%03o\n", - fi->flags, path, mode, - fuse_get_context()->umask); - - err = fs->op.create(path, mode, fi); - - if (fs->debug && !err) - fprintf(stderr, " create[%llu] flags: 0x%x %s\n", - (unsigned long long) fi->fh, fi->flags, path); - - return err; - } else { - return -ENOSYS; - } -} - -int fuse_fs_lock(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, int cmd, struct flock *lock) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.lock) { - if (fs->debug) - fprintf(stderr, "lock[%llu] %s %s start: %llu len: %llu pid: %llu\n", - (unsigned long long) fi->fh, - (cmd == F_GETLK ? "F_GETLK" : - (cmd == F_SETLK ? "F_SETLK" : - (cmd == F_SETLKW ? "F_SETLKW" : "???"))), - (lock->l_type == F_RDLCK ? "F_RDLCK" : - (lock->l_type == F_WRLCK ? "F_WRLCK" : - (lock->l_type == F_UNLCK ? "F_UNLCK" : - "???"))), - (unsigned long long) lock->l_start, - (unsigned long long) lock->l_len, - (unsigned long long) lock->l_pid); - - return fs->op.lock(path, fi, cmd, lock); - } else { - return -ENOSYS; - } -} - -int fuse_fs_flock(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, int op) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.flock) { - if (fs->debug) { - int xop = op & ~LOCK_NB; - - fprintf(stderr, "lock[%llu] %s%s\n", - (unsigned long long) fi->fh, - xop == LOCK_SH ? "LOCK_SH" : - (xop == LOCK_EX ? "LOCK_EX" : - (xop == LOCK_UN ? "LOCK_UN" : "???")), - (op & LOCK_NB) ? "|LOCK_NB" : ""); - } - return fs->op.flock(path, fi, op); - } else { - return -ENOSYS; - } -} - -int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, - gid_t gid, struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.chown) { - if (fs->debug) { - char buf[10]; - fprintf(stderr, "chown[%s] %s %lu %lu\n", - file_info_string(fi, buf, sizeof(buf)), - path, (unsigned long) uid, (unsigned long) gid); - } - return fs->op.chown(path, uid, gid, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.truncate) { - if (fs->debug) { - char buf[10]; - fprintf(stderr, "truncate[%s] %llu\n", - file_info_string(fi, buf, sizeof(buf)), - (unsigned long long) size); - } - return fs->op.truncate(path, size, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_utimens(struct fuse_fs *fs, const char *path, - const struct timespec tv[2], struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.utimens) { - if (fs->debug) { - char buf[10]; - fprintf(stderr, "utimens[%s] %s %li.%09lu %li.%09lu\n", - file_info_string(fi, buf, sizeof(buf)), - path, tv[0].tv_sec, tv[0].tv_nsec, - tv[1].tv_sec, tv[1].tv_nsec); - } - return fs->op.utimens(path, tv, fi); - } else { - return -ENOSYS; - } -} - -int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.access) { - if (fs->debug) - fprintf(stderr, "access %s 0%o\n", path, mask); - - return fs->op.access(path, mask); - } else { - return -ENOSYS; - } -} - -int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf, - size_t len) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.readlink) { - if (fs->debug) - fprintf(stderr, "readlink %s %lu\n", path, - (unsigned long) len); - - return fs->op.readlink(path, buf, len); - } else { - return -ENOSYS; - } -} - -int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode, - dev_t rdev) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.mknod) { - if (fs->debug) - fprintf(stderr, "mknod %s 0%o 0x%llx umask=0%03o\n", - path, mode, (unsigned long long) rdev, - fuse_get_context()->umask); - - return fs->op.mknod(path, mode, rdev); - } else { - return -ENOSYS; - } -} - -int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.mkdir) { - if (fs->debug) - fprintf(stderr, "mkdir %s 0%o umask=0%03o\n", - path, mode, fuse_get_context()->umask); - - return fs->op.mkdir(path, mode); - } else { - return -ENOSYS; - } -} - -int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name, - const char *value, size_t size, int flags) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.setxattr) { - if (fs->debug) - fprintf(stderr, "setxattr %s %s %lu 0x%x\n", - path, name, (unsigned long) size, flags); - - return fs->op.setxattr(path, name, value, size, flags); - } else { - return -ENOSYS; - } -} - -int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name, - char *value, size_t size) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.getxattr) { - if (fs->debug) - fprintf(stderr, "getxattr %s %s %lu\n", - path, name, (unsigned long) size); - - return fs->op.getxattr(path, name, value, size); - } else { - return -ENOSYS; - } -} - -int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list, - size_t size) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.listxattr) { - if (fs->debug) - fprintf(stderr, "listxattr %s %lu\n", - path, (unsigned long) size); - - return fs->op.listxattr(path, list, size); - } else { - return -ENOSYS; - } -} - -int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize, - uint64_t *idx) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.bmap) { - if (fs->debug) - fprintf(stderr, "bmap %s blocksize: %lu index: %llu\n", - path, (unsigned long) blocksize, - (unsigned long long) *idx); - - return fs->op.bmap(path, blocksize, idx); - } else { - return -ENOSYS; - } -} - -int fuse_fs_removexattr(struct fuse_fs *fs, const char *path, const char *name) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.removexattr) { - if (fs->debug) - fprintf(stderr, "removexattr %s %s\n", path, name); - - return fs->op.removexattr(path, name); - } else { - return -ENOSYS; - } -} - -int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd, void *arg, - struct fuse_file_info *fi, unsigned int flags, void *data) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.ioctl) { - if (fs->debug) - fprintf(stderr, "ioctl[%llu] 0x%x flags: 0x%x\n", - (unsigned long long) fi->fh, cmd, flags); - - return fs->op.ioctl(path, cmd, arg, fi, flags, data); - } else - return -ENOSYS; -} - -int fuse_fs_poll(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, struct fuse_pollhandle *ph, - unsigned *reventsp) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.poll) { - int res; - - if (fs->debug) - fprintf(stderr, "poll[%llu] ph: %p, events 0x%x\n", - (unsigned long long) fi->fh, ph, - fi->poll_events); - - res = fs->op.poll(path, fi, ph, reventsp); - - if (fs->debug && !res) - fprintf(stderr, " poll[%llu] revents: 0x%x\n", - (unsigned long long) fi->fh, *reventsp); - - return res; - } else - return -ENOSYS; -} - -int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode, - off_t offset, off_t length, struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.fallocate) { - if (fs->debug) - fprintf(stderr, "fallocate %s mode %x, offset: %llu, length: %llu\n", - path, - mode, - (unsigned long long) offset, - (unsigned long long) length); - - return fs->op.fallocate(path, mode, offset, length, fi); - } else - return -ENOSYS; -} - -static int is_open(struct fuse *f, fuse_ino_t dir, const char *name) -{ - struct node *node; - int isopen = 0; - pthread_mutex_lock(&f->lock); - node = lookup_node(f, dir, name); - if (node && node->open_count > 0) - isopen = 1; - pthread_mutex_unlock(&f->lock); - return isopen; -} - -static char *hidden_name(struct fuse *f, fuse_ino_t dir, const char *oldname, - char *newname, size_t bufsize) -{ - struct stat buf; - struct node *node; - struct node *newnode; - char *newpath; - int res; - int failctr = 10; - - do { - pthread_mutex_lock(&f->lock); - node = lookup_node(f, dir, oldname); - if (node == NULL) { - pthread_mutex_unlock(&f->lock); - return NULL; - } - do { - f->hidectr ++; - snprintf(newname, bufsize, ".fuse_hidden%08x%08x", - (unsigned int) node->nodeid, f->hidectr); - newnode = lookup_node(f, dir, newname); - } while(newnode); - - res = try_get_path(f, dir, newname, &newpath, NULL, false); - pthread_mutex_unlock(&f->lock); - if (res) - break; - - memset(&buf, 0, sizeof(buf)); - res = fuse_fs_getattr(f->fs, newpath, &buf, NULL); - if (res == -ENOENT) - break; - free(newpath); - newpath = NULL; - } while(res == 0 && --failctr); - - return newpath; -} - -static int hide_node(struct fuse *f, const char *oldpath, - fuse_ino_t dir, const char *oldname) -{ - char newname[64]; - char *newpath; - int err = -EBUSY; - - newpath = hidden_name(f, dir, oldname, newname, sizeof(newname)); - if (newpath) { - err = fuse_fs_rename(f->fs, oldpath, newpath, 0); - if (!err) - err = rename_node(f, dir, oldname, dir, newname, 1); - free(newpath); - } - return err; -} - -static int mtime_eq(const struct stat *stbuf, const struct timespec *ts) -{ - return stbuf->st_mtime == ts->tv_sec && - ST_MTIM_NSEC(stbuf) == ts->tv_nsec; -} - -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC CLOCK_REALTIME -#endif - -static void curr_time(struct timespec *now) -{ - static clockid_t clockid = CLOCK_MONOTONIC; - int res = clock_gettime(clockid, now); - if (res == -1 && errno == EINVAL) { - clockid = CLOCK_REALTIME; - res = clock_gettime(clockid, now); - } - if (res == -1) { - perror("fuse: clock_gettime"); - abort(); - } -} - -static void update_stat(struct node *node, const struct stat *stbuf) -{ - if (node->cache_valid && (!mtime_eq(stbuf, &node->mtime) || - stbuf->st_size != node->size)) - node->cache_valid = 0; - node->mtime.tv_sec = stbuf->st_mtime; - node->mtime.tv_nsec = ST_MTIM_NSEC(stbuf); - node->size = stbuf->st_size; - curr_time(&node->stat_updated); -} - -static int do_lookup(struct fuse *f, fuse_ino_t nodeid, const char *name, - struct fuse_entry_param *e) -{ - struct node *node; - - node = find_node(f, nodeid, name); - if (node == NULL) - return -ENOMEM; - - e->ino = node->nodeid; - e->generation = node->generation; - e->entry_timeout = f->conf.entry_timeout; - e->attr_timeout = f->conf.attr_timeout; - if (f->conf.auto_cache) { - pthread_mutex_lock(&f->lock); - update_stat(node, &e->attr); - pthread_mutex_unlock(&f->lock); - } - set_stat(f, e->ino, &e->attr); - return 0; -} - -static int lookup_path(struct fuse *f, fuse_ino_t nodeid, - const char *name, const char *path, - struct fuse_entry_param *e, struct fuse_file_info *fi) -{ - int res; - - memset(e, 0, sizeof(struct fuse_entry_param)); - res = fuse_fs_getattr(f->fs, path, &e->attr, fi); - if (res == 0) { - res = do_lookup(f, nodeid, name, e); - if (res == 0 && f->conf.debug) { - fprintf(stderr, " NODEID: %llu\n", - (unsigned long long) e->ino); - } - } - return res; -} - -static struct fuse_context_i *fuse_get_context_internal(void) -{ - return (struct fuse_context_i *) pthread_getspecific(fuse_context_key); -} - -static struct fuse_context_i *fuse_create_context(struct fuse *f) -{ - struct fuse_context_i *c = fuse_get_context_internal(); - if (c == NULL) { - c = (struct fuse_context_i *) - calloc(1, sizeof(struct fuse_context_i)); - if (c == NULL) { - /* This is hard to deal with properly, so just - abort. If memory is so low that the - context cannot be allocated, there's not - much hope for the filesystem anyway */ - fprintf(stderr, "fuse: failed to allocate thread specific data\n"); - abort(); - } - pthread_setspecific(fuse_context_key, c); - } else { - memset(c, 0, sizeof(*c)); - } - c->ctx.fuse = f; - - return c; -} - -static void fuse_freecontext(void *data) -{ - free(data); -} - -static int fuse_create_context_key(void) -{ - int err = 0; - pthread_mutex_lock(&fuse_context_lock); - if (!fuse_context_ref) { - err = pthread_key_create(&fuse_context_key, fuse_freecontext); - if (err) { - fprintf(stderr, "fuse: failed to create thread specific key: %s\n", - strerror(err)); - pthread_mutex_unlock(&fuse_context_lock); - return -1; - } - } - fuse_context_ref++; - pthread_mutex_unlock(&fuse_context_lock); - return 0; -} - -static void fuse_delete_context_key(void) -{ - pthread_mutex_lock(&fuse_context_lock); - fuse_context_ref--; - if (!fuse_context_ref) { - free(pthread_getspecific(fuse_context_key)); - pthread_key_delete(fuse_context_key); - } - pthread_mutex_unlock(&fuse_context_lock); -} - -static struct fuse *req_fuse_prepare(fuse_req_t req) -{ - struct fuse_context_i *c = fuse_create_context(req_fuse(req)); - const struct fuse_ctx *ctx = fuse_req_ctx(req); - c->req = req; - c->ctx.uid = ctx->uid; - c->ctx.gid = ctx->gid; - c->ctx.pid = ctx->pid; - c->ctx.umask = ctx->umask; - return c->ctx.fuse; -} - -static inline void reply_err(fuse_req_t req, int err) -{ - /* fuse_reply_err() uses non-negated errno values */ - fuse_reply_err(req, -err); -} - -static void reply_entry(fuse_req_t req, const struct fuse_entry_param *e, - int err) -{ - if (!err) { - struct fuse *f = req_fuse(req); - if (fuse_reply_entry(req, e) == -ENOENT) { - /* Skip forget for negative result */ - if (e->ino != 0) - forget_node(f, e->ino, 1); - } - } else - reply_err(req, err); -} - -void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn, - struct fuse_config *cfg) -{ - fuse_get_context()->private_data = fs->user_data; - if (!fs->op.write_buf) - conn->want &= ~FUSE_CAP_SPLICE_READ; - if (!fs->op.lock) - conn->want &= ~FUSE_CAP_POSIX_LOCKS; - if (!fs->op.flock) - conn->want &= ~FUSE_CAP_FLOCK_LOCKS; - if (fs->op.init) - fs->user_data = fs->op.init(conn, cfg); -} - -static void fuse_lib_init(void *data, struct fuse_conn_info *conn) -{ - struct fuse *f = (struct fuse *) data; - - fuse_create_context(f); - conn->want |= FUSE_CAP_EXPORT_SUPPORT; - fuse_fs_init(f->fs, conn, &f->conf); -} - -void fuse_fs_destroy(struct fuse_fs *fs) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.destroy) - fs->op.destroy(fs->user_data); - if (fs->m) - fuse_put_module(fs->m); - free(fs); -} - -static void fuse_lib_destroy(void *data) -{ - struct fuse *f = (struct fuse *) data; - - fuse_create_context(f); - fuse_fs_destroy(f->fs); - f->fs = NULL; -} - -static void fuse_lib_lookup(fuse_req_t req, fuse_ino_t parent, - const char *name) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_entry_param e; - char *path; - int err; - struct node *dot = NULL; - - if (name[0] == '.') { - int len = strlen(name); - - if (len == 1 || (name[1] == '.' && len == 2)) { - pthread_mutex_lock(&f->lock); - if (len == 1) { - if (f->conf.debug) - fprintf(stderr, "LOOKUP-DOT\n"); - dot = get_node_nocheck(f, parent); - if (dot == NULL) { - pthread_mutex_unlock(&f->lock); - reply_entry(req, &e, -ESTALE); - return; - } - dot->refctr++; - } else { - if (f->conf.debug) - fprintf(stderr, "LOOKUP-DOTDOT\n"); - parent = get_node(f, parent)->parent->nodeid; - } - pthread_mutex_unlock(&f->lock); - name = NULL; - } - } - - err = get_path_name(f, parent, name, &path); - if (!err) { - struct fuse_intr_data d; - if (f->conf.debug) - fprintf(stderr, "LOOKUP %s\n", path); - fuse_prepare_interrupt(f, req, &d); - err = lookup_path(f, parent, name, path, &e, NULL); - if (err == -ENOENT && f->conf.negative_timeout != 0.0) { - e.ino = 0; - e.entry_timeout = f->conf.negative_timeout; - err = 0; - } - fuse_finish_interrupt(f, req, &d); - free_path(f, parent, path); - } - if (dot) { - pthread_mutex_lock(&f->lock); - unref_node(f, dot); - pthread_mutex_unlock(&f->lock); - } - reply_entry(req, &e, err); -} - -static void do_forget(struct fuse *f, fuse_ino_t ino, uint64_t nlookup) -{ - if (f->conf.debug) - fprintf(stderr, "FORGET %llu/%llu\n", (unsigned long long)ino, - (unsigned long long) nlookup); - forget_node(f, ino, nlookup); -} - -static void fuse_lib_forget(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup) -{ - do_forget(req_fuse(req), ino, nlookup); - fuse_reply_none(req); -} - -static void fuse_lib_forget_multi(fuse_req_t req, size_t count, - struct fuse_forget_data *forgets) -{ - struct fuse *f = req_fuse(req); - size_t i; - - for (i = 0; i < count; i++) - do_forget(f, forgets[i].ino, forgets[i].nlookup); - - fuse_reply_none(req); -} - - -static void fuse_lib_getattr(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct stat buf; - char *path; - int err; - - memset(&buf, 0, sizeof(buf)); - - if (fi != NULL) - err = get_path_nullok(f, ino, &path); - else - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_getattr(f->fs, path, &buf, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - if (!err) { - struct node *node; - - pthread_mutex_lock(&f->lock); - node = get_node(f, ino); - if (node->is_hidden && buf.st_nlink > 0) - buf.st_nlink--; - if (f->conf.auto_cache) - update_stat(node, &buf); - pthread_mutex_unlock(&f->lock); - set_stat(f, ino, &buf); - fuse_reply_attr(req, &buf, f->conf.attr_timeout); - } else - reply_err(req, err); -} - -int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode, - struct fuse_file_info *fi) -{ - fuse_get_context()->private_data = fs->user_data; - if (fs->op.chmod) { - if (fs->debug) { - char buf[10]; - fprintf(stderr, "chmod[%s] %s %llo\n", - file_info_string(fi, buf, sizeof(buf)), - path, (unsigned long long) mode); - } - return fs->op.chmod(path, mode, fi); - } - else - return -ENOSYS; -} - -static void fuse_lib_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr, - int valid, struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct stat buf; - char *path; - int err; - - memset(&buf, 0, sizeof(buf)); - if (fi != NULL) - err = get_path_nullok(f, ino, &path); - else - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = 0; - if (!err && (valid & FUSE_SET_ATTR_MODE)) - err = fuse_fs_chmod(f->fs, path, attr->st_mode, fi); - if (!err && (valid & (FUSE_SET_ATTR_UID | FUSE_SET_ATTR_GID))) { - uid_t uid = (valid & FUSE_SET_ATTR_UID) ? - attr->st_uid : (uid_t) -1; - gid_t gid = (valid & FUSE_SET_ATTR_GID) ? - attr->st_gid : (gid_t) -1; - err = fuse_fs_chown(f->fs, path, uid, gid, fi); - } - if (!err && (valid & FUSE_SET_ATTR_SIZE)) { - err = fuse_fs_truncate(f->fs, path, - attr->st_size, fi); - } -#ifdef HAVE_UTIMENSAT - if (!err && - (valid & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME))) { - struct timespec tv[2]; - - tv[0].tv_sec = 0; - tv[1].tv_sec = 0; - tv[0].tv_nsec = UTIME_OMIT; - tv[1].tv_nsec = UTIME_OMIT; - - if (valid & FUSE_SET_ATTR_ATIME_NOW) - tv[0].tv_nsec = UTIME_NOW; - else if (valid & FUSE_SET_ATTR_ATIME) - tv[0] = attr->st_atim; - - if (valid & FUSE_SET_ATTR_MTIME_NOW) - tv[1].tv_nsec = UTIME_NOW; - else if (valid & FUSE_SET_ATTR_MTIME) - tv[1] = attr->st_mtim; - - err = fuse_fs_utimens(f->fs, path, tv, fi); - } else -#endif - if (!err && - (valid & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) == - (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) { - struct timespec tv[2]; - tv[0].tv_sec = attr->st_atime; - tv[0].tv_nsec = ST_ATIM_NSEC(attr); - tv[1].tv_sec = attr->st_mtime; - tv[1].tv_nsec = ST_MTIM_NSEC(attr); - err = fuse_fs_utimens(f->fs, path, tv, fi); - } - if (!err) { - err = fuse_fs_getattr(f->fs, path, &buf, fi); - } - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - if (!err) { - if (f->conf.auto_cache) { - pthread_mutex_lock(&f->lock); - update_stat(get_node(f, ino), &buf); - pthread_mutex_unlock(&f->lock); - } - set_stat(f, ino, &buf); - fuse_reply_attr(req, &buf, f->conf.attr_timeout); - } else - reply_err(req, err); -} - -static void fuse_lib_access(fuse_req_t req, fuse_ino_t ino, int mask) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_access(f->fs, path, mask); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static void fuse_lib_readlink(fuse_req_t req, fuse_ino_t ino) -{ - struct fuse *f = req_fuse_prepare(req); - char linkname[PATH_MAX + 1]; - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_readlink(f->fs, path, linkname, sizeof(linkname)); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - if (!err) { - linkname[PATH_MAX] = '\0'; - fuse_reply_readlink(req, linkname); - } else - reply_err(req, err); -} - -static void fuse_lib_mknod(fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode, dev_t rdev) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_entry_param e; - char *path; - int err; - - err = get_path_name(f, parent, name, &path); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = -ENOSYS; - if (S_ISREG(mode)) { - struct fuse_file_info fi; - - memset(&fi, 0, sizeof(fi)); - fi.flags = O_CREAT | O_EXCL | O_WRONLY; - err = fuse_fs_create(f->fs, path, mode, &fi); - if (!err) { - err = lookup_path(f, parent, name, path, &e, - &fi); - fuse_fs_release(f->fs, path, &fi); - } - } - if (err == -ENOSYS) { - err = fuse_fs_mknod(f->fs, path, mode, rdev); - if (!err) - err = lookup_path(f, parent, name, path, &e, - NULL); - } - fuse_finish_interrupt(f, req, &d); - free_path(f, parent, path); - } - reply_entry(req, &e, err); -} - -static void fuse_lib_mkdir(fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_entry_param e; - char *path; - int err; - - err = get_path_name(f, parent, name, &path); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_mkdir(f->fs, path, mode); - if (!err) - err = lookup_path(f, parent, name, path, &e, NULL); - fuse_finish_interrupt(f, req, &d); - free_path(f, parent, path); - } - reply_entry(req, &e, err); -} - -static void fuse_lib_unlink(fuse_req_t req, fuse_ino_t parent, - const char *name) -{ - struct fuse *f = req_fuse_prepare(req); - struct node *wnode; - char *path; - int err; - - err = get_path_wrlock(f, parent, name, &path, &wnode); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - if (!f->conf.hard_remove && is_open(f, parent, name)) { - err = hide_node(f, path, parent, name); - } else { - err = fuse_fs_unlink(f->fs, path); - if (!err) - remove_node(f, parent, name); - } - fuse_finish_interrupt(f, req, &d); - free_path_wrlock(f, parent, wnode, path); - } - reply_err(req, err); -} - -static void fuse_lib_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name) -{ - struct fuse *f = req_fuse_prepare(req); - struct node *wnode; - char *path; - int err; - - err = get_path_wrlock(f, parent, name, &path, &wnode); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_rmdir(f->fs, path); - fuse_finish_interrupt(f, req, &d); - if (!err) - remove_node(f, parent, name); - free_path_wrlock(f, parent, wnode, path); - } - reply_err(req, err); -} - -static void fuse_lib_symlink(fuse_req_t req, const char *linkname, - fuse_ino_t parent, const char *name) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_entry_param e; - char *path; - int err; - - err = get_path_name(f, parent, name, &path); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_symlink(f->fs, linkname, path); - if (!err) - err = lookup_path(f, parent, name, path, &e, NULL); - fuse_finish_interrupt(f, req, &d); - free_path(f, parent, path); - } - reply_entry(req, &e, err); -} - -static void fuse_lib_rename(fuse_req_t req, fuse_ino_t olddir, - const char *oldname, fuse_ino_t newdir, - const char *newname, unsigned int flags) -{ - struct fuse *f = req_fuse_prepare(req); - char *oldpath; - char *newpath; - struct node *wnode1; - struct node *wnode2; - int err; - - err = get_path2(f, olddir, oldname, newdir, newname, - &oldpath, &newpath, &wnode1, &wnode2); - if (!err) { - struct fuse_intr_data d; - err = 0; - fuse_prepare_interrupt(f, req, &d); - if (!f->conf.hard_remove && !(flags & RENAME_EXCHANGE) && - is_open(f, newdir, newname)) - err = hide_node(f, newpath, newdir, newname); - if (!err) { - err = fuse_fs_rename(f->fs, oldpath, newpath, flags); - if (!err) { - if (flags & RENAME_EXCHANGE) { - err = exchange_node(f, olddir, oldname, - newdir, newname); - } else { - err = rename_node(f, olddir, oldname, - newdir, newname, 0); - } - } - } - fuse_finish_interrupt(f, req, &d); - free_path2(f, olddir, newdir, wnode1, wnode2, oldpath, newpath); - } - reply_err(req, err); -} - -static void fuse_lib_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, - const char *newname) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_entry_param e; - char *oldpath; - char *newpath; - int err; - - err = get_path2(f, ino, NULL, newparent, newname, - &oldpath, &newpath, NULL, NULL); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_link(f->fs, oldpath, newpath); - if (!err) - err = lookup_path(f, newparent, newname, newpath, - &e, NULL); - fuse_finish_interrupt(f, req, &d); - free_path2(f, ino, newparent, NULL, NULL, oldpath, newpath); - } - reply_entry(req, &e, err); -} - -static void fuse_do_release(struct fuse *f, fuse_ino_t ino, const char *path, - struct fuse_file_info *fi) -{ - struct node *node; - int unlink_hidden = 0; - - fuse_fs_release(f->fs, path, fi); - - pthread_mutex_lock(&f->lock); - node = get_node(f, ino); - assert(node->open_count > 0); - --node->open_count; - if (node->is_hidden && !node->open_count) { - unlink_hidden = 1; - node->is_hidden = 0; - } - pthread_mutex_unlock(&f->lock); - - if(unlink_hidden) { - if (path) { - fuse_fs_unlink(f->fs, path); - } else if (f->conf.nullpath_ok) { - char *unlinkpath; - - if (get_path(f, ino, &unlinkpath) == 0) - fuse_fs_unlink(f->fs, unlinkpath); - - free_path(f, ino, unlinkpath); - } - } -} - -static void fuse_lib_create(fuse_req_t req, fuse_ino_t parent, - const char *name, mode_t mode, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - struct fuse_entry_param e; - char *path; - int err; - - err = get_path_name(f, parent, name, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_create(f->fs, path, mode, fi); - if (!err) { - err = lookup_path(f, parent, name, path, &e, fi); - if (err) - fuse_fs_release(f->fs, path, fi); - else if (!S_ISREG(e.attr.st_mode)) { - err = -EIO; - fuse_fs_release(f->fs, path, fi); - forget_node(f, e.ino, 1); - } else { - if (f->conf.direct_io) - fi->direct_io = 1; - if (f->conf.kernel_cache) - fi->keep_cache = 1; - - } - } - fuse_finish_interrupt(f, req, &d); - } - if (!err) { - pthread_mutex_lock(&f->lock); - get_node(f, e.ino)->open_count++; - pthread_mutex_unlock(&f->lock); - if (fuse_reply_create(req, &e, fi) == -ENOENT) { - /* The open syscall was interrupted, so it - must be cancelled */ - fuse_do_release(f, e.ino, path, fi); - forget_node(f, e.ino, 1); - } - } else { - reply_err(req, err); - } - - free_path(f, parent, path); -} - -static double diff_timespec(const struct timespec *t1, - const struct timespec *t2) -{ - return (t1->tv_sec - t2->tv_sec) + - ((double) t1->tv_nsec - (double) t2->tv_nsec) / 1000000000.0; -} - -static void open_auto_cache(struct fuse *f, fuse_ino_t ino, const char *path, - struct fuse_file_info *fi) -{ - struct node *node; - - pthread_mutex_lock(&f->lock); - node = get_node(f, ino); - if (node->cache_valid) { - struct timespec now; - - curr_time(&now); - if (diff_timespec(&now, &node->stat_updated) > - f->conf.ac_attr_timeout) { - struct stat stbuf; - int err; - pthread_mutex_unlock(&f->lock); - err = fuse_fs_getattr(f->fs, path, &stbuf, fi); - pthread_mutex_lock(&f->lock); - if (!err) - update_stat(node, &stbuf); - else - node->cache_valid = 0; - } - } - if (node->cache_valid) - fi->keep_cache = 1; - - node->cache_valid = 1; - pthread_mutex_unlock(&f->lock); -} - -static void fuse_lib_open(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_open(f->fs, path, fi); - if (!err) { - if (f->conf.direct_io) - fi->direct_io = 1; - if (f->conf.kernel_cache) - fi->keep_cache = 1; - - if (f->conf.auto_cache) - open_auto_cache(f, ino, path, fi); - } - fuse_finish_interrupt(f, req, &d); - } - if (!err) { - pthread_mutex_lock(&f->lock); - get_node(f, ino)->open_count++; - pthread_mutex_unlock(&f->lock); - if (fuse_reply_open(req, fi) == -ENOENT) { - /* The open syscall was interrupted, so it - must be cancelled */ - fuse_do_release(f, ino, path, fi); - } - } else - reply_err(req, err); - - free_path(f, ino, path); -} - -static void fuse_lib_read(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t off, struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_bufvec *buf = NULL; - char *path; - int res; - - res = get_path_nullok(f, ino, &path); - if (res == 0) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - res = fuse_fs_read_buf(f->fs, path, &buf, size, off, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - - if (res == 0) - fuse_reply_data(req, buf, FUSE_BUF_SPLICE_MOVE); - else - reply_err(req, res); - - fuse_free_buf(buf); -} - -static void fuse_lib_write_buf(fuse_req_t req, fuse_ino_t ino, - struct fuse_bufvec *buf, off_t off, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int res; - - res = get_path_nullok(f, ino, &path); - if (res == 0) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - res = fuse_fs_write_buf(f->fs, path, buf, off, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - - if (res >= 0) - fuse_reply_write(req, res); - else - reply_err(req, res); -} - -static void fuse_lib_fsync(fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path_nullok(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_fsync(f->fs, path, datasync, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static struct fuse_dh *get_dirhandle(const struct fuse_file_info *llfi, - struct fuse_file_info *fi) -{ - struct fuse_dh *dh = (struct fuse_dh *) (uintptr_t) llfi->fh; - memset(fi, 0, sizeof(struct fuse_file_info)); - fi->fh = dh->fh; - return dh; -} - -static void fuse_lib_opendir(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *llfi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - struct fuse_dh *dh; - struct fuse_file_info fi; - char *path; - int err; - - dh = (struct fuse_dh *) malloc(sizeof(struct fuse_dh)); - if (dh == NULL) { - reply_err(req, -ENOMEM); - return; - } - memset(dh, 0, sizeof(struct fuse_dh)); - dh->fuse = f; - dh->contents = NULL; - dh->first = NULL; - dh->len = 0; - dh->filled = 0; - dh->nodeid = ino; - fuse_mutex_init(&dh->lock); - - llfi->fh = (uintptr_t) dh; - - memset(&fi, 0, sizeof(fi)); - fi.flags = llfi->flags; - - err = get_path(f, ino, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_opendir(f->fs, path, &fi); - fuse_finish_interrupt(f, req, &d); - dh->fh = fi.fh; - } - if (!err) { - if (fuse_reply_open(req, llfi) == -ENOENT) { - /* The opendir syscall was interrupted, so it - must be cancelled */ - fuse_fs_releasedir(f->fs, path, &fi); - pthread_mutex_destroy(&dh->lock); - free(dh); - } - } else { - reply_err(req, err); - pthread_mutex_destroy(&dh->lock); - free(dh); - } - free_path(f, ino, path); -} - -static int extend_contents(struct fuse_dh *dh, unsigned minsize) -{ - if (minsize > dh->size) { - char *newptr; - unsigned newsize = dh->size; - if (!newsize) - newsize = 1024; - while (newsize < minsize) { - if (newsize >= 0x80000000) - newsize = 0xffffffff; - else - newsize *= 2; - } - - newptr = (char *) realloc(dh->contents, newsize); - if (!newptr) { - dh->error = -ENOMEM; - return -1; - } - dh->contents = newptr; - dh->size = newsize; - } - return 0; -} - -static int fuse_add_direntry_to_dh(struct fuse_dh *dh, const char *name, - struct stat *st) -{ - struct fuse_direntry *de; - - de = malloc(sizeof(struct fuse_direntry)); - if (!de) { - dh->error = -ENOMEM; - return -1; - } - de->name = strdup(name); - if (!de->name) { - dh->error = -ENOMEM; - free(de); - return -1; - } - de->stat = *st; - de->next = NULL; - - *dh->last = de; - dh->last = &de->next; - - return 0; -} - -static fuse_ino_t lookup_nodeid(struct fuse *f, fuse_ino_t parent, - const char *name) -{ - struct node *node; - fuse_ino_t res = FUSE_UNKNOWN_INO; - - pthread_mutex_lock(&f->lock); - node = lookup_node(f, parent, name); - if (node) - res = node->nodeid; - pthread_mutex_unlock(&f->lock); - - return res; -} - -static int fill_dir(void *dh_, const char *name, const struct stat *statp, - off_t off, enum fuse_fill_dir_flags flags) -{ - struct fuse_dh *dh = (struct fuse_dh *) dh_; - struct stat stbuf; - - if ((flags & ~FUSE_FILL_DIR_PLUS) != 0) { - dh->error = -EIO; - return 1; - } - - if (statp) - stbuf = *statp; - else { - memset(&stbuf, 0, sizeof(stbuf)); - stbuf.st_ino = FUSE_UNKNOWN_INO; - } - - if (!dh->fuse->conf.use_ino) { - stbuf.st_ino = FUSE_UNKNOWN_INO; - if (dh->fuse->conf.readdir_ino) { - stbuf.st_ino = (ino_t) - lookup_nodeid(dh->fuse, dh->nodeid, name); - } - } - - if (off) { - size_t newlen; - - if (dh->first) { - dh->error = -EIO; - return 1; - } - - if (extend_contents(dh, dh->needlen) == -1) - return 1; - - dh->filled = 0; - newlen = dh->len + - fuse_add_direntry(dh->req, dh->contents + dh->len, - dh->needlen - dh->len, name, - &stbuf, off); - if (newlen > dh->needlen) - return 1; - - dh->len = newlen; - } else { - if (!dh->filled) { - dh->error = -EIO; - return 1; - } - if (fuse_add_direntry_to_dh(dh, name, &stbuf) == -1) - return 1; - } - return 0; -} - -static int is_dot_or_dotdot(const char *name) -{ - return name[0] == '.' && (name[1] == '\0' || - (name[1] == '.' && name[2] == '\0')); -} - -static int fill_dir_plus(void *dh_, const char *name, const struct stat *statp, - off_t off, enum fuse_fill_dir_flags flags) -{ - struct fuse_dh *dh = (struct fuse_dh *) dh_; - struct fuse_entry_param e = { - /* ino=0 tells the kernel to ignore readdirplus stat info */ - .ino = 0, - }; - struct fuse *f = dh->fuse; - int res; - - if ((flags & ~FUSE_FILL_DIR_PLUS) != 0) { - dh->error = -EIO; - return 1; - } - - if (off && statp && (flags & FUSE_FILL_DIR_PLUS)) { - e.attr = *statp; - - if (!is_dot_or_dotdot(name)) { - res = do_lookup(f, dh->nodeid, name, &e); - if (res) { - dh->error = res; - return 1; - } - } - } else { - e.attr.st_ino = FUSE_UNKNOWN_INO; - if (!f->conf.use_ino && f->conf.readdir_ino) { - e.attr.st_ino = (ino_t) - lookup_nodeid(f, dh->nodeid, name); - } - } - - if (off) { - size_t newlen; - - if (dh->first) { - dh->error = -EIO; - return 1; - } - if (extend_contents(dh, dh->needlen) == -1) - return 1; - - dh->filled = 0; - newlen = dh->len + - fuse_add_direntry_plus(dh->req, dh->contents + dh->len, - dh->needlen - dh->len, name, - &e, off); - if (newlen > dh->needlen) - return 1; - dh->len = newlen; - } else { - if (!dh->filled) { - dh->error = -EIO; - return 1; - } - if (fuse_add_direntry_to_dh(dh, name, &e.attr) == -1) - return 1; - } - - return 0; -} - -static void free_direntries(struct fuse_direntry *de) -{ - while (de) { - struct fuse_direntry *next = de->next; - free(de->name); - free(de); - de = next; - } -} - -static int readdir_fill(struct fuse *f, fuse_req_t req, fuse_ino_t ino, - size_t size, off_t off, struct fuse_dh *dh, - struct fuse_file_info *fi, - enum fuse_readdir_flags flags) -{ - char *path; - int err; - - if (f->fs->op.readdir) - err = get_path_nullok(f, ino, &path); - else - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_fill_dir_t filler = fill_dir; - - if (flags & FUSE_READDIR_PLUS) - filler = fill_dir_plus; - - free_direntries(dh->first); - dh->first = NULL; - dh->last = &dh->first; - dh->len = 0; - dh->error = 0; - dh->needlen = size; - dh->filled = 1; - dh->req = req; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_readdir(f->fs, path, dh, filler, off, fi, flags); - fuse_finish_interrupt(f, req, &d); - dh->req = NULL; - if (!err) - err = dh->error; - if (err) - dh->filled = 0; - free_path(f, ino, path); - } - return err; -} - -static int readdir_fill_from_list(fuse_req_t req, struct fuse_dh *dh, - off_t off, enum fuse_readdir_flags flags) -{ - off_t pos; - struct fuse_direntry *de = dh->first; - - dh->len = 0; - - if (extend_contents(dh, dh->needlen) == -1) - return dh->error; - - for (pos = 0; pos < off; pos++) { - if (!de) - break; - - de = de->next; - } - while (de) { - char *p = dh->contents + dh->len; - unsigned rem = dh->needlen - dh->len; - unsigned thislen; - unsigned newlen; - pos++; - - if (flags & FUSE_READDIR_PLUS) { - struct fuse_entry_param e = { - .ino = 0, - .attr = de->stat, - }; - thislen = fuse_add_direntry_plus(req, p, rem, - de->name, &e, pos); - } else { - thislen = fuse_add_direntry(req, p, rem, - de->name, &de->stat, pos); - } - newlen = dh->len + thislen; - if (newlen > dh->needlen) - break; - dh->len = newlen; - de = de->next; - } - return 0; -} - -static void fuse_readdir_common(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t off, struct fuse_file_info *llfi, - enum fuse_readdir_flags flags) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_file_info fi; - struct fuse_dh *dh = get_dirhandle(llfi, &fi); - int err; - - pthread_mutex_lock(&dh->lock); - /* According to SUS, directory contents need to be refreshed on - rewinddir() */ - if (!off) - dh->filled = 0; - - if (!dh->filled) { - err = readdir_fill(f, req, ino, size, off, dh, &fi, flags); - if (err) { - reply_err(req, err); - goto out; - } - } - if (dh->filled) { - dh->needlen = size; - err = readdir_fill_from_list(req, dh, off, flags); - if (err) { - reply_err(req, err); - goto out; - } - } - fuse_reply_buf(req, dh->contents, dh->len); -out: - pthread_mutex_unlock(&dh->lock); -} - -static void fuse_lib_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t off, struct fuse_file_info *llfi) -{ - fuse_readdir_common(req, ino, size, off, llfi, 0); -} - -static void fuse_lib_readdirplus(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t off, struct fuse_file_info *llfi) -{ - fuse_readdir_common(req, ino, size, off, llfi, FUSE_READDIR_PLUS); -} - -static void fuse_lib_releasedir(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *llfi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - struct fuse_file_info fi; - struct fuse_dh *dh = get_dirhandle(llfi, &fi); - char *path; - - get_path_nullok(f, ino, &path); - - fuse_prepare_interrupt(f, req, &d); - fuse_fs_releasedir(f->fs, path, &fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - - pthread_mutex_lock(&dh->lock); - pthread_mutex_unlock(&dh->lock); - pthread_mutex_destroy(&dh->lock); - free_direntries(dh->first); - free(dh->contents); - free(dh); - reply_err(req, 0); -} - -static void fuse_lib_fsyncdir(fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info *llfi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_file_info fi; - char *path; - int err; - - get_dirhandle(llfi, &fi); - - err = get_path_nullok(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_fsyncdir(f->fs, path, datasync, &fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static void fuse_lib_statfs(fuse_req_t req, fuse_ino_t ino) -{ - struct fuse *f = req_fuse_prepare(req); - struct statvfs buf; - char *path = NULL; - int err = 0; - - memset(&buf, 0, sizeof(buf)); - if (ino) - err = get_path(f, ino, &path); - - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_statfs(f->fs, path ? path : "/", &buf); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - - if (!err) - fuse_reply_statfs(req, &buf); - else - reply_err(req, err); -} - -static void fuse_lib_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name, - const char *value, size_t size, int flags) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_setxattr(f->fs, path, name, value, size, flags); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static int common_getxattr(struct fuse *f, fuse_req_t req, fuse_ino_t ino, - const char *name, char *value, size_t size) -{ - int err; - char *path; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_getxattr(f->fs, path, name, value, size); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - return err; -} - -static void fuse_lib_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name, - size_t size) -{ - struct fuse *f = req_fuse_prepare(req); - int res; - - if (size) { - char *value = (char *) malloc(size); - if (value == NULL) { - reply_err(req, -ENOMEM); - return; - } - res = common_getxattr(f, req, ino, name, value, size); - if (res > 0) - fuse_reply_buf(req, value, res); - else - reply_err(req, res); - free(value); - } else { - res = common_getxattr(f, req, ino, name, NULL, 0); - if (res >= 0) - fuse_reply_xattr(req, res); - else - reply_err(req, res); - } -} - -static int common_listxattr(struct fuse *f, fuse_req_t req, fuse_ino_t ino, - char *list, size_t size) -{ - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_listxattr(f->fs, path, list, size); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - return err; -} - -static void fuse_lib_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size) -{ - struct fuse *f = req_fuse_prepare(req); - int res; - - if (size) { - char *list = (char *) malloc(size); - if (list == NULL) { - reply_err(req, -ENOMEM); - return; - } - res = common_listxattr(f, req, ino, list, size); - if (res > 0) - fuse_reply_buf(req, list, res); - else - reply_err(req, res); - free(list); - } else { - res = common_listxattr(f, req, ino, NULL, 0); - if (res >= 0) - fuse_reply_xattr(req, res); - else - reply_err(req, res); - } -} - -static void fuse_lib_removexattr(fuse_req_t req, fuse_ino_t ino, - const char *name) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_removexattr(f->fs, path, name); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static struct lock *locks_conflict(struct node *node, const struct lock *lock) -{ - struct lock *l; - - for (l = node->locks; l; l = l->next) - if (l->owner != lock->owner && - lock->start <= l->end && l->start <= lock->end && - (l->type == F_WRLCK || lock->type == F_WRLCK)) - break; - - return l; -} - -static void delete_lock(struct lock **lockp) -{ - struct lock *l = *lockp; - *lockp = l->next; - free(l); -} - -static void insert_lock(struct lock **pos, struct lock *lock) -{ - lock->next = *pos; - *pos = lock; -} - -static int locks_insert(struct node *node, struct lock *lock) -{ - struct lock **lp; - struct lock *newl1 = NULL; - struct lock *newl2 = NULL; - - if (lock->type != F_UNLCK || lock->start != 0 || - lock->end != OFFSET_MAX) { - newl1 = malloc(sizeof(struct lock)); - newl2 = malloc(sizeof(struct lock)); - - if (!newl1 || !newl2) { - free(newl1); - free(newl2); - return -ENOLCK; - } - } - - for (lp = &node->locks; *lp;) { - struct lock *l = *lp; - if (l->owner != lock->owner) - goto skip; - - if (lock->type == l->type) { - if (l->end < lock->start - 1) - goto skip; - if (lock->end < l->start - 1) - break; - if (l->start <= lock->start && lock->end <= l->end) - goto out; - if (l->start < lock->start) - lock->start = l->start; - if (lock->end < l->end) - lock->end = l->end; - goto delete; - } else { - if (l->end < lock->start) - goto skip; - if (lock->end < l->start) - break; - if (lock->start <= l->start && l->end <= lock->end) - goto delete; - if (l->end <= lock->end) { - l->end = lock->start - 1; - goto skip; - } - if (lock->start <= l->start) { - l->start = lock->end + 1; - break; - } - *newl2 = *l; - newl2->start = lock->end + 1; - l->end = lock->start - 1; - insert_lock(&l->next, newl2); - newl2 = NULL; - } - skip: - lp = &l->next; - continue; - - delete: - delete_lock(lp); - } - if (lock->type != F_UNLCK) { - *newl1 = *lock; - insert_lock(lp, newl1); - newl1 = NULL; - } -out: - free(newl1); - free(newl2); - return 0; -} - -static void flock_to_lock(struct flock *flock, struct lock *lock) -{ - memset(lock, 0, sizeof(struct lock)); - lock->type = flock->l_type; - lock->start = flock->l_start; - lock->end = - flock->l_len ? flock->l_start + flock->l_len - 1 : OFFSET_MAX; - lock->pid = flock->l_pid; -} - -static void lock_to_flock(struct lock *lock, struct flock *flock) -{ - flock->l_type = lock->type; - flock->l_start = lock->start; - flock->l_len = - (lock->end == OFFSET_MAX) ? 0 : lock->end - lock->start + 1; - flock->l_pid = lock->pid; -} - -static int fuse_flush_common(struct fuse *f, fuse_req_t req, fuse_ino_t ino, - const char *path, struct fuse_file_info *fi) -{ - struct fuse_intr_data d; - struct flock lock; - struct lock l; - int err; - int errlock; - - fuse_prepare_interrupt(f, req, &d); - memset(&lock, 0, sizeof(lock)); - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - err = fuse_fs_flush(f->fs, path, fi); - errlock = fuse_fs_lock(f->fs, path, fi, F_SETLK, &lock); - fuse_finish_interrupt(f, req, &d); - - if (errlock != -ENOSYS) { - flock_to_lock(&lock, &l); - l.owner = fi->lock_owner; - pthread_mutex_lock(&f->lock); - locks_insert(get_node(f, ino), &l); - pthread_mutex_unlock(&f->lock); - - /* if op.lock() is defined FLUSH is needed regardless - of op.flush() */ - if (err == -ENOSYS) - err = 0; - } - return err; -} - -static void fuse_lib_release(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - char *path; - int err = 0; - - get_path_nullok(f, ino, &path); - if (fi->flush) { - err = fuse_flush_common(f, req, ino, path, fi); - if (err == -ENOSYS) - err = 0; - } - - fuse_prepare_interrupt(f, req, &d); - fuse_do_release(f, ino, path, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - - reply_err(req, err); -} - -static void fuse_lib_flush(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - get_path_nullok(f, ino, &path); - err = fuse_flush_common(f, req, ino, path, fi); - free_path(f, ino, path); - - reply_err(req, err); -} - -static int fuse_lock_common(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, struct flock *lock, - int cmd) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path_nullok(f, ino, &path); - if (!err) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_lock(f->fs, path, fi, cmd, lock); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - return err; -} - -static void fuse_lib_getlk(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, struct flock *lock) -{ - int err; - struct lock l; - struct lock *conflict; - struct fuse *f = req_fuse(req); - - flock_to_lock(lock, &l); - l.owner = fi->lock_owner; - pthread_mutex_lock(&f->lock); - conflict = locks_conflict(get_node(f, ino), &l); - if (conflict) - lock_to_flock(conflict, lock); - pthread_mutex_unlock(&f->lock); - if (!conflict) - err = fuse_lock_common(req, ino, fi, lock, F_GETLK); - else - err = 0; - - if (!err) - fuse_reply_lock(req, lock); - else - reply_err(req, err); -} - -static void fuse_lib_setlk(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, struct flock *lock, - int sleep) -{ - int err = fuse_lock_common(req, ino, fi, lock, - sleep ? F_SETLKW : F_SETLK); - if (!err) { - struct fuse *f = req_fuse(req); - struct lock l; - flock_to_lock(lock, &l); - l.owner = fi->lock_owner; - pthread_mutex_lock(&f->lock); - locks_insert(get_node(f, ino), &l); - pthread_mutex_unlock(&f->lock); - } - reply_err(req, err); -} - -static void fuse_lib_flock(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, int op) -{ - struct fuse *f = req_fuse_prepare(req); - char *path; - int err; - - err = get_path_nullok(f, ino, &path); - if (err == 0) { - struct fuse_intr_data d; - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_flock(f->fs, path, fi, op); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static void fuse_lib_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize, - uint64_t idx) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - char *path; - int err; - - err = get_path(f, ino, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_bmap(f->fs, path, blocksize, &idx); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - if (!err) - fuse_reply_bmap(req, idx); - else - reply_err(req, err); -} - -static void fuse_lib_ioctl(fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, - struct fuse_file_info *llfi, unsigned int flags, - const void *in_buf, size_t in_bufsz, - size_t out_bufsz) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - struct fuse_file_info fi; - char *path, *out_buf = NULL; - int err; - - err = -EPERM; - if (flags & FUSE_IOCTL_UNRESTRICTED) - goto err; - - if (flags & FUSE_IOCTL_DIR) - get_dirhandle(llfi, &fi); - else - fi = *llfi; - - if (out_bufsz) { - err = -ENOMEM; - out_buf = malloc(out_bufsz); - if (!out_buf) - goto err; - } - - assert(!in_bufsz || !out_bufsz || in_bufsz == out_bufsz); - if (out_buf) - memcpy(out_buf, in_buf, in_bufsz); - - err = get_path_nullok(f, ino, &path); - if (err) - goto err; - - fuse_prepare_interrupt(f, req, &d); - - err = fuse_fs_ioctl(f->fs, path, cmd, arg, &fi, flags, - out_buf ?: (void *)in_buf); - - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - - fuse_reply_ioctl(req, err, out_buf, out_bufsz); - goto out; -err: - reply_err(req, err); -out: - free(out_buf); -} - -static void fuse_lib_poll(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, struct fuse_pollhandle *ph) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - char *path; - int err; - unsigned revents = 0; - - err = get_path_nullok(f, ino, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_poll(f->fs, path, fi, ph, &revents); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - if (!err) - fuse_reply_poll(req, revents); - else - reply_err(req, err); -} - -static void fuse_lib_fallocate(fuse_req_t req, fuse_ino_t ino, int mode, - off_t offset, off_t length, struct fuse_file_info *fi) -{ - struct fuse *f = req_fuse_prepare(req); - struct fuse_intr_data d; - char *path; - int err; - - err = get_path_nullok(f, ino, &path); - if (!err) { - fuse_prepare_interrupt(f, req, &d); - err = fuse_fs_fallocate(f->fs, path, mode, offset, length, fi); - fuse_finish_interrupt(f, req, &d); - free_path(f, ino, path); - } - reply_err(req, err); -} - -static int clean_delay(struct fuse *f) -{ - /* - * This is calculating the delay between clean runs. To - * reduce the number of cleans we are doing them 10 times - * within the remember window. - */ - int min_sleep = 60; - int max_sleep = 3600; - int sleep_time = f->conf.remember / 10; - - if (sleep_time > max_sleep) - return max_sleep; - if (sleep_time < min_sleep) - return min_sleep; - return sleep_time; -} - -int fuse_clean_cache(struct fuse *f) -{ - struct node_lru *lnode; - struct list_head *curr, *next; - struct node *node; - struct timespec now; - - pthread_mutex_lock(&f->lock); - - curr_time(&now); - - for (curr = f->lru_table.next; curr != &f->lru_table; curr = next) { - double age; - - next = curr->next; - lnode = list_entry(curr, struct node_lru, lru); - node = &lnode->node; - - age = diff_timespec(&now, &lnode->forget_time); - if (age <= f->conf.remember) - break; - - assert(node->nlookup == 1); - - /* Don't forget active directories */ - if (node->refctr > 1) - continue; - - node->nlookup = 0; - unhash_name(f, node); - unref_node(f, node); - } - pthread_mutex_unlock(&f->lock); - - return clean_delay(f); -} - -static struct fuse_lowlevel_ops fuse_path_ops = { - .init = fuse_lib_init, - .destroy = fuse_lib_destroy, - .lookup = fuse_lib_lookup, - .forget = fuse_lib_forget, - .forget_multi = fuse_lib_forget_multi, - .getattr = fuse_lib_getattr, - .setattr = fuse_lib_setattr, - .access = fuse_lib_access, - .readlink = fuse_lib_readlink, - .mknod = fuse_lib_mknod, - .mkdir = fuse_lib_mkdir, - .unlink = fuse_lib_unlink, - .rmdir = fuse_lib_rmdir, - .symlink = fuse_lib_symlink, - .rename = fuse_lib_rename, - .link = fuse_lib_link, - .create = fuse_lib_create, - .open = fuse_lib_open, - .read = fuse_lib_read, - .write_buf = fuse_lib_write_buf, - .flush = fuse_lib_flush, - .release = fuse_lib_release, - .fsync = fuse_lib_fsync, - .opendir = fuse_lib_opendir, - .readdir = fuse_lib_readdir, - .readdirplus = fuse_lib_readdirplus, - .releasedir = fuse_lib_releasedir, - .fsyncdir = fuse_lib_fsyncdir, - .statfs = fuse_lib_statfs, - .setxattr = fuse_lib_setxattr, - .getxattr = fuse_lib_getxattr, - .listxattr = fuse_lib_listxattr, - .removexattr = fuse_lib_removexattr, - .getlk = fuse_lib_getlk, - .setlk = fuse_lib_setlk, - .flock = fuse_lib_flock, - .bmap = fuse_lib_bmap, - .ioctl = fuse_lib_ioctl, - .poll = fuse_lib_poll, - .fallocate = fuse_lib_fallocate, -}; - -int fuse_notify_poll(struct fuse_pollhandle *ph) -{ - return fuse_lowlevel_notify_poll(ph); -} - -struct fuse_session *fuse_get_session(struct fuse *f) -{ - return f->se; -} - -static int fuse_session_loop_remember(struct fuse *f) -{ - struct fuse_session *se = f->se; - int res = 0; - struct timespec now; - time_t next_clean; - struct pollfd fds = { - .fd = se->fd, - .events = POLLIN - }; - struct fuse_buf fbuf = { - .mem = NULL, - }; - - curr_time(&now); - next_clean = now.tv_sec; - while (!fuse_session_exited(se)) { - unsigned timeout; - - curr_time(&now); - if (now.tv_sec < next_clean) - timeout = next_clean - now.tv_sec; - else - timeout = 0; - - res = poll(&fds, 1, timeout * 1000); - if (res == -1) { - if (errno == -EINTR) - continue; - else - break; - } else if (res > 0) { - res = fuse_session_receive_buf_int(se, &fbuf, NULL); - - if (res == -EINTR) - continue; - if (res <= 0) - break; - - fuse_session_process_buf_int(se, &fbuf, NULL); - } else { - timeout = fuse_clean_cache(f); - curr_time(&now); - next_clean = now.tv_sec + timeout; - } - } - - free(fbuf.mem); - fuse_session_reset(se); - return res < 0 ? -1 : 0; -} - -int fuse_loop(struct fuse *f) -{ - if (!f) - return -1; - - if (lru_enabled(f)) - return fuse_session_loop_remember(f); - - return fuse_session_loop(f->se); -} - -int fuse_loop_mt(struct fuse *f, int clone_fd) -{ - if (f == NULL) - return -1; - - int res = fuse_start_cleanup_thread(f); - if (res) - return -1; - - res = fuse_session_loop_mt(fuse_get_session(f), clone_fd); - fuse_stop_cleanup_thread(f); - return res; -} - -void fuse_exit(struct fuse *f) -{ - fuse_session_exit(f->se); -} - -struct fuse_context *fuse_get_context(void) -{ - struct fuse_context_i *c = fuse_get_context_internal(); - - if (c) - return &c->ctx; - else - return NULL; -} - -int fuse_getgroups(int size, gid_t list[]) -{ - struct fuse_context_i *c = fuse_get_context_internal(); - if (!c) - return -EINVAL; - - return fuse_req_getgroups(c->req, size, list); -} - -int fuse_interrupted(void) -{ - struct fuse_context_i *c = fuse_get_context_internal(); - - if (c) - return fuse_req_interrupted(c->req); - else - return 0; -} - -#define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v } - -static const struct fuse_opt fuse_lib_opts[] = { - FUSE_LIB_OPT("-h", show_help, 1), - FUSE_LIB_OPT("--help", show_help, 1), - FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP), - FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP), - FUSE_LIB_OPT("debug", debug, 1), - FUSE_LIB_OPT("-d", debug, 1), - FUSE_LIB_OPT("kernel_cache", kernel_cache, 1), - FUSE_LIB_OPT("auto_cache", auto_cache, 1), - FUSE_LIB_OPT("noauto_cache", auto_cache, 0), - FUSE_LIB_OPT("umask=", set_mode, 1), - FUSE_LIB_OPT("umask=%o", umask, 0), - FUSE_LIB_OPT("uid=", set_uid, 1), - FUSE_LIB_OPT("uid=%d", uid, 0), - FUSE_LIB_OPT("gid=", set_gid, 1), - FUSE_LIB_OPT("gid=%d", gid, 0), - FUSE_LIB_OPT("entry_timeout=%lf", entry_timeout, 0), - FUSE_LIB_OPT("attr_timeout=%lf", attr_timeout, 0), - FUSE_LIB_OPT("ac_attr_timeout=%lf", ac_attr_timeout, 0), - FUSE_LIB_OPT("ac_attr_timeout=", ac_attr_timeout_set, 1), - FUSE_LIB_OPT("negative_timeout=%lf", negative_timeout, 0), - FUSE_LIB_OPT("noforget", remember, -1), - FUSE_LIB_OPT("remember=%u", remember, 0), - FUSE_LIB_OPT("modules=%s", modules, 0), - FUSE_OPT_END -}; - -static void fuse_lib_help(void) -{ - /* These are not all options, but only the ones that - may be of interest to an end-user */ - printf( -" -o kernel_cache cache files in kernel\n" -" -o [no]auto_cache enable caching based on modification times (off)\n" -" -o umask=M set file permissions (octal)\n" -" -o uid=N set file owner\n" -" -o gid=N set file group\n" -" -o entry_timeout=T cache timeout for names (1.0s)\n" -" -o negative_timeout=T cache timeout for deleted names (0.0s)\n" -" -o attr_timeout=T cache timeout for attributes (1.0s)\n" -" -o ac_attr_timeout=T auto cache timeout for attributes (attr_timeout)\n" -" -o noforget never forget cached inodes\n" -" -o remember=T remember cached inodes for T seconds (0s)\n" -" -o modules=M1[:M2...] names of modules to push onto filesystem stack\n"); -} - -static void fuse_lib_help_modules(void) -{ - struct fuse_module *m; - printf("\nModule options:\n"); - pthread_mutex_lock(&fuse_context_lock); - for (m = fuse_modules; m; m = m->next) { - struct fuse_fs *fs = NULL; - struct fuse_fs *newfs; - struct fuse_args args = FUSE_ARGS_INIT(0, NULL); - if (fuse_opt_add_arg(&args, "") != -1 && - fuse_opt_add_arg(&args, "-h") != -1) { - printf("\n[%s]\n", m->name); - newfs = m->factory(&args, &fs); - assert(newfs == NULL); - } - fuse_opt_free_args(&args); - } - pthread_mutex_unlock(&fuse_context_lock); -} - -static int fuse_lib_opt_proc(void *data, const char *arg, int key, - struct fuse_args *outargs) -{ - (void) arg; (void) outargs; (void) data; (void) key; - - /* Pass through unknown options */ - return 1; -} - -static int fuse_init_intr_signal(int signum, int *installed) -{ - struct sigaction old_sa; - - if (sigaction(signum, NULL, &old_sa) == -1) { - perror("fuse: cannot get old signal handler"); - return -1; - } - - if (old_sa.sa_handler == SIG_DFL) { - struct sigaction sa; - - memset(&sa, 0, sizeof(struct sigaction)); - sa.sa_handler = fuse_intr_sighandler; - sigemptyset(&sa.sa_mask); - - if (sigaction(signum, &sa, NULL) == -1) { - perror("fuse: cannot set interrupt signal handler"); - return -1; - } - *installed = 1; - } - return 0; -} - -static void fuse_restore_intr_signal(int signum) -{ - struct sigaction sa; - - memset(&sa, 0, sizeof(struct sigaction)); - sa.sa_handler = SIG_DFL; - sigaction(signum, &sa, NULL); -} - - -static int fuse_push_module(struct fuse *f, const char *module, - struct fuse_args *args) -{ - struct fuse_fs *fs[2] = { f->fs, NULL }; - struct fuse_fs *newfs; - struct fuse_module *m = fuse_get_module(module); - - if (!m) - return -1; - - newfs = m->factory(args, fs); - if (!newfs) { - fuse_put_module(m); - return -1; - } - newfs->m = m; - f->fs = newfs; - return 0; -} - -struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size, - void *user_data) -{ - struct fuse_fs *fs; - - if (sizeof(struct fuse_operations) < op_size) { - fprintf(stderr, "fuse: warning: library too old, some operations may not not work\n"); - op_size = sizeof(struct fuse_operations); - } - - fs = (struct fuse_fs *) calloc(1, sizeof(struct fuse_fs)); - if (!fs) { - fprintf(stderr, "fuse: failed to allocate fuse_fs object\n"); - return NULL; - } - - fs->user_data = user_data; - if (op) - memcpy(&fs->op, op, op_size); - return fs; -} - -static int node_table_init(struct node_table *t) -{ - t->size = NODE_TABLE_MIN_SIZE; - t->array = (struct node **) calloc(1, sizeof(struct node *) * t->size); - if (t->array == NULL) { - fprintf(stderr, "fuse: memory allocation failed\n"); - return -1; - } - t->use = 0; - t->split = 0; - - return 0; -} - -static void *fuse_prune_nodes(void *fuse) -{ - struct fuse *f = fuse; - int sleep_time; - - while(1) { - sleep_time = fuse_clean_cache(f); - sleep(sleep_time); - } - return NULL; -} - -int fuse_start_cleanup_thread(struct fuse *f) -{ - if (lru_enabled(f)) - return fuse_start_thread(&f->prune_thread, fuse_prune_nodes, f); - - return 0; -} - -void fuse_stop_cleanup_thread(struct fuse *f) -{ - if (lru_enabled(f)) { - pthread_mutex_lock(&f->lock); - pthread_cancel(f->prune_thread); - pthread_mutex_unlock(&f->lock); - pthread_join(f->prune_thread, NULL); - } -} - -struct fuse *fuse_new(struct fuse_args *args, - const struct fuse_operations *op, - size_t op_size, void *user_data) -{ - struct fuse *f; - struct node *root; - struct fuse_fs *fs; - struct fuse_lowlevel_ops llop = fuse_path_ops; - - f = (struct fuse *) calloc(1, sizeof(struct fuse)); - if (f == NULL) { - fprintf(stderr, "fuse: failed to allocate fuse object\n"); - goto out; - } - - /* Parse options */ - if (fuse_opt_parse(args, &f->conf, fuse_lib_opts, - fuse_lib_opt_proc) == -1) - goto out_free; - - if (f->conf.show_help) { - fuse_lib_help(); - fuse_lowlevel_help(); - /* Defer printing module help until modules - have been loaded */ - } - - pthread_mutex_lock(&fuse_context_lock); - static int builtin_modules_registered = 0; - /* Have the builtin modules already been registered? */ - if (builtin_modules_registered == 0) { - /* If not, register them. */ - fuse_register_module("subdir", fuse_module_subdir_factory, NULL); - fuse_register_module("iconv", fuse_module_iconv_factory, NULL); - builtin_modules_registered= 1; - } - pthread_mutex_unlock(&fuse_context_lock); - - if (fuse_create_context_key() == -1) - goto out_free; - - fs = fuse_fs_new(op, op_size, user_data); - if (!fs) - goto out_delete_context_key; - - f->fs = fs; - - /* Oh f**k, this is ugly! */ - if (!fs->op.lock) { - llop.getlk = NULL; - llop.setlk = NULL; - } - - f->conf.entry_timeout = 1.0; - f->conf.attr_timeout = 1.0; - f->conf.negative_timeout = 0.0; - f->conf.intr_signal = FUSE_DEFAULT_INTR_SIGNAL; - - f->pagesize = getpagesize(); - init_list_head(&f->partial_slabs); - init_list_head(&f->full_slabs); - init_list_head(&f->lru_table); - - if (f->conf.modules) { - char *module; - char *next; - - for (module = f->conf.modules; module; module = next) { - char *p; - for (p = module; *p && *p != ':'; p++); - next = *p ? p + 1 : NULL; - *p = '\0'; - if (module[0] && - fuse_push_module(f, module, args) == -1) - goto out_free_fs; - } - } - - if(f->conf.show_help) { - fuse_lib_help_modules(); - goto out_free_fs; - } - - if (!f->conf.ac_attr_timeout_set) - f->conf.ac_attr_timeout = f->conf.attr_timeout; - -#if defined(__FreeBSD__) || defined(__NetBSD__) - /* - * In FreeBSD, we always use these settings as inode numbers - * are needed to make getcwd(3) work. - */ - f->conf.readdir_ino = 1; -#endif - - f->se = fuse_session_new(args, &llop, sizeof(llop), f); - if (f->se == NULL) - goto out_free_fs; - - if (f->conf.debug) { - fprintf(stderr, "nullpath_ok: %i\n", f->conf.nullpath_ok); - } - - /* Trace topmost layer by default */ - f->fs->debug = f->conf.debug; - f->ctr = 0; - f->generation = 0; - if (node_table_init(&f->name_table) == -1) - goto out_free_session; - - if (node_table_init(&f->id_table) == -1) - goto out_free_name_table; - - fuse_mutex_init(&f->lock); - - root = alloc_node(f); - if (root == NULL) { - fprintf(stderr, "fuse: memory allocation failed\n"); - goto out_free_id_table; - } - if (lru_enabled(f)) { - struct node_lru *lnode = node_lru(root); - init_list_head(&lnode->lru); - } - - strcpy(root->inline_name, "/"); - root->name = root->inline_name; - - if (f->conf.intr && - fuse_init_intr_signal(f->conf.intr_signal, - &f->intr_installed) == -1) - goto out_free_root; - - root->parent = NULL; - root->nodeid = FUSE_ROOT_ID; - inc_nlookup(root); - hash_id(f, root); - - return f; - -out_free_root: - free(root); -out_free_id_table: - free(f->id_table.array); -out_free_name_table: - free(f->name_table.array); -out_free_session: - fuse_session_destroy(f->se); -out_free_fs: - if (f->fs->m) - fuse_put_module(f->fs->m); - free(f->fs); - free(f->conf.modules); -out_delete_context_key: - fuse_delete_context_key(); -out_free: - free(f); -out: - return NULL; -} - -void fuse_destroy(struct fuse *f) -{ - size_t i; - - if (f->conf.intr && f->intr_installed) - fuse_restore_intr_signal(f->conf.intr_signal); - - if (f->fs) { - fuse_create_context(f); - - for (i = 0; i < f->id_table.size; i++) { - struct node *node; - - for (node = f->id_table.array[i]; node != NULL; - node = node->id_next) { - if (node->is_hidden) { - char *path; - if (try_get_path(f, node->nodeid, NULL, &path, NULL, false) == 0) { - fuse_fs_unlink(f->fs, path); - free(path); - } - } - } - } - } - for (i = 0; i < f->id_table.size; i++) { - struct node *node; - struct node *next; - - for (node = f->id_table.array[i]; node != NULL; node = next) { - next = node->id_next; - free_node(f, node); - f->id_table.use--; - } - } - assert(list_empty(&f->partial_slabs)); - assert(list_empty(&f->full_slabs)); - - free(f->id_table.array); - free(f->name_table.array); - pthread_mutex_destroy(&f->lock); - fuse_session_destroy(f->se); - free(f->conf.modules); - free(f); - fuse_delete_context_key(); -} - -int fuse_mount(struct fuse *f, const char *mountpoint) { - return fuse_session_mount(fuse_get_session(f), mountpoint); -} - - -void fuse_unmount(struct fuse *f) { - return fuse_session_unmount(fuse_get_session(f)); -} - -int fuse_version(void) -{ - return FUSE_VERSION; -} - -const char *fuse_pkgversion(void) -{ - return PACKAGE_VERSION; -} diff --git a/archive_old_fs_versions/bbfs/fuse_libs/fuse.h b/archive_old_fs_versions/bbfs/fuse_libs/fuse.h deleted file mode 100644 index 89798eff6d056b03c2684e6df4c9340aec04753d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/fuse_libs/fuse.h +++ /dev/null @@ -1,1122 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - This program can be distributed under the terms of the GNU LGPLv2. - See the file COPYING.LIB. -*/ - -#ifndef FUSE_H_ -#define FUSE_H_ - -/** @file - * - * This file defines the library interface of FUSE - * - * IMPORTANT: you should define FUSE_USE_VERSION before including this header. - */ - -#include "fuse_common.h" - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------- * - * Basic FUSE API * - * ----------------------------------------------------------- */ - -/** Handle for a FUSE filesystem */ -struct fuse; - -/** - * Readdir flags, passed to ->readdir() - */ -enum fuse_readdir_flags { - /** - * "Plus" mode. - * - * The kernel wants to prefill the inode cache during readdir. The - * filesystem may honour this by filling in the attributes and setting - * FUSE_FILL_DIR_FLAGS for the filler function. The filesystem may also - * just ignore this flag completely. - */ - FUSE_READDIR_PLUS = (1 << 0), -}; - -enum fuse_fill_dir_flags { - /** - * "Plus" mode: all file attributes are valid - * - * The attributes are used by the kernel to prefill the inode cache - * during a readdir. - * - * It is okay to set FUSE_FILL_DIR_PLUS if FUSE_READDIR_PLUS is not set - * and vice versa. - */ - FUSE_FILL_DIR_PLUS = (1 << 1), -}; - -/** Function to add an entry in a readdir() operation - * - * @param buf the buffer passed to the readdir() operation - * @param name the file name of the directory entry - * @param stat file attributes, can be NULL - * @param off offset of the next entry or zero - * @param flags fill flags - * @return 1 if buffer is full, zero otherwise - */ -typedef int (*fuse_fill_dir_t) (void *buf, const char *name, - const struct stat *stbuf, off_t off, - enum fuse_fill_dir_flags flags); -/** - * Configuration of the high-level API - * - * This structure is initialized from the arguments passed to - * fuse_new(), and then passed to the file system's init() handler - * which should ensure that the configuration is compatible with the - * file system implementation. - */ -struct fuse_config { - /** - * If `set_gid` is non-zero, the st_gid attribute of each file - * is overwritten with the value of `gid`. - */ - int set_gid; - unsigned int gid; - - /** - * If `set_uid` is non-zero, the st_uid attribute of each file - * is overwritten with the value of `uid`. - */ - int set_uid; - unsigned int uid; - - /** - * If `set_mode` is non-zero, the any permissions bits set in - * `umask` are unset in the st_mode attribute of each file. - */ - int set_mode; - unsigned int umask; - - /** - * The timeout in seconds for which name lookups will be - * cached. - */ - double entry_timeout; - - /** - * The timeout in seconds for which a negative lookup will be - * cached. This means, that if file did not exist (lookup - * retuned ENOENT), the lookup will only be redone after the - * timeout, and the file/directory will be assumed to not - * exist until then. A value of zero means that negative - * lookups are not cached. - */ - double negative_timeout; - - /** - * The timeout in seconds for which file/directory attributes - * (as returned by e.g. the `getattr` handler) are cached. - */ - double attr_timeout; - - /** - * Allow requests to be interrupted - */ - int intr; - - /** - * Specify which signal number to send to the filesystem when - * a request is interrupted. The default is hardcoded to - * USR1. - */ - int intr_signal; - - /** - * Normally, FUSE assigns inodes to paths only for as long as - * the kernel is aware of them. With this option inodes are - * instead remembered for at least this many seconds. This - * will require more memory, but may be necessary when using - * applications that make use of inode numbers. - * - * A number of -1 means that inodes will be remembered for the - * entire life-time of the file-system process. - */ - int remember; - - /** - * The default behavior is that if an open file is deleted, - * the file is renamed to a hidden file (.fuse_hiddenXXX), and - * only removed when the file is finally released. This - * relieves the filesystem implementation of having to deal - * with this problem. This option disables the hiding - * behavior, and files are removed immediately in an unlink - * operation (or in a rename operation which overwrites an - * existing file). - * - * It is recommended that you not use the hard_remove - * option. When hard_remove is set, the following libc - * functions fail on unlinked files (returning errno of - * ENOENT): read(2), write(2), fsync(2), close(2), f*xattr(2), - * ftruncate(2), fstat(2), fchmod(2), fchown(2) - */ - int hard_remove; - - /** - * Honor the st_ino field in the functions getattr() and - * fill_dir(). This value is used to fill in the st_ino field - * in the stat(2), lstat(2), fstat(2) functions and the d_ino - * field in the readdir(2) function. The filesystem does not - * have to guarantee uniqueness, however some applications - * rely on this value being unique for the whole filesystem. - */ - int use_ino; - - /** - * If use_ino option is not given, still try to fill in the - * d_ino field in readdir(2). If the name was previously - * looked up, and is still in the cache, the inode number - * found there will be used. Otherwise it will be set to -1. - * If use_ino option is given, this option is ignored. - */ - int readdir_ino; - - /** - * This option disables the use of page cache (file content cache) - * in the kernel for this filesystem. This has several affects: - * - * 1. Each read(2) or write(2) system call will initiate one - * or more read or write operations, data will not be - * cached in the kernel. - * - * 2. The return value of the read() and write() system calls - * will correspond to the return values of the read and - * write operations. This is useful for example if the - * file size is not known in advance (before reading it). - * - * Internally, enabling this option causes fuse to set the - * `direct_io` field of `struct fuse_file_info` - overwriting - * any value that was put there by the file system. - */ - int direct_io; - - /** - * This option disables flushing the cache of the file - * contents on every open(2). This should only be enabled on - * filesystems, where the file data is never changed - * externally (not through the mounted FUSE filesystem). Thus - * it is not suitable for network filesystems and other - * intermediate filesystems. - * - * NOTE: if this option is not specified (and neither - * direct_io) data is still cached after the open(2), so a - * read(2) system call will not always initiate a read - * operation. - * - * Internally, enabling this option causes fuse to set the - * `keep_cache` field of `struct fuse_file_info` - overwriting - * any value that was put there by the file system. - */ - int kernel_cache; - - /** - * This option is an alternative to `kernel_cache`. Instead of - * unconditionally keeping cached data, the cached data is - * invalidated on open(2) if if the modification time or the - * size of the file has changed since it was last opened. - */ - int auto_cache; - - /** - * The timeout in seconds for which file attributes are cached - * for the purpose of checking if auto_cache should flush the - * file data on open. - */ - int ac_attr_timeout_set; - double ac_attr_timeout; - - /** - * If this option is given the file-system handlers for the - * following operations will not receive path information: - * read, write, flush, release, fsync, readdir, releasedir, - * fsyncdir, lock, ioctl and poll. - * - * For the truncate, getattr, chmod, chown and utimens - * operations the path will be provided only if the struct - * fuse_file_info argument is NULL. - */ - int nullpath_ok; - - /** - * The remaining options are used by libfuse internally and - * should not be touched. - */ - int show_help; - char *modules; - int debug; -}; - - -/** - * The file system operations: - * - * Most of these should work very similarly to the well known UNIX - * file system operations. A major exception is that instead of - * returning an error in 'errno', the operation should return the - * negated error value (-errno) directly. - * - * All methods are optional, but some are essential for a useful - * filesystem (e.g. getattr). Open, flush, release, fsync, opendir, - * releasedir, fsyncdir, access, create, truncate, lock, init and - * destroy are special purpose methods, without which a full featured - * filesystem can still be implemented. - * - * In general, all methods are expected to perform any necessary - * permission checking. However, a filesystem may delegate this task - * to the kernel by passing the `default_permissions` mount option to - * `fuse_new()`. In this case, methods will only be called if - * the kernel's permission check has succeeded. - * - * Almost all operations take a path which can be of any length. - */ -struct fuse_operations { - /** Get file attributes. - * - * Similar to stat(). The 'st_dev' and 'st_blksize' fields are - * ignored. The 'st_ino' field is ignored except if the 'use_ino' - * mount option is given. - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - */ - int (*getattr) (const char *, struct stat *, struct fuse_file_info *fi); - - /** Read the target of a symbolic link - * - * The buffer should be filled with a null terminated string. The - * buffer size argument includes the space for the terminating - * null character. If the linkname is too long to fit in the - * buffer, it should be truncated. The return value should be 0 - * for success. - */ - int (*readlink) (const char *, char *, size_t); - - /** Create a file node - * - * This is called for creation of all non-directory, non-symlink - * nodes. If the filesystem defines a create() method, then for - * regular files that will be called instead. - */ - int (*mknod) (const char *, mode_t, dev_t); - - /** Create a directory - * - * Note that the mode argument may not have the type specification - * bits set, i.e. S_ISDIR(mode) can be false. To obtain the - * correct directory type bits use mode|S_IFDIR - * */ - int (*mkdir) (const char *, mode_t); - - /** Remove a file */ - int (*unlink) (const char *); - - /** Remove a directory */ - int (*rmdir) (const char *); - - /** Create a symbolic link */ - int (*symlink) (const char *, const char *); - - /** Rename a file */ - int (*rename) (const char *, const char *, unsigned int); - - /** Create a hard link to a file */ - int (*link) (const char *, const char *); - - /** Change the permission bits of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - */ - int (*chmod) (const char *, mode_t, struct fuse_file_info *fi); - - /** Change the owner and group of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ - int (*chown) (const char *, uid_t, gid_t, struct fuse_file_info *fi); - - /** Change the size of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ - int (*truncate) (const char *, off_t, struct fuse_file_info *fi); - - /** File open operation - * - * No creation (O_CREAT, O_EXCL) and by default also no - * truncation (O_TRUNC) flags will be passed to open(). If an - * application specifies O_TRUNC, fuse first calls truncate() - * and then open(). Only if 'atomic_o_trunc' has been - * specified and kernel version is 2.6.24 or later, O_TRUNC is - * passed on to open. - * - * Unless the 'default_permissions' mount option is given, - * open should check if the operation is permitted for the - * given flags. Optionally open may also return an arbitrary - * filehandle in the fuse_file_info structure, which will be - * passed to all file operations. - */ - int (*open) (const char *, struct fuse_file_info *); - - /** Read data from an open file - * - * Read should return exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the - * 'direct_io' mount option is specified, in which case the return - * value of the read system call will reflect the return value of - * this operation. - */ - int (*read) (const char *, char *, size_t, off_t, - struct fuse_file_info *); - - /** Write data to an open file - * - * Write should return exactly the number of bytes requested - * except on error. An exception to this is when the 'direct_io' - * mount option is specified (see read operation). - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ - int (*write) (const char *, const char *, size_t, off_t, - struct fuse_file_info *); - - /** Get file system statistics - * - * The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored - */ - int (*statfs) (const char *, struct statvfs *); - - /** Possibly flush cached data - * - * BIG NOTE: This is not equivalent to fsync(). It's not a - * request to sync dirty data. - * - * Flush is called on each close() of a file descriptor. So if a - * filesystem wants to return write errors in close() and the file - * has cached dirty data, this is a good place to write back data - * and return any errors. Since many applications ignore close() - * errors this is not always useful. - * - * NOTE: The flush() method may be called more than once for each - * open(). This happens if more than one file descriptor refers - * to an opened file due to dup(), dup2() or fork() calls. It is - * not possible to determine if a flush is final, so each flush - * should be treated equally. Multiple write-flush sequences are - * relatively rare, so this shouldn't be a problem. - * - * Filesystems shouldn't assume that flush will always be called - * after some writes, or that if will be called at all. - */ - int (*flush) (const char *, struct fuse_file_info *); - - /** Release an open file - * - * Release is called when there are no more references to an open - * file: all file descriptors are closed and all memory mappings - * are unmapped. - * - * For every open() call there will be exactly one release() call - * with the same flags and file descriptor. It is possible to - * have a file opened more than once, in which case only the last - * release will mean, that no more reads/writes will happen on the - * file. The return value of release is ignored. - */ - int (*release) (const char *, struct fuse_file_info *); - - /** Synchronize file contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data. - */ - int (*fsync) (const char *, int, struct fuse_file_info *); - - /** Set extended attributes */ - int (*setxattr) (const char *, const char *, const char *, size_t, int); - - /** Get extended attributes */ - int (*getxattr) (const char *, const char *, char *, size_t); - - /** List extended attributes */ - int (*listxattr) (const char *, char *, size_t); - - /** Remove extended attributes */ - int (*removexattr) (const char *, const char *); - - /** Open directory - * - * Unless the 'default_permissions' mount option is given, - * this method should check if opendir is permitted for this - * directory. Optionally opendir may also return an arbitrary - * filehandle in the fuse_file_info structure, which will be - * passed to readdir, closedir and fsyncdir. - */ - int (*opendir) (const char *, struct fuse_file_info *); - - /** Read directory - * - * The filesystem may choose between two modes of operation: - * - * 1) The readdir implementation ignores the offset parameter, and - * passes zero to the filler function's offset. The filler - * function will not return '1' (unless an error happens), so the - * whole directory is read in a single readdir operation. - * - * 2) The readdir implementation keeps track of the offsets of the - * directory entries. It uses the offset parameter and always - * passes non-zero offset to the filler function. When the buffer - * is full (or an error happens) the filler function will return - * '1'. - */ - int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, - struct fuse_file_info *, enum fuse_readdir_flags); - - /** Release directory - */ - int (*releasedir) (const char *, struct fuse_file_info *); - - /** Synchronize directory contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data - */ - int (*fsyncdir) (const char *, int, struct fuse_file_info *); - - /** - * Initialize filesystem - * - * The return value will passed in the private_data field of - * fuse_context to all file operations and as a parameter to the - * destroy() method. - */ - void *(*init) (struct fuse_conn_info *conn, - struct fuse_config *cfg); - - /** - * Clean up filesystem - * - * Called on filesystem exit. - */ - void (*destroy) (void *); - - /** - * Check file access permissions - * - * This will be called for the access() system call. If the - * 'default_permissions' mount option is given, this method is not - * called. - * - * This method is not called under Linux kernel versions 2.4.x - */ - int (*access) (const char *, int); - - /** - * Create and open a file - * - * If the file does not exist, first create it with the specified - * mode, and then open it. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the mknod() and open() methods - * will be called instead. - */ - int (*create) (const char *, mode_t, struct fuse_file_info *); - - /** - * Perform POSIX file locking operation - * - * The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW. - * - * For the meaning of fields in 'struct flock' see the man page - * for fcntl(2). The l_whence field will always be set to - * SEEK_SET. - * - * For checking lock ownership, the 'fuse_file_info->owner' - * argument must be used. - * - * For F_GETLK operation, the library will first check currently - * held locks, and if a conflicting lock is found it will return - * information without calling this method. This ensures, that - * for local locks the l_pid field is correctly filled in. The - * results may not be accurate in case of race conditions and in - * the presence of hard links, but it's unlikely that an - * application would rely on accurate GETLK results in these - * cases. If a conflicting lock is not found, this method will be - * called, and the filesystem may fill out l_pid by a meaningful - * value, or it may leave this field zero. - * - * For F_SETLK and F_SETLKW the l_pid field will be set to the pid - * of the process performing the locking operation. - * - * Note: if this method is not implemented, the kernel will still - * allow file locking to work locally. Hence it is only - * interesting for network filesystems and similar. - */ - int (*lock) (const char *, struct fuse_file_info *, int cmd, - struct flock *); - - /** - * Change the access and modification times of a file with - * nanosecond resolution - * - * This supersedes the old utime() interface. New applications - * should use this. - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * See the utimensat(2) man page for details. - */ - int (*utimens) (const char *, const struct timespec tv[2], - struct fuse_file_info *fi); - - /** - * Map block index within file to block index within device - * - * Note: This makes sense only for block device backed filesystems - * mounted with the 'blkdev' option - */ - int (*bmap) (const char *, size_t blocksize, uint64_t *idx); - - /** - * Ioctl - * - * flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in - * 64bit environment. The size and direction of data is - * determined by _IOC_*() decoding of cmd. For _IOC_NONE, - * data will be NULL, for _IOC_WRITE data is out area, for - * _IOC_READ in area and if both are set in/out area. In all - * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes. - * - * If flags has FUSE_IOCTL_DIR then the fuse_file_info refers to a - * directory file handle. - */ - int (*ioctl) (const char *, int cmd, void *arg, - struct fuse_file_info *, unsigned int flags, void *data); - - /** - * Poll for IO readiness events - * - * Note: If ph is non-NULL, the client should notify - * when IO readiness events occur by calling - * fuse_notify_poll() with the specified ph. - * - * Regardless of the number of times poll with a non-NULL ph - * is received, single notification is enough to clear all. - * Notifying more times incurs overhead but doesn't harm - * correctness. - * - * The callee is responsible for destroying ph with - * fuse_pollhandle_destroy() when no longer in use. - */ - int (*poll) (const char *, struct fuse_file_info *, - struct fuse_pollhandle *ph, unsigned *reventsp); - - /** Write contents of buffer to an open file - * - * Similar to the write() method, but data is supplied in a - * generic buffer. Use fuse_buf_copy() to transfer data to - * the destination. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ - int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, - struct fuse_file_info *); - - /** Store data from an open file in a buffer - * - * Similar to the read() method, but data is stored and - * returned in a generic buffer. - * - * No actual copying of data has to take place, the source - * file descriptor may simply be stored in the buffer for - * later data transfer. - * - * The buffer must be allocated dynamically and stored at the - * location pointed to by bufp. If the buffer contains memory - * regions, they too must be allocated using malloc(). The - * allocated memory will be freed by the caller. - */ - int (*read_buf) (const char *, struct fuse_bufvec **bufp, - size_t size, off_t off, struct fuse_file_info *); - /** - * Perform BSD file locking operation - * - * The op argument will be either LOCK_SH, LOCK_EX or LOCK_UN - * - * Nonblocking requests will be indicated by ORing LOCK_NB to - * the above operations - * - * For more information see the flock(2) manual page. - * - * Additionally fi->owner will be set to a value unique to - * this open file. This same value will be supplied to - * ->release() when the file is released. - * - * Note: if this method is not implemented, the kernel will still - * allow file locking to work locally. Hence it is only - * interesting for network filesystems and similar. - */ - int (*flock) (const char *, struct fuse_file_info *, int op); - - /** - * Allocates space for an open file - * - * This function ensures that required space is allocated for specified - * file. If this function returns success then any subsequent write - * request to specified range is guaranteed not to fail because of lack - * of space on the file system media. - */ - int (*fallocate) (const char *, int, off_t, off_t, - struct fuse_file_info *); -}; - -/** Extra context that may be needed by some filesystems - * - * The uid, gid and pid fields are not filled in case of a writepage - * operation. - */ -struct fuse_context { - /** Pointer to the fuse object */ - struct fuse *fuse; - - /** User ID of the calling process */ - uid_t uid; - - /** Group ID of the calling process */ - gid_t gid; - - /** Thread ID of the calling process */ - pid_t pid; - - /** Private filesystem data */ - void *private_data; - - /** Umask of the calling process */ - mode_t umask; -}; - -/** - * Main function of FUSE. - * - * This is for the lazy. This is all that has to be called from the - * main() function. - * - * This function does the following: - * - parses command line options, and handles --help and - * --version - * - installs signal handlers for INT, HUP, TERM and PIPE - * - registers an exit handler to unmount the filesystem on program exit - * - creates a fuse handle - * - registers the operations - * - calls either the single-threaded or the multi-threaded event loop - * - * Most file systems will have to parse some file-system specific - * arguments before calling this function. It is recommended to do - * this with fuse_opt_parse() and a processing function that passes - * through any unknown options (this can also be achieved by just - * passing NULL as the processing function). That way, the remaining - * options can be passed directly to fuse_main(). - * - * fuse_main() accepts all options that can be passed to - * fuse_parse_cmdline(), fuse_new(), or fuse_session_new(). - * - * Option parsing skips argv[0], which is assumed to contain the - * program name. This element must always be present and is used to - * construct a basic ``usage: `` message for the --help - * output. argv[0] may also be set to the empty string. In this case - * the usage message is suppressed. This can be used by file systems - * to print their own usage line first. See hello.c for an example of - * how to do this. - * - * Note: this is currently implemented as a macro. - * - * @param argc the argument counter passed to the main() function - * @param argv the argument vector passed to the main() function - * @param op the file system operation - * @param user_data user data supplied in the context during the init() method - * @return 0 on success, nonzero on failure - * - * Example usage, see hello.c - */ -/* - int fuse_main(int argc, char *argv[], const struct fuse_operations *op, - void *user_data); -*/ -#define fuse_main(argc, argv, op, user_data) \ - fuse_main_real(argc, argv, op, sizeof(*(op)), user_data) - -/* ----------------------------------------------------------- * - * More detailed API * - * ----------------------------------------------------------- */ - -/** - * Create a new FUSE filesystem. - * - * This function accepts most file-system independent mount options - * (like context, nodev, ro - see mount(8)), as well as the - * FUSE-specific mount options from mount.fuse(8). - * - * If the --help option is specified, the function writes a help text - * to stdout and returns NULL. - * - * Option parsing skips argv[0], which is assumed to contain the - * program name. This element must always be present and is used to - * construct a basic ``usage: `` message for the --help output. If - * argv[0] is set to the empty string, no usage message is included in - * the --help output. - * - * If an unknown option is passed in, an error message is written to - * stderr and the function returns NULL. - * - * @param args argument vector - * @param op the filesystem operations - * @param op_size the size of the fuse_operations structure - * @param user_data user data supplied in the context during the init() method - * @return the created FUSE handle - */ -struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, - size_t op_size, void *user_data); - -/** - * Mount a FUSE file system. - * - * @param mountpoint the mount point path - * @param f the FUSE handle - * - * @return 0 on success, -1 on failure. - **/ -int fuse_mount(struct fuse *f, const char *mountpoint); - -/** - * Unmount a FUSE file system. - * - * See fuse_session_unmount() for additional information. - * - * @param f the FUSE handle - **/ -void fuse_unmount(struct fuse *f); - -/** - * Destroy the FUSE handle. - * - * NOTE: This function does not unmount the filesystem. If this is - * needed, call fuse_unmount() before calling this function. - * - * @param f the FUSE handle - */ -void fuse_destroy(struct fuse *f); - -/** - * FUSE event loop. - * - * Requests from the kernel are processed, and the appropriate - * operations are called. - * - * For a description of the return value and the conditions when the - * event loop exits, refer to the documentation of - * fuse_session_loop(). - * - * @param f the FUSE handle - * @return see fuse_session_loop() - * - * See also: fuse_loop_mt() - */ -int fuse_loop(struct fuse *f); - -/** - * Flag session as terminated - * - * This function will cause any running event loops to exit on - * the next opportunity. - * - * @param f the FUSE handle - */ -void fuse_exit(struct fuse *f); - -/** - * FUSE event loop with multiple threads - * - * Requests from the kernel are processed, and the appropriate - * operations are called. Request are processed in parallel by - * distributing them between multiple threads. - * - * For a description of the return value and the conditions when the - * event loop exits, refer to the documentation of - * fuse_session_loop(). - * - * Note: using fuse_loop() instead of fuse_loop_mt() means you are running in - * single-threaded mode, and that you will not have to worry about reentrancy, - * though you will have to worry about recursive lookups. In single-threaded - * mode, FUSE will wait for one callback to return before calling another. - * - * Enabling multiple threads, by using fuse_loop_mt(), will cause FUSE to make - * multiple simultaneous calls into the various callback functions given by your - * fuse_operations record. - * - * If you are using multiple threads, you can enjoy all the parallel execution - * and interactive response benefits of threads, and you get to enjoy all the - * benefits of race conditions and locking bugs, too. Ensure that any code used - * in the callback function of fuse_operations is also thread-safe. - * - * @param f the FUSE handle - * @param clone_fd whether to use separate device fds for each thread - * (may increase performance) - * @return see fuse_session_loop() - * - * See also: fuse_loop() - */ -int fuse_loop_mt(struct fuse *f, int clone_fd); - -/** - * Get the current context - * - * The context is only valid for the duration of a filesystem - * operation, and thus must not be stored and used later. - * - * @return the context - */ -struct fuse_context *fuse_get_context(void); - -/** - * Get the current supplementary group IDs for the current request - * - * Similar to the getgroups(2) system call, except the return value is - * always the total number of group IDs, even if it is larger than the - * specified size. - * - * The current fuse kernel module in linux (as of 2.6.30) doesn't pass - * the group list to userspace, hence this function needs to parse - * "/proc/$TID/task/$TID/status" to get the group IDs. - * - * This feature may not be supported on all operating systems. In - * such a case this function will return -ENOSYS. - * - * @param size size of given array - * @param list array of group IDs to be filled in - * @return the total number of supplementary group IDs or -errno on failure - */ -int fuse_getgroups(int size, gid_t list[]); - -/** - * Check if the current request has already been interrupted - * - * @return 1 if the request has been interrupted, 0 otherwise - */ -int fuse_interrupted(void); - -/** - * The real main function - * - * Do not call this directly, use fuse_main() - */ -int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, - size_t op_size, void *user_data); - -/** - * Start the cleanup thread when using option "remember". - * - * This is done automatically by fuse_loop_mt() - * @param fuse struct fuse pointer for fuse instance - * @return 0 on success and -1 on error - */ -int fuse_start_cleanup_thread(struct fuse *fuse); - -/** - * Stop the cleanup thread when using option "remember". - * - * This is done automatically by fuse_loop_mt() - * @param fuse struct fuse pointer for fuse instance - */ -void fuse_stop_cleanup_thread(struct fuse *fuse); - -/** - * Iterate over cache removing stale entries - * use in conjunction with "-oremember" - * - * NOTE: This is already done for the standard sessions - * - * @param fuse struct fuse pointer for fuse instance - * @return the number of seconds until the next cleanup - */ -int fuse_clean_cache(struct fuse *fuse); - -/* - * Stacking API - */ - -/** - * Fuse filesystem object - * - * This is opaque object represents a filesystem layer - */ -struct fuse_fs; - -/* - * These functions call the relevant filesystem operation, and return - * the result. - * - * If the operation is not defined, they return -ENOSYS, with the - * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir, - * fuse_fs_releasedir and fuse_fs_statfs, which return 0. - */ - -int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf, - struct fuse_file_info *fi); -int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath, - const char *newpath, unsigned int flags); -int fuse_fs_unlink(struct fuse_fs *fs, const char *path); -int fuse_fs_rmdir(struct fuse_fs *fs, const char *path); -int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname, - const char *path); -int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath); -int fuse_fs_release(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi); -int fuse_fs_open(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi); -int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size, - off_t off, struct fuse_file_info *fi); -int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, - struct fuse_bufvec **bufp, size_t size, off_t off, - struct fuse_file_info *fi); -int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf, - size_t size, off_t off, struct fuse_file_info *fi); -int fuse_fs_write_buf(struct fuse_fs *fs, const char *path, - struct fuse_bufvec *buf, off_t off, - struct fuse_file_info *fi); -int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync, - struct fuse_file_info *fi); -int fuse_fs_flush(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi); -int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf); -int fuse_fs_opendir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi); -int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf, - fuse_fill_dir_t filler, off_t off, - struct fuse_file_info *fi, enum fuse_readdir_flags flags); -int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync, - struct fuse_file_info *fi); -int fuse_fs_releasedir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi); -int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode, - struct fuse_file_info *fi); -int fuse_fs_lock(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, int cmd, struct flock *lock); -int fuse_fs_flock(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, int op); -int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode, - struct fuse_file_info *fi); -int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid, - struct fuse_file_info *fi); -int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size, - struct fuse_file_info *fi); -int fuse_fs_utimens(struct fuse_fs *fs, const char *path, - const struct timespec tv[2], struct fuse_file_info *fi); -int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask); -int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf, - size_t len); -int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode, - dev_t rdev); -int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode); -int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name, - const char *value, size_t size, int flags); -int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name, - char *value, size_t size); -int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list, - size_t size); -int fuse_fs_removexattr(struct fuse_fs *fs, const char *path, - const char *name); -int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize, - uint64_t *idx); -int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd, void *arg, - struct fuse_file_info *fi, unsigned int flags, void *data); -int fuse_fs_poll(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi, struct fuse_pollhandle *ph, - unsigned *reventsp); -int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode, - off_t offset, off_t length, struct fuse_file_info *fi); -void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn, - struct fuse_config *cfg); -void fuse_fs_destroy(struct fuse_fs *fs); - -int fuse_notify_poll(struct fuse_pollhandle *ph); - -/** - * Create a new fuse filesystem object - * - * This is usually called from the factory of a fuse module to create - * a new instance of a filesystem. - * - * @param op the filesystem operations - * @param op_size the size of the fuse_operations structure - * @param user_data user data supplied in the context during the init() method - * @return a new filesystem object - */ -struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size, - void *user_data); - -/** - * Factory for creating filesystem objects - * - * The function may use and remove options from 'args' that belong - * to this module. - * - * For now the 'fs' vector always contains exactly one filesystem. - * This is the filesystem which will be below the newly created - * filesystem in the stack. - * - * @param args the command line arguments - * @param fs NULL terminated filesystem object vector - * @return the new filesystem object - */ -typedef struct fuse_fs *(*fuse_module_factory_t)(struct fuse_args *args, - struct fuse_fs *fs[]); -/** - * Register filesystem module - * - * If the "-omodules=*name*_:..." option is present, filesystem - * objects are created and pushed onto the stack with the *factory_* - * function. - * - * @param name_ the name of this filesystem module - * @param factory_ the factory function for this filesystem module - */ -#define FUSE_REGISTER_MODULE(name_, factory_) \ - fuse_module_factory_t fuse_module_ ## name_ ## _factory = factory_; - -/** Get session from fuse object */ -struct fuse_session *fuse_get_session(struct fuse *f); - -#ifdef __cplusplus -} -#endif - -#endif /* FUSE_H_ */ diff --git a/archive_old_fs_versions/bbfs/src/bbfs.c b/archive_old_fs_versions/bbfs/src/bbfs.c deleted file mode 100644 index be96aaeb10c0958c53cee46e229e05f3b7ac5c62..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/src/bbfs.c +++ /dev/null @@ -1,911 +0,0 @@ -/* - Big Brother File System - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - This code is derived from function prototypes found /usr/include/fuse/fuse.h - Copyright (C) 2001-2007 Miklos Szeredi - His code is licensed under the LGPLv2. - A copy of that code is included in the file fuse.h - - The point of this FUSE filesystem is to provide an introduction to - FUSE. It was my first FUSE filesystem as I got to know the - software; hopefully, the comments in this code will help people who - follow later to get a gentler introduction. - - This might be called a no-op filesystem: it doesn't impose - filesystem semantics on top of any other existing structure. It - simply reports the requests that come in, and passes them to an - underlying filesystem. The information is saved in a logfile named - bbfs.log, in the directory from which you run bbfs. -*/ - -#include "params.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_SYS_XATTR_H -#include -#endif - -#include "log.h" - -// All the paths I see are relative to the root of the mounted -// filesystem. In order to get to the underlying filesystem, I need to -// have the mountpoint. I'll save it away early on in main(), and then -// whenever I need a path for something I'll call this to construct -// it. -static void bb_fullpath(char fpath[PATH_MAX], const char *path) -{ - strcpy(fpath, BB_DATA->rootdir); - strncat(fpath, path, PATH_MAX); // ridiculously long paths will - // break here - - log_msg(" bb_fullpath: rootdir = \"%s\", path = \"%s\", fpath = \"%s\"\n", - BB_DATA->rootdir, path, fpath); -} - -/////////////////////////////////////////////////////////// -// -// Prototypes for all these functions, and the C-style comments, -// come from /usr/include/fuse.h -// -/** Get file attributes. - * - * Similar to stat(). The 'st_dev' and 'st_blksize' fields are - * ignored. The 'st_ino' field is ignored except if the 'use_ino' - * mount option is given. - */ -int bb_getattr(const char *path, struct stat *statbuf) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("\nbb_getattr(path=\"%s\", statbuf=0x%08x)\n", - path, statbuf); - bb_fullpath(fpath, path); - - retstat = log_syscall("lstat", lstat(fpath, statbuf), 0); - - log_stat(statbuf); - - return retstat; -} - -/** Read the target of a symbolic link - * - * The buffer should be filled with a null terminated string. The - * buffer size argument includes the space for the terminating - * null character. If the linkname is too long to fit in the - * buffer, it should be truncated. The return value should be 0 - * for success. - */ -// Note the system readlink() will truncate and lose the terminating -// null. So, the size passed to to the system readlink() must be one -// less than the size passed to bb_readlink() -// bb_readlink() code by Bernardo F Costa (thanks!) -int bb_readlink(const char *path, char *link, size_t size) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("bb_readlink(path=\"%s\", link=\"%s\", size=%d)\n", - path, link, size); - bb_fullpath(fpath, path); - - retstat = log_syscall("fpath", readlink(fpath, link, size - 1), 0); - if (retstat >= 0) { - link[retstat] = '\0'; - retstat = 0; - } - - return retstat; -} - -/** Create a file node - * - * There is no create() operation, mknod() will be called for - * creation of all non-directory, non-symlink nodes. - */ -// shouldn't that comment be "if" there is no.... ? -int bb_mknod(const char *path, mode_t mode, dev_t dev) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("\nbb_mknod(path=\"%s\", mode=0%3o, dev=%lld)\n", - path, mode, dev); - bb_fullpath(fpath, path); - - // On Linux this could just be 'mknod(path, mode, dev)' but this - // tries to be be more portable by honoring the quote in the Linux - // mknod man page stating the only portable use of mknod() is to - // make a fifo, but saying it should never actually be used for - // that. - if (S_ISREG(mode)) { - retstat = log_syscall("open", open(fpath, O_CREAT | O_EXCL | O_WRONLY, mode), 0); - if (retstat >= 0) - retstat = log_syscall("close", close(retstat), 0); - } else - if (S_ISFIFO(mode)) - retstat = log_syscall("mkfifo", mkfifo(fpath, mode), 0); - else - retstat = log_syscall("mknod", mknod(fpath, mode, dev), 0); - - return retstat; -} - -/** Create a directory */ -int bb_mkdir(const char *path, mode_t mode) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_mkdir(path=\"%s\", mode=0%3o)\n", - path, mode); - bb_fullpath(fpath, path); - - return log_syscall("mkdir", mkdir(fpath, mode), 0); -} - -/** Remove a file */ -int bb_unlink(const char *path) -{ - char fpath[PATH_MAX]; - - log_msg("bb_unlink(path=\"%s\")\n", - path); - bb_fullpath(fpath, path); - - return log_syscall("unlink", unlink(fpath), 0); -} - -/** Remove a directory */ -int bb_rmdir(const char *path) -{ - char fpath[PATH_MAX]; - - log_msg("bb_rmdir(path=\"%s\")\n", - path); - bb_fullpath(fpath, path); - - return log_syscall("rmdir", rmdir(fpath), 0); -} - -/** Create a symbolic link */ -// The parameters here are a little bit confusing, but do correspond -// to the symlink() system call. The 'path' is where the link points, -// while the 'link' is the link itself. So we need to leave the path -// unaltered, but insert the link into the mounted directory. -int bb_symlink(const char *path, const char *link) -{ - char flink[PATH_MAX]; - - log_msg("\nbb_symlink(path=\"%s\", link=\"%s\")\n", - path, link); - bb_fullpath(flink, link); - - return log_syscall("symlink", symlink(path, flink), 0); -} - -/** Rename a file */ -// both path and newpath are fs-relative -int bb_rename(const char *path, const char *newpath) -{ - char fpath[PATH_MAX]; - char fnewpath[PATH_MAX]; - - log_msg("\nbb_rename(fpath=\"%s\", newpath=\"%s\")\n", - path, newpath); - bb_fullpath(fpath, path); - bb_fullpath(fnewpath, newpath); - - return log_syscall("rename", rename(fpath, fnewpath), 0); -} - -/** Create a hard link to a file */ -int bb_link(const char *path, const char *newpath) -{ - char fpath[PATH_MAX], fnewpath[PATH_MAX]; - - log_msg("\nbb_link(path=\"%s\", newpath=\"%s\")\n", - path, newpath); - bb_fullpath(fpath, path); - bb_fullpath(fnewpath, newpath); - - return log_syscall("link", link(fpath, fnewpath), 0); -} - -/** Change the permission bits of a file */ -int bb_chmod(const char *path, mode_t mode) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_chmod(fpath=\"%s\", mode=0%03o)\n", - path, mode); - bb_fullpath(fpath, path); - - return log_syscall("chmod", chmod(fpath, mode), 0); -} - -/** Change the owner and group of a file */ -int bb_chown(const char *path, uid_t uid, gid_t gid) - -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_chown(path=\"%s\", uid=%d, gid=%d)\n", - path, uid, gid); - bb_fullpath(fpath, path); - - return log_syscall("chown", chown(fpath, uid, gid), 0); -} - -/** Change the size of a file */ -int bb_truncate(const char *path, off_t newsize) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_truncate(path=\"%s\", newsize=%lld)\n", - path, newsize); - bb_fullpath(fpath, path); - - return log_syscall("truncate", truncate(fpath, newsize), 0); -} - -/** Change the access and/or modification times of a file */ -/* note -- I'll want to change this as soon as 2.6 is in debian testing */ -int bb_utime(const char *path, struct utimbuf *ubuf) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_utime(path=\"%s\", ubuf=0x%08x)\n", - path, ubuf); - bb_fullpath(fpath, path); - - return log_syscall("utime", utime(fpath, ubuf), 0); -} - -/** File open operation - * - * No creation, or truncation flags (O_CREAT, O_EXCL, O_TRUNC) - * will be passed to open(). Open should check if the operation - * is permitted for the given flags. Optionally open may also - * return an arbitrary filehandle in the fuse_file_info structure, - * which will be passed to all file operations. - * - * Changed in version 2.2 - */ -int bb_open(const char *path, struct fuse_file_info *fi) -{ - int retstat = 0; - int fd; - char fpath[PATH_MAX]; - - log_msg("\nbb_open(path\"%s\", fi=0x%08x)\n", - path, fi); - bb_fullpath(fpath, path); - - // if the open call succeeds, my retstat is the file descriptor, - // else it's -errno. I'm making sure that in that case the saved - // file descriptor is exactly -1. - fd = log_syscall("open", open(fpath, fi->flags), 0); - if (fd < 0) - retstat = log_error("open"); - - fi->fh = fd; - - log_fi(fi); - - return retstat; -} - -/** Read data from an open file - * - * Read should return exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the - * 'direct_io' mount option is specified, in which case the return - * value of the read system call will reflect the return value of - * this operation. - * - * Changed in version 2.2 - */ -// I don't fully understand the documentation above -- it doesn't -// match the documentation for the read() system call which says it -// can return with anything up to the amount of data requested. nor -// with the fusexmp code which returns the amount of data also -// returned by read. -int bb_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_read(path=\"%s\", buf=0x%08x, size=%d, offset=%lld, fi=0x%08x)\n", - path, buf, size, offset, fi); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return log_syscall("pread", pread(fi->fh, buf, size, offset), 0); -} - -/** Write data to an open file - * - * Write should return exactly the number of bytes requested - * except on error. An exception to this is when the 'direct_io' - * mount option is specified (see read operation). - * - * Changed in version 2.2 - */ -// As with read(), the documentation above is inconsistent with the -// documentation for the write() system call. -int bb_write(const char *path, const char *buf, size_t size, off_t offset, - struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_write(path=\"%s\", buf=0x%08x, size=%d, offset=%lld, fi=0x%08x)\n", - path, buf, size, offset, fi - ); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return log_syscall("pwrite", pwrite(fi->fh, buf, size, offset), 0); -} - -/** Get file system statistics - * - * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored - * - * Replaced 'struct statfs' parameter with 'struct statvfs' in - * version 2.5 - */ -int bb_statfs(const char *path, struct statvfs *statv) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_statfs(path=\"%s\", statv=0x%08x)\n", - path, statv); - bb_fullpath(fpath, path); - - // get stats for underlying filesystem - retstat = log_syscall("statvfs", statvfs(fpath, statv), 0); - - log_statvfs(statv); - - return retstat; -} - -/** Possibly flush cached data - * - * BIG NOTE: This is not equivalent to fsync(). It's not a - * request to sync dirty data. - * - * Flush is called on each close() of a file descriptor. So if a - * filesystem wants to return write errors in close() and the file - * has cached dirty data, this is a good place to write back data - * and return any errors. Since many applications ignore close() - * errors this is not always useful. - * - * NOTE: The flush() method may be called more than once for each - * open(). This happens if more than one file descriptor refers - * to an opened file due to dup(), dup2() or fork() calls. It is - * not possible to determine if a flush is final, so each flush - * should be treated equally. Multiple write-flush sequences are - * relatively rare, so this shouldn't be a problem. - * - * Filesystems shouldn't assume that flush will always be called - * after some writes, or that if will be called at all. - * - * Changed in version 2.2 - */ -// this is a no-op in BBFS. It just logs the call and returns success -int bb_flush(const char *path, struct fuse_file_info *fi) -{ - log_msg("\nbb_flush(path=\"%s\", fi=0x%08x)\n", path, fi); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return 0; -} - -/** Release an open file - * - * Release is called when there are no more references to an open - * file: all file descriptors are closed and all memory mappings - * are unmapped. - * - * For every open() call there will be exactly one release() call - * with the same flags and file descriptor. It is possible to - * have a file opened more than once, in which case only the last - * release will mean, that no more reads/writes will happen on the - * file. The return value of release is ignored. - * - * Changed in version 2.2 - */ -int bb_release(const char *path, struct fuse_file_info *fi) -{ - log_msg("\nbb_release(path=\"%s\", fi=0x%08x)\n", - path, fi); - log_fi(fi); - - // We need to close the file. Had we allocated any resources - // (buffers etc) we'd need to free them here as well. - return log_syscall("close", close(fi->fh), 0); -} - -/** Synchronize file contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data. - * - * Changed in version 2.2 - */ -int bb_fsync(const char *path, int datasync, struct fuse_file_info *fi) -{ - log_msg("\nbb_fsync(path=\"%s\", datasync=%d, fi=0x%08x)\n", - path, datasync, fi); - log_fi(fi); - - // some unix-like systems (notably freebsd) don't have a datasync call -#ifdef HAVE_FDATASYNC - if (datasync) - return log_syscall("fdatasync", fdatasync(fi->fh), 0); - else -#endif - return log_syscall("fsync", fsync(fi->fh), 0); -} - -#ifdef HAVE_SYS_XATTR_H -/** Set extended attributes */ -int bb_setxattr(const char *path, const char *name, const char *value, size_t size, int flags) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_setxattr(path=\"%s\", name=\"%s\", value=\"%s\", size=%d, flags=0x%08x)\n", - path, name, value, size, flags); - bb_fullpath(fpath, path); - - return log_syscall("lsetxattr", lsetxattr(fpath, name, value, size, flags), 0); -} - -/** Get extended attributes */ -int bb_getxattr(const char *path, const char *name, char *value, size_t size) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_getxattr(path = \"%s\", name = \"%s\", value = 0x%08x, size = %d)\n", - path, name, value, size); - bb_fullpath(fpath, path); - - retstat = log_syscall("lgetxattr", lgetxattr(fpath, name, value, size), 0); - if (retstat >= 0) - log_msg(" value = \"%s\"\n", value); - - return retstat; -} - -/** List extended attributes */ -int bb_listxattr(const char *path, char *list, size_t size) -{ - int retstat = 0; - char fpath[PATH_MAX]; - char *ptr; - - log_msg("bb_listxattr(path=\"%s\", list=0x%08x, size=%d)\n", - path, list, size - ); - bb_fullpath(fpath, path); - - retstat = log_syscall("llistxattr", llistxattr(fpath, list, size), 0); - if (retstat >= 0) { - log_msg(" returned attributes (length %d):\n", retstat); - for (ptr = list; ptr < list + retstat; ptr += strlen(ptr)+1) - log_msg(" \"%s\"\n", ptr); - } - - return retstat; -} - -/** Remove extended attributes */ -int bb_removexattr(const char *path, const char *name) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_removexattr(path=\"%s\", name=\"%s\")\n", - path, name); - bb_fullpath(fpath, path); - - return log_syscall("lremovexattr", lremovexattr(fpath, name), 0); -} -#endif - -/** Open directory - * - * This method should check if the open operation is permitted for - * this directory - * - * Introduced in version 2.3 - */ -int bb_opendir(const char *path, struct fuse_file_info *fi) -{ - DIR *dp; - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_opendir(path=\"%s\", fi=0x%08x)\n", - path, fi); - bb_fullpath(fpath, path); - - // since opendir returns a pointer, takes some custom handling of - // return status. - dp = opendir(fpath); - log_msg(" opendir returned 0x%p\n", dp); - if (dp == NULL) - retstat = log_error("bb_opendir opendir"); - - fi->fh = (intptr_t) dp; - - log_fi(fi); - - return retstat; -} - -/** Read directory - * - * This supersedes the old getdir() interface. New applications - * should use this. - * - * The filesystem may choose between two modes of operation: - * - * 1) The readdir implementation ignores the offset parameter, and - * passes zero to the filler function's offset. The filler - * function will not return '1' (unless an error happens), so the - * whole directory is read in a single readdir operation. This - * works just like the old getdir() method. - * - * 2) The readdir implementation keeps track of the offsets of the - * directory entries. It uses the offset parameter and always - * passes non-zero offset to the filler function. When the buffer - * is full (or an error happens) the filler function will return - * '1'. - * - * Introduced in version 2.3 - */ - -int bb_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, - struct fuse_file_info *fi) -{ - int retstat = 0; - DIR *dp; - struct dirent *de; - - log_msg("\nbb_readdir(path=\"%s\", buf=0x%08x, filler=0x%08x, offset=%lld, fi=0x%08x)\n", - path, buf, filler, offset, fi); - // once again, no need for fullpath -- but note that I need to cast fi->fh - dp = (DIR *) (uintptr_t) fi->fh; - - // Every directory contains at least two entries: . and .. If my - // first call to the system readdir() returns NULL I've got an - // error; near as I can tell, that's the only condition under - // which I can get an error from readdir() - de = readdir(dp); - log_msg(" readdir returned 0x%p\n", de); - if (de == 0) { - retstat = log_error("bb_readdir readdir"); - return retstat; - } - - // This will copy the entire directory into the buffer. The loop exits - // when either the system readdir() returns NULL, or filler() - // returns something non-zero. The first case just means I've - // read the whole directory; the second means the buffer is full. - do { - log_msg("calling filler with name %s\n", de->d_name); - if (filler(buf, de->d_name, NULL, 0) != 0) { - log_msg(" ERROR bb_readdir filler: buffer full"); - return -ENOMEM; - } - } while ((de = readdir(dp)) != NULL); - - log_fi(fi); - - return retstat; -} - -/** Release directory - * - * Introduced in version 2.3 - */ -int bb_releasedir(const char *path, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_releasedir(path=\"%s\", fi=0x%08x)\n", - path, fi); - log_fi(fi); - - closedir((DIR *) (uintptr_t) fi->fh); - - return retstat; -} - -/** Synchronize directory contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data - * - * Introduced in version 2.3 - */ -// when exactly is this called? when a user calls fsync and it -// happens to be a directory? ??? >>> I need to implement this... -int bb_fsyncdir(const char *path, int datasync, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_fsyncdir(path=\"%s\", datasync=%d, fi=0x%08x)\n", - path, datasync, fi); - log_fi(fi); - - return retstat; -} - -/** - * Initialize filesystem - * - * The return value will passed in the private_data field of - * fuse_context to all file operations and as a parameter to the - * destroy() method. - * - * Introduced in version 2.3 - * Changed in version 2.6 - */ -// Undocumented but extraordinarily useful fact: the fuse_context is -// set up before this function is called, and -// fuse_get_context()->private_data returns the user_data passed to -// fuse_main(). Really seems like either it should be a third -// parameter coming in here, or else the fact should be documented -// (and this might as well return void, as it did in older versions of -// FUSE). -void *bb_init(struct fuse_conn_info *conn) -{ - log_msg("\nbb_init()\n"); - - log_conn(conn); - log_fuse_context(fuse_get_context()); - - return BB_DATA; -} - -/** - * Clean up filesystem - * - * Called on filesystem exit. - * - * Introduced in version 2.3 - */ -void bb_destroy(void *userdata) -{ - log_msg("\nbb_destroy(userdata=0x%08x)\n", userdata); -} - -/** - * Check file access permissions - * - * This will be called for the access() system call. If the - * 'default_permissions' mount option is given, this method is not - * called. - * - * This method is not called under Linux kernel versions 2.4.x - * - * Introduced in version 2.5 - */ -int bb_access(const char *path, int mask) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_access(path=\"%s\", mask=0%o)\n", - path, mask); - bb_fullpath(fpath, path); - - retstat = access(fpath, mask); - - if (retstat < 0) - retstat = log_error("bb_access access"); - - return retstat; -} - -/** - * Create and open a file - * - * If the file does not exist, first create it with the specified - * mode, and then open it. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the mknod() and open() methods - * will be called instead. - * - * Introduced in version 2.5 - */ -// Not implemented. I had a version that used creat() to create and -// open the file, which it turned out opened the file write-only. - -/** - * Change the size of an open file - * - * This method is called instead of the truncate() method if the - * truncation was invoked from an ftruncate() system call. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the truncate() method will be - * called instead. - * - * Introduced in version 2.5 - */ -int bb_ftruncate(const char *path, off_t offset, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_ftruncate(path=\"%s\", offset=%lld, fi=0x%08x)\n", - path, offset, fi); - log_fi(fi); - - retstat = ftruncate(fi->fh, offset); - if (retstat < 0) - retstat = log_error("bb_ftruncate ftruncate"); - - return retstat; -} - -/** - * Get attributes from an open file - * - * This method is called instead of the getattr() method if the - * file information is available. - * - * Currently this is only called after the create() method if that - * is implemented (see above). Later it may be called for - * invocations of fstat() too. - * - * Introduced in version 2.5 - */ -int bb_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_fgetattr(path=\"%s\", statbuf=0x%08x, fi=0x%08x)\n", - path, statbuf, fi); - log_fi(fi); - - // On FreeBSD, trying to do anything with the mountpoint ends up - // opening it, and then using the FD for an fgetattr. So in the - // special case of a path of "/", I need to do a getattr on the - // underlying root directory instead of doing the fgetattr(). - if (!strcmp(path, "/")) - return bb_getattr(path, statbuf); - - retstat = fstat(fi->fh, statbuf); - if (retstat < 0) - retstat = log_error("bb_fgetattr fstat"); - - log_stat(statbuf); - - return retstat; -} - -struct fuse_operations bb_oper = { - .getattr = bb_getattr, - .readlink = bb_readlink, - // no .getdir -- that's deprecated - .getdir = NULL, - .mknod = bb_mknod, - .mkdir = bb_mkdir, - .unlink = bb_unlink, - .rmdir = bb_rmdir, - .symlink = bb_symlink, - .rename = bb_rename, - .link = bb_link, - .chmod = bb_chmod, - .chown = bb_chown, - .truncate = bb_truncate, - .utime = bb_utime, - .open = bb_open, - .read = bb_read, - .write = bb_write, - /** Just a placeholder, don't set */ // huh??? - .statfs = bb_statfs, - .flush = bb_flush, - .release = bb_release, - .fsync = bb_fsync, - -#ifdef HAVE_SYS_XATTR_H -.setxattr = bb_setxattr, - .getxattr = bb_getxattr, - .listxattr = bb_listxattr, - .removexattr = bb_removexattr, -#endif - - .opendir = bb_opendir, - .readdir = bb_readdir, - .releasedir = bb_releasedir, - .fsyncdir = bb_fsyncdir, - .init = bb_init, - .destroy = bb_destroy, - .access = bb_access, - .ftruncate = bb_ftruncate, - .fgetattr = bb_fgetattr -}; - -void bb_usage() -{ - fprintf(stderr, "usage: bbfs [FUSE and mount options] rootDir mountPoint\n"); - abort(); -} - -int main(int argc, char *argv[]) -{ - int fuse_stat; - struct bb_state *bb_data; - - // bbfs doesn't do any access checking on its own (the comment - // blocks in fuse.h mention some of the functions that need - // accesses checked -- but note there are other functions, like - // chown(), that also need checking!). Since running bbfs as root - // will therefore open Metrodome-sized holes in the system - // security, we'll check if root is trying to mount the filesystem - // and refuse if it is. The somewhat smaller hole of an ordinary - // user doing it with the allow_other flag is still there because - // I don't want to parse the options string. - if ((getuid() == 0) || (geteuid() == 0)) { - fprintf(stderr, "Running BBFS as root opens unnacceptable security holes\n"); - return 1; - } - - // See which version of fuse we're running - fprintf(stderr, "Fuse library version %d.%d\n", FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION); - - // Perform some sanity checking on the command line: make sure - // there are enough arguments, and that neither of the last two - // start with a hyphen (this will break if you actually have a - // rootpoint or mountpoint whose name starts with a hyphen, but so - // will a zillion other programs) - if ((argc < 3) || (argv[argc-2][0] == '-') || (argv[argc-1][0] == '-')) - bb_usage(); - - bb_data = malloc(sizeof(struct bb_state)); - if (bb_data == NULL) { - perror("main calloc"); - abort(); - } - - // Pull the rootdir out of the argument list and save it in my - // internal data - bb_data->rootdir = realpath(argv[argc-2], NULL); - argv[argc-2] = argv[argc-1]; - argv[argc-1] = NULL; - argc--; - - bb_data->logfile = log_open(); - - // turn over control to fuse - fprintf(stderr, "about to call fuse_main\n"); - fuse_stat = fuse_main(argc, argv, &bb_oper, bb_data); - fprintf(stderr, "fuse_main returned %d\n", fuse_stat); - - return fuse_stat; -} diff --git a/archive_old_fs_versions/bbfs/src/bbfs.h b/archive_old_fs_versions/bbfs/src/bbfs.h deleted file mode 100644 index 30ae7c9d15257091894a592311c26056e5fd39f2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/src/bbfs.h +++ /dev/null @@ -1,8 +0,0 @@ -// -// Created by lefthy on 1/24/17. -// - -#ifndef FS_BBFS_H -#define FS_BBFS_H - -#endif //FS_BBFS_H diff --git a/archive_old_fs_versions/bbfs/src/log.c b/archive_old_fs_versions/bbfs/src/log.c deleted file mode 100644 index 01b30e46dce223fa52c0d0ebb1bd724217313a4d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/src/log.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - Since the point of this filesystem is to learn FUSE and its - datastructures, I want to see *everything* that happens related to - its data structures. This file contains macros and functions to - accomplish this. -*/ - -#include "params.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "log.h" - -FILE *log_open() -{ - FILE *logfile; - - // very first thing, open up the logfile and mark that we got in - // here. If we can't open the logfile, we're dead. - logfile = fopen("bbfs.log", "w"); - if (logfile == NULL) { - perror("logfile"); - exit(EXIT_FAILURE); - } - - // set logfile to line buffering - setvbuf(logfile, NULL, _IOLBF, 0); - - return logfile; -} - -void log_msg(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - - vfprintf(BB_DATA->logfile, format, ap); -} - -// Report errors to logfile and give -errno to caller -int log_error(char *func) -{ - int ret = -errno; - - log_msg(" ERROR %s: %s\n", func, strerror(errno)); - - return ret; -} - -// fuse context -void log_fuse_context(struct fuse_context *context) -{ - log_msg(" context:\n"); - - /** Pointer to the fuse object */ - // struct fuse *fuse; - log_struct(context, fuse, %08x, ); - - /** User ID of the calling process */ - // uid_t uid; - log_struct(context, uid, %d, ); - - /** Group ID of the calling process */ - // gid_t gid; - log_struct(context, gid, %d, ); - - /** Thread ID of the calling process */ - // pid_t pid; - log_struct(context, pid, %d, ); - - /** Private filesystem data */ - // void *private_data; - log_struct(context, private_data, %08x, ); - log_struct(((struct bb_state *)context->private_data), logfile, %08x, ); - log_struct(((struct bb_state *)context->private_data), rootdir, %s, ); - - /** Umask of the calling process (introduced in version 2.8) */ - // mode_t umask; - log_struct(context, umask, %05o, ); -} - -// struct fuse_conn_info contains information about the socket -// connection being used. I don't actually use any of this -// information in bbfs -void log_conn(struct fuse_conn_info *conn) -{ - log_msg(" conn:\n"); - - /** Major version of the protocol (read-only) */ - // unsigned proto_major; - log_struct(conn, proto_major, %d, ); - - /** Minor version of the protocol (read-only) */ - // unsigned proto_minor; - log_struct(conn, proto_minor, %d, ); - - /** Is asynchronous read supported (read-write) */ - // unsigned async_read; - log_struct(conn, async_read, %d, ); - - /** Maximum size of the write buffer */ - // unsigned max_write; - log_struct(conn, max_write, %d, ); - - /** Maximum readahead */ - // unsigned max_readahead; - log_struct(conn, max_readahead, %d, ); - - /** Capability flags, that the kernel supports */ - // unsigned capable; - log_struct(conn, capable, %08x, ); - - /** Capability flags, that the filesystem wants to enable */ - // unsigned want; - log_struct(conn, want, %08x, ); - - /** Maximum number of backgrounded requests */ - // unsigned max_background; - log_struct(conn, max_background, %d, ); - - /** Kernel congestion threshold parameter */ - // unsigned congestion_threshold; - log_struct(conn, congestion_threshold, %d, ); - - /** For future use. */ - // unsigned reserved[23]; -} - -// struct fuse_file_info keeps information about files (surprise!). -// This dumps all the information in a struct fuse_file_info. The struct -// definition, and comments, come from /usr/include/fuse/fuse_common.h -// Duplicated here for convenience. -void log_fi (struct fuse_file_info *fi) -{ - log_msg(" fi:\n"); - - /** Open flags. Available in open() and release() */ - // int flags; - log_struct(fi, flags, 0x%08x, ); - - /** Old file handle, don't use */ - // unsigned long fh_old; - log_struct(fi, fh_old, 0x%08lx, ); - - /** In case of a write operation indicates if this was caused by a - writepage */ - // int writepage; - log_struct(fi, writepage, %d, ); - - /** Can be filled in by open, to use direct I/O on this file. - Introduced in version 2.4 */ - // unsigned int keep_cache : 1; - log_struct(fi, direct_io, %d, ); - - /** Can be filled in by open, to indicate, that cached file data - need not be invalidated. Introduced in version 2.4 */ - // unsigned int flush : 1; - log_struct(fi, keep_cache, %d, ); - - /** Padding. Do not use*/ - // unsigned int padding : 29; - - /** File handle. May be filled in by filesystem in open(). - Available in all other file operations */ - // uint64_t fh; - log_struct(fi, fh, 0x%016llx, ); - - /** Lock owner id. Available in locking operations and flush */ - // uint64_t lock_owner; - log_struct(fi, lock_owner, 0x%016llx, ); -} - -void log_retstat(char *func, int retstat) -{ - int errsave = errno; - log_msg(" %s returned %d\n", func, retstat); - errno = errsave; -} - -// make a system call, checking (and reporting) return status and -// possibly logging error -int log_syscall(char *func, int retstat, int min_ret) -{ - log_retstat(func, retstat); - - if (retstat < min_ret) { - log_error(func); - retstat = -errno; - } - - return retstat; -} - -// This dumps the info from a struct stat. The struct is defined in -// ; this is indirectly included from -void log_stat(struct stat *si) -{ - log_msg(" si:\n"); - - // dev_t st_dev; /* ID of device containing file */ - log_struct(si, st_dev, %lld, ); - - // ino_t st_ino; /* inode number */ - log_struct(si, st_ino, %lld, ); - - // mode_t st_mode; /* protection */ - log_struct(si, st_mode, 0%o, ); - - // nlink_t st_nlink; /* number of hard links */ - log_struct(si, st_nlink, %d, ); - - // uid_t st_uid; /* user ID of owner */ - log_struct(si, st_uid, %d, ); - - // gid_t st_gid; /* group ID of owner */ - log_struct(si, st_gid, %d, ); - - // dev_t st_rdev; /* device ID (if special file) */ - log_struct(si, st_rdev, %lld, ); - - // off_t st_size; /* total size, in bytes */ - log_struct(si, st_size, %lld, ); - - // blksize_t st_blksize; /* blocksize for filesystem I/O */ - log_struct(si, st_blksize, %ld, ); - - // blkcnt_t st_blocks; /* number of blocks allocated */ - log_struct(si, st_blocks, %lld, ); - - // time_t st_atime; /* time of last access */ - log_struct(si, st_atime, 0x%08lx, ); - - // time_t st_mtime; /* time of last modification */ - log_struct(si, st_mtime, 0x%08lx, ); - - // time_t st_ctime; /* time of last status change */ - log_struct(si, st_ctime, 0x%08lx, ); - -} - -void log_statvfs(struct statvfs *sv) -{ - log_msg(" sv:\n"); - - // unsigned long f_bsize; /* file system block size */ - log_struct(sv, f_bsize, %ld, ); - - // unsigned long f_frsize; /* fragment size */ - log_struct(sv, f_frsize, %ld, ); - - // fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ - log_struct(sv, f_blocks, %lld, ); - - // fsblkcnt_t f_bfree; /* # free blocks */ - log_struct(sv, f_bfree, %lld, ); - - // fsblkcnt_t f_bavail; /* # free blocks for non-root */ - log_struct(sv, f_bavail, %lld, ); - - // fsfilcnt_t f_files; /* # inodes */ - log_struct(sv, f_files, %lld, ); - - // fsfilcnt_t f_ffree; /* # free inodes */ - log_struct(sv, f_ffree, %lld, ); - - // fsfilcnt_t f_favail; /* # free inodes for non-root */ - log_struct(sv, f_favail, %lld, ); - - // unsigned long f_fsid; /* file system ID */ - log_struct(sv, f_fsid, %ld, ); - - // unsigned long f_flag; /* mount flags */ - log_struct(sv, f_flag, 0x%08lx, ); - - // unsigned long f_namemax; /* maximum filename length */ - log_struct(sv, f_namemax, %ld, ); - -} - -void log_utime(struct utimbuf *buf) -{ - log_msg(" buf:\n"); - - // time_t actime; - log_struct(buf, actime, 0x%08lx, ); - - // time_t modtime; - log_struct(buf, modtime, 0x%08lx, ); -} - diff --git a/archive_old_fs_versions/bbfs/src/log.h b/archive_old_fs_versions/bbfs/src/log.h deleted file mode 100644 index c92f70dcf36dde33f81792bbf74cde8b9fc26228..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/src/log.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. -*/ - -#ifndef _LOG_H_ -#define _LOG_H_ -#include - -// macro to log fields in structs. -#define log_struct(st, field, format, typecast) \ - log_msg(" " #field " = " #format "\n", typecast st->field) - -FILE *log_open(void); -void log_msg(const char *format, ...); -void log_conn(struct fuse_conn_info *conn); -int log_error(char *func); -void log_fi(struct fuse_file_info *fi); -void log_fuse_context(struct fuse_context *context); -void log_retstat(char *func, int retstat); -void log_stat(struct stat *si); -void log_statvfs(struct statvfs *sv); -int log_syscall(char *func, int retstat, int min_ret); -void log_utime(struct utimbuf *buf); - -#endif diff --git a/archive_old_fs_versions/bbfs/src/params.h b/archive_old_fs_versions/bbfs/src/params.h deleted file mode 100644 index f37430ff18614347c15f29d05aae50c9891ccd60..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/bbfs/src/params.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - There are a couple of symbols that need to be #defined before - #including all the headers. -*/ - -#ifndef _PARAMS_H_ -#define _PARAMS_H_ - -// The FUSE API has been changed a number of times. So, our code -// needs to define the version of the API that we assume. As of this -// writing, the most current API version is 26 -#define FUSE_USE_VERSION 26 - -// need this to get pwrite(). I have to use setvbuf() instead of -// setlinebuf() later in consequence. -#define _XOPEN_SOURCE 500 - -// maintain bbfs state in here -#include -#include -struct bb_state { - FILE *logfile; - char *rootdir; -}; -#define BB_DATA ((struct bb_state *) fuse_get_context()->private_data) - -#endif diff --git a/archive_old_fs_versions/fs/.gitignore b/archive_old_fs_versions/fs/.gitignore deleted file mode 100644 index 0647a8677245e3d740d54d8b153644bfb3fde48e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ - - -# IDEA FILES # -##################### -.idea/ - -# BUILD # -######### - -build/ - -# DEBUG # -######### - -cmake-build-debug/ -cmake-build-release/ -playground/ diff --git a/archive_old_fs_versions/fs/CMake/FindFUSE.cmake b/archive_old_fs_versions/fs/CMake/FindFUSE.cmake deleted file mode 100644 index bd178e26a6e28d63df43a43181df9b6279e224d8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/CMake/FindFUSE.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Find the FUSE includes and library -# -# FUSE_INCLUDE_DIR - where to find fuse.h, etc. -# FUSE_LIBRARIES - List of libraries when using FUSE. -# FUSE_FOUND - True if FUSE lib is found. - -# check if already in cache, be silent -IF (FUSE_INCLUDE_DIR) - SET (FUSE_FIND_QUIETLY TRUE) -ENDIF (FUSE_INCLUDE_DIR) - -# find includes -FIND_PATH (FUSE_INCLUDE_DIR fuse.h - /usr/local/include/osxfuse - /usr/local/include - /usr/include - ) - -# find lib -if (APPLE) - SET(FUSE_NAMES libosxfuse.dylib fuse) -else (APPLE) - SET(FUSE_NAMES fuse) -endif (APPLE) -FIND_LIBRARY(FUSE_LIBRARIES - NAMES ${FUSE_NAMES} - PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu - ) - -include ("FindPackageHandleStandardArgs") -find_package_handle_standard_args ("FUSE" DEFAULT_MSG - FUSE_INCLUDE_DIR FUSE_LIBRARIES) - -mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES) \ No newline at end of file diff --git a/archive_old_fs_versions/fs/CMake/FindFUSE3.cmake b/archive_old_fs_versions/fs/CMake/FindFUSE3.cmake deleted file mode 100644 index ab2e822f143d3911d52aca98c793d6a5f4daf562..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/CMake/FindFUSE3.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Try to find fuse (devel) -# Once done, this will define -# -# FUSE3_FOUND - system has fuse -# FUSE3_INCLUDE_DIRS - the fuse include directories -# FUSE3_LIBRARIES - fuse libraries directories - -if(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - set(FUSE3_FIND_QUIETLY TRUE) -endif(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - -find_path( FUSE3_INCLUDE_DIR fuse3/fuse_lowlevel.h - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES include ) - -find_library( FUSE3_LIBRARY fuse3 - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES lib ) - -set(FUSE3_INCLUDE_DIRS ${FUSE3_INCLUDE_DIR}) -set(FUSE3_LIBRARIES ${FUSE3_LIBRARY}) - -# handle the QUIETLY and REQUIRED arguments and set FUSE3_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(fuse3 DEFAULT_MSG FUSE3_INCLUDE_DIR FUSE3_LIBRARY) - -mark_as_advanced(FUSE3_INCLUDE_DIR FUSE3_LIBRARY) \ No newline at end of file diff --git a/archive_old_fs_versions/fs/CMakeLists.txt b/archive_old_fs_versions/fs/CMakeLists.txt deleted file mode 100644 index 2ad57ddb9f247945a6513d41ea52c124f7e0f5ff..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -cmake_minimum_required(VERSION 3.4 FATAL_ERROR) -project(fs VERSION 0.0.1) - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall --pedantic -g -pg") - -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - - -# required packages -find_package(FUSE3 REQUIRED) -# boost dependencies, system is required for filesystem #TODO VERSION UNTESTED. I USE 1.62 -find_package(Boost 1.58 REQUIRED COMPONENTS system filesystem serialization) - -include_directories(${FUSE3_INCLUDE_DIR} include/) -set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/util.cpp - src/classes/metadata.h src/classes/metadata.cpp src/adafs_ops/metadata_ops.h - src/adafs_ops/metadata_ops.cpp src/adafs_ops/dentry_ops.cpp - src/adafs_ops/dentry_ops.h src/configure.h src/fuse_ops/file.cpp - src/fuse_ops/directory.cpp src/fuse_ops/access.cpp src/fuse_ops/sync.cpp - src/adafs_ops/access.cpp src/adafs_ops/access.h src/fuse_ops/fs.cpp - src/fuse_ops/io.cpp src/adafs_ops/io.cpp src/adafs_ops/io.h) -add_executable(adafs ${SOURCE_FILES} src/main.cpp) -target_link_libraries(adafs ${FUSE3_LIBRARIES} -lpthread -lboost_system -lboost_filesystem -lboost_serialization -pg) diff --git a/archive_old_fs_versions/fs/include/spdlog/async_logger.h b/archive_old_fs_versions/fs/include/spdlog/async_logger.h deleted file mode 100644 index 1c42fd9ce6c4d0e0c175cf815ca6a1f425864183..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/async_logger.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Very fast asynchronous logger (millions of logs per second on an average desktop) -// Uses pre allocated lockfree queue for maximum throughput even under large number of threads. -// Creates a single back thread to pop messages from the queue and log them. -// -// Upon each log write the logger: -// 1. Checks if its log level is enough to log the message -// 2. Push a new copy of the message to a queue (or block the caller until space is available in the queue) -// 3. will throw spdlog_ex upon log exceptions -// Upon destruction, logs all remaining messages in the queue before destructing.. - -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ - -namespace details -{ -class async_log_helper; -} - -class async_logger :public logger -{ -public: - template - async_logger(const std::string& name, - const It& begin, - const It& end, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - async_logger(const std::string& logger_name, - sinks_init_list sinks, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - async_logger(const std::string& logger_name, - sink_ptr single_sink, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - //Wait for the queue to be empty, and flush synchronously - //Warning: this can potentialy last forever as we wait it to complete - void flush() override; -protected: - void _sink_it(details::log_msg& msg) override; - void _set_formatter(spdlog::formatter_ptr msg_formatter) override; - void _set_pattern(const std::string& pattern) override; - -private: - std::unique_ptr _async_log_helper; -}; -} - - -#include diff --git a/archive_old_fs_versions/fs/include/spdlog/common.h b/archive_old_fs_versions/fs/include/spdlog/common.h deleted file mode 100644 index a0a227ef6f18f5735dd6ee3d053706983736f3c9..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/common.h +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -#include -#include -#endif - -#include - -//visual studio upto 2013 does not support noexcept nor constexpr -#if defined(_MSC_VER) && (_MSC_VER < 1900) -#define SPDLOG_NOEXCEPT throw() -#define SPDLOG_CONSTEXPR -#else -#define SPDLOG_NOEXCEPT noexcept -#define SPDLOG_CONSTEXPR constexpr -#endif - -#if defined(__GNUC__) || defined(__clang__) -#define SPDLOG_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define SPDLOG_DEPRECATED __declspec(deprecated) -#else -#define SPDLOG_DEPRECATED -#endif - - -#include - -namespace spdlog -{ - -class formatter; - -namespace sinks -{ -class sink; -} - -using log_clock = std::chrono::system_clock; -using sink_ptr = std::shared_ptr < sinks::sink >; -using sinks_init_list = std::initializer_list < sink_ptr >; -using formatter_ptr = std::shared_ptr; -#if defined(SPDLOG_NO_ATOMIC_LEVELS) -using level_t = details::null_atomic_int; -#else -using level_t = std::atomic; -#endif - -using log_err_handler = std::function; - -//Log level enum -namespace level -{ -typedef enum -{ - trace = 0, - debug = 1, - info = 2, - warn = 3, - err = 4, - critical = 5, - off = 6 -} level_enum; - -static const char* level_names[] { "trace", "debug", "info", "warning", "error", "critical", "off" }; - -static const char* short_level_names[] { "T", "D", "I", "W", "E", "C", "O" }; - -inline const char* to_str(spdlog::level::level_enum l) -{ - return level_names[l]; -} - -inline const char* to_short_str(spdlog::level::level_enum l) -{ - return short_level_names[l]; -} -} //level - - -// -// Async overflow policy - block by default. -// -enum class async_overflow_policy -{ - block_retry, // Block / yield / sleep until message can be enqueued - discard_log_msg // Discard the message it enqueue fails -}; - - -// -// Log exception -// -namespace details -{ -namespace os -{ -std::string errno_str(int err_num); -} -} -class spdlog_ex: public std::exception -{ -public: - spdlog_ex(const std::string& msg):_msg(msg) - {} - spdlog_ex(const std::string& msg, int last_errno) - { - _msg = msg + ": " + details::os::errno_str(last_errno); - } - const char* what() const SPDLOG_NOEXCEPT override - { - return _msg.c_str(); - } -private: - std::string _msg; - -}; - -// -// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) -// -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -using filename_t = std::wstring; -#else -using filename_t = std::string; -#endif - - -} //spdlog diff --git a/archive_old_fs_versions/fs/include/spdlog/details/async_log_helper.h b/archive_old_fs_versions/fs/include/spdlog/details/async_log_helper.h deleted file mode 100644 index deb8dcc6073779aeb2bce73dd58230e0b07f8bbd..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/async_log_helper.h +++ /dev/null @@ -1,378 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -// async log helper : -// Process logs asynchronously using a back thread. -// -// If the internal queue of log messages reaches its max size, -// then the client call will block until there is more room. -// -// If the back thread throws during logging, a spdlog::spdlog_ex exception -// will be thrown in client's thread when tries to log the next message - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ - -class async_log_helper -{ - // Async msg to move to/from the queue - // Movable only. should never be copied - enum class async_msg_type - { - log, - flush, - terminate - }; - struct async_msg - { - std::string logger_name; - level::level_enum level; - log_clock::time_point time; - size_t thread_id; - std::string txt; - async_msg_type msg_type; - - async_msg() = default; - ~async_msg() = default; - - -async_msg(async_msg&& other) SPDLOG_NOEXCEPT: - logger_name(std::move(other.logger_name)), - level(std::move(other.level)), - time(std::move(other.time)), - txt(std::move(other.txt)), - msg_type(std::move(other.msg_type)) - {} - - async_msg(async_msg_type m_type) :msg_type(m_type) - {} - - async_msg& operator=(async_msg&& other) SPDLOG_NOEXCEPT - { - logger_name = std::move(other.logger_name); - level = other.level; - time = std::move(other.time); - thread_id = other.thread_id; - txt = std::move(other.txt); - msg_type = other.msg_type; - return *this; - } - - // never copy or assign. should only be moved.. - async_msg(const async_msg&) = delete; - async_msg& operator=(const async_msg& other) = delete; - - // construct from log_msg - async_msg(const details::log_msg& m) : - level(m.level), - time(m.time), - thread_id(m.thread_id), - txt(m.raw.data(), m.raw.size()), - msg_type(async_msg_type::log) - { -#ifndef SPDLOG_NO_NAME - logger_name = *m.logger_name; -#endif - } - - - // copy into log_msg - void fill_log_msg(log_msg &msg) - { - msg.logger_name = &logger_name; - msg.level = level; - msg.time = time; - msg.thread_id = thread_id; - msg.raw << txt; - } - }; - -public: - - using item_type = async_msg; - using q_type = details::mpmc_bounded_queue; - - using clock = std::chrono::steady_clock; - - - async_log_helper(formatter_ptr formatter, - const std::vector& sinks, - size_t queue_size, - const log_err_handler err_handler, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - void log(const details::log_msg& msg); - - // stop logging and join the back thread - ~async_log_helper(); - - void set_formatter(formatter_ptr); - - void flush(bool wait_for_q); - - -private: - formatter_ptr _formatter; - std::vector> _sinks; - - // queue of messages to log - q_type _q; - - log_err_handler _err_handler; - - bool _flush_requested; - - bool _terminate_requested; - - - // overflow policy - const async_overflow_policy _overflow_policy; - - // worker thread warmup callback - one can set thread priority, affinity, etc - const std::function _worker_warmup_cb; - - // auto periodic sink flush parameter - const std::chrono::milliseconds _flush_interval_ms; - - // worker thread teardown callback - const std::function _worker_teardown_cb; - - // worker thread - std::thread _worker_thread; - - void push_msg(async_msg&& new_msg); - - // worker thread main loop - void worker_loop(); - - // pop next message from the queue and process it. will set the last_pop to the pop time - // return false if termination of the queue is required - bool process_next_msg(log_clock::time_point& last_pop, log_clock::time_point& last_flush); - - void handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush); - - // sleep,yield or return immediatly using the time passed since last message as a hint - static void sleep_or_yield(const spdlog::log_clock::time_point& now, const log_clock::time_point& last_op_time); - - // wait until the queue is empty - void wait_empty_q(); - -}; -} -} - -/////////////////////////////////////////////////////////////////////////////// -// async_sink class implementation -/////////////////////////////////////////////////////////////////////////////// -inline spdlog::details::async_log_helper::async_log_helper( - formatter_ptr formatter, - const std::vector& sinks, - size_t queue_size, - log_err_handler err_handler, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb): - _formatter(formatter), - _sinks(sinks), - _q(queue_size), - _err_handler(err_handler), - _flush_requested(false), - _terminate_requested(false), - _overflow_policy(overflow_policy), - _worker_warmup_cb(worker_warmup_cb), - _flush_interval_ms(flush_interval_ms), - _worker_teardown_cb(worker_teardown_cb), - _worker_thread(&async_log_helper::worker_loop, this) -{} - -// Send to the worker thread termination message(level=off) -// and wait for it to finish gracefully -inline spdlog::details::async_log_helper::~async_log_helper() -{ - try - { - push_msg(async_msg(async_msg_type::terminate)); - _worker_thread.join(); - } - catch (...) // don't crash in destructor - {} -} - - -//Try to push and block until succeeded (if the policy is not to discard when the queue is full) -inline void spdlog::details::async_log_helper::log(const details::log_msg& msg) -{ - push_msg(async_msg(msg)); -} - -inline void spdlog::details::async_log_helper::push_msg(details::async_log_helper::async_msg&& new_msg) -{ - if (!_q.enqueue(std::move(new_msg)) && _overflow_policy != async_overflow_policy::discard_log_msg) - { - auto last_op_time = details::os::now(); - auto now = last_op_time; - do - { - now = details::os::now(); - sleep_or_yield(now, last_op_time); - } - while (!_q.enqueue(std::move(new_msg))); - } -} - -// optionally wait for the queue be empty and request flush from the sinks -inline void spdlog::details::async_log_helper::flush(bool wait_for_q) -{ - push_msg(async_msg(async_msg_type::flush)); - if(wait_for_q) - wait_empty_q(); //return only make after the above flush message was processed -} - -inline void spdlog::details::async_log_helper::worker_loop() -{ - try - { - if (_worker_warmup_cb) _worker_warmup_cb(); - auto last_pop = details::os::now(); - auto last_flush = last_pop; - while(process_next_msg(last_pop, last_flush)); - if (_worker_teardown_cb) _worker_teardown_cb(); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - -// process next message in the queue -// return true if this thread should still be active (while no terminate msg was received) -inline bool spdlog::details::async_log_helper::process_next_msg(log_clock::time_point& last_pop, log_clock::time_point& last_flush) -{ - async_msg incoming_async_msg; - - if (_q.dequeue(incoming_async_msg)) - { - last_pop = details::os::now(); - switch (incoming_async_msg.msg_type) - { - case async_msg_type::flush: - _flush_requested = true; - break; - - case async_msg_type::terminate: - _flush_requested = true; - _terminate_requested = true; - break; - - default: - log_msg incoming_log_msg; - incoming_async_msg.fill_log_msg(incoming_log_msg); - _formatter->format(incoming_log_msg); - for (auto &s : _sinks) - { - if(s->should_log( incoming_log_msg.level)) - { - s->log(incoming_log_msg); - } - } - } - return true; - } - - // Handle empty queue.. - // This is the only place where the queue can terminate or flush to avoid losing messages already in the queue - else - { - auto now = details::os::now(); - handle_flush_interval(now, last_flush); - sleep_or_yield(now, last_pop); - return !_terminate_requested; - } -} - -// flush all sinks if _flush_interval_ms has expired -inline void spdlog::details::async_log_helper::handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush) -{ - auto should_flush = _flush_requested || (_flush_interval_ms != std::chrono::milliseconds::zero() && now - last_flush >= _flush_interval_ms); - if (should_flush) - { - for (auto &s : _sinks) - s->flush(); - now = last_flush = details::os::now(); - _flush_requested = false; - } -} - -inline void spdlog::details::async_log_helper::set_formatter(formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; -} - - -// spin, yield or sleep. use the time passed since last message as a hint -inline void spdlog::details::async_log_helper::sleep_or_yield(const spdlog::log_clock::time_point& now, const spdlog::log_clock::time_point& last_op_time) -{ - using namespace std::this_thread; - using std::chrono::milliseconds; - using std::chrono::microseconds; - - auto time_since_op = now - last_op_time; - - // spin upto 50 micros - if (time_since_op <= microseconds(50)) - return; - - // yield upto 150 micros - if (time_since_op <= microseconds(100)) - return std::this_thread::yield(); - - // sleep for 20 ms upto 200 ms - if (time_since_op <= milliseconds(200)) - return sleep_for(milliseconds(20)); - - // sleep for 200 ms - return sleep_for(milliseconds(200)); -} - -// wait for the queue to be empty -inline void spdlog::details::async_log_helper::wait_empty_q() -{ - auto last_op = details::os::now(); - while (_q.approx_size() > 0) - { - sleep_or_yield(details::os::now(), last_op); - } -} - - - diff --git a/archive_old_fs_versions/fs/include/spdlog/details/async_logger_impl.h b/archive_old_fs_versions/fs/include/spdlog/details/async_logger_impl.h deleted file mode 100644 index 2092f06cfa81def0b96a7ed795266f6b0d098dbc..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/async_logger_impl.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Async Logger implementation -// Use an async_sink (queue per logger) to perform the logging in a worker thread - -#include -#include - -#include -#include -#include -#include - -template -inline spdlog::async_logger::async_logger(const std::string& logger_name, - const It& begin, - const It& end, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - logger(logger_name, begin, end), - _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, _err_handler, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb)) -{ -} - -inline spdlog::async_logger::async_logger(const std::string& logger_name, - sinks_init_list sinks_list, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - async_logger(logger_name, sinks_list.begin(), sinks_list.end(), queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {} - -inline spdlog::async_logger::async_logger(const std::string& logger_name, - sink_ptr single_sink, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - async_logger(logger_name, -{ - single_sink -}, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {} - - -inline void spdlog::async_logger::flush() -{ - _async_log_helper->flush(true); -} - -inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; - _async_log_helper->set_formatter(_formatter); -} - -inline void spdlog::async_logger::_set_pattern(const std::string& pattern) -{ - _formatter = std::make_shared(pattern); - _async_log_helper->set_formatter(_formatter); -} - - -inline void spdlog::async_logger::_sink_it(details::log_msg& msg) -{ - try - { - _async_log_helper->log(msg); - if (_should_flush_on(msg)) - _async_log_helper->flush(false); // do async flush - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/file_helper.h b/archive_old_fs_versions/fs/include/spdlog/details/file_helper.h deleted file mode 100644 index 074d9b8356061316c99b60983608bfaab0221218..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/file_helper.h +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Helper class for file sink -// When failing to open a file, retry several times(5) with small delay between the tries(10 ms) -// Can be set to auto flush on every line -// Throw spdlog_ex exception on errors - -#include -#include - -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ - -class file_helper -{ - -public: - const int open_tries = 5; - const int open_interval = 10; - - explicit file_helper() : - _fd(nullptr) - {} - - file_helper(const file_helper&) = delete; - file_helper& operator=(const file_helper&) = delete; - - ~file_helper() - { - close(); - } - - - void open(const filename_t& fname, bool truncate = false) - { - - close(); - auto *mode = truncate ? SPDLOG_FILENAME_T("wb") : SPDLOG_FILENAME_T("ab"); - _filename = fname; - for (int tries = 0; tries < open_tries; ++tries) - { - if (!os::fopen_s(&_fd, fname, mode)) - return; - - std::this_thread::sleep_for(std::chrono::milliseconds(open_interval)); - } - - throw spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno); - } - - void reopen(bool truncate) - { - if (_filename.empty()) - throw spdlog_ex("Failed re opening file - was not opened before"); - open(_filename, truncate); - - } - - void flush() - { - std::fflush(_fd); - } - - void close() - { - if (_fd) - { - std::fclose(_fd); - _fd = nullptr; - } - } - - void write(const log_msg& msg) - { - - size_t msg_size = msg.formatted.size(); - auto data = msg.formatted.data(); - if (std::fwrite(data, 1, msg_size, _fd) != msg_size) - throw spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno); - } - - size_t size() - { - if (!_fd) - throw spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename)); - return os::filesize(_fd); - } - - const filename_t& filename() const - { - return _filename; - } - - static bool file_exists(const filename_t& name) - { - - return os::file_exists(name); - } - -private: - FILE* _fd; - filename_t _filename; -}; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/log_msg.h b/archive_old_fs_versions/fs/include/spdlog/details/log_msg.h deleted file mode 100644 index ecdc73d7c77780ce80831e54a4e2151e238e5504..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/log_msg.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - - -#include -#include - -namespace spdlog -{ -namespace details -{ -struct log_msg -{ - log_msg() = default; - log_msg(const std::string *loggers_name, level::level_enum lvl) : logger_name(loggers_name), level(lvl) - { -#ifndef SPDLOG_NO_DATETIME - time = os::now(); -#endif - -#ifndef SPDLOG_NO_THREAD_ID - thread_id = os::thread_id(); -#endif - } - - log_msg(const log_msg& other) = delete; - log_msg& operator=(log_msg&& other) = delete; - log_msg(log_msg&& other) = delete; - - - const std::string *logger_name; - level::level_enum level; - log_clock::time_point time; - size_t thread_id; - fmt::MemoryWriter raw; - fmt::MemoryWriter formatted; -}; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/logger_impl.h b/archive_old_fs_versions/fs/include/spdlog/details/logger_impl.h deleted file mode 100644 index 2b27f1053722ea28b8b273174f06e900ab5590a0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/logger_impl.h +++ /dev/null @@ -1,298 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - - -// create logger with given name, sinks and the default pattern formatter -// all other ctors will call this one -template -inline spdlog::logger::logger(const std::string& logger_name, const It& begin, const It& end): - _name(logger_name), - _sinks(begin, end), - _formatter(std::make_shared("%+")) -{ - _level = level::info; - _flush_level = level::off; - _last_err_time = 0; - _err_handler = [this](const std::string &msg) - { - this->_default_err_handler(msg); - }; -} - -// ctor with sinks as init list -inline spdlog::logger::logger(const std::string& logger_name, sinks_init_list sinks_list): - logger(logger_name, sinks_list.begin(), sinks_list.end()) -{} - - -// ctor with single sink -inline spdlog::logger::logger(const std::string& logger_name, spdlog::sink_ptr single_sink): - logger(logger_name, -{ - single_sink -}) -{} - - -inline spdlog::logger::~logger() = default; - - -inline void spdlog::logger::set_formatter(spdlog::formatter_ptr msg_formatter) -{ - _set_formatter(msg_formatter); -} - -inline void spdlog::logger::set_pattern(const std::string& pattern) -{ - _set_pattern(pattern); -} - - -template -inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Args&... args) -{ - if (!should_log(lvl)) return; - - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw.write(fmt, args...); - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - -template -inline void spdlog::logger::log(level::level_enum lvl, const char* msg) -{ - if (!should_log(lvl)) return; - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw << msg; - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } - -} - -template -inline void spdlog::logger::log(level::level_enum lvl, const T& msg) -{ - if (!should_log(lvl)) return; - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw << msg; - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - - -template -inline void spdlog::logger::trace(const char* fmt, const Args&... args) -{ - log(level::trace, fmt, args...); -} - -template -inline void spdlog::logger::debug(const char* fmt, const Args&... args) -{ - log(level::debug, fmt, args...); -} - -template -inline void spdlog::logger::info(const char* fmt, const Args&... args) -{ - log(level::info, fmt, args...); -} - - -template -inline void spdlog::logger::warn(const char* fmt, const Args&... args) -{ - log(level::warn, fmt, args...); -} - -template -inline void spdlog::logger::error(const char* fmt, const Args&... args) -{ - log(level::err, fmt, args...); -} - -template -inline void spdlog::logger::critical(const char* fmt, const Args&... args) -{ - log(level::critical, fmt, args...); -} - - -template -inline void spdlog::logger::trace(const T& msg) -{ - log(level::trace, msg); -} - -template -inline void spdlog::logger::debug(const T& msg) -{ - log(level::debug, msg); -} - - -template -inline void spdlog::logger::info(const T& msg) -{ - log(level::info, msg); -} - - -template -inline void spdlog::logger::warn(const T& msg) -{ - log(level::warn, msg); -} - -template -inline void spdlog::logger::error(const T& msg) -{ - log(level::err, msg); -} - -template -inline void spdlog::logger::critical(const T& msg) -{ - log(level::critical, msg); -} - - - - -// -// name and level -// -inline const std::string& spdlog::logger::name() const -{ - return _name; -} - -inline void spdlog::logger::set_level(spdlog::level::level_enum log_level) -{ - _level.store(log_level); -} - -inline void spdlog::logger::set_error_handler(spdlog::log_err_handler err_handler) -{ - _err_handler = err_handler; -} - -inline spdlog::log_err_handler spdlog::logger::error_handler() -{ - return _err_handler; -} - - -inline void spdlog::logger::flush_on(level::level_enum log_level) -{ - _flush_level.store(log_level); -} - -inline spdlog::level::level_enum spdlog::logger::level() const -{ - return static_cast(_level.load(std::memory_order_relaxed)); -} - -inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) const -{ - return msg_level >= _level.load(std::memory_order_relaxed); -} - -// -// protected virtual called at end of each user log call (if enabled) by the line_logger -// -inline void spdlog::logger::_sink_it(details::log_msg& msg) -{ - _formatter->format(msg); - for (auto &sink : _sinks) - { - if( sink->should_log( msg.level)) - { - sink->log(msg); - } - } - - if(_should_flush_on(msg)) - flush(); -} - -inline void spdlog::logger::_set_pattern(const std::string& pattern) -{ - _formatter = std::make_shared(pattern); -} -inline void spdlog::logger::_set_formatter(formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; -} - -inline void spdlog::logger::flush() -{ - for (auto& sink : _sinks) - sink->flush(); -} - -inline void spdlog::logger::_default_err_handler(const std::string &msg) -{ - auto now = time(nullptr); - if (now - _last_err_time < 60) - return; - auto tm_time = details::os::localtime(now); - char date_buf[100]; - std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); - details::log_msg err_msg; - err_msg.formatted.write("[*** LOG ERROR ***] [{}] [{}] [{}]{}", name(), msg, date_buf, details::os::eol); - sinks::stderr_sink_mt::instance()->log(err_msg); - _last_err_time = now; -} - -inline bool spdlog::logger::_should_flush_on(const details::log_msg &msg) -{ - const auto flush_level = _flush_level.load(std::memory_order_relaxed); - return (msg.level >= flush_level) && (msg.level != level::off); -} - -inline const std::vector& spdlog::logger::sinks() const -{ - return _sinks; -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/mpmc_bounded_q.h b/archive_old_fs_versions/fs/include/spdlog/details/mpmc_bounded_q.h deleted file mode 100644 index 3a46e8ebd52b6f6be991bad7df7f54e9b2445142..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/mpmc_bounded_q.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -A modified version of Bounded MPMC queue by Dmitry Vyukov. - -Original code from: -http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue - -licensed by Dmitry Vyukov under the terms below: - -Simplified BSD license - -Copyright (c) 2010-2011 Dmitry Vyukov. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list -of conditions and the following disclaimer in the documentation and/or other materials -provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY DMITRY VYUKOV "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL DMITRY VYUKOV OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the authors and -should not be interpreted as representing official policies, either expressed or implied, of Dmitry Vyukov. -*/ - -/* -The code in its current form adds the license below: - -Copyright(c) 2015 Gabi Melman. -Distributed under the MIT License (http://opensource.org/licenses/MIT) - -*/ - -#pragma once - -#include - -#include -#include - -namespace spdlog -{ -namespace details -{ - -template -class mpmc_bounded_queue -{ -public: - - using item_type = T; - mpmc_bounded_queue(size_t buffer_size) - :max_size_(buffer_size), - buffer_(new cell_t [buffer_size]), - buffer_mask_(buffer_size - 1) - { - //queue size must be power of two - if(!((buffer_size >= 2) && ((buffer_size & (buffer_size - 1)) == 0))) - throw spdlog_ex("async logger queue size must be power of two"); - - for (size_t i = 0; i != buffer_size; i += 1) - buffer_[i].sequence_.store(i, std::memory_order_relaxed); - enqueue_pos_.store(0, std::memory_order_relaxed); - dequeue_pos_.store(0, std::memory_order_relaxed); - } - - ~mpmc_bounded_queue() - { - delete [] buffer_; - } - - - bool enqueue(T&& data) - { - cell_t* cell; - size_t pos = enqueue_pos_.load(std::memory_order_relaxed); - for (;;) - { - cell = &buffer_[pos & buffer_mask_]; - size_t seq = cell->sequence_.load(std::memory_order_acquire); - intptr_t dif = (intptr_t)seq - (intptr_t)pos; - if (dif == 0) - { - if (enqueue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed)) - break; - } - else if (dif < 0) - { - return false; - } - else - { - pos = enqueue_pos_.load(std::memory_order_relaxed); - } - } - cell->data_ = std::move(data); - cell->sequence_.store(pos + 1, std::memory_order_release); - return true; - } - - bool dequeue(T& data) - { - cell_t* cell; - size_t pos = dequeue_pos_.load(std::memory_order_relaxed); - for (;;) - { - cell = &buffer_[pos & buffer_mask_]; - size_t seq = - cell->sequence_.load(std::memory_order_acquire); - intptr_t dif = (intptr_t)seq - (intptr_t)(pos + 1); - if (dif == 0) - { - if (dequeue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed)) - break; - } - else if (dif < 0) - return false; - else - pos = dequeue_pos_.load(std::memory_order_relaxed); - } - data = std::move(cell->data_); - cell->sequence_.store(pos + buffer_mask_ + 1, std::memory_order_release); - return true; - } - - size_t approx_size() - { - size_t first_pos = dequeue_pos_.load(std::memory_order_relaxed); - size_t last_pos = enqueue_pos_.load(std::memory_order_relaxed); - if (last_pos <= first_pos) - return 0; - auto size = last_pos - first_pos; - return size < max_size_ ? size : max_size_; - } - -private: - struct cell_t - { - std::atomic sequence_; - T data_; - }; - - size_t const max_size_; - - static size_t const cacheline_size = 64; - typedef char cacheline_pad_t [cacheline_size]; - - cacheline_pad_t pad0_; - cell_t* const buffer_; - size_t const buffer_mask_; - cacheline_pad_t pad1_; - std::atomic enqueue_pos_; - cacheline_pad_t pad2_; - std::atomic dequeue_pos_; - cacheline_pad_t pad3_; - - mpmc_bounded_queue(mpmc_bounded_queue const&) = delete; - void operator= (mpmc_bounded_queue const&) = delete; -}; - -} // ns details -} // ns spdlog diff --git a/archive_old_fs_versions/fs/include/spdlog/details/null_mutex.h b/archive_old_fs_versions/fs/include/spdlog/details/null_mutex.h deleted file mode 100644 index 67b0aeee004c3120d33d54e546a18854ac4d0ecc..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/null_mutex.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -// null, no cost dummy "mutex" and dummy "atomic" int - -namespace spdlog -{ -namespace details -{ -struct null_mutex -{ - void lock() {} - void unlock() {} - bool try_lock() - { - return true; - } -}; - -struct null_atomic_int -{ - int value; - null_atomic_int() = default; - - null_atomic_int(int val):value(val) - {} - - int load(std::memory_order) const - { - return value; - } - - void store(int val) - { - value = val; - } -}; - -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/os.h b/archive_old_fs_versions/fs/include/spdlog/details/os.h deleted file mode 100644 index b63ce667f35c57086c5a3526b13a1497e38ed525..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/os.h +++ /dev/null @@ -1,406 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 - -#ifndef NOMINMAX -#define NOMINMAX //prevent windows redefining min/max -#endif - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include // _get_pid support -#include // _get_osfhandle support - -#ifdef __MINGW32__ -#include -#endif - -#else // unix - -#include -#include - -#ifdef __linux__ -#include //Use gettid() syscall under linux to get thread id - -#elif __FreeBSD__ -#include //Use thr_self() syscall under FreeBSD to get thread id -#endif - -#endif //unix - -#ifndef __has_feature // Clang - feature checking macros. -#define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif - - -namespace spdlog -{ -namespace details -{ -namespace os -{ - -inline spdlog::log_clock::time_point now() -{ - -#if defined __linux__ && defined SPDLOG_CLOCK_COARSE - timespec ts; - ::clock_gettime(CLOCK_REALTIME_COARSE, &ts); - return std::chrono::time_point( - std::chrono::duration_cast( - std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec))); - - -#else - return log_clock::now(); -#endif - -} -inline std::tm localtime(const std::time_t &time_tt) -{ - -#ifdef _WIN32 - std::tm tm; - localtime_s(&tm, &time_tt); -#else - std::tm tm; - localtime_r(&time_tt, &tm); -#endif - return tm; -} - -inline std::tm localtime() -{ - std::time_t now_t = time(nullptr); - return localtime(now_t); -} - - -inline std::tm gmtime(const std::time_t &time_tt) -{ - -#ifdef _WIN32 - std::tm tm; - gmtime_s(&tm, &time_tt); -#else - std::tm tm; - gmtime_r(&time_tt, &tm); -#endif - return tm; -} - -inline std::tm gmtime() -{ - std::time_t now_t = time(nullptr); - return gmtime(now_t); -} -inline bool operator==(const std::tm& tm1, const std::tm& tm2) -{ - return (tm1.tm_sec == tm2.tm_sec && - tm1.tm_min == tm2.tm_min && - tm1.tm_hour == tm2.tm_hour && - tm1.tm_mday == tm2.tm_mday && - tm1.tm_mon == tm2.tm_mon && - tm1.tm_year == tm2.tm_year && - tm1.tm_isdst == tm2.tm_isdst); -} - -inline bool operator!=(const std::tm& tm1, const std::tm& tm2) -{ - return !(tm1 == tm2); -} - -// eol definition -#if !defined (SPDLOG_EOL) -#ifdef _WIN32 -#define SPDLOG_EOL "\r\n" -#else -#define SPDLOG_EOL "\n" -#endif -#endif - -SPDLOG_CONSTEXPR static const char* eol = SPDLOG_EOL; -SPDLOG_CONSTEXPR static int eol_size = sizeof(SPDLOG_EOL) - 1; - -inline void prevent_child_fd(FILE *f) -{ -#ifdef _WIN32 - auto file_handle = (HANDLE)_get_osfhandle(_fileno(f)); - if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) - throw spdlog_ex("SetHandleInformation failed", errno); -#else - auto fd = fileno(f); - if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - throw spdlog_ex("fcntl with FD_CLOEXEC failed", errno); -#endif -} - - -//fopen_s on non windows for writing -inline int fopen_s(FILE** fp, const filename_t& filename, const filename_t& mode) -{ -#ifdef _WIN32 -#ifdef SPDLOG_WCHAR_FILENAMES - *fp = _wfsopen((filename.c_str()), mode.c_str(), _SH_DENYWR); -#else - *fp = _fsopen((filename.c_str()), mode.c_str(), _SH_DENYWR); -#endif -#else //unix - *fp = fopen((filename.c_str()), mode.c_str()); -#endif - -#ifdef SPDLOG_PREVENT_CHILD_FD - if(*fp != nullptr) - prevent_child_fd(*fp); -#endif - return *fp == nullptr; -} - - -inline int remove(const filename_t &filename) -{ -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) - return _wremove(filename.c_str()); -#else - return std::remove(filename.c_str()); -#endif -} - -inline int rename(const filename_t& filename1, const filename_t& filename2) -{ -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) - return _wrename(filename1.c_str(), filename2.c_str()); -#else - return std::rename(filename1.c_str(), filename2.c_str()); -#endif -} - - -//Return if file exists -inline bool file_exists(const filename_t& filename) -{ -#ifdef _WIN32 -#ifdef SPDLOG_WCHAR_FILENAMES - auto attribs = GetFileAttributesW(filename.c_str()); -#else - auto attribs = GetFileAttributesA(filename.c_str()); -#endif - return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); -#else //common linux/unix all have the stat system call - struct stat buffer; - return (stat (filename.c_str(), &buffer) == 0); -#endif -} - - - - -//Return file size according to open FILE* object -inline size_t filesize(FILE *f) -{ - if (f == nullptr) - throw spdlog_ex("Failed getting file size. fd is null"); -#ifdef _WIN32 - int fd = _fileno(f); -#if _WIN64 //64 bits - struct _stat64 st; - if (_fstat64(fd, &st) == 0) - return st.st_size; - -#else //windows 32 bits - long ret = _filelength(fd); - if (ret >= 0) - return static_cast(ret); -#endif - -#else // unix - int fd = fileno(f); - //64 bits(but not in osx, where fstat64 is deprecated) -#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) - struct stat64 st; - if (fstat64(fd, &st) == 0) - return static_cast(st.st_size); -#else // unix 32 bits or osx - struct stat st; - if (fstat(fd, &st) == 0) - return static_cast(st.st_size); -#endif -#endif - throw spdlog_ex("Failed getting file size from fd", errno); -} - - - - -//Return utc offset in minutes or throw spdlog_ex on failure -inline int utc_minutes_offset(const std::tm& tm = details::os::localtime()) -{ - -#ifdef _WIN32 -#if _WIN32_WINNT < _WIN32_WINNT_WS08 - TIME_ZONE_INFORMATION tzinfo; - auto rv = GetTimeZoneInformation(&tzinfo); -#else - DYNAMIC_TIME_ZONE_INFORMATION tzinfo; - auto rv = GetDynamicTimeZoneInformation(&tzinfo); -#endif - if (rv == TIME_ZONE_ID_INVALID) - throw spdlog::spdlog_ex("Failed getting timezone info. ", errno); - - int offset = -tzinfo.Bias; - if (tm.tm_isdst) - offset -= tzinfo.DaylightBias; - else - offset -= tzinfo.StandardBias; - return offset; -#else - -#if defined(sun) || defined(__sun) - // 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris - struct helper - { - static long int calculate_gmt_offset(const std::tm & localtm = details::os::localtime(), const std::tm & gmtm = details::os::gmtime()) - { - int local_year = localtm.tm_year + (1900 - 1); - int gmt_year = gmtm.tm_year + (1900 - 1); - - long int days = ( - // difference in day of year - localtm.tm_yday - gmtm.tm_yday - - // + intervening leap days - + ((local_year >> 2) - (gmt_year >> 2)) - - (local_year / 100 - gmt_year / 100) - + ((local_year / 100 >> 2) - (gmt_year / 100 >> 2)) - - // + difference in years * 365 */ - + (long int)(local_year - gmt_year) * 365 - ); - - long int hours = (24 * days) + (localtm.tm_hour - gmtm.tm_hour); - long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min); - long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec); - - return secs; - } - }; - - long int offset_seconds = helper::calculate_gmt_offset(tm); -#else - long int offset_seconds = tm.tm_gmtoff; -#endif - - return static_cast(offset_seconds / 60); -#endif -} - -//Return current thread id as size_t -//It exists because the std::this_thread::get_id() is much slower(espcially under VS 2013) -inline size_t _thread_id() -{ -#ifdef _WIN32 - return static_cast(::GetCurrentThreadId()); -#elif __linux__ -# if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) -# define SYS_gettid __NR_gettid -# endif - return static_cast(syscall(SYS_gettid)); -#elif __FreeBSD__ - long tid; - thr_self(&tid); - return static_cast(tid); -#else //Default to standard C++11 (OSX and other Unix) - return static_cast(std::hash()(std::this_thread::get_id())); -#endif -} - -//Return current thread id as size_t (from thread local storage) -inline size_t thread_id() -{ -#if defined(_MSC_VER) && (_MSC_VER < 1900) || defined(__clang__) && !__has_feature(cxx_thread_local) - return _thread_id(); -#else - static thread_local const size_t tid = _thread_id(); - return tid; -#endif -} - - - - -// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -#define SPDLOG_FILENAME_T(s) L ## s -inline std::string filename_to_str(const filename_t& filename) -{ - std::wstring_convert, wchar_t> c; - return c.to_bytes(filename); -} -#else -#define SPDLOG_FILENAME_T(s) s -inline std::string filename_to_str(const filename_t& filename) -{ - return filename; -} -#endif - - -// Return errno string (thread safe) -inline std::string errno_str(int err_num) -{ - char buf[256]; - SPDLOG_CONSTEXPR auto buf_size = sizeof(buf); - -#ifdef _WIN32 - if(strerror_s(buf, buf_size, err_num) == 0) - return std::string(buf); - else - return "Unkown error"; - -#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(ANDROID) || defined(__SUNPRO_CC) || \ - ((_POSIX_C_SOURCE >= 200112L) && ! defined(_GNU_SOURCE)) // posix version - - if (strerror_r(err_num, buf, buf_size) == 0) - return std::string(buf); - else - return "Unkown error"; - -#else // gnu version (might not use the given buf, so its retval pointer must be used) - return std::string(strerror_r(err_num, buf, buf_size)); -#endif -} - -inline int pid() -{ - -#ifdef _WIN32 - return ::_getpid(); -#else - return static_cast(::getpid()); -#endif - -} - -} //os -} //details -} //spdlog diff --git a/archive_old_fs_versions/fs/include/spdlog/details/pattern_formatter_impl.h b/archive_old_fs_versions/fs/include/spdlog/details/pattern_formatter_impl.h deleted file mode 100644 index 70b9dc8074bf02d8e2260d0c38dc08e6bf38ab6d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/pattern_formatter_impl.h +++ /dev/null @@ -1,670 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -class flag_formatter -{ -public: - virtual ~flag_formatter() - {} - virtual void format(details::log_msg& msg, const std::tm& tm_time) = 0; -}; - -/////////////////////////////////////////////////////////////////////// -// name & level pattern appenders -/////////////////////////////////////////////////////////////////////// -namespace -{ -class name_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << *msg.logger_name; - } -}; -} - -// log level appender -class level_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << level::to_str(msg.level); - } -}; - -// short log level appender -class short_level_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << level::to_short_str(msg.level); - } -}; - -/////////////////////////////////////////////////////////////////////// -// Date time pattern appenders -/////////////////////////////////////////////////////////////////////// - -static const char* ampm(const tm& t) -{ - return t.tm_hour >= 12 ? "PM" : "AM"; -} - -static int to12h(const tm& t) -{ - return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour; -} - -//Abbreviated weekday name -using days_array = std::array; -static const days_array& days() -{ - static const days_array arr{ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } }; - return arr; -} -class a_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << days()[tm_time.tm_wday]; - } -}; - -//Full weekday name -static const days_array& full_days() -{ - static const days_array arr{ { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } }; - return arr; -} -class A_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << full_days()[tm_time.tm_wday]; - } -}; - -//Abbreviated month -using months_array = std::array; -static const months_array& months() -{ - static const months_array arr{ { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" } }; - return arr; -} -class b_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << months()[tm_time.tm_mon]; - } -}; - -//Full month name -static const months_array& full_months() -{ - static const months_array arr{ { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } }; - return arr; -} -class B_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << full_months()[tm_time.tm_mon]; - } -}; - - -//write 2 ints seperated by sep with padding of 2 -static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, char sep) -{ - w << fmt::pad(v1, 2, '0') << sep << fmt::pad(v2, 2, '0'); - return w; -} - -//write 3 ints seperated by sep with padding of 2 -static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v3, char sep) -{ - w << fmt::pad(v1, 2, '0') << sep << fmt::pad(v2, 2, '0') << sep << fmt::pad(v3, 2, '0'); - return w; -} - - -//Date and time representation (Thu Aug 23 15:35:46 2014) -class c_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << days()[tm_time.tm_wday] << ' ' << months()[tm_time.tm_mon] << ' ' << tm_time.tm_mday << ' '; - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec, ':') << ' ' << tm_time.tm_year + 1900; - } -}; - - -// year - 2 digit -class C_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_year % 100, 2, '0'); - } -}; - - - -// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01 -class D_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_mon + 1, tm_time.tm_mday, tm_time.tm_year % 100, '/'); - } -}; - - -// year - 4 digit -class Y_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << tm_time.tm_year + 1900; - } -}; - -// month 1-12 -class m_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_mon + 1, 2, '0'); - } -}; - -// day of month 1-31 -class d_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_mday, 2, '0'); - } -}; - -// hours in 24 format 0-23 -class H_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_hour, 2, '0'); - } -}; - -// hours in 12 format 1-12 -class I_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(to12h(tm_time), 2, '0'); - } -}; - -// minutes 0-59 -class M_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_min, 2, '0'); - } -}; - -// seconds 0-59 -class S_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_sec, 2, '0'); - } -}; - -// milliseconds -class e_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto millis = std::chrono::duration_cast(duration).count() % 1000; - msg.formatted << fmt::pad(static_cast(millis), 3, '0'); - } -}; - -// microseconds -class f_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto micros = std::chrono::duration_cast(duration).count() % 1000000; - msg.formatted << fmt::pad(static_cast(micros), 6, '0'); - } -}; - -// nanoseconds -class F_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto ns = std::chrono::duration_cast(duration).count() % 1000000000; - msg.formatted << fmt::pad(static_cast(ns), 9, '0'); - } -}; - -// AM/PM -class p_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << ampm(tm_time); - } -}; - - -// 12 hour clock 02:55:02 pm -class r_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, to12h(tm_time), tm_time.tm_min, tm_time.tm_sec, ':') << ' ' << ampm(tm_time); - } -}; - -// 24-hour HH:MM time, equivalent to %H:%M -class R_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, ':'); - } -}; - -// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S -class T_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec, ':'); - } -}; - - -// ISO 8601 offset from UTC in timezone (+-HH:MM) -class z_formatter:public flag_formatter -{ -public: - const std::chrono::seconds cache_refresh = std::chrono::seconds(5); - - z_formatter():_last_update(std::chrono::seconds(0)) - {} - z_formatter(const z_formatter&) = delete; - z_formatter& operator=(const z_formatter&) = delete; - - void format(details::log_msg& msg, const std::tm& tm_time) override - { -#ifdef _WIN32 - int total_minutes = get_cached_offset(msg, tm_time); -#else - // No need to chache under gcc, - // it is very fast (already stored in tm.tm_gmtoff) - int total_minutes = os::utc_minutes_offset(tm_time); -#endif - bool is_negative = total_minutes < 0; - char sign; - if (is_negative) - { - total_minutes = -total_minutes; - sign = '-'; - } - else - { - sign = '+'; - } - - int h = total_minutes / 60; - int m = total_minutes % 60; - msg.formatted << sign; - pad_n_join(msg.formatted, h, m, ':'); - } -private: - log_clock::time_point _last_update; - int _offset_minutes; - std::mutex _mutex; - - int get_cached_offset(const log_msg& msg, const std::tm& tm_time) - { - using namespace std::chrono; - std::lock_guard l(_mutex); - if (msg.time - _last_update >= cache_refresh) - { - _offset_minutes = os::utc_minutes_offset(tm_time); - _last_update = msg.time; - } - return _offset_minutes; - } -}; - - - -// Thread id -class t_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << msg.thread_id; - } -}; - -// Current pid -class pid_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << details::os::pid(); - } -}; - - -class v_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << fmt::StringRef(msg.raw.data(), msg.raw.size()); - } -}; - -class ch_formatter:public flag_formatter -{ -public: - explicit ch_formatter(char ch): _ch(ch) - {} - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << _ch; - } -private: - char _ch; -}; - - -//aggregate user chars to display as is -class aggregate_formatter:public flag_formatter -{ -public: - aggregate_formatter() - {} - void add_ch(char ch) - { - _str += ch; - } - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << _str; - } -private: - std::string _str; -}; - -// Full info formatter -// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v -class full_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { -#ifndef SPDLOG_NO_DATETIME - auto duration = msg.time.time_since_epoch(); - auto millis = std::chrono::duration_cast(duration).count() % 1000; - - /* Slower version(while still very fast - about 3.2 million lines/sec under 10 threads), - msg.formatted.write("[{:d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:03d}] [{}] [{}] {} ", - tm_time.tm_year + 1900, - tm_time.tm_mon + 1, - tm_time.tm_mday, - tm_time.tm_hour, - tm_time.tm_min, - tm_time.tm_sec, - static_cast(millis), - msg.logger_name, - level::to_str(msg.level), - msg.raw.str());*/ - - - // Faster (albeit uglier) way to format the line (5.6 million lines/sec under 10 threads) - msg.formatted << '[' << static_cast(tm_time.tm_year + 1900) << '-' - << fmt::pad(static_cast(tm_time.tm_mon + 1), 2, '0') << '-' - << fmt::pad(static_cast(tm_time.tm_mday), 2, '0') << ' ' - << fmt::pad(static_cast(tm_time.tm_hour), 2, '0') << ':' - << fmt::pad(static_cast(tm_time.tm_min), 2, '0') << ':' - << fmt::pad(static_cast(tm_time.tm_sec), 2, '0') << '.' - << fmt::pad(static_cast(millis), 3, '0') << "] "; - - //no datetime needed -#else - (void)tm_time; -#endif - -#ifndef SPDLOG_NO_NAME - msg.formatted << '[' << *msg.logger_name << "] "; -#endif - - msg.formatted << '[' << level::to_str(msg.level) << "] "; - msg.formatted << fmt::StringRef(msg.raw.data(), msg.raw.size()); - } -}; - - - -} -} -/////////////////////////////////////////////////////////////////////////////// -// pattern_formatter inline impl -/////////////////////////////////////////////////////////////////////////////// -inline spdlog::pattern_formatter::pattern_formatter(const std::string& pattern) -{ - compile_pattern(pattern); -} - -inline void spdlog::pattern_formatter::compile_pattern(const std::string& pattern) -{ - auto end = pattern.end(); - std::unique_ptr user_chars; - for (auto it = pattern.begin(); it != end; ++it) - { - if (*it == '%') - { - if (user_chars) //append user chars found so far - _formatters.push_back(std::move(user_chars)); - - if (++it != end) - handle_flag(*it); - else - break; - } - else // chars not following the % sign should be displayed as is - { - if (!user_chars) - user_chars = std::unique_ptr(new details::aggregate_formatter()); - user_chars->add_ch(*it); - } - } - if (user_chars) //append raw chars found so far - { - _formatters.push_back(std::move(user_chars)); - } - -} -inline void spdlog::pattern_formatter::handle_flag(char flag) -{ - switch (flag) - { - // logger name - case 'n': - _formatters.push_back(std::unique_ptr(new details::name_formatter())); - break; - - case 'l': - _formatters.push_back(std::unique_ptr(new details::level_formatter())); - break; - - case 'L': - _formatters.push_back(std::unique_ptr(new details::short_level_formatter())); - break; - - case('t'): - _formatters.push_back(std::unique_ptr(new details::t_formatter())); - break; - - case('v'): - _formatters.push_back(std::unique_ptr(new details::v_formatter())); - break; - - case('a'): - _formatters.push_back(std::unique_ptr(new details::a_formatter())); - break; - - case('A'): - _formatters.push_back(std::unique_ptr(new details::A_formatter())); - break; - - case('b'): - case('h'): - _formatters.push_back(std::unique_ptr(new details::b_formatter())); - break; - - case('B'): - _formatters.push_back(std::unique_ptr(new details::B_formatter())); - break; - case('c'): - _formatters.push_back(std::unique_ptr(new details::c_formatter())); - break; - - case('C'): - _formatters.push_back(std::unique_ptr(new details::C_formatter())); - break; - - case('Y'): - _formatters.push_back(std::unique_ptr(new details::Y_formatter())); - break; - - case('D'): - case('x'): - - _formatters.push_back(std::unique_ptr(new details::D_formatter())); - break; - - case('m'): - _formatters.push_back(std::unique_ptr(new details::m_formatter())); - break; - - case('d'): - _formatters.push_back(std::unique_ptr(new details::d_formatter())); - break; - - case('H'): - _formatters.push_back(std::unique_ptr(new details::H_formatter())); - break; - - case('I'): - _formatters.push_back(std::unique_ptr(new details::I_formatter())); - break; - - case('M'): - _formatters.push_back(std::unique_ptr(new details::M_formatter())); - break; - - case('S'): - _formatters.push_back(std::unique_ptr(new details::S_formatter())); - break; - - case('e'): - _formatters.push_back(std::unique_ptr(new details::e_formatter())); - break; - - case('f'): - _formatters.push_back(std::unique_ptr(new details::f_formatter())); - break; - case('F'): - _formatters.push_back(std::unique_ptr(new details::F_formatter())); - break; - - case('p'): - _formatters.push_back(std::unique_ptr(new details::p_formatter())); - break; - - case('r'): - _formatters.push_back(std::unique_ptr(new details::r_formatter())); - break; - - case('R'): - _formatters.push_back(std::unique_ptr(new details::R_formatter())); - break; - - case('T'): - case('X'): - _formatters.push_back(std::unique_ptr(new details::T_formatter())); - break; - - case('z'): - _formatters.push_back(std::unique_ptr(new details::z_formatter())); - break; - - case ('+'): - _formatters.push_back(std::unique_ptr(new details::full_formatter())); - break; - - case ('P'): - _formatters.push_back(std::unique_ptr(new details::pid_formatter())); - break; - - default: //Unkown flag appears as is - _formatters.push_back(std::unique_ptr(new details::ch_formatter('%'))); - _formatters.push_back(std::unique_ptr(new details::ch_formatter(flag))); - break; - } -} - - -inline void spdlog::pattern_formatter::format(details::log_msg& msg) -{ - -#ifndef SPDLOG_NO_DATETIME - auto tm_time = details::os::localtime(log_clock::to_time_t(msg.time)); -#else - std::tm tm_time; -#endif - for (auto &f : _formatters) - { - f->format(msg, tm_time); - } - //write eol - msg.formatted.write(details::os::eol, details::os::eol_size); -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/registry.h b/archive_old_fs_versions/fs/include/spdlog/details/registry.h deleted file mode 100644 index ee14adfdb106dc1d094c35c162ec45689460df6d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/registry.h +++ /dev/null @@ -1,185 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Loggers registy of unique name->logger pointer -// An attempt to create a logger with an already existing name will be ignored -// If user requests a non existing logger, nullptr will be returned -// This class is thread safe - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -template class registry_t -{ -public: - - void register_logger(std::shared_ptr logger) - { - std::lock_guard lock(_mutex); - auto logger_name = logger->name(); - throw_if_exists(logger_name); - _loggers[logger_name] = logger; - } - - - std::shared_ptr get(const std::string& logger_name) - { - std::lock_guard lock(_mutex); - auto found = _loggers.find(logger_name); - return found == _loggers.end() ? nullptr : found->second; - } - - template - std::shared_ptr create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end) - { - std::lock_guard lock(_mutex); - throw_if_exists(logger_name); - std::shared_ptr new_logger; - if (_async_mode) - new_logger = std::make_shared(logger_name, sinks_begin, sinks_end, _async_q_size, _overflow_policy, _worker_warmup_cb, _flush_interval_ms, _worker_teardown_cb); - else - new_logger = std::make_shared(logger_name, sinks_begin, sinks_end); - - if (_formatter) - new_logger->set_formatter(_formatter); - - if (_err_handler) - new_logger->set_error_handler(_err_handler); - - new_logger->set_level(_level); - - - //Add to registry - _loggers[logger_name] = new_logger; - return new_logger; - } - - void apply_all(std::function)> fun) - { - std::lock_guard lock(_mutex); - for (auto &l : _loggers) - fun(l.second); - } - - void drop(const std::string& logger_name) - { - std::lock_guard lock(_mutex); - _loggers.erase(logger_name); - } - - void drop_all() - { - std::lock_guard lock(_mutex); - _loggers.clear(); - } - std::shared_ptr create(const std::string& logger_name, sinks_init_list sinks) - { - return create(logger_name, sinks.begin(), sinks.end()); - } - - std::shared_ptr create(const std::string& logger_name, sink_ptr sink) - { - return create(logger_name, { sink }); - } - - - void formatter(formatter_ptr f) - { - std::lock_guard lock(_mutex); - _formatter = f; - for (auto& l : _loggers) - l.second->set_formatter(_formatter); - } - - void set_pattern(const std::string& pattern) - { - std::lock_guard lock(_mutex); - _formatter = std::make_shared(pattern); - for (auto& l : _loggers) - l.second->set_formatter(_formatter); - } - - void set_level(level::level_enum log_level) - { - std::lock_guard lock(_mutex); - for (auto& l : _loggers) - l.second->set_level(log_level); - _level = log_level; - } - - void set_error_handler(log_err_handler handler) - { - for (auto& l : _loggers) - l.second->set_error_handler(handler); - _err_handler = handler; - } - - void set_async_mode(size_t q_size, const async_overflow_policy overflow_policy, const std::function& worker_warmup_cb, const std::chrono::milliseconds& flush_interval_ms, const std::function& worker_teardown_cb) - { - std::lock_guard lock(_mutex); - _async_mode = true; - _async_q_size = q_size; - _overflow_policy = overflow_policy; - _worker_warmup_cb = worker_warmup_cb; - _flush_interval_ms = flush_interval_ms; - _worker_teardown_cb = worker_teardown_cb; - } - - void set_sync_mode() - { - std::lock_guard lock(_mutex); - _async_mode = false; - } - - static registry_t& instance() - { - static registry_t s_instance; - return s_instance; - } - -private: - registry_t() {} - registry_t(const registry_t&) = delete; - registry_t& operator=(const registry_t&) = delete; - - void throw_if_exists(const std::string &logger_name) - { - if (_loggers.find(logger_name) != _loggers.end()) - throw spdlog_ex("logger with name '" + logger_name + "' already exists"); - } - Mutex _mutex; - std::unordered_map > _loggers; - formatter_ptr _formatter; - level::level_enum _level = level::info; - log_err_handler _err_handler; - bool _async_mode = false; - size_t _async_q_size = 0; - async_overflow_policy _overflow_policy = async_overflow_policy::block_retry; - std::function _worker_warmup_cb = nullptr; - std::chrono::milliseconds _flush_interval_ms; - std::function _worker_teardown_cb = nullptr; -}; -#ifdef SPDLOG_NO_REGISTRY_MUTEX -typedef registry_t registry; -#else -typedef registry_t registry; -#endif -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/details/spdlog_impl.h b/archive_old_fs_versions/fs/include/spdlog/details/spdlog_impl.h deleted file mode 100644 index 79d3ac4506b146924d0549fb646fdc463e8e05f1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/details/spdlog_impl.h +++ /dev/null @@ -1,245 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// -// Global registry functions -// -#include -#include -#include -#include -#ifdef SPDLOG_ENABLE_SYSLOG -#include -#endif - -#ifdef _WIN32 -#include -#else -#include -#endif - - -#ifdef __ANDROID__ -#include -#endif - -#include -#include -#include -#include - -inline void spdlog::register_logger(std::shared_ptr logger) -{ - return details::registry::instance().register_logger(logger); -} - -inline std::shared_ptr spdlog::get(const std::string& name) -{ - return details::registry::instance().get(name); -} - -inline void spdlog::drop(const std::string &name) -{ - details::registry::instance().drop(name); -} - -// Create multi/single threaded simple file logger -inline std::shared_ptr spdlog::basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate) -{ - return create(logger_name, filename, truncate); -} - -inline std::shared_ptr spdlog::basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate) -{ - return create(logger_name, filename, truncate); -} - -// Create multi/single threaded rotating file logger -inline std::shared_ptr spdlog::rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files) -{ - return create(logger_name, filename, max_file_size, max_files); -} - -inline std::shared_ptr spdlog::rotating_logger_st(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files) -{ - return create(logger_name, filename, max_file_size, max_files); -} - -// Create file logger which creates new file at midnight): -inline std::shared_ptr spdlog::daily_logger_mt(const std::string& logger_name, const filename_t& filename, int hour, int minute) -{ - return create(logger_name, filename, hour, minute); -} - -inline std::shared_ptr spdlog::daily_logger_st(const std::string& logger_name, const filename_t& filename, int hour, int minute) -{ - return create(logger_name, filename, hour, minute); -} - - -// -// stdout/stderr loggers -// -inline std::shared_ptr spdlog::stdout_logger_mt(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_mt::instance()); -} - -inline std::shared_ptr spdlog::stdout_logger_st(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_st::instance()); -} - -inline std::shared_ptr spdlog::stderr_logger_mt(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_mt::instance()); -} - -inline std::shared_ptr spdlog::stderr_logger_st(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_st::instance()); -} - -// -// stdout/stderr color loggers -// -#ifdef _WIN32 -inline std::shared_ptr spdlog::stdout_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stdout_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - - -inline std::shared_ptr spdlog::stderr_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -#else //ansi terminal colors - -inline std::shared_ptr spdlog::stdout_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stdout_sink_mt::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stdout_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stdout_sink_st::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stderr_sink_mt::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stderr_sink_st::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} -#endif - -#ifdef SPDLOG_ENABLE_SYSLOG -// Create syslog logger -inline std::shared_ptr spdlog::syslog_logger(const std::string& logger_name, const std::string& syslog_ident, int syslog_option) -{ - return create(logger_name, syslog_ident, syslog_option); -} -#endif - -#ifdef __ANDROID__ -inline std::shared_ptr spdlog::android_logger(const std::string& logger_name, const std::string& tag) -{ - return create(logger_name, tag); -} -#endif - -// Create and register a logger a single sink -inline std::shared_ptr spdlog::create(const std::string& logger_name, const spdlog::sink_ptr& sink) -{ - return details::registry::instance().create(logger_name, sink); -} - -//Create logger with multiple sinks - -inline std::shared_ptr spdlog::create(const std::string& logger_name, spdlog::sinks_init_list sinks) -{ - return details::registry::instance().create(logger_name, sinks); -} - - -template -inline std::shared_ptr spdlog::create(const std::string& logger_name, Args... args) -{ - sink_ptr sink = std::make_shared(args...); - return details::registry::instance().create(logger_name, { sink }); -} - - -template -inline std::shared_ptr spdlog::create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end) -{ - return details::registry::instance().create(logger_name, sinks_begin, sinks_end); -} - -inline void spdlog::set_formatter(spdlog::formatter_ptr f) -{ - details::registry::instance().formatter(f); -} - -inline void spdlog::set_pattern(const std::string& format_string) -{ - return details::registry::instance().set_pattern(format_string); -} - -inline void spdlog::set_level(level::level_enum log_level) -{ - return details::registry::instance().set_level(log_level); -} - -inline void spdlog::set_error_handler(log_err_handler handler) -{ - return details::registry::instance().set_error_handler(handler); -} - - -inline void spdlog::set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy, const std::function& worker_warmup_cb, const std::chrono::milliseconds& flush_interval_ms, const std::function& worker_teardown_cb) -{ - details::registry::instance().set_async_mode(queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb); -} - -inline void spdlog::set_sync_mode() -{ - details::registry::instance().set_sync_mode(); -} - -inline void spdlog::apply_all(std::function)> fun) -{ - details::registry::instance().apply_all(fun); -} - -inline void spdlog::drop_all() -{ - details::registry::instance().drop_all(); -} diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.cc b/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.cc deleted file mode 100644 index fd8855be4c3f9a0cb631ac6a718e573dceea2d80..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.cc +++ /dev/null @@ -1,583 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "format.h" - -#include - -#include -#include -#include -#include -#include -#include // for std::ptrdiff_t - -#if defined(_WIN32) && defined(__MINGW32__) -# include -#endif - -#if FMT_USE_WINDOWS_H -# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX) -# include -# else -# define NOMINMAX -# include -# undef NOMINMAX -# endif -#endif - -using fmt::internal::Arg; - -#if FMT_EXCEPTIONS -# define FMT_TRY try -# define FMT_CATCH(x) catch (x) -#else -# define FMT_TRY if (true) -# define FMT_CATCH(x) if (false) -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -# pragma warning(disable: 4702) // unreachable code -// Disable deprecation warning for strerror. The latter is not called but -// MSVC fails to detect it. -# pragma warning(disable: 4996) -#endif - -// Dummy implementations of strerror_r and strerror_s called if corresponding -// system functions are not available. -static inline fmt::internal::Null<> strerror_r(int, char *, ...) -{ - return fmt::internal::Null<>(); -} -static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) -{ - return fmt::internal::Null<>(); -} - -namespace fmt { - - FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT - {} - FMT_FUNC FormatError::~FormatError() FMT_DTOR_NOEXCEPT - {} - FMT_FUNC SystemError::~SystemError() FMT_DTOR_NOEXCEPT - {} - - namespace { - -#ifndef _MSC_VER -# define FMT_SNPRINTF snprintf -#else // _MSC_VER - inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) - { - va_list args; - va_start(args, format); - int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args); - va_end(args); - return result; - } -# define FMT_SNPRINTF fmt_snprintf -#endif // _MSC_VER - -#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) -# define FMT_SWPRINTF snwprintf -#else -# define FMT_SWPRINTF swprintf -#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) - - const char RESET_COLOR[] = "\x1b[0m"; - - typedef void(*FormatFunc)(Writer &, int, StringRef); - - // Portable thread-safe version of strerror. - // Sets buffer to point to a string describing the error code. - // This can be either a pointer to a string stored in buffer, - // or a pointer to some static immutable string. - // Returns one of the following values: - // 0 - success - // ERANGE - buffer is not large enough to store the error message - // other - failure - // Buffer should be at least of size 1. - int safe_strerror( - int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT - { - FMT_ASSERT(buffer != 0 && buffer_size != 0, "invalid buffer"); - - class StrError - { - private: - int error_code_; - char *&buffer_; - std::size_t buffer_size_; - - // A noop assignment operator to avoid bogus warnings. - void operator=(const StrError &) - {} - - // Handle the result of XSI-compliant version of strerror_r. - int handle(int result) - { - // glibc versions before 2.13 return result in errno. - return result == -1 ? errno : result; - } - - // Handle the result of GNU-specific version of strerror_r. - int handle(char *message) - { - // If the buffer is full then the message is probably truncated. - if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1) - return ERANGE; - buffer_ = message; - return 0; - } - - // Handle the case when strerror_r is not available. - int handle(internal::Null<>) - { - return fallback(strerror_s(buffer_, buffer_size_, error_code_)); - } - - // Fallback to strerror_s when strerror_r is not available. - int fallback(int result) - { - // If the buffer is full then the message is probably truncated. - return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? - ERANGE : result; - } - - // Fallback to strerror if strerror_r and strerror_s are not available. - int fallback(internal::Null<>) - { - errno = 0; - buffer_ = strerror(error_code_); - return errno; - } - - public: - StrError(int err_code, char *&buf, std::size_t buf_size) - : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) - {} - - int run() - { - // Suppress a warning about unused strerror_r. - strerror_r(0, FMT_NULL, ""); - return handle(strerror_r(error_code_, buffer_, buffer_size_)); - } - }; - return StrError(error_code, buffer, buffer_size).run(); - } - - void format_error_code(Writer &out, int error_code, - StringRef message) FMT_NOEXCEPT - { - // Report error code making sure that the output fits into - // INLINE_BUFFER_SIZE to avoid dynamic memory allocation and potential - // bad_alloc. - out.clear(); - static const char SEP[] = ": "; - static const char ERROR_STR[] = "error "; - // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. - std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; - typedef internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(error_code); - if (internal::is_negative(error_code)) { - abs_value = 0 - abs_value; - ++error_code_size; - } - error_code_size += internal::count_digits(abs_value); - if (message.size() <= internal::INLINE_BUFFER_SIZE - error_code_size) - out << message << SEP; - out << ERROR_STR << error_code; - assert(out.size() <= internal::INLINE_BUFFER_SIZE); - } - - void report_error(FormatFunc func, int error_code, - StringRef message) FMT_NOEXCEPT - { - MemoryWriter full_message; - func(full_message, error_code, message); - // Use Writer::data instead of Writer::c_str to avoid potential memory - // allocation. - std::fwrite(full_message.data(), full_message.size(), 1, stderr); - std::fputc('\n', stderr); - } - } // namespace - - namespace internal { - - // This method is used to preserve binary compatibility with fmt 3.0. - // It can be removed in 4.0. - FMT_FUNC void format_system_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - fmt::format_system_error(out, error_code, message); - } - } // namespace internal - - FMT_FUNC void SystemError::init( - int err_code, CStringRef format_str, ArgList args) - { - error_code_ = err_code; - MemoryWriter w; - format_system_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); - } - - template - int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, T value) - { - if (width == 0) { - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, value) : - FMT_SNPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, width, value) : - FMT_SNPRINTF(buffer, size, format, width, precision, value); - } - - template - int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, T value) - { - if (width == 0) { - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, value) : - FMT_SWPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, width, value) : - FMT_SWPRINTF(buffer, size, format, width, precision, value); - } - - template - const char internal::BasicData::DIGITS[] = - "0001020304050607080910111213141516171819" - "2021222324252627282930313233343536373839" - "4041424344454647484950515253545556575859" - "6061626364656667686970717273747576777879" - "8081828384858687888990919293949596979899"; - -#define FMT_POWERS_OF_10(factor) \ - factor * 10, \ - factor * 100, \ - factor * 1000, \ - factor * 10000, \ - factor * 100000, \ - factor * 1000000, \ - factor * 10000000, \ - factor * 100000000, \ - factor * 1000000000 - - template - const uint32_t internal::BasicData::POWERS_OF_10_32[] = { - 0, FMT_POWERS_OF_10(1) - }; - - template - const uint64_t internal::BasicData::POWERS_OF_10_64[] = { - 0, - FMT_POWERS_OF_10(1), - FMT_POWERS_OF_10(ULongLong(1000000000)), - // Multiply several constants instead of using a single long long constant - // to avoid warnings about C++98 not supporting long long. - ULongLong(1000000000) * ULongLong(1000000000) * 10 - }; - - FMT_FUNC void internal::report_unknown_type(char code, const char *type) - { - (void)type; - if (std::isprint(static_cast(code))) { - FMT_THROW(FormatError( - format("unknown format code '{}' for {}", code, type))); - } - FMT_THROW(FormatError( - format("unknown format code '\\x{:02x}' for {}", - static_cast(code), type))); - } - -#if FMT_USE_WINDOWS_H - - FMT_FUNC internal::UTF8ToUTF16::UTF8ToUTF16(StringRef s) - { - static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16"; - if (s.size() > INT_MAX) - FMT_THROW(WindowsError(ERROR_INVALID_PARAMETER, ERROR_MSG)); - int s_size = static_cast(s.size()); - int length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, FMT_NULL, 0); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_.resize(length + 1); - length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, &buffer_[0], length); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_[length] = 0; - } - - FMT_FUNC internal::UTF16ToUTF8::UTF16ToUTF8(WStringRef s) - { - if (int error_code = convert(s)) { - FMT_THROW(WindowsError(error_code, - "cannot convert string from UTF-16 to UTF-8")); - } - } - - FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) - { - if (s.size() > INT_MAX) - return ERROR_INVALID_PARAMETER; - int s_size = static_cast(s.size()); - int length = WideCharToMultiByte( - CP_UTF8, 0, s.data(), s_size, FMT_NULL, 0, FMT_NULL, FMT_NULL); - if (length == 0) - return GetLastError(); - buffer_.resize(length + 1); - length = WideCharToMultiByte( - CP_UTF8, 0, s.data(), s_size, &buffer_[0], length, FMT_NULL, FMT_NULL); - if (length == 0) - return GetLastError(); - buffer_[length] = 0; - return 0; - } - - FMT_FUNC void WindowsError::init( - int err_code, CStringRef format_str, ArgList args) - { - error_code_ = err_code; - MemoryWriter w; - internal::format_windows_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); - } - - FMT_FUNC void internal::format_windows_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - FMT_TRY{ - MemoryBuffer buffer; - buffer.resize(INLINE_BUFFER_SIZE); - for (;;) { - wchar_t *system_message = &buffer[0]; - int result = FormatMessageW( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - FMT_NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - system_message, static_cast(buffer.size()), FMT_NULL); - if (result != 0) { - UTF16ToUTF8 utf8_message; - if (utf8_message.convert(system_message) == ERROR_SUCCESS) { - out << message << ": " << utf8_message; - return; - } - break; - } - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) - {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. - } - -#endif // FMT_USE_WINDOWS_H - - FMT_FUNC void format_system_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - FMT_TRY{ - internal::MemoryBuffer buffer; - buffer.resize(internal::INLINE_BUFFER_SIZE); - for (;;) { - char *system_message = &buffer[0]; - int result = safe_strerror(error_code, system_message, buffer.size()); - if (result == 0) { - out << message << ": " << system_message; - return; - } - if (result != ERANGE) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) - {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. - } - - template - void internal::ArgMap::init(const ArgList &args) - { - if (!map_.empty()) - return; - typedef internal::NamedArg NamedArg; - const NamedArg *named_arg = FMT_NULL; - bool use_values = - args.type(ArgList::MAX_PACKED_ARGS - 1) == internal::Arg::NONE; - if (use_values) { - for (unsigned i = 0;/*nothing*/; ++i) { - internal::Arg::Type arg_type = args.type(i); - switch (arg_type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.values_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } - return; - } - for (unsigned i = 0; i != ArgList::MAX_PACKED_ARGS; ++i) { - internal::Arg::Type arg_type = args.type(i); - if (arg_type == internal::Arg::NAMED_ARG) { - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - } - } - for (unsigned i = ArgList::MAX_PACKED_ARGS;/*nothing*/; ++i) { - switch (args.args_[i].type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } - } - - template - void internal::FixedBuffer::grow(std::size_t) - { - FMT_THROW(std::runtime_error("buffer overflow")); - } - - FMT_FUNC Arg internal::FormatterBase::do_get_arg( - unsigned arg_index, const char *&error) - { - Arg arg = args_[arg_index]; - switch (arg.type) { - case Arg::NONE: - error = "argument index out of range"; - break; - case Arg::NAMED_ARG: - arg = *static_cast(arg.pointer); - break; - default: - /*nothing*/; - } - return arg; - } - - FMT_FUNC void report_system_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT - { - // 'fmt::' is for bcc32. - report_error(format_system_error, error_code, message); - } - -#if FMT_USE_WINDOWS_H - FMT_FUNC void report_windows_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT - { - // 'fmt::' is for bcc32. - report_error(internal::format_windows_error, error_code, message); - } -#endif - - FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args) - { - MemoryWriter w; - w.write(format_str, args); - std::fwrite(w.data(), 1, w.size(), f); - } - - FMT_FUNC void print(CStringRef format_str, ArgList args) - { - print(stdout, format_str, args); - } - - FMT_FUNC void print_colored(Color c, CStringRef format, ArgList args) - { - char escape[] = "\x1b[30m"; - escape[3] = static_cast('0' + c); - std::fputs(escape, stdout); - print(format, args); - std::fputs(RESET_COLOR, stdout); - } - -#ifndef FMT_HEADER_ONLY - - template struct internal::BasicData; - - // Explicit instantiations for char. - - template void internal::FixedBuffer::grow(std::size_t); - - template void internal::ArgMap::init(const ArgList &args); - - template int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, double value); - - template int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, long double value); - - // Explicit instantiations for wchar_t. - - template void internal::FixedBuffer::grow(std::size_t); - - template void internal::ArgMap::init(const ArgList &args); - - template int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, double value); - - template int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, long double value); - -#endif // FMT_HEADER_ONLY - -} // namespace fmt - -#ifdef _MSC_VER -# pragma warning(pop) -#endif diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.h b/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.h deleted file mode 100644 index e5e2e2ef93346cb9daafe77b33d7e65597621408..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/format.h +++ /dev/null @@ -1,4645 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef FMT_FORMAT_H_ -#define FMT_FORMAT_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 30002 - -#ifdef _SECURE_SCL -# define FMT_SECURE_SCL _SECURE_SCL -#else -# define FMT_SECURE_SCL 0 -#endif - -#if FMT_SECURE_SCL -# include -#endif - -#ifdef _MSC_VER -# define FMT_MSC_VER _MSC_VER -#else -# define FMT_MSC_VER 0 -#endif - -#if FMT_MSC_VER && FMT_MSC_VER <= 1500 -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int64 intmax_t; -#else -#include -#endif - -#if !defined(FMT_HEADER_ONLY) && defined(_WIN32) -# ifdef FMT_EXPORT -# define FMT_API __declspec(dllexport) -# elif defined(FMT_SHARED) -# define FMT_API __declspec(dllimport) -# endif -#endif -#ifndef FMT_API -# define FMT_API -#endif - -#ifdef __GNUC__ -# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -# define FMT_GCC_EXTENSION __extension__ -# if FMT_GCC_VERSION >= 406 -# pragma GCC diagnostic push -// Disable the warning about "long long" which is sometimes reported even -// when using __extension__. -# pragma GCC diagnostic ignored "-Wlong-long" -// Disable the warning about declaration shadowing because it affects too -// many valid cases. -# pragma GCC diagnostic ignored "-Wshadow" -// Disable the warning about implicit conversions that may change the sign of -// an integer; silencing it otherwise would require many explicit casts. -# pragma GCC diagnostic ignored "-Wsign-conversion" -# endif -# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ -# define FMT_HAS_GXX_CXX11 1 -# endif -#else -# define FMT_GCC_EXTENSION -#endif - -#if defined(__INTEL_COMPILER) -# define FMT_ICC_VERSION __INTEL_COMPILER -#elif defined(__ICL) -# define FMT_ICC_VERSION __ICL -#endif - -#if defined(__clang__) && !defined(FMT_ICC_VERSION) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" -# pragma clang diagnostic ignored "-Wpadded" -#endif - -#ifdef __GNUC_LIBSTD__ -# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__) -#endif - -#ifdef __has_feature -# define FMT_HAS_FEATURE(x) __has_feature(x) -#else -# define FMT_HAS_FEATURE(x) 0 -#endif - -#ifdef __has_builtin -# define FMT_HAS_BUILTIN(x) __has_builtin(x) -#else -# define FMT_HAS_BUILTIN(x) 0 -#endif - -#ifdef __has_cpp_attribute -# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define FMT_HAS_CPP_ATTRIBUTE(x) 0 -#endif - -#ifndef FMT_USE_VARIADIC_TEMPLATES -// Variadic templates are available in GCC since version 4.4 -// (http://gcc.gnu.org/projects/cxx0x.html) and in Visual C++ -// since version 2013. -# define FMT_USE_VARIADIC_TEMPLATES \ - (FMT_HAS_FEATURE(cxx_variadic_templates) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800) -#endif - -#ifndef FMT_USE_RVALUE_REFERENCES -// Don't use rvalue references when compiling with clang and an old libstdc++ -// as the latter doesn't provide std::move. -# if defined(FMT_GNUC_LIBSTD_VERSION) && FMT_GNUC_LIBSTD_VERSION <= 402 -# define FMT_USE_RVALUE_REFERENCES 0 -# else -# define FMT_USE_RVALUE_REFERENCES \ - (FMT_HAS_FEATURE(cxx_rvalue_references) || \ - (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1600) -# endif -#endif - -#if FMT_USE_RVALUE_REFERENCES -# include // for std::move -#endif - -// Check if exceptions are disabled. -#if defined(__GNUC__) && !defined(__EXCEPTIONS) -# define FMT_EXCEPTIONS 0 -#endif -#if FMT_MSC_VER && !_HAS_EXCEPTIONS -# define FMT_EXCEPTIONS 0 -#endif -#ifndef FMT_EXCEPTIONS -# define FMT_EXCEPTIONS 1 -#endif - -#ifndef FMT_THROW -# if FMT_EXCEPTIONS -# define FMT_THROW(x) throw x -# else -# define FMT_THROW(x) assert(false) -# endif -#endif - -// Define FMT_USE_NOEXCEPT to make fmt use noexcept (C++11 feature). -#ifndef FMT_USE_NOEXCEPT -# define FMT_USE_NOEXCEPT 0 -#endif - -#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1900 -# define FMT_DETECTED_NOEXCEPT noexcept -#else -# define FMT_DETECTED_NOEXCEPT throw() -#endif - -#ifndef FMT_NOEXCEPT -# if FMT_EXCEPTIONS -# define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT -# else -# define FMT_NOEXCEPT -# endif -#endif - -// This is needed because GCC still uses throw() in its headers when exceptions -// are disabled. -#if FMT_GCC_VERSION -# define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT -#else -# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT -#endif - -#ifndef FMT_OVERRIDE -# if (defined(FMT_USE_OVERRIDE) && FMT_USE_OVERRIDE) || FMT_HAS_FEATURE(cxx_override) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1900 -# define FMT_OVERRIDE override -# else -# define FMT_OVERRIDE -# endif -#endif - -#ifndef FMT_NULL -# if FMT_HAS_FEATURE(cxx_nullptr) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1600 -# define FMT_NULL nullptr -# else -# define FMT_NULL NULL -# endif -#endif - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#ifndef FMT_USE_DELETED_FUNCTIONS -# define FMT_USE_DELETED_FUNCTIONS 0 -#endif - -#if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 -# define FMT_DELETED_OR_UNDEFINED = delete -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) = delete; \ - TypeName& operator=(const TypeName&) = delete -#else -# define FMT_DELETED_OR_UNDEFINED -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - TypeName& operator=(const TypeName&) -#endif - -#ifndef FMT_USE_USER_DEFINED_LITERALS -// All compilers which support UDLs also support variadic templates. This -// makes the fmt::literals implementation easier. However, an explicit check -// for variadic templates is added here just in case. -// For Intel's compiler both it and the system gcc/msc must support UDLs. -# define FMT_USE_USER_DEFINED_LITERALS \ - FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \ - (FMT_HAS_FEATURE(cxx_user_literals) || \ - (FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900) && \ - (!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500) -#endif - -#ifndef FMT_USE_EXTERN_TEMPLATES -// Clang doesn't have a feature check for extern templates so we check -// for variadic templates which were introduced in the same version. -// For GCC according to cppreference.com they were introduced in 3.3. -# define FMT_USE_EXTERN_TEMPLATES \ - ((__clang__ && FMT_USE_VARIADIC_TEMPLATES) || \ - (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11)) -#endif - -#ifdef FMT_HEADER_ONLY -// If header only do not use extern templates. -# undef FMT_USE_EXTERN_TEMPLATES -# define FMT_USE_EXTERN_TEMPLATES 0 -#endif - -#ifndef FMT_ASSERT -# define FMT_ASSERT(condition, message) assert((condition) && message) -#endif - -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) -# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) -#endif - -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) -# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) -#endif - -// Some compilers masquerade as both MSVC and GCC-likes or -// otherwise support __builtin_clz and __builtin_clzll, so -// only define FMT_BUILTIN_CLZ using the MSVC intrinsics -// if the clz and clzll builtins are not available. -#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) -# include // _BitScanReverse, _BitScanReverse64 - -namespace fmt -{ -namespace internal -{ -# pragma intrinsic(_BitScanReverse) -inline uint32_t clz(uint32_t x) -{ - unsigned long r = 0; - _BitScanReverse(&r, x); - - assert(x != 0); - // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, - // which the callers guarantee to not happen. -# pragma warning(suppress: 6102) - return 31 - r; -} -# define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n) - -# ifdef _WIN64 -# pragma intrinsic(_BitScanReverse64) -# endif - -inline uint32_t clzll(uint64_t x) -{ - unsigned long r = 0; -# ifdef _WIN64 - _BitScanReverse64(&r, x); -# else - // Scan the high 32 bits. - if (_BitScanReverse(&r, static_cast(x >> 32))) - return 63 - (r + 32); - - // Scan the low 32 bits. - _BitScanReverse(&r, static_cast(x)); -# endif - - assert(x != 0); - // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, - // which the callers guarantee to not happen. -# pragma warning(suppress: 6102) - return 63 - r; -} -# define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n) -} -} -#endif - -namespace fmt -{ -namespace internal -{ -struct DummyInt -{ - int data[2]; - operator int() const - { - return 0; - } -}; -typedef std::numeric_limits FPUtil; - -// Dummy implementations of system functions such as signbit and ecvt called -// if the latter are not available. -inline DummyInt signbit(...) -{ - return DummyInt(); -} -inline DummyInt _ecvt_s(...) -{ - return DummyInt(); -} -inline DummyInt isinf(...) -{ - return DummyInt(); -} -inline DummyInt _finite(...) -{ - return DummyInt(); -} -inline DummyInt isnan(...) -{ - return DummyInt(); -} -inline DummyInt _isnan(...) -{ - return DummyInt(); -} - -// A helper function to suppress bogus "conditional expression is constant" -// warnings. -template -inline T const_check(T value) -{ - return value; -} -} -} // namespace fmt - -namespace std -{ -// Standard permits specialization of std::numeric_limits. This specialization -// is used to resolve ambiguity between isinf and std::isinf in glibc: -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891 -// and the same for isnan and signbit. -template <> -class numeric_limits: - public std::numeric_limits -{ -public: - // Portable version of isinf. - template - static bool isinfinity(T x) - { - using namespace fmt::internal; - // The resolution "priority" is: - // isinf macro > std::isinf > ::isinf > fmt::internal::isinf - if (const_check(sizeof(isinf(x)) == sizeof(bool) || - sizeof(isinf(x)) == sizeof(int))) - { - return isinf(x) != 0; - } - return !_finite(static_cast(x)); - } - - // Portable version of isnan. - template - static bool isnotanumber(T x) - { - using namespace fmt::internal; - if (const_check(sizeof(isnan(x)) == sizeof(bool) || - sizeof(isnan(x)) == sizeof(int))) - { - return isnan(x) != 0; - } - return _isnan(static_cast(x)) != 0; - } - - // Portable version of signbit. - static bool isnegative(double x) - { - using namespace fmt::internal; - if (const_check(sizeof(signbit(x)) == sizeof(bool) || - sizeof(signbit(x)) == sizeof(int))) - { - return signbit(x) != 0; - } - if (x < 0) return true; - if (!isnotanumber(x)) return false; - int dec = 0, sign = 0; - char buffer[2]; // The buffer size must be >= 2 or _ecvt_s will fail. - _ecvt_s(buffer, sizeof(buffer), x, 0, &dec, &sign); - return sign != 0; - } -}; -} // namespace std - -namespace fmt -{ - -// Fix the warning about long long on older versions of GCC -// that don't support the diagnostic pragma. -FMT_GCC_EXTENSION typedef long long LongLong; -FMT_GCC_EXTENSION typedef unsigned long long ULongLong; - -#if FMT_USE_RVALUE_REFERENCES -using std::move; -#endif - -template -class BasicWriter; - -typedef BasicWriter Writer; -typedef BasicWriter WWriter; - -template -class ArgFormatter; - -template -class BasicPrintfArgFormatter; - -template > -class BasicFormatter; - -/** -\rst -A string reference. It can be constructed from a C string or ``std::string``. - -You can use one of the following typedefs for common character types: - -+------------+-------------------------+ -| Type | Definition | -+============+=========================+ -| StringRef | BasicStringRef | -+------------+-------------------------+ -| WStringRef | BasicStringRef | -+------------+-------------------------+ - -This class is most useful as a parameter type to allow passing -different types of strings to a function, for example:: - -template -std::string format(StringRef format_str, const Args & ... args); - -format("{}", 42); -format(std::string("{}"), 42); -\endrst -*/ -template -class BasicStringRef -{ -private: - const Char *data_; - std::size_t size_; - -public: - /** Constructs a string reference object from a C string and a size. */ - BasicStringRef(const Char *s, std::size_t size): data_(s), size_(size) - {} - - /** - \rst - Constructs a string reference object from a C string computing - the size with ``std::char_traits::length``. - \endrst - */ - BasicStringRef(const Char *s) - : data_(s), size_(std::char_traits::length(s)) - {} - - /** - \rst - Constructs a string reference from an ``std::string`` object. - \endrst - */ - BasicStringRef(const std::basic_string &s) - : data_(s.c_str()), size_(s.size()) - {} - - /** - \rst - Converts a string reference to an ``std::string`` object. - \endrst - */ - std::basic_string to_string() const - { - return std::basic_string(data_, size_); - } - - /** Returns a pointer to the string data. */ - const Char *data() const - { - return data_; - } - - /** Returns the string size. */ - std::size_t size() const - { - return size_; - } - - // Lexicographically compare this string reference to other. - int compare(BasicStringRef other) const - { - std::size_t size = size_ < other.size_ ? size_ : other.size_; - int result = std::char_traits::compare(data_, other.data_, size); - if (result == 0) - result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1); - return result; - } - - friend bool operator==(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) == 0; - } - friend bool operator!=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) != 0; - } - friend bool operator<(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) < 0; - } - friend bool operator<=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) <= 0; - } - friend bool operator>(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) > 0; - } - friend bool operator>=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) >= 0; - } -}; - -typedef BasicStringRef StringRef; -typedef BasicStringRef WStringRef; - -/** -\rst -A reference to a null terminated string. It can be constructed from a C -string or ``std::string``. - -You can use one of the following typedefs for common character types: - -+-------------+--------------------------+ -| Type | Definition | -+=============+==========================+ -| CStringRef | BasicCStringRef | -+-------------+--------------------------+ -| WCStringRef | BasicCStringRef | -+-------------+--------------------------+ - -This class is most useful as a parameter type to allow passing -different types of strings to a function, for example:: - -template -std::string format(CStringRef format_str, const Args & ... args); - -format("{}", 42); -format(std::string("{}"), 42); -\endrst -*/ -template -class BasicCStringRef -{ -private: - const Char *data_; - -public: - /** Constructs a string reference object from a C string. */ - BasicCStringRef(const Char *s): data_(s) - {} - - /** - \rst - Constructs a string reference from an ``std::string`` object. - \endrst - */ - BasicCStringRef(const std::basic_string &s): data_(s.c_str()) - {} - - /** Returns the pointer to a C string. */ - const Char *c_str() const - { - return data_; - } -}; - -typedef BasicCStringRef CStringRef; -typedef BasicCStringRef WCStringRef; - -/** A formatting error such as invalid format string. */ -class FormatError: public std::runtime_error -{ -public: - explicit FormatError(CStringRef message) - : std::runtime_error(message.c_str()) - {} - FormatError(const FormatError &ferr): std::runtime_error(ferr) - {} - ~FormatError() FMT_DTOR_NOEXCEPT; -}; - -namespace internal -{ - -// MakeUnsigned::Type gives an unsigned type corresponding to integer type T. -template -struct MakeUnsigned -{ - typedef T Type; -}; - -#define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \ - template <> \ - struct MakeUnsigned { typedef U Type; } - -FMT_SPECIALIZE_MAKE_UNSIGNED(char, unsigned char); -FMT_SPECIALIZE_MAKE_UNSIGNED(signed char, unsigned char); -FMT_SPECIALIZE_MAKE_UNSIGNED(short, unsigned short); -FMT_SPECIALIZE_MAKE_UNSIGNED(int, unsigned); -FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long); -FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong); - -// Casts nonnegative integer to unsigned. -template -inline typename MakeUnsigned::Type to_unsigned(Int value) -{ - FMT_ASSERT(value >= 0, "negative value"); - return static_cast::Type>(value); -} - -// The number of characters to store in the MemoryBuffer object itself -// to avoid dynamic memory allocation. -enum -{ - INLINE_BUFFER_SIZE = 500 -}; - -#if FMT_SECURE_SCL -// Use checked iterator to avoid warnings on MSVC. -template -inline stdext::checked_array_iterator make_ptr(T *ptr, std::size_t size) -{ - return stdext::checked_array_iterator(ptr, size); -} -#else -template -inline T *make_ptr(T *ptr, std::size_t) -{ - return ptr; -} -#endif -} // namespace internal - -/** -\rst -A buffer supporting a subset of ``std::vector``'s operations. -\endrst -*/ -template -class Buffer -{ -private: - FMT_DISALLOW_COPY_AND_ASSIGN(Buffer); - -protected: - T *ptr_; - std::size_t size_; - std::size_t capacity_; - - Buffer(T *ptr = FMT_NULL, std::size_t capacity = 0) - : ptr_(ptr), size_(0), capacity_(capacity) - {} - - /** - \rst - Increases the buffer capacity to hold at least *size* elements updating - ``ptr_`` and ``capacity_``. - \endrst - */ - virtual void grow(std::size_t size) = 0; - -public: - virtual ~Buffer() - {} - - /** Returns the size of this buffer. */ - std::size_t size() const - { - return size_; - } - - /** Returns the capacity of this buffer. */ - std::size_t capacity() const - { - return capacity_; - } - - /** - Resizes the buffer. If T is a POD type new elements may not be initialized. - */ - void resize(std::size_t new_size) - { - if (new_size > capacity_) - grow(new_size); - size_ = new_size; - } - - /** - \rst - Reserves space to store at least *capacity* elements. - \endrst - */ - void reserve(std::size_t capacity) - { - if (capacity > capacity_) - grow(capacity); - } - - void clear() FMT_NOEXCEPT - { - size_ = 0; - } - - void push_back(const T &value) - { - if (size_ == capacity_) - grow(size_ + 1); - ptr_[size_++] = value; - } - - /** Appends data to the end of the buffer. */ - template - void append(const U *begin, const U *end); - - T &operator[](std::size_t index) - { - return ptr_[index]; - } - const T &operator[](std::size_t index) const - { - return ptr_[index]; - } -}; - -template -template -void Buffer::append(const U *begin, const U *end) -{ - std::size_t new_size = size_ + internal::to_unsigned(end - begin); - if (new_size > capacity_) - grow(new_size); - std::uninitialized_copy(begin, end, - internal::make_ptr(ptr_, capacity_) + size_); - size_ = new_size; -} - -namespace internal -{ - -// A memory buffer for trivially copyable/constructible types with the first -// SIZE elements stored in the object itself. -template > -class MemoryBuffer: private Allocator, public Buffer -{ -private: - T data_[SIZE]; - - // Deallocate memory allocated by the buffer. - void deallocate() - { - if (this->ptr_ != data_) Allocator::deallocate(this->ptr_, this->capacity_); - } - -protected: - void grow(std::size_t size) FMT_OVERRIDE; - -public: - explicit MemoryBuffer(const Allocator &alloc = Allocator()) - : Allocator(alloc), Buffer(data_, SIZE) - {} - ~MemoryBuffer() - { - deallocate(); - } - -#if FMT_USE_RVALUE_REFERENCES -private: - // Move data from other to this buffer. - void move(MemoryBuffer &other) - { - Allocator &this_alloc = *this, &other_alloc = other; - this_alloc = std::move(other_alloc); - this->size_ = other.size_; - this->capacity_ = other.capacity_; - if (other.ptr_ == other.data_) - { - this->ptr_ = data_; - std::uninitialized_copy(other.data_, other.data_ + this->size_, - make_ptr(data_, this->capacity_)); - } - else - { - this->ptr_ = other.ptr_; - // Set pointer to the inline array so that delete is not called - // when deallocating. - other.ptr_ = other.data_; - } - } - -public: - MemoryBuffer(MemoryBuffer &&other) - { - move(other); - } - - MemoryBuffer &operator=(MemoryBuffer &&other) - { - assert(this != &other); - deallocate(); - move(other); - return *this; - } -#endif - - // Returns a copy of the allocator associated with this buffer. - Allocator get_allocator() const - { - return *this; - } -}; - -template -void MemoryBuffer::grow(std::size_t size) -{ - std::size_t new_capacity = this->capacity_ + this->capacity_ / 2; - if (size > new_capacity) - new_capacity = size; - T *new_ptr = this->allocate(new_capacity, FMT_NULL); - // The following code doesn't throw, so the raw pointer above doesn't leak. - std::uninitialized_copy(this->ptr_, this->ptr_ + this->size_, - make_ptr(new_ptr, new_capacity)); - std::size_t old_capacity = this->capacity_; - T *old_ptr = this->ptr_; - this->capacity_ = new_capacity; - this->ptr_ = new_ptr; - // deallocate may throw (at least in principle), but it doesn't matter since - // the buffer already uses the new storage and will deallocate it in case - // of exception. - if (old_ptr != data_) - Allocator::deallocate(old_ptr, old_capacity); -} - -// A fixed-size buffer. -template -class FixedBuffer: public fmt::Buffer -{ -public: - FixedBuffer(Char *array, std::size_t size): fmt::Buffer(array, size) - {} - -protected: - FMT_API void grow(std::size_t size) FMT_OVERRIDE; -}; - -template -class BasicCharTraits -{ -public: -#if FMT_SECURE_SCL - typedef stdext::checked_array_iterator CharPtr; -#else - typedef Char *CharPtr; -#endif - static Char cast(int value) - { - return static_cast(value); - } -}; - -template -class CharTraits; - -template <> -class CharTraits: public BasicCharTraits -{ -private: - // Conversion from wchar_t to char is not allowed. - static char convert(wchar_t); - -public: - static char convert(char value) - { - return value; - } - - // Formats a floating-point number. - template - FMT_API static int format_float(char *buffer, std::size_t size, - const char *format, unsigned width, int precision, T value); -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template int CharTraits::format_float -(char *buffer, std::size_t size, - const char* format, unsigned width, int precision, double value); -extern template int CharTraits::format_float -(char *buffer, std::size_t size, - const char* format, unsigned width, int precision, long double value); -#endif - -template <> -class CharTraits: public BasicCharTraits -{ -public: - static wchar_t convert(char value) - { - return value; - } - static wchar_t convert(wchar_t value) - { - return value; - } - - template - FMT_API static int format_float(wchar_t *buffer, std::size_t size, - const wchar_t *format, unsigned width, int precision, T value); -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template int CharTraits::format_float -(wchar_t *buffer, std::size_t size, - const wchar_t* format, unsigned width, int precision, double value); -extern template int CharTraits::format_float -(wchar_t *buffer, std::size_t size, - const wchar_t* format, unsigned width, int precision, long double value); -#endif - -// Checks if a number is negative - used to avoid warnings. -template -struct SignChecker -{ - template - static bool is_negative(T value) - { - return value < 0; - } -}; - -template <> -struct SignChecker -{ - template - static bool is_negative(T) - { - return false; - } -}; - -// Returns true if value is negative, false otherwise. -// Same as (value < 0) but doesn't produce warnings if T is an unsigned type. -template -inline bool is_negative(T value) -{ - return SignChecker::is_signed>::is_negative(value); -} - -// Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise. -template -struct TypeSelector -{ - typedef uint32_t Type; -}; - -template <> -struct TypeSelector -{ - typedef uint64_t Type; -}; - -template -struct IntTraits -{ - // Smallest of uint32_t and uint64_t that is large enough to represent - // all values of T. - typedef typename - TypeSelector::digits <= 32>::Type MainType; -}; - -FMT_API void report_unknown_type(char code, const char *type); - -// Static data is placed in this class template to allow header-only -// configuration. -template -struct FMT_API BasicData -{ - static const uint32_t POWERS_OF_10_32[]; - static const uint64_t POWERS_OF_10_64[]; - static const char DIGITS[]; -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template struct BasicData; -#endif - -typedef BasicData<> Data; - -#ifdef FMT_BUILTIN_CLZLL -// Returns the number of decimal digits in n. Leading zeros are not counted -// except for n == 0 in which case count_digits returns 1. -inline unsigned count_digits(uint64_t n) -{ - // Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - // and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits. - int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12; - return to_unsigned(t) - (n < Data::POWERS_OF_10_64[t]) + 1; -} -#else -// Fallback version of count_digits used when __builtin_clz is not available. -inline unsigned count_digits(uint64_t n) -{ - unsigned count = 1; - for (;;) - { - // Integer division is slow so do it for a group of four digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - if (n < 10) return count; - if (n < 100) return count + 1; - if (n < 1000) return count + 2; - if (n < 10000) return count + 3; - n /= 10000u; - count += 4; - } -} -#endif - -#ifdef FMT_BUILTIN_CLZ -// Optional version of count_digits for better performance on 32-bit platforms. -inline unsigned count_digits(uint32_t n) -{ - int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12; - return to_unsigned(t) - (n < Data::POWERS_OF_10_32[t]) + 1; -} -#endif - -// A functor that doesn't add a thousands separator. -struct NoThousandsSep -{ - template - void operator()(Char *) - {} -}; - -// A functor that adds a thousands separator. -class ThousandsSep -{ -private: - fmt::StringRef sep_; - - // Index of a decimal digit with the least significant digit having index 0. - unsigned digit_index_; - -public: - explicit ThousandsSep(fmt::StringRef sep): sep_(sep), digit_index_(0) - {} - - template - void operator()(Char *&buffer) - { - if (++digit_index_ % 3 != 0) - return; - buffer -= sep_.size(); - std::uninitialized_copy(sep_.data(), sep_.data() + sep_.size(), - internal::make_ptr(buffer, sep_.size())); - } -}; - -// Formats a decimal unsigned integer value writing into buffer. -// thousands_sep is a functor that is called after writing each char to -// add a thousands separator if necessary. -template -inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, - ThousandsSep thousands_sep) -{ - buffer += num_digits; - while (value >= 100) - { - // Integer division is slow so do it for a group of two digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - unsigned index = static_cast((value % 100) * 2); - value /= 100; - *--buffer = Data::DIGITS[index + 1]; - thousands_sep(buffer); - *--buffer = Data::DIGITS[index]; - thousands_sep(buffer); - } - if (value < 10) - { - *--buffer = static_cast('0' + value); - return; - } - unsigned index = static_cast(value * 2); - *--buffer = Data::DIGITS[index + 1]; - thousands_sep(buffer); - *--buffer = Data::DIGITS[index]; -} - -template -inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) -{ - format_decimal(buffer, value, num_digits, NoThousandsSep()); - return; -} - -#ifndef _WIN32 -# define FMT_USE_WINDOWS_H 0 -#elif !defined(FMT_USE_WINDOWS_H) -# define FMT_USE_WINDOWS_H 1 -#endif - -// Define FMT_USE_WINDOWS_H to 0 to disable use of windows.h. -// All the functionality that relies on it will be disabled too. -#if FMT_USE_WINDOWS_H -// A converter from UTF-8 to UTF-16. -// It is only provided for Windows since other systems support UTF-8 natively. -class UTF8ToUTF16 -{ -private: - MemoryBuffer buffer_; - -public: - FMT_API explicit UTF8ToUTF16(StringRef s); - operator WStringRef() const - { - return WStringRef(&buffer_[0], size()); - } - size_t size() const - { - return buffer_.size() - 1; - } - const wchar_t *c_str() const - { - return &buffer_[0]; - } - std::wstring str() const - { - return std::wstring(&buffer_[0], size()); - } -}; - -// A converter from UTF-16 to UTF-8. -// It is only provided for Windows since other systems support UTF-8 natively. -class UTF16ToUTF8 -{ -private: - MemoryBuffer buffer_; - -public: - UTF16ToUTF8() - {} - FMT_API explicit UTF16ToUTF8(WStringRef s); - operator StringRef() const - { - return StringRef(&buffer_[0], size()); - } - size_t size() const - { - return buffer_.size() - 1; - } - const char *c_str() const - { - return &buffer_[0]; - } - std::string str() const - { - return std::string(&buffer_[0], size()); - } - - // Performs conversion returning a system error code instead of - // throwing exception on conversion error. This method may still throw - // in case of memory allocation error. - FMT_API int convert(WStringRef s); -}; - -FMT_API void format_windows_error(fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT; -#endif - -// A formatting argument value. -struct Value -{ - template - struct StringValue - { - const Char *value; - std::size_t size; - }; - - typedef void(*FormatFunc)( - void *formatter, const void *arg, void *format_str_ptr); - - struct CustomValue - { - const void *value; - FormatFunc format; - }; - - union - { - int int_value; - unsigned uint_value; - LongLong long_long_value; - ULongLong ulong_long_value; - double double_value; - long double long_double_value; - const void *pointer; - StringValue string; - StringValue sstring; - StringValue ustring; - StringValue wstring; - CustomValue custom; - }; - - enum Type - { - NONE, NAMED_ARG, - // Integer types should go first, - INT, UINT, LONG_LONG, ULONG_LONG, BOOL, CHAR, LAST_INTEGER_TYPE = CHAR, - // followed by floating-point types. - DOUBLE, LONG_DOUBLE, LAST_NUMERIC_TYPE = LONG_DOUBLE, - CSTRING, STRING, WSTRING, POINTER, CUSTOM - }; -}; - -// A formatting argument. It is a trivially copyable/constructible type to -// allow storage in internal::MemoryBuffer. -struct Arg: Value -{ - Type type; -}; - -template -struct NamedArg; -template -struct NamedArgWithType; - -template -struct Null -{}; - -// A helper class template to enable or disable overloads taking wide -// characters and strings in MakeValue. -template -struct WCharHelper -{ - typedef Null Supported; - typedef T Unsupported; -}; - -template -struct WCharHelper -{ - typedef T Supported; - typedef Null Unsupported; -}; - -typedef char Yes[1]; -typedef char No[2]; - -template -T &get(); - -// These are non-members to workaround an overload resolution bug in bcc32. -Yes &convert(fmt::ULongLong); -No &convert(...); - -template -struct ConvertToIntImpl -{ - enum - { - value = ENABLE_CONVERSION - }; -}; - -template -struct ConvertToIntImpl2 -{ - enum - { - value = false - }; -}; - -template -struct ConvertToIntImpl2 -{ - enum - { - // Don't convert numeric types. - value = ConvertToIntImpl::is_specialized>::value - }; -}; - -template -struct ConvertToInt -{ - enum - { - enable_conversion = sizeof(fmt::internal::convert(get())) == sizeof(Yes) - }; - enum - { - value = ConvertToIntImpl2::value - }; -}; - -#define FMT_DISABLE_CONVERSION_TO_INT(Type) \ - template <> \ - struct ConvertToInt { enum { value = 0 }; } - -// Silence warnings about convering float to int. -FMT_DISABLE_CONVERSION_TO_INT(float); -FMT_DISABLE_CONVERSION_TO_INT(double); -FMT_DISABLE_CONVERSION_TO_INT(long double); - -template -struct EnableIf -{}; - -template -struct EnableIf -{ - typedef T type; -}; - -template -struct Conditional -{ - typedef T type; -}; - -template -struct Conditional -{ - typedef F type; -}; - -// For bcc32 which doesn't understand ! in template arguments. -template -struct Not -{ - enum - { - value = 0 - }; -}; - -template <> -struct Not -{ - enum - { - value = 1 - }; -}; - -template -struct False -{ - enum - { - value = 0 - }; -}; - -template struct LConvCheck -{ - LConvCheck(int) - {} -}; - -// Returns the thousands separator for the current locale. -// We check if ``lconv`` contains ``thousands_sep`` because on Android -// ``lconv`` is stubbed as an empty struct. -template -inline StringRef thousands_sep( - LConv *lc, LConvCheck = 0) -{ - return lc->thousands_sep; -} - -inline fmt::StringRef thousands_sep(...) -{ - return ""; -} - -#define FMT_CONCAT(a, b) a##b - -#if FMT_GCC_VERSION >= 303 -# define FMT_UNUSED __attribute__((unused)) -#else -# define FMT_UNUSED -#endif - -#ifndef FMT_USE_STATIC_ASSERT -# define FMT_USE_STATIC_ASSERT 0 -#endif - -#if FMT_USE_STATIC_ASSERT || FMT_HAS_FEATURE(cxx_static_assert) || \ - (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600 -# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message) -#else -# define FMT_CONCAT_(a, b) FMT_CONCAT(a, b) -# define FMT_STATIC_ASSERT(cond, message) \ - typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED -#endif - -template -void format_arg(Formatter &, const Char *, const T &) -{ - FMT_STATIC_ASSERT(False::value, - "Cannot format argument. To enable the use of ostream " - "operator<< include fmt/ostream.h. Otherwise provide " - "an overload of format_arg."); -} - -// Makes an Arg object from any type. -template -class MakeValue: public Arg -{ -public: - typedef typename Formatter::Char Char; - -private: - // The following two methods are private to disallow formatting of - // arbitrary pointers. If you want to output a pointer cast it to - // "void *" or "const void *". In particular, this forbids formatting - // of "[const] volatile char *" which is printed as bool by iostreams. - // Do not implement! - template - MakeValue(const T *value); - template - MakeValue(T *value); - - // The following methods are private to disallow formatting of wide - // characters and strings into narrow strings as in - // fmt::format("{}", L"test"); - // To fix this, use a wide format string: fmt::format(L"{}", L"test"). -#if !FMT_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED) - MakeValue(typename WCharHelper::Unsupported); -#endif - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - - void set_string(StringRef str) - { - string.value = str.data(); - string.size = str.size(); - } - - void set_string(WStringRef str) - { - wstring.value = str.data(); - wstring.size = str.size(); - } - - // Formats an argument of a custom type, such as a user-defined class. - template - static void format_custom_arg( - void *formatter, const void *arg, void *format_str_ptr) - { - format_arg(*static_cast(formatter), - *static_cast(format_str_ptr), - *static_cast(arg)); - } - -public: - MakeValue() - {} - -#define FMT_MAKE_VALUE_(Type, field, TYPE, rhs) \ - MakeValue(Type value) { field = rhs; } \ - static uint64_t type(Type) { return Arg::TYPE; } - -#define FMT_MAKE_VALUE(Type, field, TYPE) \ - FMT_MAKE_VALUE_(Type, field, TYPE, value) - - FMT_MAKE_VALUE(bool, int_value, BOOL) - FMT_MAKE_VALUE(short, int_value, INT) - FMT_MAKE_VALUE(unsigned short, uint_value, UINT) - FMT_MAKE_VALUE(int, int_value, INT) - FMT_MAKE_VALUE(unsigned, uint_value, UINT) - - MakeValue(long value) - { - // To minimize the number of types we need to deal with, long is - // translated either to int or to long long depending on its size. - if (const_check(sizeof(long) == sizeof(int))) - int_value = static_cast(value); - else - long_long_value = value; - } - static uint64_t type(long) - { - return sizeof(long) == sizeof(int) ? Arg::INT : Arg::LONG_LONG; - } - - MakeValue(unsigned long value) - { - if (const_check(sizeof(unsigned long) == sizeof(unsigned))) - uint_value = static_cast(value); - else - ulong_long_value = value; - } - static uint64_t type(unsigned long) - { - return sizeof(unsigned long) == sizeof(unsigned) ? - Arg::UINT : Arg::ULONG_LONG; - } - - FMT_MAKE_VALUE(LongLong, long_long_value, LONG_LONG) - FMT_MAKE_VALUE(ULongLong, ulong_long_value, ULONG_LONG) - FMT_MAKE_VALUE(float, double_value, DOUBLE) - FMT_MAKE_VALUE(double, double_value, DOUBLE) - FMT_MAKE_VALUE(long double, long_double_value, LONG_DOUBLE) - FMT_MAKE_VALUE(signed char, int_value, INT) - FMT_MAKE_VALUE(unsigned char, uint_value, UINT) - FMT_MAKE_VALUE(char, int_value, CHAR) - -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) - MakeValue(typename WCharHelper::Supported value) - { - int_value = value; - } - static uint64_t type(wchar_t) - { - return Arg::CHAR; - } -#endif - -#define FMT_MAKE_STR_VALUE(Type, TYPE) \ - MakeValue(Type value) { set_string(value); } \ - static uint64_t type(Type) { return Arg::TYPE; } - - FMT_MAKE_VALUE(char *, string.value, CSTRING) - FMT_MAKE_VALUE(const char *, string.value, CSTRING) - FMT_MAKE_VALUE(signed char *, sstring.value, CSTRING) - FMT_MAKE_VALUE(const signed char *, sstring.value, CSTRING) - FMT_MAKE_VALUE(unsigned char *, ustring.value, CSTRING) - FMT_MAKE_VALUE(const unsigned char *, ustring.value, CSTRING) - FMT_MAKE_STR_VALUE(const std::string &, STRING) - FMT_MAKE_STR_VALUE(StringRef, STRING) - FMT_MAKE_VALUE_(CStringRef, string.value, CSTRING, value.c_str()) - -#define FMT_MAKE_WSTR_VALUE(Type, TYPE) \ - MakeValue(typename WCharHelper::Supported value) { \ - set_string(value); \ - } \ - static uint64_t type(Type) { return Arg::TYPE; } - - FMT_MAKE_WSTR_VALUE(wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const std::wstring &, WSTRING) - FMT_MAKE_WSTR_VALUE(WStringRef, WSTRING) - - FMT_MAKE_VALUE(void *, pointer, POINTER) - FMT_MAKE_VALUE(const void *, pointer, POINTER) - - template - MakeValue(const T &value, - typename EnableIf::value>::value, int>::type = 0) - { - custom.value = &value; - custom.format = &format_custom_arg; - } - - template - MakeValue(const T &value, - typename EnableIf::value, int>::type = 0) - { - int_value = value; - } - - template - static uint64_t type(const T &) - { - return ConvertToInt::value ? Arg::INT : Arg::CUSTOM; - } - - // Additional template param `Char_` is needed here because make_type always - // uses char. - template - MakeValue(const NamedArg &value) - { - pointer = &value; - } - template - MakeValue(const NamedArgWithType &value) - { - pointer = &value; - } - - template - static uint64_t type(const NamedArg &) - { - return Arg::NAMED_ARG; - } - template - static uint64_t type(const NamedArgWithType &) - { - return Arg::NAMED_ARG; - } -}; - -template -class MakeArg: public Arg -{ -public: - MakeArg() - { - type = Arg::NONE; - } - - template - MakeArg(const T &value) - : Arg(MakeValue(value)) - { - type = static_cast(MakeValue::type(value)); - } -}; - -template -struct NamedArg: Arg -{ - BasicStringRef name; - - template - NamedArg(BasicStringRef argname, const T &value) - : Arg(MakeArg< BasicFormatter >(value)), name(argname) - {} -}; - -template -struct NamedArgWithType: NamedArg -{ - NamedArgWithType(BasicStringRef argname, const T &value) - : NamedArg(argname, value) - {} -}; - -class RuntimeError: public std::runtime_error -{ -protected: - RuntimeError(): std::runtime_error("") - {} - RuntimeError(const RuntimeError &rerr): std::runtime_error(rerr) - {} - ~RuntimeError() FMT_DTOR_NOEXCEPT; -}; - -template -class ArgMap; -} // namespace internal - -/** An argument list. */ -class ArgList -{ -private: - // To reduce compiled code size per formatting function call, types of first - // MAX_PACKED_ARGS arguments are passed in the types_ field. - uint64_t types_; - union - { - // If the number of arguments is less than MAX_PACKED_ARGS, the argument - // values are stored in values_, otherwise they are stored in args_. - // This is done to reduce compiled code size as storing larger objects - // may require more code (at least on x86-64) even if the same amount of - // data is actually copied to stack. It saves ~10% on the bloat test. - const internal::Value *values_; - const internal::Arg *args_; - }; - - internal::Arg::Type type(unsigned index) const - { - return type(types_, index); - } - - template - friend class internal::ArgMap; - -public: - // Maximum number of arguments with packed types. - enum - { - MAX_PACKED_ARGS = 16 - }; - - ArgList(): types_(0) - {} - - ArgList(ULongLong types, const internal::Value *values) - : types_(types), values_(values) - {} - ArgList(ULongLong types, const internal::Arg *args) - : types_(types), args_(args) - {} - - uint64_t types() const - { - return types_; - } - - /** Returns the argument at specified index. */ - internal::Arg operator[](unsigned index) const - { - using internal::Arg; - Arg arg; - bool use_values = type(MAX_PACKED_ARGS - 1) == Arg::NONE; - if (index < MAX_PACKED_ARGS) - { - Arg::Type arg_type = type(index); - internal::Value &val = arg; - if (arg_type != Arg::NONE) - val = use_values ? values_[index] : args_[index]; - arg.type = arg_type; - return arg; - } - if (use_values) - { - // The index is greater than the number of arguments that can be stored - // in values, so return a "none" argument. - arg.type = Arg::NONE; - return arg; - } - for (unsigned i = MAX_PACKED_ARGS; i <= index; ++i) - { - if (args_[i].type == Arg::NONE) - return args_[i]; - } - return args_[index]; - } - - static internal::Arg::Type type(uint64_t types, unsigned index) - { - unsigned shift = index * 4; - uint64_t mask = 0xf; - return static_cast( - (types & (mask << shift)) >> shift); - } -}; - -#define FMT_DISPATCH(call) static_cast(this)->call - -/** -\rst -An argument visitor based on the `curiously recurring template pattern -`_. - -To use `~fmt::ArgVisitor` define a subclass that implements some or all of the -visit methods with the same signatures as the methods in `~fmt::ArgVisitor`, -for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. Then calling -`~fmt::ArgVisitor::visit` for some argument will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::ArgVisitor` will be called. - -**Example**:: - -class MyArgVisitor : public fmt::ArgVisitor { -public: -void visit_int(int value) { fmt::print("{}", value); } -void visit_double(double value) { fmt::print("{}", value ); } -}; -\endrst -*/ -template -class ArgVisitor -{ -private: - typedef internal::Arg Arg; - -public: - void report_unhandled_arg() - {} - - Result visit_unhandled_arg() - { - FMT_DISPATCH(report_unhandled_arg()); - return Result(); - } - - /** Visits an ``int`` argument. **/ - Result visit_int(int value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``long long`` argument. **/ - Result visit_long_long(LongLong value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an ``unsigned`` argument. **/ - Result visit_uint(unsigned value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an ``unsigned long long`` argument. **/ - Result visit_ulong_long(ULongLong value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``bool`` argument. **/ - Result visit_bool(bool value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``char`` or ``wchar_t`` argument. **/ - Result visit_char(int value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an argument of any integral type. **/ - template - Result visit_any_int(T) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a ``double`` argument. **/ - Result visit_double(double value) - { - return FMT_DISPATCH(visit_any_double(value)); - } - - /** Visits a ``long double`` argument. **/ - Result visit_long_double(long double value) - { - return FMT_DISPATCH(visit_any_double(value)); - } - - /** Visits a ``double`` or ``long double`` argument. **/ - template - Result visit_any_double(T) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a null-terminated C string (``const char *``) argument. **/ - Result visit_cstring(const char *) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a string argument. **/ - Result visit_string(Arg::StringValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a wide string argument. **/ - Result visit_wstring(Arg::StringValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a pointer argument. **/ - Result visit_pointer(const void *) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits an argument of a custom (user-defined) type. **/ - Result visit_custom(Arg::CustomValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** - \rst - Visits an argument dispatching to the appropriate visit method based on - the argument type. For example, if the argument type is ``double`` then - the `~fmt::ArgVisitor::visit_double()` method of the *Impl* class will be - called. - \endrst - */ - Result visit(const Arg &arg) - { - switch (arg.type) - { - case Arg::NONE: - case Arg::NAMED_ARG: - FMT_ASSERT(false, "invalid argument type"); - break; - case Arg::INT: - return FMT_DISPATCH(visit_int(arg.int_value)); - case Arg::UINT: - return FMT_DISPATCH(visit_uint(arg.uint_value)); - case Arg::LONG_LONG: - return FMT_DISPATCH(visit_long_long(arg.long_long_value)); - case Arg::ULONG_LONG: - return FMT_DISPATCH(visit_ulong_long(arg.ulong_long_value)); - case Arg::BOOL: - return FMT_DISPATCH(visit_bool(arg.int_value != 0)); - case Arg::CHAR: - return FMT_DISPATCH(visit_char(arg.int_value)); - case Arg::DOUBLE: - return FMT_DISPATCH(visit_double(arg.double_value)); - case Arg::LONG_DOUBLE: - return FMT_DISPATCH(visit_long_double(arg.long_double_value)); - case Arg::CSTRING: - return FMT_DISPATCH(visit_cstring(arg.string.value)); - case Arg::STRING: - return FMT_DISPATCH(visit_string(arg.string)); - case Arg::WSTRING: - return FMT_DISPATCH(visit_wstring(arg.wstring)); - case Arg::POINTER: - return FMT_DISPATCH(visit_pointer(arg.pointer)); - case Arg::CUSTOM: - return FMT_DISPATCH(visit_custom(arg.custom)); - } - return Result(); - } -}; - -enum Alignment -{ - ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ALIGN_NUMERIC -}; - -// Flags. -enum -{ - SIGN_FLAG = 1, PLUS_FLAG = 2, MINUS_FLAG = 4, HASH_FLAG = 8, - CHAR_FLAG = 0x10 // Argument has char type - used in error reporting. -}; - -// An empty format specifier. -struct EmptySpec -{}; - -// A type specifier. -template -struct TypeSpec: EmptySpec -{ - Alignment align() const - { - return ALIGN_DEFAULT; - } - unsigned width() const - { - return 0; - } - int precision() const - { - return -1; - } - bool flag(unsigned) const - { - return false; - } - char type() const - { - return TYPE; - } - char fill() const - { - return ' '; - } -}; - -// A width specifier. -struct WidthSpec -{ - unsigned width_; - // Fill is always wchar_t and cast to char if necessary to avoid having - // two specialization of WidthSpec and its subclasses. - wchar_t fill_; - - WidthSpec(unsigned width, wchar_t fill): width_(width), fill_(fill) - {} - - unsigned width() const - { - return width_; - } - wchar_t fill() const - { - return fill_; - } -}; - -// An alignment specifier. -struct AlignSpec: WidthSpec -{ - Alignment align_; - - AlignSpec(unsigned width, wchar_t fill, Alignment align = ALIGN_DEFAULT) - : WidthSpec(width, fill), align_(align) - {} - - Alignment align() const - { - return align_; - } - - int precision() const - { - return -1; - } -}; - -// An alignment and type specifier. -template -struct AlignTypeSpec: AlignSpec -{ - AlignTypeSpec(unsigned width, wchar_t fill): AlignSpec(width, fill) - {} - - bool flag(unsigned) const - { - return false; - } - char type() const - { - return TYPE; - } -}; - -// A full format specifier. -struct FormatSpec: AlignSpec -{ - unsigned flags_; - int precision_; - char type_; - - FormatSpec( - unsigned width = 0, char type = 0, wchar_t fill = ' ') - : AlignSpec(width, fill), flags_(0), precision_(-1), type_(type) - {} - - bool flag(unsigned f) const - { - return (flags_ & f) != 0; - } - int precision() const - { - return precision_; - } - char type() const - { - return type_; - } -}; - -// An integer format specifier. -template , typename Char = char> -class IntFormatSpec: public SpecT -{ -private: - T value_; - -public: - IntFormatSpec(T val, const SpecT &spec = SpecT()) - : SpecT(spec), value_(val) - {} - - T value() const - { - return value_; - } -}; - -// A string format specifier. -template -class StrFormatSpec: public AlignSpec -{ -private: - const Char *str_; - -public: - template - StrFormatSpec(const Char *str, unsigned width, FillChar fill) - : AlignSpec(width, fill), str_(str) - { - internal::CharTraits::convert(FillChar()); - } - - const Char *str() const - { - return str_; - } -}; - -/** -Returns an integer format specifier to format the value in base 2. -*/ -IntFormatSpec > bin(int value); - -/** -Returns an integer format specifier to format the value in base 8. -*/ -IntFormatSpec > oct(int value); - -/** -Returns an integer format specifier to format the value in base 16 using -lower-case letters for the digits above 9. -*/ -IntFormatSpec > hex(int value); - -/** -Returns an integer formatter format specifier to format in base 16 using -upper-case letters for the digits above 9. -*/ -IntFormatSpec > hexu(int value); - -/** -\rst -Returns an integer format specifier to pad the formatted argument with the -fill character to the specified width using the default (right) numeric -alignment. - -**Example**:: - -MemoryWriter out; -out << pad(hex(0xcafe), 8, '0'); -// out.str() == "0000cafe" - -\endrst -*/ -template -IntFormatSpec, Char> pad( - int value, unsigned width, Char fill = ' '); - -#define FMT_DEFINE_INT_FORMATTERS(TYPE) \ -inline IntFormatSpec > bin(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'b'>()); \ -} \ - \ -inline IntFormatSpec > oct(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'o'>()); \ -} \ - \ -inline IntFormatSpec > hex(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'x'>()); \ -} \ - \ -inline IntFormatSpec > hexu(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'X'>()); \ -} \ - \ -template \ -inline IntFormatSpec > pad( \ - IntFormatSpec > f, unsigned width) { \ - return IntFormatSpec >( \ - f.value(), AlignTypeSpec(width, ' ')); \ -} \ - \ -/* For compatibility with older compilers we provide two overloads for pad, */ \ -/* one that takes a fill character and one that doesn't. In the future this */ \ -/* can be replaced with one overload making the template argument Char */ \ -/* default to char (C++11). */ \ -template \ -inline IntFormatSpec, Char> pad( \ - IntFormatSpec, Char> f, \ - unsigned width, Char fill) { \ - return IntFormatSpec, Char>( \ - f.value(), AlignTypeSpec(width, fill)); \ -} \ - \ -inline IntFormatSpec > pad( \ - TYPE value, unsigned width) { \ - return IntFormatSpec >( \ - value, AlignTypeSpec<0>(width, ' ')); \ -} \ - \ -template \ -inline IntFormatSpec, Char> pad( \ - TYPE value, unsigned width, Char fill) { \ - return IntFormatSpec, Char>( \ - value, AlignTypeSpec<0>(width, fill)); \ -} - -FMT_DEFINE_INT_FORMATTERS(int) -FMT_DEFINE_INT_FORMATTERS(long) -FMT_DEFINE_INT_FORMATTERS(unsigned) -FMT_DEFINE_INT_FORMATTERS(unsigned long) -FMT_DEFINE_INT_FORMATTERS(LongLong) -FMT_DEFINE_INT_FORMATTERS(ULongLong) - -/** -\rst -Returns a string formatter that pads the formatted argument with the fill -character to the specified width using the default (left) string alignment. - -**Example**:: - -std::string s = str(MemoryWriter() << pad("abc", 8)); -// s == "abc " - -\endrst -*/ -template -inline StrFormatSpec pad( - const Char *str, unsigned width, Char fill = ' ') -{ - return StrFormatSpec(str, width, fill); -} - -inline StrFormatSpec pad( - const wchar_t *str, unsigned width, char fill = ' ') -{ - return StrFormatSpec(str, width, fill); -} - -namespace internal -{ - -template -class ArgMap -{ -private: - typedef std::vector< - std::pair, internal::Arg> > MapType; - typedef typename MapType::value_type Pair; - - MapType map_; - -public: - FMT_API void init(const ArgList &args); - - const internal::Arg *find(const fmt::BasicStringRef &name) const - { - // The list is unsorted, so just return the first matching name. - for (typename MapType::const_iterator it = map_.begin(), end = map_.end(); - it != end; ++it) - { - if (it->first == name) - return &it->second; - } - return FMT_NULL; - } -}; - -template -class ArgFormatterBase: public ArgVisitor -{ -private: - BasicWriter &writer_; - FormatSpec &spec_; - - FMT_DISALLOW_COPY_AND_ASSIGN(ArgFormatterBase); - - void write_pointer(const void *p) - { - spec_.flags_ = HASH_FLAG; - spec_.type_ = 'x'; - writer_.write_int(reinterpret_cast(p), spec_); - } - -protected: - BasicWriter &writer() - { - return writer_; - } - FormatSpec &spec() - { - return spec_; - } - - void write(bool value) - { - const char *str_value = value ? "true" : "false"; - Arg::StringValue str = { str_value, std::strlen(str_value) }; - writer_.write_str(str, spec_); - } - - void write(const char *value) - { - Arg::StringValue str = { value, value ? std::strlen(value) : 0 }; - writer_.write_str(str, spec_); - } - -public: - ArgFormatterBase(BasicWriter &w, FormatSpec &s) - : writer_(w), spec_(s) - {} - - template - void visit_any_int(T value) - { - writer_.write_int(value, spec_); - } - - template - void visit_any_double(T value) - { - writer_.write_double(value, spec_); - } - - void visit_bool(bool value) - { - if (spec_.type_) - { - visit_any_int(value); - return; - } - write(value); - } - - void visit_char(int value) - { - if (spec_.type_ && spec_.type_ != 'c') - { - spec_.flags_ |= CHAR_FLAG; - writer_.write_int(value, spec_); - return; - } - if (spec_.align_ == ALIGN_NUMERIC || spec_.flags_ != 0) - FMT_THROW(FormatError("invalid format specifier for char")); - typedef typename BasicWriter::CharPtr CharPtr; - Char fill = internal::CharTraits::cast(spec_.fill()); - CharPtr out = CharPtr(); - const unsigned CHAR_SIZE = 1; - if (spec_.width_ > CHAR_SIZE) - { - out = writer_.grow_buffer(spec_.width_); - if (spec_.align_ == ALIGN_RIGHT) - { - std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill); - out += spec_.width_ - CHAR_SIZE; - } - else if (spec_.align_ == ALIGN_CENTER) - { - out = writer_.fill_padding(out, spec_.width_, - internal::const_check(CHAR_SIZE), fill); - } - else - { - std::uninitialized_fill_n(out + CHAR_SIZE, - spec_.width_ - CHAR_SIZE, fill); - } - } - else - { - out = writer_.grow_buffer(CHAR_SIZE); - } - *out = internal::CharTraits::cast(value); - } - - void visit_cstring(const char *value) - { - if (spec_.type_ == 'p') - return write_pointer(value); - write(value); - } - - void visit_string(Arg::StringValue value) - { - writer_.write_str(value, spec_); - } - - using ArgVisitor::visit_wstring; - - void visit_wstring(Arg::StringValue value) - { - writer_.write_str(value, spec_); - } - - void visit_pointer(const void *value) - { - if (spec_.type_ && spec_.type_ != 'p') - report_unknown_type(spec_.type_, "pointer"); - write_pointer(value); - } -}; - -class FormatterBase -{ -private: - ArgList args_; - int next_arg_index_; - - // Returns the argument with specified index. - FMT_API Arg do_get_arg(unsigned arg_index, const char *&error); - -protected: - const ArgList &args() const - { - return args_; - } - - explicit FormatterBase(const ArgList &args) - { - args_ = args; - next_arg_index_ = 0; - } - - // Returns the next argument. - Arg next_arg(const char *&error) - { - if (next_arg_index_ >= 0) - return do_get_arg(internal::to_unsigned(next_arg_index_++), error); - error = "cannot switch from manual to automatic argument indexing"; - return Arg(); - } - - // Checks if manual indexing is used and returns the argument with - // specified index. - Arg get_arg(unsigned arg_index, const char *&error) - { - return check_no_auto_index(error) ? do_get_arg(arg_index, error) : Arg(); - } - - bool check_no_auto_index(const char *&error) - { - if (next_arg_index_ > 0) - { - error = "cannot switch from automatic to manual argument indexing"; - return false; - } - next_arg_index_ = -1; - return true; - } - - template - void write(BasicWriter &w, const Char *start, const Char *end) - { - if (start != end) - w << BasicStringRef(start, internal::to_unsigned(end - start)); - } -}; -} // namespace internal - -/** -\rst -An argument formatter based on the `curiously recurring template pattern -`_. - -To use `~fmt::BasicArgFormatter` define a subclass that implements some or -all of the visit methods with the same signatures as the methods in -`~fmt::ArgVisitor`, for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. When a formatting -function processes an argument, it will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::BasicArgFormatter` or its superclass -will be called. -\endrst -*/ -template -class BasicArgFormatter: public internal::ArgFormatterBase -{ -private: - BasicFormatter &formatter_; - const Char *format_; - -public: - /** - \rst - Constructs an argument formatter object. - *formatter* is a reference to the main formatter object, *spec* contains - format specifier information for standard argument types, and *fmt* points - to the part of the format string being parsed for custom argument types. - \endrst - */ - BasicArgFormatter(BasicFormatter &formatter, - FormatSpec &spec, const Char *fmt) - : internal::ArgFormatterBase(formatter.writer(), spec), - formatter_(formatter), format_(fmt) - {} - - /** Formats an argument of a custom (user-defined) type. */ - void visit_custom(internal::Arg::CustomValue c) - { - c.format(&formatter_, c.value, &format_); - } -}; - -/** The default argument formatter. */ -template -class ArgFormatter: public BasicArgFormatter, Char> -{ -public: - /** Constructs an argument formatter object. */ - ArgFormatter(BasicFormatter &formatter, - FormatSpec &spec, const Char *fmt) - : BasicArgFormatter, Char>(formatter, spec, fmt) - {} -}; - -/** This template formats data and writes the output to a writer. */ -template -class BasicFormatter: private internal::FormatterBase -{ -public: - /** The character type for the output. */ - typedef CharType Char; - -private: - BasicWriter &writer_; - internal::ArgMap map_; - - FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter); - - using internal::FormatterBase::get_arg; - - // Checks if manual indexing is used and returns the argument with - // specified name. - internal::Arg get_arg(BasicStringRef arg_name, const char *&error); - - // Parses argument index and returns corresponding argument. - internal::Arg parse_arg_index(const Char *&s); - - // Parses argument name and returns corresponding argument. - internal::Arg parse_arg_name(const Char *&s); - -public: - /** - \rst - Constructs a ``BasicFormatter`` object. References to the arguments and - the writer are stored in the formatter object so make sure they have - appropriate lifetimes. - \endrst - */ - BasicFormatter(const ArgList &args, BasicWriter &w) - : internal::FormatterBase(args), writer_(w) - {} - - /** Returns a reference to the writer associated with this formatter. */ - BasicWriter &writer() - { - return writer_; - } - - /** Formats stored arguments and writes the output to the writer. */ - void format(BasicCStringRef format_str); - - // Formats a single argument and advances format_str, a format string pointer. - const Char *format(const Char *&format_str, const internal::Arg &arg); -}; - -// Generates a comma-separated list with results of applying f to -// numbers 0..n-1. -# define FMT_GEN(n, f) FMT_GEN##n(f) -# define FMT_GEN1(f) f(0) -# define FMT_GEN2(f) FMT_GEN1(f), f(1) -# define FMT_GEN3(f) FMT_GEN2(f), f(2) -# define FMT_GEN4(f) FMT_GEN3(f), f(3) -# define FMT_GEN5(f) FMT_GEN4(f), f(4) -# define FMT_GEN6(f) FMT_GEN5(f), f(5) -# define FMT_GEN7(f) FMT_GEN6(f), f(6) -# define FMT_GEN8(f) FMT_GEN7(f), f(7) -# define FMT_GEN9(f) FMT_GEN8(f), f(8) -# define FMT_GEN10(f) FMT_GEN9(f), f(9) -# define FMT_GEN11(f) FMT_GEN10(f), f(10) -# define FMT_GEN12(f) FMT_GEN11(f), f(11) -# define FMT_GEN13(f) FMT_GEN12(f), f(12) -# define FMT_GEN14(f) FMT_GEN13(f), f(13) -# define FMT_GEN15(f) FMT_GEN14(f), f(14) - -namespace internal -{ -inline uint64_t make_type() -{ - return 0; -} - -template -inline uint64_t make_type(const T &arg) -{ - return MakeValue< BasicFormatter >::type(arg); -} - -template - struct ArgArray; - -template -struct ArgArray -{ - typedef Value Type[N > 0 ? N : 1]; - -template -static Value make(const T &value) -{ -#ifdef __clang__ - Value result = MakeValue(value); - // Workaround a bug in Apple LLVM version 4.2 (clang-425.0.28) of clang: - // https://github.com/fmtlib/fmt/issues/276 - (void)result.custom.format; - return result; -#else - return MakeValue(value); -#endif -} - }; - -template -struct ArgArray -{ - typedef Arg Type[N + 1]; // +1 for the list end Arg::NONE - - template - static Arg make(const T &value) - { - return MakeArg(value); - } -}; - -#if FMT_USE_VARIADIC_TEMPLATES -template -inline uint64_t make_type(const Arg &first, const Args & ... tail) -{ - return make_type(first) | (make_type(tail...) << 4); -} - -#else - -struct ArgType -{ - uint64_t type; - - ArgType(): type(0) - {} - - template - ArgType(const T &arg) : type(make_type(arg)) - {} -}; - -# define FMT_ARG_TYPE_DEFAULT(n) ArgType t##n = ArgType() - -inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) -{ - return t0.type | (t1.type << 4) | (t2.type << 8) | (t3.type << 12) | - (t4.type << 16) | (t5.type << 20) | (t6.type << 24) | (t7.type << 28) | - (t8.type << 32) | (t9.type << 36) | (t10.type << 40) | (t11.type << 44) | - (t12.type << 48) | (t13.type << 52) | (t14.type << 56); -} -#endif -} // namespace internal - -# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n -# define FMT_MAKE_ARG_TYPE(n) T##n -# define FMT_MAKE_ARG(n) const T##n &v##n -# define FMT_ASSIGN_char(n) \ - arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) -# define FMT_ASSIGN_wchar_t(n) \ - arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) - -#if FMT_USE_VARIADIC_TEMPLATES -// Defines a variadic function returning void. -# define FMT_VARIADIC_VOID(func, arg_type) \ - template \ - void func(arg_type arg0, const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - func(arg0, fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } - -// Defines a variadic constructor. -# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ - template \ - ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } - -#else - -# define FMT_MAKE_REF(n) \ - fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) -# define FMT_MAKE_REF2(n) v##n - -// Defines a wrapper for a function taking one argument of type arg_type -// and n additional arguments of arbitrary types. -# define FMT_WRAP1(func, arg_type, n) \ - template \ - inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::ArgArray::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ - func(arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ - } - -// Emulates a variadic function returning void on a pre-C++11 compiler. -# define FMT_VARIADIC_VOID(func, arg_type) \ - inline void func(arg_type arg) { func(arg, fmt::ArgList()); } \ - FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \ - FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \ - FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \ - FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \ - FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10) - -# define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ - template \ - ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::ArgArray::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ - func(arg0, arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ - } - -// Emulates a variadic constructor on a pre-C++11 compiler. -# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 1) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 2) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 3) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 4) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 5) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 6) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 7) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 8) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 9) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 10) -#endif - -// Generates a comma-separated list with results of applying f to pairs -// (argument, index). -#define FMT_FOR_EACH1(f, x0) f(x0, 0) -#define FMT_FOR_EACH2(f, x0, x1) \ - FMT_FOR_EACH1(f, x0), f(x1, 1) -#define FMT_FOR_EACH3(f, x0, x1, x2) \ - FMT_FOR_EACH2(f, x0 ,x1), f(x2, 2) -#define FMT_FOR_EACH4(f, x0, x1, x2, x3) \ - FMT_FOR_EACH3(f, x0, x1, x2), f(x3, 3) -#define FMT_FOR_EACH5(f, x0, x1, x2, x3, x4) \ - FMT_FOR_EACH4(f, x0, x1, x2, x3), f(x4, 4) -#define FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5) \ - FMT_FOR_EACH5(f, x0, x1, x2, x3, x4), f(x5, 5) -#define FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6) \ - FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5), f(x6, 6) -#define FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7) \ - FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6), f(x7, 7) -#define FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8) \ - FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7), f(x8, 8) -#define FMT_FOR_EACH10(f, x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) \ - FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8), f(x9, 9) - -/** -An error returned by an operating system or a language runtime, -for example a file opening error. -*/ -class SystemError: public internal::RuntimeError -{ -private: - void init(int err_code, CStringRef format_str, ArgList args); - -protected: - int error_code_; - - typedef char Char; // For FMT_VARIADIC_CTOR. - - SystemError() - {} - -public: - /** - \rst - Constructs a :class:`fmt::SystemError` object with a description - formatted with `fmt::format_system_error`. *message* and additional - arguments passed into the constructor are formatted similarly to - `fmt::format`. - - **Example**:: - - // This throws a SystemError with the description - // cannot open file 'madeup': No such file or directory - // or similar (system message may vary). - const char *filename = "madeup"; - std::FILE *file = std::fopen(filename, "r"); - if (!file) - throw fmt::SystemError(errno, "cannot open file '{}'", filename); - \endrst - */ - SystemError(int error_code, CStringRef message) - { - init(error_code, message, ArgList()); - } - FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef) - - ~SystemError() FMT_DTOR_NOEXCEPT; - - int error_code() const - { - return error_code_; - } -}; - -/** -\rst -Formats an error returned by an operating system or a language runtime, -for example a file opening error, and writes it to *out* in the following -form: - -.. parsed-literal:: -**: ** - -where ** is the passed message and ** is -the system message corresponding to the error code. -*error_code* is a system error code as given by ``errno``. -If *error_code* is not a valid error code such as -1, the system message -may look like "Unknown error -1" and is platform-dependent. -\endrst -*/ -FMT_API void format_system_error(fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT; - -/** -\rst -This template provides operations for formatting and writing data into -a character stream. The output is stored in a buffer provided by a subclass -such as :class:`fmt::BasicMemoryWriter`. - -You can use one of the following typedefs for common character types: - -+---------+----------------------+ -| Type | Definition | -+=========+======================+ -| Writer | BasicWriter | -+---------+----------------------+ -| WWriter | BasicWriter | -+---------+----------------------+ - -\endrst -*/ -template -class BasicWriter -{ -private: - // Output buffer. - Buffer &buffer_; - - FMT_DISALLOW_COPY_AND_ASSIGN(BasicWriter); - - typedef typename internal::CharTraits::CharPtr CharPtr; - -#if FMT_SECURE_SCL - // Returns pointer value. - static Char *get(CharPtr p) - { - return p.base(); - } -#else - static Char *get(Char *p) - { - return p; - } -#endif - - // Fills the padding around the content and returns the pointer to the - // content area. - static CharPtr fill_padding(CharPtr buffer, - unsigned total_size, std::size_t content_size, wchar_t fill); - - // Grows the buffer by n characters and returns a pointer to the newly - // allocated area. - CharPtr grow_buffer(std::size_t n) - { - std::size_t size = buffer_.size(); - buffer_.resize(size + n); - return internal::make_ptr(&buffer_[size], n); - } - - // Writes an unsigned decimal integer. - template - Char *write_unsigned_decimal(UInt value, unsigned prefix_size = 0) - { - unsigned num_digits = internal::count_digits(value); - Char *ptr = get(grow_buffer(prefix_size + num_digits)); - internal::format_decimal(ptr + prefix_size, value, num_digits); - return ptr; - } - - // Writes a decimal integer. - template - void write_decimal(Int value) - { - typedef typename internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(value); - if (internal::is_negative(value)) - { - abs_value = 0 - abs_value; - *write_unsigned_decimal(abs_value, 1) = '-'; - } - else - { - write_unsigned_decimal(abs_value, 0); - } - } - - // Prepare a buffer for integer formatting. - CharPtr prepare_int_buffer(unsigned num_digits, - const EmptySpec &, const char *prefix, unsigned prefix_size) - { - unsigned size = prefix_size + num_digits; - CharPtr p = grow_buffer(size); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - return p + size - 1; - } - - template - CharPtr prepare_int_buffer(unsigned num_digits, - const Spec &spec, const char *prefix, unsigned prefix_size); - - // Formats an integer. - template - void write_int(T value, Spec spec); - - // Formats a floating-point number (double or long double). - template - void write_double(T value, const FormatSpec &spec); - - // Writes a formatted string. - template - CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec); - - template - void write_str(const internal::Arg::StringValue &str, - const FormatSpec &spec); - - // This following methods are private to disallow writing wide characters - // and strings to a char stream. If you want to print a wide string as a - // pointer as std::ostream does, cast it to const void*. - // Do not implement! - void operator<<(typename internal::WCharHelper::Unsupported); - void operator<<( - typename internal::WCharHelper::Unsupported); - - // Appends floating-point length specifier to the format string. - // The second argument is only used for overload resolution. - void append_float_length(Char *&format_ptr, long double) - { - *format_ptr++ = 'L'; - } - - template - void append_float_length(Char *&, T) - {} - - template - friend class internal::ArgFormatterBase; - - template - friend class BasicPrintfArgFormatter; - -protected: - /** - Constructs a ``BasicWriter`` object. - */ - explicit BasicWriter(Buffer &b): buffer_(b) - {} - -public: - /** - \rst - Destroys a ``BasicWriter`` object. - \endrst - */ - virtual ~BasicWriter() - {} - - /** - Returns the total number of characters written. - */ - std::size_t size() const - { - return buffer_.size(); - } - - /** - Returns a pointer to the output buffer content. No terminating null - character is appended. - */ - const Char *data() const FMT_NOEXCEPT - { - return &buffer_[0]; - } - - /** - Returns a pointer to the output buffer content with terminating null - character appended. - */ - const Char *c_str() const - { - std::size_t size = buffer_.size(); - buffer_.reserve(size + 1); - buffer_[size] = '\0'; - return &buffer_[0]; - } - - /** - \rst - Returns the content of the output buffer as an `std::string`. - \endrst - */ - std::basic_string str() const - { - return std::basic_string(&buffer_[0], buffer_.size()); - } - - /** - \rst - Writes formatted data. - - *args* is an argument list representing arbitrary arguments. - - **Example**:: - - MemoryWriter out; - out.write("Current point:\n"); - out.write("({:+f}, {:+f})", -3.14, 3.14); - - This will write the following output to the ``out`` object: - - .. code-block:: none - - Current point: - (-3.140000, +3.140000) - - The output can be accessed using :func:`data()`, :func:`c_str` or - :func:`str` methods. - - See also :ref:`syntax`. - \endrst - */ - void write(BasicCStringRef format, ArgList args) - { - BasicFormatter(args, *this).format(format); - } - FMT_VARIADIC_VOID(write, BasicCStringRef) - - BasicWriter &operator<<(int value) - { - write_decimal(value); - return *this; - } - BasicWriter &operator<<(unsigned value) - { - return *this << IntFormatSpec(value); - } - BasicWriter &operator<<(long value) - { - write_decimal(value); - return *this; - } - BasicWriter &operator<<(unsigned long value) - { - return *this << IntFormatSpec(value); - } - BasicWriter &operator<<(LongLong value) - { - write_decimal(value); - return *this; - } - - /** - \rst - Formats *value* and writes it to the stream. - \endrst - */ - BasicWriter &operator<<(ULongLong value) - { - return *this << IntFormatSpec(value); - } - - BasicWriter &operator<<(double value) - { - write_double(value, FormatSpec()); - return *this; - } - - /** - \rst - Formats *value* using the general format for floating-point numbers - (``'g'``) and writes it to the stream. - \endrst - */ - BasicWriter &operator<<(long double value) - { - write_double(value, FormatSpec()); - return *this; - } - - /** - Writes a character to the stream. - */ - BasicWriter &operator<<(char value) - { - buffer_.push_back(value); - return *this; - } - - BasicWriter &operator<<( - typename internal::WCharHelper::Supported value) - { - buffer_.push_back(value); - return *this; - } - - /** - \rst - Writes *value* to the stream. - \endrst - */ - BasicWriter &operator<<(fmt::BasicStringRef value) - { - const Char *str = value.data(); - buffer_.append(str, str + value.size()); - return *this; - } - - BasicWriter &operator<<( - typename internal::WCharHelper::Supported value) - { - const char *str = value.data(); - buffer_.append(str, str + value.size()); - return *this; - } - - template - BasicWriter &operator<<(IntFormatSpec spec) - { - internal::CharTraits::convert(FillChar()); - write_int(spec.value(), spec); - return *this; - } - - template - BasicWriter &operator<<(const StrFormatSpec &spec) - { - const StrChar *s = spec.str(); - write_str(s, std::char_traits::length(s), spec); - return *this; - } - - void clear() FMT_NOEXCEPT - { - buffer_.clear(); - } - - Buffer &buffer() FMT_NOEXCEPT - { - return buffer_; - } -}; - -template -template -typename BasicWriter::CharPtr BasicWriter::write_str( - const StrChar *s, std::size_t size, const AlignSpec &spec) -{ - CharPtr out = CharPtr(); - if (spec.width() > size) - { - out = grow_buffer(spec.width()); - Char fill = internal::CharTraits::cast(spec.fill()); - if (spec.align() == ALIGN_RIGHT) - { - std::uninitialized_fill_n(out, spec.width() - size, fill); - out += spec.width() - size; - } - else if (spec.align() == ALIGN_CENTER) - { - out = fill_padding(out, spec.width(), size, fill); - } - else - { - std::uninitialized_fill_n(out + size, spec.width() - size, fill); - } - } - else - { - out = grow_buffer(size); - } - std::uninitialized_copy(s, s + size, out); - return out; -} - -template -template -void BasicWriter::write_str( - const internal::Arg::StringValue &s, const FormatSpec &spec) -{ - // Check if StrChar is convertible to Char. - internal::CharTraits::convert(StrChar()); - if (spec.type_ && spec.type_ != 's') - internal::report_unknown_type(spec.type_, "string"); - const StrChar *str_value = s.value; - std::size_t str_size = s.size; - if (str_size == 0) - { - if (!str_value) - { - FMT_THROW(FormatError("string pointer is null")); - } - } - std::size_t precision = static_cast(spec.precision_); - if (spec.precision_ >= 0 && precision < str_size) - str_size = precision; - write_str(str_value, str_size, spec); -} - -template -typename BasicWriter::CharPtr -BasicWriter::fill_padding( - CharPtr buffer, unsigned total_size, - std::size_t content_size, wchar_t fill) -{ - std::size_t padding = total_size - content_size; - std::size_t left_padding = padding / 2; - Char fill_char = internal::CharTraits::cast(fill); - std::uninitialized_fill_n(buffer, left_padding, fill_char); - buffer += left_padding; - CharPtr content = buffer; - std::uninitialized_fill_n(buffer + content_size, - padding - left_padding, fill_char); - return content; -} - -template -template -typename BasicWriter::CharPtr -BasicWriter::prepare_int_buffer( - unsigned num_digits, const Spec &spec, - const char *prefix, unsigned prefix_size) -{ - unsigned width = spec.width(); - Alignment align = spec.align(); - Char fill = internal::CharTraits::cast(spec.fill()); - if (spec.precision() > static_cast(num_digits)) - { - // Octal prefix '0' is counted as a digit, so ignore it if precision - // is specified. - if (prefix_size > 0 && prefix[prefix_size - 1] == '0') - --prefix_size; - unsigned number_size = - prefix_size + internal::to_unsigned(spec.precision()); - AlignSpec subspec(number_size, '0', ALIGN_NUMERIC); - if (number_size >= width) - return prepare_int_buffer(num_digits, subspec, prefix, prefix_size); - buffer_.reserve(width); - unsigned fill_size = width - number_size; - if (align != ALIGN_LEFT) - { - CharPtr p = grow_buffer(fill_size); - std::uninitialized_fill(p, p + fill_size, fill); - } - CharPtr result = prepare_int_buffer( - num_digits, subspec, prefix, prefix_size); - if (align == ALIGN_LEFT) - { - CharPtr p = grow_buffer(fill_size); - std::uninitialized_fill(p, p + fill_size, fill); - } - return result; - } - unsigned size = prefix_size + num_digits; - if (width <= size) - { - CharPtr p = grow_buffer(size); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - return p + size - 1; - } - CharPtr p = grow_buffer(width); - CharPtr end = p + width; - if (align == ALIGN_LEFT) - { - std::uninitialized_copy(prefix, prefix + prefix_size, p); - p += size; - std::uninitialized_fill(p, end, fill); - } - else if (align == ALIGN_CENTER) - { - p = fill_padding(p, width, size, fill); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - p += size; - } - else - { - if (align == ALIGN_NUMERIC) - { - if (prefix_size != 0) - { - p = std::uninitialized_copy(prefix, prefix + prefix_size, p); - size -= prefix_size; - } - } - else - { - std::uninitialized_copy(prefix, prefix + prefix_size, end - size); - } - std::uninitialized_fill(p, end - size, fill); - p = end; - } - return p - 1; -} - -template -template -void BasicWriter::write_int(T value, Spec spec) -{ - unsigned prefix_size = 0; - typedef typename internal::IntTraits::MainType UnsignedType; - UnsignedType abs_value = static_cast(value); - char prefix[4] = ""; - if (internal::is_negative(value)) - { - prefix[0] = '-'; - ++prefix_size; - abs_value = 0 - abs_value; - } - else if (spec.flag(SIGN_FLAG)) - { - prefix[0] = spec.flag(PLUS_FLAG) ? '+' : ' '; - ++prefix_size; - } - switch (spec.type()) - { - case 0: - case 'd': - { - unsigned num_digits = internal::count_digits(abs_value); - CharPtr p = prepare_int_buffer(num_digits, spec, prefix, prefix_size) + 1; - internal::format_decimal(get(p), abs_value, 0); - break; - } - case 'x': - case 'X': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); - } - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 4) != 0); - Char *p = get(prepare_int_buffer( - num_digits, spec, prefix, prefix_size)); - n = abs_value; - const char *digits = spec.type() == 'x' ? - "0123456789abcdef" : "0123456789ABCDEF"; - do - { - *p-- = digits[n & 0xf]; - } - while ((n >>= 4) != 0); - break; - } - case 'b': - case 'B': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); - } - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 1) != 0); - Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size)); - n = abs_value; - do - { - *p-- = static_cast('0' + (n & 1)); - } - while ((n >>= 1) != 0); - break; - } - case 'o': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - prefix[prefix_size++] = '0'; - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 3) != 0); - Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size)); - n = abs_value; - do - { - *p-- = static_cast('0' + (n & 7)); - } - while ((n >>= 3) != 0); - break; - } - case 'n': - { - unsigned num_digits = internal::count_digits(abs_value); - fmt::StringRef sep = ""; -#ifndef ANDROID - sep = internal::thousands_sep(std::localeconv()); -#endif - unsigned size = static_cast( - num_digits + sep.size() * ((num_digits - 1) / 3)); - CharPtr p = prepare_int_buffer(size, spec, prefix, prefix_size) + 1; - internal::format_decimal(get(p), abs_value, 0, internal::ThousandsSep(sep)); - break; - } - default: - internal::report_unknown_type( - spec.type(), spec.flag(CHAR_FLAG) ? "char" : "integer"); - break; - } -} - -template -template -void BasicWriter::write_double(T value, const FormatSpec &spec) -{ - // Check type. - char type = spec.type(); - bool upper = false; - switch (type) - { - case 0: - type = 'g'; - break; - case 'e': - case 'f': - case 'g': - case 'a': - break; - case 'F': -#if FMT_MSC_VER - // MSVC's printf doesn't support 'F'. - type = 'f'; -#endif - // Fall through. - case 'E': - case 'G': - case 'A': - upper = true; - break; - default: - internal::report_unknown_type(type, "double"); - break; - } - - char sign = 0; - // Use isnegative instead of value < 0 because the latter is always - // false for NaN. - if (internal::FPUtil::isnegative(static_cast(value))) - { - sign = '-'; - value = -value; - } - else if (spec.flag(SIGN_FLAG)) - { - sign = spec.flag(PLUS_FLAG) ? '+' : ' '; - } - - if (internal::FPUtil::isnotanumber(value)) - { - // Format NaN ourselves because sprintf's output is not consistent - // across platforms. - std::size_t nan_size = 4; - const char *nan = upper ? " NAN" : " nan"; - if (!sign) - { - --nan_size; - ++nan; - } - CharPtr out = write_str(nan, nan_size, spec); - if (sign) - *out = sign; - return; - } - - if (internal::FPUtil::isinfinity(value)) - { - // Format infinity ourselves because sprintf's output is not consistent - // across platforms. - std::size_t inf_size = 4; - const char *inf = upper ? " INF" : " inf"; - if (!sign) - { - --inf_size; - ++inf; - } - CharPtr out = write_str(inf, inf_size, spec); - if (sign) - *out = sign; - return; - } - - std::size_t offset = buffer_.size(); - unsigned width = spec.width(); - if (sign) - { - buffer_.reserve(buffer_.size() + (width > 1u ? width : 1u)); - if (width > 0) - --width; - ++offset; - } - - // Build format string. - enum - { - MAX_FORMAT_SIZE = 10 - }; // longest format: %#-*.*Lg - Char format[MAX_FORMAT_SIZE]; - Char *format_ptr = format; - *format_ptr++ = '%'; - unsigned width_for_sprintf = width; - if (spec.flag(HASH_FLAG)) - *format_ptr++ = '#'; - if (spec.align() == ALIGN_CENTER) - { - width_for_sprintf = 0; - } - else - { - if (spec.align() == ALIGN_LEFT) - *format_ptr++ = '-'; - if (width != 0) - *format_ptr++ = '*'; - } - if (spec.precision() >= 0) - { - *format_ptr++ = '.'; - *format_ptr++ = '*'; - } - - append_float_length(format_ptr, value); - *format_ptr++ = type; - *format_ptr = '\0'; - - // Format using snprintf. - Char fill = internal::CharTraits::cast(spec.fill()); - unsigned n = 0; - Char *start = FMT_NULL; - for (;;) - { - std::size_t buffer_size = buffer_.capacity() - offset; -#if FMT_MSC_VER - // MSVC's vsnprintf_s doesn't work with zero size, so reserve - // space for at least one extra character to make the size non-zero. - // Note that the buffer's capacity will increase by more than 1. - if (buffer_size == 0) - { - buffer_.reserve(offset + 1); - buffer_size = buffer_.capacity() - offset; - } -#endif - start = &buffer_[offset]; - int result = internal::CharTraits::format_float( - start, buffer_size, format, width_for_sprintf, spec.precision(), value); - if (result >= 0) - { - n = internal::to_unsigned(result); - if (offset + n < buffer_.capacity()) - break; // The buffer is large enough - continue with formatting. - buffer_.reserve(offset + n + 1); - } - else - { - // If result is negative we ask to increase the capacity by at least 1, - // but as std::vector, the buffer grows exponentially. - buffer_.reserve(buffer_.capacity() + 1); - } - } - if (sign) - { - if ((spec.align() != ALIGN_RIGHT && spec.align() != ALIGN_DEFAULT) || - *start != ' ') - { - *(start - 1) = sign; - sign = 0; - } - else - { - *(start - 1) = fill; - } - ++n; - } - if (spec.align() == ALIGN_CENTER && spec.width() > n) - { - width = spec.width(); - CharPtr p = grow_buffer(width); - std::memmove(get(p) + (width - n) / 2, get(p), n * sizeof(Char)); - fill_padding(p, spec.width(), n, fill); - return; - } - if (spec.fill() != ' ' || sign) - { - while (*start == ' ') - *start++ = fill; - if (sign) - *(start - 1) = sign; - } - grow_buffer(n); -} - -/** -\rst -This class template provides operations for formatting and writing data -into a character stream. The output is stored in a memory buffer that grows -dynamically. - -You can use one of the following typedefs for common character types -and the standard allocator: - -+---------------+-----------------------------------------------------+ -| Type | Definition | -+===============+=====================================================+ -| MemoryWriter | BasicMemoryWriter> | -+---------------+-----------------------------------------------------+ -| WMemoryWriter | BasicMemoryWriter> | -+---------------+-----------------------------------------------------+ - -**Example**:: - -MemoryWriter out; -out << "The answer is " << 42 << "\n"; -out.write("({:+f}, {:+f})", -3.14, 3.14); - -This will write the following output to the ``out`` object: - -.. code-block:: none - -The answer is 42 -(-3.140000, +3.140000) - -The output can be converted to an ``std::string`` with ``out.str()`` or -accessed as a C string with ``out.c_str()``. -\endrst -*/ -template > -class BasicMemoryWriter: public BasicWriter -{ -private: - internal::MemoryBuffer buffer_; - -public: - explicit BasicMemoryWriter(const Allocator& alloc = Allocator()) - : BasicWriter(buffer_), buffer_(alloc) - {} - -#if FMT_USE_RVALUE_REFERENCES - /** - \rst - Constructs a :class:`fmt::BasicMemoryWriter` object moving the content - of the other object to it. - \endrst - */ - BasicMemoryWriter(BasicMemoryWriter &&other) - : BasicWriter(buffer_), buffer_(std::move(other.buffer_)) - {} - - /** - \rst - Moves the content of the other ``BasicMemoryWriter`` object to this one. - \endrst - */ - BasicMemoryWriter &operator=(BasicMemoryWriter &&other) - { - buffer_ = std::move(other.buffer_); - return *this; - } -#endif -}; - -typedef BasicMemoryWriter MemoryWriter; -typedef BasicMemoryWriter WMemoryWriter; - -/** -\rst -This class template provides operations for formatting and writing data -into a fixed-size array. For writing into a dynamically growing buffer -use :class:`fmt::BasicMemoryWriter`. - -Any write method will throw ``std::runtime_error`` if the output doesn't fit -into the array. - -You can use one of the following typedefs for common character types: - -+--------------+---------------------------+ -| Type | Definition | -+==============+===========================+ -| ArrayWriter | BasicArrayWriter | -+--------------+---------------------------+ -| WArrayWriter | BasicArrayWriter | -+--------------+---------------------------+ -\endrst -*/ -template -class BasicArrayWriter: public BasicWriter -{ -private: - internal::FixedBuffer buffer_; - -public: - /** - \rst - Constructs a :class:`fmt::BasicArrayWriter` object for *array* of the - given size. - \endrst - */ - BasicArrayWriter(Char *array, std::size_t size) - : BasicWriter(buffer_), buffer_(array, size) - {} - - /** - \rst - Constructs a :class:`fmt::BasicArrayWriter` object for *array* of the - size known at compile time. - \endrst - */ - template - explicit BasicArrayWriter(Char(&array)[SIZE]) - : BasicWriter(buffer_), buffer_(array, SIZE) - {} -}; - -typedef BasicArrayWriter ArrayWriter; -typedef BasicArrayWriter WArrayWriter; - -// Reports a system error without throwing an exception. -// Can be used to report errors from destructors. -FMT_API void report_system_error(int error_code, - StringRef message) FMT_NOEXCEPT; - -#if FMT_USE_WINDOWS_H - -/** A Windows error. */ -class WindowsError: public SystemError -{ -private: - FMT_API void init(int error_code, CStringRef format_str, ArgList args); - -public: - /** - \rst - Constructs a :class:`fmt::WindowsError` object with the description - of the form - - .. parsed-literal:: - **: ** - - where ** is the formatted message and ** is the - system message corresponding to the error code. - *error_code* is a Windows error code as given by ``GetLastError``. - If *error_code* is not a valid error code such as -1, the system message - will look like "error -1". - - **Example**:: - - // This throws a WindowsError with the description - // cannot open file 'madeup': The system cannot find the file specified. - // or similar (system message may vary). - const char *filename = "madeup"; - LPOFSTRUCT of = LPOFSTRUCT(); - HFILE file = OpenFile(filename, &of, OF_READ); - if (file == HFILE_ERROR) { - throw fmt::WindowsError(GetLastError(), - "cannot open file '{}'", filename); - } - \endrst - */ - WindowsError(int error_code, CStringRef message) - { - init(error_code, message, ArgList()); - } - FMT_VARIADIC_CTOR(WindowsError, init, int, CStringRef) -}; - -// Reports a Windows error without throwing an exception. -// Can be used to report errors from destructors. -FMT_API void report_windows_error(int error_code, - StringRef message) FMT_NOEXCEPT; - -#endif - -enum Color -{ - BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE -}; - -/** -Formats a string and prints it to stdout using ANSI escape sequences -to specify color (experimental). -Example: -print_colored(fmt::RED, "Elapsed time: {0:.2f} seconds", 1.23); -*/ -FMT_API void print_colored(Color c, CStringRef format, ArgList args); - -/** -\rst -Formats arguments and returns the result as a string. - -**Example**:: - -std::string message = format("The answer is {}", 42); -\endrst -*/ -inline std::string format(CStringRef format_str, ArgList args) -{ - MemoryWriter w; - w.write(format_str, args); - return w.str(); -} - -inline std::wstring format(WCStringRef format_str, ArgList args) -{ - WMemoryWriter w; - w.write(format_str, args); - return w.str(); -} - -/** -\rst -Prints formatted data to the file *f*. - -**Example**:: - -print(stderr, "Don't {}!", "panic"); -\endrst -*/ -FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args); - -/** -\rst -Prints formatted data to ``stdout``. - -**Example**:: - -print("Elapsed time: {0:.2f} seconds", 1.23); -\endrst -*/ -FMT_API void print(CStringRef format_str, ArgList args); - -/** -Fast integer formatter. -*/ -class FormatInt -{ -private: - // Buffer should be large enough to hold all digits (digits10 + 1), - // a sign and a null character. - enum - { - BUFFER_SIZE = std::numeric_limits::digits10 + 3 - }; - mutable char buffer_[BUFFER_SIZE]; - char *str_; - - // Formats value in reverse and returns the number of digits. - char *format_decimal(ULongLong value) - { - char *buffer_end = buffer_ + BUFFER_SIZE - 1; - while (value >= 100) - { - // Integer division is slow so do it for a group of two digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - unsigned index = static_cast((value % 100) * 2); - value /= 100; - *--buffer_end = internal::Data::DIGITS[index + 1]; - *--buffer_end = internal::Data::DIGITS[index]; - } - if (value < 10) - { - *--buffer_end = static_cast('0' + value); - return buffer_end; - } - unsigned index = static_cast(value * 2); - *--buffer_end = internal::Data::DIGITS[index + 1]; - *--buffer_end = internal::Data::DIGITS[index]; - return buffer_end; - } - - void FormatSigned(LongLong value) - { - ULongLong abs_value = static_cast(value); - bool negative = value < 0; - if (negative) - abs_value = 0 - abs_value; - str_ = format_decimal(abs_value); - if (negative) - *--str_ = '-'; - } - -public: - explicit FormatInt(int value) - { - FormatSigned(value); - } - explicit FormatInt(long value) - { - FormatSigned(value); - } - explicit FormatInt(LongLong value) - { - FormatSigned(value); - } - explicit FormatInt(unsigned value): str_(format_decimal(value)) - {} - explicit FormatInt(unsigned long value): str_(format_decimal(value)) - {} - explicit FormatInt(ULongLong value): str_(format_decimal(value)) - {} - - /** Returns the number of characters written to the output buffer. */ - std::size_t size() const - { - return internal::to_unsigned(buffer_ - str_ + BUFFER_SIZE - 1); - } - - /** - Returns a pointer to the output buffer content. No terminating null - character is appended. - */ - const char *data() const - { - return str_; - } - - /** - Returns a pointer to the output buffer content with terminating null - character appended. - */ - const char *c_str() const - { - buffer_[BUFFER_SIZE - 1] = '\0'; - return str_; - } - - /** - \rst - Returns the content of the output buffer as an ``std::string``. - \endrst - */ - std::string str() const - { - return std::string(str_, size()); - } -}; - -// Formats a decimal integer value writing into buffer and returns -// a pointer to the end of the formatted string. This function doesn't -// write a terminating null character. -template -inline void format_decimal(char *&buffer, T value) -{ - typedef typename internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(value); - if (internal::is_negative(value)) - { - *buffer++ = '-'; - abs_value = 0 - abs_value; - } - if (abs_value < 100) - { - if (abs_value < 10) - { - *buffer++ = static_cast('0' + abs_value); - return; - } - unsigned index = static_cast(abs_value * 2); - *buffer++ = internal::Data::DIGITS[index]; - *buffer++ = internal::Data::DIGITS[index + 1]; - return; - } - unsigned num_digits = internal::count_digits(abs_value); - internal::format_decimal(buffer, abs_value, num_digits); - buffer += num_digits; -} - -/** -\rst -Returns a named argument for formatting functions. - -**Example**:: - -print("Elapsed time: {s:.2f} seconds", arg("s", 1.23)); - -\endrst -*/ -template -inline internal::NamedArgWithType arg(StringRef name, const T &arg) -{ - return internal::NamedArgWithType(name, arg); -} - -template -inline internal::NamedArgWithType arg(WStringRef name, const T &arg) -{ - return internal::NamedArgWithType(name, arg); -} - -// The following two functions are deleted intentionally to disable -// nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``. -template -void arg(StringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; -template -void arg(WStringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; -} - -#if FMT_GCC_VERSION -// Use the system_header pragma to suppress warnings about variadic macros -// because suppressing -Wvariadic-macros with the diagnostic pragma doesn't -// work. It is used at the end because we want to suppress as little warnings -// as possible. -# pragma GCC system_header -#endif - -// This is used to work around VC++ bugs in handling variadic macros. -#define FMT_EXPAND(args) args - -// Returns the number of arguments. -// Based on https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s. -#define FMT_NARG(...) FMT_NARG_(__VA_ARGS__, FMT_RSEQ_N()) -#define FMT_NARG_(...) FMT_EXPAND(FMT_ARG_N(__VA_ARGS__)) -#define FMT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define FMT_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - -#define FMT_FOR_EACH_(N, f, ...) \ - FMT_EXPAND(FMT_CONCAT(FMT_FOR_EACH, N)(f, __VA_ARGS__)) -#define FMT_FOR_EACH(f, ...) \ - FMT_EXPAND(FMT_FOR_EACH_(FMT_NARG(__VA_ARGS__), f, __VA_ARGS__)) - -#define FMT_ADD_ARG_NAME(type, index) type arg##index -#define FMT_GET_ARG_NAME(type, index) arg##index - -#if FMT_USE_VARIADIC_TEMPLATES -# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ - template \ - ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ - const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ - fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } -#else -// Defines a wrapper for a function taking __VA_ARGS__ arguments -// and n additional arguments of arbitrary types. -# define FMT_WRAP(Char, ReturnType, func, call, n, ...) \ - template \ - inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ - FMT_GEN(n, FMT_MAKE_ARG)) { \ - fmt::internal::ArgArray::Type arr; \ - FMT_GEN(n, FMT_ASSIGN_##Char); \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \ - } - -# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ - inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__)) { \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList()); \ - } \ - FMT_WRAP(Char, ReturnType, func, call, 1, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 2, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 3, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 4, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 5, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 6, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 11, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 12, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 13, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 14, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 15, __VA_ARGS__) -#endif // FMT_USE_VARIADIC_TEMPLATES - -/** -\rst -Defines a variadic function with the specified return type, function name -and argument types passed as variable arguments to this macro. - -**Example**:: - -void print_error(const char *file, int line, const char *format, -fmt::ArgList args) { -fmt::print("{}: {}: ", file, line); -fmt::print(format, args); -} -FMT_VARIADIC(void, print_error, const char *, int, const char *) - -``FMT_VARIADIC`` is used for compatibility with legacy C++ compilers that -don't implement variadic templates. You don't have to use this macro if -you don't need legacy compiler support and can use variadic templates -directly:: - -template -void print_error(const char *file, int line, const char *format, -const Args & ... args) { -fmt::print("{}: {}: ", file, line); -fmt::print(format, args...); -} -\endrst -*/ -#define FMT_VARIADIC(ReturnType, func, ...) \ - FMT_VARIADIC_(char, ReturnType, func, return func, __VA_ARGS__) - -#define FMT_VARIADIC_W(ReturnType, func, ...) \ - FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__) - -#define FMT_CAPTURE_ARG_(id, index) ::fmt::arg(#id, id) - -#define FMT_CAPTURE_ARG_W_(id, index) ::fmt::arg(L###id, id) - -/** -\rst -Convenient macro to capture the arguments' names and values into several -``fmt::arg(name, value)``. - -**Example**:: - -int x = 1, y = 2; -print("point: ({x}, {y})", FMT_CAPTURE(x, y)); -// same as: -// print("point: ({x}, {y})", arg("x", x), arg("y", y)); - -\endrst -*/ -#define FMT_CAPTURE(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_, __VA_ARGS__) - -#define FMT_CAPTURE_W(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_W_, __VA_ARGS__) - -namespace fmt -{ -FMT_VARIADIC(std::string, format, CStringRef) -FMT_VARIADIC_W(std::wstring, format, WCStringRef) -FMT_VARIADIC(void, print, CStringRef) -FMT_VARIADIC(void, print, std::FILE *, CStringRef) -FMT_VARIADIC(void, print_colored, Color, CStringRef) - -namespace internal -{ -template -inline bool is_name_start(Char c) -{ - return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || '_' == c; -} - -// Parses an unsigned integer advancing s to the end of the parsed input. -// This function assumes that the first character of s is a digit. -template -unsigned parse_nonnegative_int(const Char *&s) -{ - assert('0' <= *s && *s <= '9'); - unsigned value = 0; - do - { - unsigned new_value = value * 10 + (*s++ - '0'); - // Check if value wrapped around. - if (new_value < value) - { - value = (std::numeric_limits::max)(); - break; - } - value = new_value; - } - while ('0' <= *s && *s <= '9'); - // Convert to unsigned to prevent a warning. - unsigned max_int = (std::numeric_limits::max)(); - if (value > max_int) - FMT_THROW(FormatError("number is too big")); - return value; -} - -inline void require_numeric_argument(const Arg &arg, char spec) -{ - if (arg.type > Arg::LAST_NUMERIC_TYPE) - { - std::string message = - fmt::format("format specifier '{}' requires numeric argument", spec); - FMT_THROW(fmt::FormatError(message)); - } -} - -template -void check_sign(const Char *&s, const Arg &arg) -{ - char sign = static_cast(*s); - require_numeric_argument(arg, sign); - if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) - { - FMT_THROW(FormatError(fmt::format( - "format specifier '{}' requires signed argument", sign))); - } - ++s; -} -} // namespace internal - -template -inline internal::Arg BasicFormatter::get_arg( - BasicStringRef arg_name, const char *&error) -{ - if (check_no_auto_index(error)) - { - map_.init(args()); - const internal::Arg *arg = map_.find(arg_name); - if (arg) - return *arg; - error = "argument not found"; - } - return internal::Arg(); -} - -template -inline internal::Arg BasicFormatter::parse_arg_index(const Char *&s) -{ - const char *error = FMT_NULL; - internal::Arg arg = *s < '0' || *s > '9' ? - next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error); - if (error) - { - FMT_THROW(FormatError( - *s != '}' && *s != ':' ? "invalid format string" : error)); - } - return arg; -} - -template -inline internal::Arg BasicFormatter::parse_arg_name(const Char *&s) -{ - assert(internal::is_name_start(*s)); - const Char *start = s; - Char c; - do - { - c = *++s; - } - while (internal::is_name_start(c) || ('0' <= c && c <= '9')); - const char *error = FMT_NULL; - internal::Arg arg = get_arg(BasicStringRef(start, s - start), error); - if (error) - FMT_THROW(FormatError(error)); - return arg; -} - -template -const Char *BasicFormatter::format( - const Char *&format_str, const internal::Arg &arg) -{ - using internal::Arg; - const Char *s = format_str; - FormatSpec spec; - if (*s == ':') - { - if (arg.type == Arg::CUSTOM) - { - arg.custom.format(this, arg.custom.value, &s); - return s; - } - ++s; - // Parse fill and alignment. - if (Char c = *s) - { - const Char *p = s + 1; - spec.align_ = ALIGN_DEFAULT; - do - { - switch (*p) - { - case '<': - spec.align_ = ALIGN_LEFT; - break; - case '>': - spec.align_ = ALIGN_RIGHT; - break; - case '=': - spec.align_ = ALIGN_NUMERIC; - break; - case '^': - spec.align_ = ALIGN_CENTER; - break; - } - if (spec.align_ != ALIGN_DEFAULT) - { - if (p != s) - { - if (c == '}') break; - if (c == '{') - FMT_THROW(FormatError("invalid fill character '{'")); - s += 2; - spec.fill_ = c; - } - else ++s; - if (spec.align_ == ALIGN_NUMERIC) - require_numeric_argument(arg, '='); - break; - } - } - while (--p >= s); - } - - // Parse sign. - switch (*s) - { - case '+': - check_sign(s, arg); - spec.flags_ |= SIGN_FLAG | PLUS_FLAG; - break; - case '-': - check_sign(s, arg); - spec.flags_ |= MINUS_FLAG; - break; - case ' ': - check_sign(s, arg); - spec.flags_ |= SIGN_FLAG; - break; - } - - if (*s == '#') - { - require_numeric_argument(arg, '#'); - spec.flags_ |= HASH_FLAG; - ++s; - } - - // Parse zero flag. - if (*s == '0') - { - require_numeric_argument(arg, '0'); - spec.align_ = ALIGN_NUMERIC; - spec.fill_ = '0'; - ++s; - } - - // Parse width. - if ('0' <= *s && *s <= '9') - { - spec.width_ = internal::parse_nonnegative_int(s); - } - else if (*s == '{') - { - ++s; - Arg width_arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - if (*s++ != '}') - FMT_THROW(FormatError("invalid format string")); - ULongLong value = 0; - switch (width_arg.type) - { - case Arg::INT: - if (width_arg.int_value < 0) - FMT_THROW(FormatError("negative width")); - value = width_arg.int_value; - break; - case Arg::UINT: - value = width_arg.uint_value; - break; - case Arg::LONG_LONG: - if (width_arg.long_long_value < 0) - FMT_THROW(FormatError("negative width")); - value = width_arg.long_long_value; - break; - case Arg::ULONG_LONG: - value = width_arg.ulong_long_value; - break; - default: - FMT_THROW(FormatError("width is not integer")); - } - if (value >(std::numeric_limits::max)()) - FMT_THROW(FormatError("number is too big")); - spec.width_ = static_cast(value); - } - - // Parse precision. - if (*s == '.') - { - ++s; - spec.precision_ = 0; - if ('0' <= *s && *s <= '9') - { - spec.precision_ = internal::parse_nonnegative_int(s); - } - else if (*s == '{') - { - ++s; - Arg precision_arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - if (*s++ != '}') - FMT_THROW(FormatError("invalid format string")); - ULongLong value = 0; - switch (precision_arg.type) - { - case Arg::INT: - if (precision_arg.int_value < 0) - FMT_THROW(FormatError("negative precision")); - value = precision_arg.int_value; - break; - case Arg::UINT: - value = precision_arg.uint_value; - break; - case Arg::LONG_LONG: - if (precision_arg.long_long_value < 0) - FMT_THROW(FormatError("negative precision")); - value = precision_arg.long_long_value; - break; - case Arg::ULONG_LONG: - value = precision_arg.ulong_long_value; - break; - default: - FMT_THROW(FormatError("precision is not integer")); - } - if (value >(std::numeric_limits::max)()) - FMT_THROW(FormatError("number is too big")); - spec.precision_ = static_cast(value); - } - else - { - FMT_THROW(FormatError("missing precision specifier")); - } - if (arg.type <= Arg::LAST_INTEGER_TYPE || arg.type == Arg::POINTER) - { - FMT_THROW(FormatError( - fmt::format("precision not allowed in {} format specifier", - arg.type == Arg::POINTER ? "pointer" : "integer"))); - } - } - - // Parse type. - if (*s != '}' && *s) - spec.type_ = static_cast(*s++); - } - - if (*s++ != '}') - FMT_THROW(FormatError("missing '}' in format string")); - - // Format argument. - ArgFormatter(*this, spec, s - 1).visit(arg); - return s; -} - -template -void BasicFormatter::format(BasicCStringRef format_str) -{ - const Char *s = format_str.c_str(); - const Char *start = s; - while (*s) - { - Char c = *s++; - if (c != '{' && c != '}') continue; - if (*s == c) - { - write(writer_, start, s); - start = ++s; - continue; - } - if (c == '}') - FMT_THROW(FormatError("unmatched '}' in format string")); - write(writer_, start, s - 1); - internal::Arg arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - start = s = format(s, arg); - } - write(writer_, start, s); -} -} // namespace fmt - -#if FMT_USE_USER_DEFINED_LITERALS -namespace fmt -{ -namespace internal -{ - -template -struct UdlFormat -{ - const Char *str; - - template - auto operator()(Args && ... args) const - -> decltype(format(str, std::forward(args)...)) - { - return format(str, std::forward(args)...); - } -}; - -template -struct UdlArg -{ - const Char *str; - - template - NamedArgWithType operator=(T &&value) const - { - return { str, std::forward(value) }; - } -}; - -} // namespace internal - -inline namespace literals -{ - -/** -\rst -C++11 literal equivalent of :func:`fmt::format`. - -**Example**:: - -using namespace fmt::literals; -std::string message = "The answer is {}"_format(42); -\endrst -*/ -inline internal::UdlFormat -operator"" _format(const char *s, std::size_t) -{ - return { s }; -} -inline internal::UdlFormat -operator"" _format(const wchar_t *s, std::size_t) -{ - return { s }; -} - -/** -\rst -C++11 literal equivalent of :func:`fmt::arg`. - -**Example**:: - -using namespace fmt::literals; -print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); -\endrst -*/ -inline internal::UdlArg -operator"" _a(const char *s, std::size_t) -{ - return { s }; -} -inline internal::UdlArg -operator"" _a(const wchar_t *s, std::size_t) -{ - return { s }; -} - -} // inline namespace literals -} // namespace fmt -#endif // FMT_USE_USER_DEFINED_LITERALS - -// Restore warnings. -#if FMT_GCC_VERSION >= 406 -# pragma GCC diagnostic pop -#endif - -#if defined(__clang__) && !defined(FMT_ICC_VERSION) -# pragma clang diagnostic pop -#endif - -#ifdef FMT_HEADER_ONLY -# define FMT_FUNC inline -# include "format.cc" -#else -# define FMT_FUNC -#endif - -#endif // FMT_FORMAT_H_ diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.cc b/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.cc deleted file mode 100644 index 2148f3c178d0950b76911d2e693f959af0571283..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* -Formatting library for C++ - std::ostream support - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#include "ostream.h" - -namespace fmt { - - namespace internal { - FMT_FUNC void write(std::ostream &os, Writer &w) - { - const char *data = w.data(); - typedef internal::MakeUnsigned::Type UnsignedStreamSize; - UnsignedStreamSize size = w.size(); - UnsignedStreamSize max_size = - internal::to_unsigned((std::numeric_limits::max)()); - do { - UnsignedStreamSize n = size <= max_size ? size : max_size; - os.write(data, static_cast(n)); - data += n; - size -= n; - } while (size != 0); - } - } - - FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) - { - MemoryWriter w; - w.write(format_str, args); - internal::write(os, w); - } -} // namespace fmt diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.h b/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.h deleted file mode 100644 index 3bdb375b20405dcd7e076030f46db7ea6dc32ff7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/ostream.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -Formatting library for C++ - std::ostream support - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#ifndef FMT_OSTREAM_H_ -#define FMT_OSTREAM_H_ - -// commented out by spdlog -// #include "format.h" -#include - -namespace fmt -{ - -namespace internal -{ - -template -class FormatBuf: public std::basic_streambuf -{ -private: - typedef typename std::basic_streambuf::int_type int_type; - typedef typename std::basic_streambuf::traits_type traits_type; - - Buffer &buffer_; - Char *start_; - -public: - FormatBuf(Buffer &buffer): buffer_(buffer), start_(&buffer[0]) - { - this->setp(start_, start_ + buffer_.capacity()); - } - - int_type overflow(int_type ch = traits_type::eof()) - { - if (!traits_type::eq_int_type(ch, traits_type::eof())) - { - size_t buf_size = size(); - buffer_.resize(buf_size); - buffer_.reserve(buf_size * 2); - - start_ = &buffer_[0]; - start_[buf_size] = traits_type::to_char_type(ch); - this->setp(start_ + buf_size + 1, start_ + buf_size * 2); - } - return ch; - } - - size_t size() const - { - return to_unsigned(this->pptr() - start_); - } -}; - -Yes &convert(std::ostream &); - -struct DummyStream: std::ostream -{ - DummyStream(); // Suppress a bogus warning in MSVC. - // Hide all operator<< overloads from std::ostream. - void operator<<(Null<>); -}; - -No &operator<<(std::ostream &, int); - -template -struct ConvertToIntImpl -{ - // Convert to int only if T doesn't have an overloaded operator<<. - enum - { - value = sizeof(convert(get() << get())) == sizeof(No) - }; -}; - -// Write the content of w to os. -void write(std::ostream &os, Writer &w); -} // namespace internal - -// Formats a value. -template -void format_arg(BasicFormatter &f, - const Char *&format_str, const T &value) -{ - internal::MemoryBuffer buffer; - - internal::FormatBuf format_buf(buffer); - std::basic_ostream output(&format_buf); - output << value; - - BasicStringRef str(&buffer[0], format_buf.size()); - typedef internal::MakeArg< BasicFormatter > MakeArg; - format_str = f.format(format_str, MakeArg(str)); -} - -/** -\rst -Prints formatted data to the stream *os*. - -**Example**:: - -print(cerr, "Don't {}!", "panic"); -\endrst -*/ -FMT_API void print(std::ostream &os, CStringRef format_str, ArgList args); -FMT_VARIADIC(void, print, std::ostream &, CStringRef) -} // namespace fmt - -#ifdef FMT_HEADER_ONLY -# include "ostream.cc" -#endif - -#endif // FMT_OSTREAM_H_ diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/printf.h b/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/printf.h deleted file mode 100644 index 2b9ddfab0a89176536ae2750ef9f2db07362f558..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/bundled/printf.h +++ /dev/null @@ -1,658 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#ifndef FMT_PRINTF_H_ -#define FMT_PRINTF_H_ - -#include // std::fill_n -#include // std::numeric_limits - -#include "ostream.h" - -namespace fmt -{ -namespace internal -{ - -// Checks if a value fits in int - used to avoid warnings about comparing -// signed and unsigned integers. -template -struct IntChecker -{ - template - static bool fits_in_int(T value) - { - unsigned max = std::numeric_limits::max(); - return value <= max; - } - static bool fits_in_int(bool) - { - return true; - } -}; - -template <> -struct IntChecker -{ - template - static bool fits_in_int(T value) - { - return value >= std::numeric_limits::min() && - value <= std::numeric_limits::max(); - } - static bool fits_in_int(int) - { - return true; - } -}; - -class PrecisionHandler: public ArgVisitor -{ -public: - void report_unhandled_arg() - { - FMT_THROW(FormatError("precision is not integer")); - } - - template - int visit_any_int(T value) - { - if (!IntChecker::is_signed>::fits_in_int(value)) - FMT_THROW(FormatError("number is too big")); - return static_cast(value); - } -}; - -// IsZeroInt::visit(arg) returns true iff arg is a zero integer. -class IsZeroInt: public ArgVisitor -{ -public: - template - bool visit_any_int(T value) - { - return value == 0; - } -}; - -template -struct is_same -{ - enum - { - value = 0 - }; -}; - -template -struct is_same -{ - enum - { - value = 1 - }; -}; - -// An argument visitor that converts an integer argument to T for printf, -// if T is an integral type. If T is void, the argument is converted to -// corresponding signed or unsigned type depending on the type specifier: -// 'd' and 'i' - signed, other - unsigned) -template -class ArgConverter: public ArgVisitor, void> -{ -private: - internal::Arg &arg_; - wchar_t type_; - - FMT_DISALLOW_COPY_AND_ASSIGN(ArgConverter); - -public: - ArgConverter(internal::Arg &arg, wchar_t type) - : arg_(arg), type_(type) - {} - - void visit_bool(bool value) - { - if (type_ != 's') - visit_any_int(value); - } - - template - void visit_any_int(U value) - { - bool is_signed = type_ == 'd' || type_ == 'i'; - using internal::Arg; - typedef typename internal::Conditional< - is_same::value, U, T>::type TargetType; - if (sizeof(TargetType) <= sizeof(int)) - { - // Extra casts are used to silence warnings. - if (is_signed) - { - arg_.type = Arg::INT; - arg_.int_value = static_cast(static_cast(value)); - } - else - { - arg_.type = Arg::UINT; - typedef typename internal::MakeUnsigned::Type Unsigned; - arg_.uint_value = static_cast(static_cast(value)); - } - } - else - { - if (is_signed) - { - arg_.type = Arg::LONG_LONG; - // glibc's printf doesn't sign extend arguments of smaller types: - // std::printf("%lld", -42); // prints "4294967254" - // but we don't have to do the same because it's a UB. - arg_.long_long_value = static_cast(value); - } - else - { - arg_.type = Arg::ULONG_LONG; - arg_.ulong_long_value = - static_cast::Type>(value); - } - } - } -}; - -// Converts an integer argument to char for printf. -class CharConverter: public ArgVisitor -{ -private: - internal::Arg &arg_; - - FMT_DISALLOW_COPY_AND_ASSIGN(CharConverter); - -public: - explicit CharConverter(internal::Arg &arg): arg_(arg) - {} - - template - void visit_any_int(T value) - { - arg_.type = internal::Arg::CHAR; - arg_.int_value = static_cast(value); - } -}; - -// Checks if an argument is a valid printf width specifier and sets -// left alignment if it is negative. -class WidthHandler: public ArgVisitor -{ -private: - FormatSpec &spec_; - - FMT_DISALLOW_COPY_AND_ASSIGN(WidthHandler); - -public: - explicit WidthHandler(FormatSpec &spec): spec_(spec) - {} - - void report_unhandled_arg() - { - FMT_THROW(FormatError("width is not integer")); - } - - template - unsigned visit_any_int(T value) - { - typedef typename internal::IntTraits::MainType UnsignedType; - UnsignedType width = static_cast(value); - if (internal::is_negative(value)) - { - spec_.align_ = ALIGN_LEFT; - width = 0 - width; - } - unsigned int_max = std::numeric_limits::max(); - if (width > int_max) - FMT_THROW(FormatError("number is too big")); - return static_cast(width); - } -}; -} // namespace internal - -/** -\rst -A ``printf`` argument formatter based on the `curiously recurring template -pattern `_. - -To use `~fmt::BasicPrintfArgFormatter` define a subclass that implements some -or all of the visit methods with the same signatures as the methods in -`~fmt::ArgVisitor`, for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. When a formatting -function processes an argument, it will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::BasicPrintfArgFormatter` or its -superclass will be called. -\endrst -*/ -template -class BasicPrintfArgFormatter: public internal::ArgFormatterBase -{ -private: - void write_null_pointer() - { - this->spec().type_ = 0; - this->write("(nil)"); - } - - typedef internal::ArgFormatterBase Base; - -public: - /** - \rst - Constructs an argument formatter object. - *writer* is a reference to the output writer and *spec* contains format - specifier information for standard argument types. - \endrst - */ - BasicPrintfArgFormatter(BasicWriter &w, FormatSpec &s) - : internal::ArgFormatterBase(w, s) - {} - - /** Formats an argument of type ``bool``. */ - void visit_bool(bool value) - { - FormatSpec &fmt_spec = this->spec(); - if (fmt_spec.type_ != 's') - return this->visit_any_int(value); - fmt_spec.type_ = 0; - this->write(value); - } - - /** Formats a character. */ - void visit_char(int value) - { - const FormatSpec &fmt_spec = this->spec(); - BasicWriter &w = this->writer(); - if (fmt_spec.type_ && fmt_spec.type_ != 'c') - w.write_int(value, fmt_spec); - typedef typename BasicWriter::CharPtr CharPtr; - CharPtr out = CharPtr(); - if (fmt_spec.width_ > 1) - { - Char fill = ' '; - out = w.grow_buffer(fmt_spec.width_); - if (fmt_spec.align_ != ALIGN_LEFT) - { - std::fill_n(out, fmt_spec.width_ - 1, fill); - out += fmt_spec.width_ - 1; - } - else - { - std::fill_n(out + 1, fmt_spec.width_ - 1, fill); - } - } - else - { - out = w.grow_buffer(1); - } - *out = static_cast(value); - } - - /** Formats a null-terminated C string. */ - void visit_cstring(const char *value) - { - if (value) - Base::visit_cstring(value); - else if (this->spec().type_ == 'p') - write_null_pointer(); - else - this->write("(null)"); - } - - /** Formats a pointer. */ - void visit_pointer(const void *value) - { - if (value) - return Base::visit_pointer(value); - this->spec().type_ = 0; - write_null_pointer(); - } - - /** Formats an argument of a custom (user-defined) type. */ - void visit_custom(internal::Arg::CustomValue c) - { - BasicFormatter formatter(ArgList(), this->writer()); - const Char format_str[] = { '}', 0 }; - const Char *format = format_str; - c.format(&formatter, c.value, &format); - } -}; - -/** The default printf argument formatter. */ -template -class PrintfArgFormatter - : public BasicPrintfArgFormatter, Char> -{ -public: - /** Constructs an argument formatter object. */ - PrintfArgFormatter(BasicWriter &w, FormatSpec &s) - : BasicPrintfArgFormatter, Char>(w, s) - {} -}; - -/** This template formats data and writes the output to a writer. */ -template > -class PrintfFormatter: private internal::FormatterBase -{ -private: - BasicWriter &writer_; - - void parse_flags(FormatSpec &spec, const Char *&s); - - // Returns the argument with specified index or, if arg_index is equal - // to the maximum unsigned value, the next argument. - internal::Arg get_arg( - const Char *s, - unsigned arg_index = (std::numeric_limits::max)()); - - // Parses argument index, flags and width and returns the argument index. - unsigned parse_header(const Char *&s, FormatSpec &spec); - -public: - /** - \rst - Constructs a ``PrintfFormatter`` object. References to the arguments and - the writer are stored in the formatter object so make sure they have - appropriate lifetimes. - \endrst - */ - explicit PrintfFormatter(const ArgList &al, BasicWriter &w) - : FormatterBase(al), writer_(w) - {} - - /** Formats stored arguments and writes the output to the writer. */ - FMT_API void format(BasicCStringRef format_str); -}; - -template -void PrintfFormatter::parse_flags(FormatSpec &spec, const Char *&s) -{ - for (;;) - { - switch (*s++) - { - case '-': - spec.align_ = ALIGN_LEFT; - break; - case '+': - spec.flags_ |= SIGN_FLAG | PLUS_FLAG; - break; - case '0': - spec.fill_ = '0'; - break; - case ' ': - spec.flags_ |= SIGN_FLAG; - break; - case '#': - spec.flags_ |= HASH_FLAG; - break; - default: - --s; - return; - } - } -} - -template -internal::Arg PrintfFormatter::get_arg(const Char *s, - unsigned arg_index) -{ - (void)s; - const char *error = FMT_NULL; - internal::Arg arg = arg_index == std::numeric_limits::max() ? - next_arg(error) : FormatterBase::get_arg(arg_index - 1, error); - if (error) - FMT_THROW(FormatError(!*s ? "invalid format string" : error)); - return arg; -} - -template -unsigned PrintfFormatter::parse_header( - const Char *&s, FormatSpec &spec) -{ - unsigned arg_index = std::numeric_limits::max(); - Char c = *s; - if (c >= '0' && c <= '9') - { - // Parse an argument index (if followed by '$') or a width possibly - // preceded with '0' flag(s). - unsigned value = internal::parse_nonnegative_int(s); - if (*s == '$') // value is an argument index - { - ++s; - arg_index = value; - } - else - { - if (c == '0') - spec.fill_ = '0'; - if (value != 0) - { - // Nonzero value means that we parsed width and don't need to - // parse it or flags again, so return now. - spec.width_ = value; - return arg_index; - } - } - } - parse_flags(spec, s); - // Parse width. - if (*s >= '0' && *s <= '9') - { - spec.width_ = internal::parse_nonnegative_int(s); - } - else if (*s == '*') - { - ++s; - spec.width_ = internal::WidthHandler(spec).visit(get_arg(s)); - } - return arg_index; -} - -template -void PrintfFormatter::format(BasicCStringRef format_str) -{ - const Char *start = format_str.c_str(); - const Char *s = start; - while (*s) - { - Char c = *s++; - if (c != '%') continue; - if (*s == c) - { - write(writer_, start, s); - start = ++s; - continue; - } - write(writer_, start, s - 1); - - FormatSpec spec; - spec.align_ = ALIGN_RIGHT; - - // Parse argument index, flags and width. - unsigned arg_index = parse_header(s, spec); - - // Parse precision. - if (*s == '.') - { - ++s; - if ('0' <= *s && *s <= '9') - { - spec.precision_ = static_cast(internal::parse_nonnegative_int(s)); - } - else if (*s == '*') - { - ++s; - spec.precision_ = internal::PrecisionHandler().visit(get_arg(s)); - } - } - - using internal::Arg; - Arg arg = get_arg(s, arg_index); - if (spec.flag(HASH_FLAG) && internal::IsZeroInt().visit(arg)) - spec.flags_ &= ~internal::to_unsigned(HASH_FLAG); - if (spec.fill_ == '0') - { - if (arg.type <= Arg::LAST_NUMERIC_TYPE) - spec.align_ = ALIGN_NUMERIC; - else - spec.fill_ = ' '; // Ignore '0' flag for non-numeric types. - } - - // Parse length and convert the argument to the required type. - using internal::ArgConverter; - switch (*s++) - { - case 'h': - if (*s == 'h') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'l': - if (*s == 'l') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'j': - ArgConverter(arg, *s).visit(arg); - break; - case 'z': - ArgConverter(arg, *s).visit(arg); - break; - case 't': - ArgConverter(arg, *s).visit(arg); - break; - case 'L': - // printf produces garbage when 'L' is omitted for long double, no - // need to do the same. - break; - default: - --s; - ArgConverter(arg, *s).visit(arg); - } - - // Parse type. - if (!*s) - FMT_THROW(FormatError("invalid format string")); - spec.type_ = static_cast(*s++); - if (arg.type <= Arg::LAST_INTEGER_TYPE) - { - // Normalize type. - switch (spec.type_) - { - case 'i': - case 'u': - spec.type_ = 'd'; - break; - case 'c': - // TODO: handle wchar_t - internal::CharConverter(arg).visit(arg); - break; - } - } - - start = s; - - // Format argument. - AF(writer_, spec).visit(arg); - } - write(writer_, start, s); -} - -template -void printf(BasicWriter &w, BasicCStringRef format, ArgList args) -{ - PrintfFormatter(args, w).format(format); -} - -/** -\rst -Formats arguments and returns the result as a string. - -**Example**:: - -std::string message = fmt::sprintf("The answer is %d", 42); -\endrst -*/ -inline std::string sprintf(CStringRef format, ArgList args) -{ - MemoryWriter w; - printf(w, format, args); - return w.str(); -} -FMT_VARIADIC(std::string, sprintf, CStringRef) - -inline std::wstring sprintf(WCStringRef format, ArgList args) -{ - WMemoryWriter w; - printf(w, format, args); - return w.str(); -} -FMT_VARIADIC_W(std::wstring, sprintf, WCStringRef) - -/** -\rst -Prints formatted data to the file *f*. - -**Example**:: - -fmt::fprintf(stderr, "Don't %s!", "panic"); -\endrst -*/ -FMT_API int fprintf(std::FILE *f, CStringRef format, ArgList args); -FMT_VARIADIC(int, fprintf, std::FILE *, CStringRef) - -/** -\rst -Prints formatted data to ``stdout``. - -**Example**:: - -fmt::printf("Elapsed time: %.2f seconds", 1.23); -\endrst -*/ -inline int printf(CStringRef format, ArgList args) -{ - return fprintf(stdout, format, args); -} -FMT_VARIADIC(int, printf, CStringRef) - -/** -\rst -Prints formatted data to the stream *os*. - -**Example**:: - -fprintf(cerr, "Don't %s!", "panic"); -\endrst -*/ -inline int fprintf(std::ostream &os, CStringRef format_str, ArgList args) -{ - MemoryWriter w; - printf(w, format_str, args); - internal::write(os, w); - return static_cast(w.size()); -} -FMT_VARIADIC(int, fprintf, std::ostream &, CStringRef) -} // namespace fmt - -#ifdef FMT_HEADER_ONLY -# include "printf.cc" -#endif - -#endif // FMT_PRINTF_H_ diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/fmt.h b/archive_old_fs_versions/fs/include/spdlog/fmt/fmt.h deleted file mode 100644 index dd035fd294b9e34e00083de5330849505415adb3..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/fmt.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright(c) 2016 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// -// Include a bundled header-only copy of fmtlib or an external one. -// By default spdlog include its own copy. -// - -#if !defined(SPDLOG_FMT_EXTERNAL) - -#ifndef FMT_HEADER_ONLY -#define FMT_HEADER_ONLY -#endif -#ifndef FMT_USE_WINDOWS_H -#define FMT_USE_WINDOWS_H 0 -#endif -#include - -#else //external fmtlib - -#include - -#endif - diff --git a/archive_old_fs_versions/fs/include/spdlog/fmt/ostr.h b/archive_old_fs_versions/fs/include/spdlog/fmt/ostr.h deleted file mode 100644 index 7a6518654785a1ada24d87b62a841737a4fb3c05..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/fmt/ostr.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// Copyright(c) 2016 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// include external or bundled copy of fmtlib's ostream support -// -#if !defined(SPDLOG_FMT_EXTERNAL) -#include -#include -#else -#include -#endif - - diff --git a/archive_old_fs_versions/fs/include/spdlog/formatter.h b/archive_old_fs_versions/fs/include/spdlog/formatter.h deleted file mode 100644 index 0ffcec03e05856215227bd5e388aa5adafa6e2e0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/formatter.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include - -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -class flag_formatter; -} - -class formatter -{ -public: - virtual ~formatter() {} - virtual void format(details::log_msg& msg) = 0; -}; - -class pattern_formatter : public formatter -{ - -public: - explicit pattern_formatter(const std::string& pattern); - pattern_formatter(const pattern_formatter&) = delete; - pattern_formatter& operator=(const pattern_formatter&) = delete; - void format(details::log_msg& msg) override; -private: - const std::string _pattern; - std::vector> _formatters; - void handle_flag(char flag); - void compile_pattern(const std::string& pattern); -}; -} - -#include - diff --git a/archive_old_fs_versions/fs/include/spdlog/logger.h b/archive_old_fs_versions/fs/include/spdlog/logger.h deleted file mode 100644 index a2deb51dfe1ff662c882fec0e708eea09650f5e0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/logger.h +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Thread safe logger (except for set_pattern(..), set_formatter(..) and set_error_handler()) -// Has name, log level, vector of std::shared sink pointers and formatter -// Upon each log write the logger: -// 1. Checks if its log level is enough to log the message -// 2. Format the message using the formatter function -// 3. Pass the formatted message to its sinks to performa the actual logging - -#include -#include - -#include -#include -#include - -namespace spdlog -{ - -class logger -{ -public: - logger(const std::string& logger_name, sink_ptr single_sink); - logger(const std::string& name, sinks_init_list); - template - logger(const std::string& name, const It& begin, const It& end); - - virtual ~logger(); - logger(const logger&) = delete; - logger& operator=(const logger&) = delete; - - - template void log(level::level_enum lvl, const char* fmt, const Args&... args); - template void log(level::level_enum lvl, const char* msg); - template void trace(const char* fmt, const Args&... args); - template void debug(const char* fmt, const Args&... args); - template void info(const char* fmt, const Args&... args); - template void warn(const char* fmt, const Args&... args); - template void error(const char* fmt, const Args&... args); - template void critical(const char* fmt, const Args&... args); - - template void log(level::level_enum lvl, const T&); - template void trace(const T&); - template void debug(const T&); - template void info(const T&); - template void warn(const T&); - template void error(const T&); - template void critical(const T&); - - bool should_log(level::level_enum) const; - void set_level(level::level_enum); - level::level_enum level() const; - const std::string& name() const; - void set_pattern(const std::string&); - void set_formatter(formatter_ptr); - - // error handler - void set_error_handler(log_err_handler); - log_err_handler error_handler(); - - // automatically call flush() if message level >= log_level - void flush_on(level::level_enum log_level); - - virtual void flush(); - - const std::vector& sinks() const; - -protected: - virtual void _sink_it(details::log_msg&); - virtual void _set_pattern(const std::string&); - virtual void _set_formatter(formatter_ptr); - - // default error handler: print the error to stderr with the max rate of 1 message/minute - virtual void _default_err_handler(const std::string &msg); - - // return true if the given message level should trigger a flush - bool _should_flush_on(const details::log_msg&); - - const std::string _name; - std::vector _sinks; - formatter_ptr _formatter; - spdlog::level_t _level; - spdlog::level_t _flush_level; - log_err_handler _err_handler; - std::atomic _last_err_time; -}; -} - -#include diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/android_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/android_sink.h deleted file mode 100644 index d8c97e03b31bba2496a10ab1b4b34e44cb7d9c5e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/android_sink.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#if defined(__ANDROID__) - -#include - -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -/* -* Android sink (logging using __android_log_write) -* __android_log_write is thread-safe. No lock is needed. -*/ -class android_sink : public sink -{ -public: - explicit android_sink(const std::string& tag = "spdlog"): _tag(tag) {} - - void log(const details::log_msg& msg) override - { - const android_LogPriority priority = convert_to_android(msg.level); - // See system/core/liblog/logger_write.c for explanation of return value - const int ret = __android_log_write( - priority, _tag.c_str(), msg.formatted.c_str() - ); - if (ret < 0) - { - throw spdlog_ex("__android_log_write() failed", ret); - } - } - - void flush() override - { - } - -private: - static android_LogPriority convert_to_android(spdlog::level::level_enum level) - { - switch(level) - { - case spdlog::level::trace: - return ANDROID_LOG_VERBOSE; - case spdlog::level::debug: - return ANDROID_LOG_DEBUG; - case spdlog::level::info: - return ANDROID_LOG_INFO; - case spdlog::level::warn: - return ANDROID_LOG_WARN; - case spdlog::level::err: - return ANDROID_LOG_ERROR; - case spdlog::level::critical: - return ANDROID_LOG_FATAL; - default: - return ANDROID_LOG_DEFAULT; - } - } - - std::string _tag; -}; - -} -} - -#endif diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/ansicolor_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/ansicolor_sink.h deleted file mode 100644 index 96e10148e1861a6e32aa4fdf21e52c2ba20b2ec4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/ansicolor_sink.h +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright(c) 2016 Kevin M. Godby (a modified version by spdlog). -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -/** - * @brief The ansi_color_sink is a decorator around another sink and prefixes - * the output with an ANSI escape sequence color code depending on the severity - * of the message. - */ -class ansicolor_sink : public sink -{ -public: - ansicolor_sink(sink_ptr wrapped_sink); - virtual ~ansicolor_sink(); - - ansicolor_sink(const ansicolor_sink& other) = delete; - ansicolor_sink& operator=(const ansicolor_sink& other) = delete; - - virtual void log(const details::log_msg& msg) override; - virtual void flush() override; - - void set_color(level::level_enum color_level, const std::string& color); - - /// Formatting codes - const std::string reset = "\033[00m"; - const std::string bold = "\033[1m"; - const std::string dark = "\033[2m"; - const std::string underline = "\033[4m"; - const std::string blink = "\033[5m"; - const std::string reverse = "\033[7m"; - const std::string concealed = "\033[8m"; - - // Foreground colors - const std::string grey = "\033[30m"; - const std::string red = "\033[31m"; - const std::string green = "\033[32m"; - const std::string yellow = "\033[33m"; - const std::string blue = "\033[34m"; - const std::string magenta = "\033[35m"; - const std::string cyan = "\033[36m"; - const std::string white = "\033[37m"; - - /// Background colors - const std::string on_grey = "\033[40m"; - const std::string on_red = "\033[41m"; - const std::string on_green = "\033[42m"; - const std::string on_yellow = "\033[43m"; - const std::string on_blue = "\033[44m"; - const std::string on_magenta = "\033[45m"; - const std::string on_cyan = "\033[46m"; - const std::string on_white = "\033[47m"; - - -protected: - sink_ptr sink_; - std::map colors_; -}; - -inline ansicolor_sink::ansicolor_sink(sink_ptr wrapped_sink) : sink_(wrapped_sink) -{ - colors_[level::trace] = cyan; - colors_[level::debug] = cyan; - colors_[level::info] = bold; - colors_[level::warn] = yellow + bold; - colors_[level::err] = red + bold; - colors_[level::critical] = bold + on_red; - colors_[level::off] = reset; -} - -inline void ansicolor_sink::log(const details::log_msg& msg) -{ - // Wrap the originally formatted message in color codes - const std::string& prefix = colors_[msg.level]; - const std::string& s = msg.formatted.str(); - const std::string& suffix = reset; - details::log_msg m; - m.level = msg.level; - m.logger_name = msg.logger_name; - m.time = msg.time; - m.thread_id = msg.thread_id; - m.formatted << prefix << s << suffix; - sink_->log(m); -} - -inline void ansicolor_sink::flush() -{ - sink_->flush(); -} - -inline void ansicolor_sink::set_color(level::level_enum color_level, const std::string& color) -{ - colors_[color_level] = color; -} - -inline ansicolor_sink::~ansicolor_sink() -{ - flush(); -} - -} // namespace sinks -} // namespace spdlog - diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/base_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/base_sink.h deleted file mode 100644 index 7f1a31dbd0cb030c76c6101dcea083e337f9d97d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/base_sink.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once -// -// base sink templated over a mutex (either dummy or realy) -// concrete implementation should only overrid the _sink_it method. -// all locking is taken care of here so no locking needed by the implementers.. -// - -#include -#include -#include -#include - -#include - -namespace spdlog -{ -namespace sinks -{ -template -class base_sink:public sink -{ -public: - base_sink():_mutex() {} - virtual ~base_sink() = default; - - base_sink(const base_sink&) = delete; - base_sink& operator=(const base_sink&) = delete; - - void log(const details::log_msg& msg) override - { - std::lock_guard lock(_mutex); - _sink_it(msg); - } - -protected: - virtual void _sink_it(const details::log_msg& msg) = 0; - Mutex _mutex; -}; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/dist_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/dist_sink.h deleted file mode 100644 index cef08bfb4062c4f1631083962d325be60a5a17d8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/dist_sink.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) 2015 David Schury, Gabi Melman -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -// Distribution sink (mux). Stores a vector of sinks which get called when log is called - -namespace spdlog -{ -namespace sinks -{ -template -class dist_sink: public base_sink -{ -public: - explicit dist_sink() :_sinks() {} - dist_sink(const dist_sink&) = delete; - dist_sink& operator=(const dist_sink&) = delete; - virtual ~dist_sink() = default; - -protected: - std::vector> _sinks; - - void _sink_it(const details::log_msg& msg) override - { - for (auto &sink : _sinks) - { - if( sink->should_log( msg.level)) - { - sink->log(msg); - } - } - } - -public: - void flush() override - { - std::lock_guard lock(base_sink::_mutex); - for (auto &sink : _sinks) - sink->flush(); - } - - void add_sink(std::shared_ptr sink) - { - std::lock_guard lock(base_sink::_mutex); - _sinks.push_back(sink); - } - - void remove_sink(std::shared_ptr sink) - { - std::lock_guard lock(base_sink::_mutex); - _sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end()); - } -}; - -typedef dist_sink dist_sink_mt; -typedef dist_sink dist_sink_st; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/file_sinks.h b/archive_old_fs_versions/fs/include/spdlog/sinks/file_sinks.h deleted file mode 100644 index 721a96df0fbf39233fc33dd75ab3af5737dafa47..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/file_sinks.h +++ /dev/null @@ -1,239 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* - * Trivial file sink with single file as target - */ -template -class simple_file_sink : public base_sink < Mutex > -{ -public: - explicit simple_file_sink(const filename_t &filename, bool truncate = false):_force_flush(false) - { - _file_helper.open(filename, truncate); - } - void flush() override - { - _file_helper.flush(); - } - void set_force_flush(bool force_flush) - { - _force_flush = force_flush; - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - _file_helper.write(msg); - if(_force_flush) - _file_helper.flush(); - } -private: - details::file_helper _file_helper; - bool _force_flush; -}; - -typedef simple_file_sink simple_file_sink_mt; -typedef simple_file_sink simple_file_sink_st; - -/* - * Rotating file sink based on size - */ -template -class rotating_file_sink : public base_sink < Mutex > -{ -public: - rotating_file_sink(const filename_t &base_filename, - std::size_t max_size, std::size_t max_files) : - _base_filename(base_filename), - _max_size(max_size), - _max_files(max_files), - _current_size(0), - _file_helper() - { - _file_helper.open(calc_filename(_base_filename, 0)); - _current_size = _file_helper.size(); //expensive. called only once - } - - void flush() override - { - _file_helper.flush(); - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - _current_size += msg.formatted.size(); - if (_current_size > _max_size) - { - _rotate(); - _current_size = msg.formatted.size(); - } - _file_helper.write(msg); - } - -private: - static filename_t calc_filename(const filename_t& filename, std::size_t index) - { - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - if (index) - w.write(SPDLOG_FILENAME_T("{}.{}"), filename, index); - else - w.write(SPDLOG_FILENAME_T("{}"), filename); - return w.str(); - } - - // Rotate files: - // log.txt -> log.txt.1 - // log.txt.1 -> log.txt.2 - // log.txt.2 -> log.txt.3 - // lo3.txt.3 -> delete - - void _rotate() - { - using details::os::filename_to_str; - _file_helper.close(); - for (auto i = _max_files; i > 0; --i) - { - filename_t src = calc_filename(_base_filename, i - 1); - filename_t target = calc_filename(_base_filename, i); - - if (details::file_helper::file_exists(target)) - { - if (details::os::remove(target) != 0) - { - throw spdlog_ex("rotating_file_sink: failed removing " + filename_to_str(target), errno); - } - } - if (details::file_helper::file_exists(src) && details::os::rename(src, target)) - { - throw spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno); - } - } - _file_helper.reopen(true); - } - filename_t _base_filename; - std::size_t _max_size; - std::size_t _max_files; - std::size_t _current_size; - details::file_helper _file_helper; -}; - -typedef rotating_file_sink rotating_file_sink_mt; -typedef rotating_file_sinkrotating_file_sink_st; - -/* - * Default generator of daily log file names. - */ -struct default_daily_file_name_calculator -{ - // Create filename for the form basename.YYYY-MM-DD_hh-mm - static filename_t calc_filename(const filename_t& basename) - { - std::tm tm = spdlog::details::os::localtime(); - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - w.write(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}"), basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); - return w.str(); - } -}; - -/* - * Generator of daily log file names in format basename.YYYY-MM-DD - */ -struct dateonly_daily_file_name_calculator -{ - // Create filename for the form basename.YYYY-MM-DD - static filename_t calc_filename(const filename_t& basename) - { - std::tm tm = spdlog::details::os::localtime(); - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - w.write(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}"), basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); - return w.str(); - } -}; - -/* - * Rotating file sink based on date. rotates at midnight - */ -template -class daily_file_sink :public base_sink < Mutex > -{ -public: - //create daily file sink which rotates on given time - daily_file_sink( - const filename_t& base_filename, - int rotation_hour, - int rotation_minute) : _base_filename(base_filename), - _rotation_h(rotation_hour), - _rotation_m(rotation_minute) - { - if (rotation_hour < 0 || rotation_hour > 23 || rotation_minute < 0 || rotation_minute > 59) - throw spdlog_ex("daily_file_sink: Invalid rotation time in ctor"); - _rotation_tp = _next_rotation_tp(); - _file_helper.open(FileNameCalc::calc_filename(_base_filename)); - } - - void flush() override - { - _file_helper.flush(); - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - if (std::chrono::system_clock::now() >= _rotation_tp) - { - _file_helper.open(FileNameCalc::calc_filename(_base_filename)); - _rotation_tp = _next_rotation_tp(); - } - _file_helper.write(msg); - } - -private: - std::chrono::system_clock::time_point _next_rotation_tp() - { - auto now = std::chrono::system_clock::now(); - time_t tnow = std::chrono::system_clock::to_time_t(now); - tm date = spdlog::details::os::localtime(tnow); - date.tm_hour = _rotation_h; - date.tm_min = _rotation_m; - date.tm_sec = 0; - auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date)); - if (rotation_time > now) - return rotation_time; - else - return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24)); - } - - filename_t _base_filename; - int _rotation_h; - int _rotation_m; - std::chrono::system_clock::time_point _rotation_tp; - details::file_helper _file_helper; -}; - -typedef daily_file_sink daily_file_sink_mt; -typedef daily_file_sink daily_file_sink_st; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/msvc_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/msvc_sink.h deleted file mode 100644 index 16342ca26435c8aab8dce40a241995f1ea986762..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/msvc_sink.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright(c) 2016 Alexander Dalshov. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#if defined(_MSC_VER) - -#include -#include - -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* -* MSVC sink (logging using OutputDebugStringA) -*/ -template -class msvc_sink : public base_sink < Mutex > -{ -public: - explicit msvc_sink() - { - } - - void flush() override - { - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - OutputDebugStringA(msg.formatted.c_str()); - } -}; - -typedef msvc_sink msvc_sink_mt; -typedef msvc_sink msvc_sink_st; - -} -} - -#endif diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/null_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/null_sink.h deleted file mode 100644 index 1d427aa2af465ae15cbca6c31f31ba5c900a532a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/null_sink.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include - -namespace spdlog -{ -namespace sinks -{ - -template -class null_sink : public base_sink < Mutex > -{ -protected: - void _sink_it(const details::log_msg&) override - {} - - void flush() override - {} - -}; -typedef null_sink null_sink_st; -typedef null_sink null_sink_mt; - -} -} - diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/ostream_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/ostream_sink.h deleted file mode 100644 index feb5efa18dd17e91b3add638a30bccd6112f49e9..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/ostream_sink.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ -template -class ostream_sink: public base_sink -{ -public: - explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {} - ostream_sink(const ostream_sink&) = delete; - ostream_sink& operator=(const ostream_sink&) = delete; - virtual ~ostream_sink() = default; - -protected: - void _sink_it(const details::log_msg& msg) override - { - _ostream.write(msg.formatted.data(), msg.formatted.size()); - if (_force_flush) - _ostream.flush(); - } - - void flush() override - { - _ostream.flush(); - } - - std::ostream& _ostream; - bool _force_flush; -}; - -typedef ostream_sink ostream_sink_mt; -typedef ostream_sink ostream_sink_st; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/sink.h deleted file mode 100644 index b48dd8b9d1a3ca80d32a8b46d30dcc6207ac8450..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/sink.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - - -#pragma once - -#include - -namespace spdlog -{ -namespace sinks -{ -class sink -{ -public: - sink() - { - _level = level::trace; - } - - virtual ~sink() {} - virtual void log(const details::log_msg& msg) = 0; - virtual void flush() = 0; - - bool should_log(level::level_enum msg_level) const; - void set_level(level::level_enum log_level); - level::level_enum level() const; - -private: - level_t _level; - -}; - -inline bool sink::should_log(level::level_enum msg_level) const -{ - return msg_level >= _level.load(std::memory_order_relaxed); -} - -inline void sink::set_level(level::level_enum log_level) -{ - _level.store(log_level); -} - -inline level::level_enum sink::level() const -{ - return static_cast(_level.load(std::memory_order_relaxed)); -} - -} -} - diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/stdout_sinks.h b/archive_old_fs_versions/fs/include/spdlog/sinks/stdout_sinks.h deleted file mode 100644 index c05f80dd12846713f751d53fbb55ee3817ad6024..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/stdout_sinks.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -template -class stdout_sink: public base_sink -{ - using MyType = stdout_sink; -public: - stdout_sink() - {} - static std::shared_ptr instance() - { - static std::shared_ptr instance = std::make_shared(); - return instance; - } - - void _sink_it(const details::log_msg& msg) override - { - fwrite(msg.formatted.data(), sizeof(char), msg.formatted.size(), stdout); - flush(); - } - - void flush() override - { - fflush(stdout); - } -}; - -typedef stdout_sink stdout_sink_st; -typedef stdout_sink stdout_sink_mt; - - -template -class stderr_sink: public base_sink -{ - using MyType = stderr_sink; -public: - stderr_sink() - {} - static std::shared_ptr instance() - { - static std::shared_ptr instance = std::make_shared(); - return instance; - } - - void _sink_it(const details::log_msg& msg) override - { - fwrite(msg.formatted.data(), sizeof(char), msg.formatted.size(), stderr); - flush(); - } - - void flush() override - { - fflush(stderr); - } -}; - -typedef stderr_sink stderr_sink_mt; -typedef stderr_sink stderr_sink_st; -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/syslog_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/syslog_sink.h deleted file mode 100644 index 0d8633c5e72a1dd8bdd63e5f490071abd8b8d4be..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/syslog_sink.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include - -#ifdef SPDLOG_ENABLE_SYSLOG - -#include -#include - -#include -#include -#include - - -namespace spdlog -{ -namespace sinks -{ -/** - * Sink that write to syslog using the `syscall()` library call. - * - * Locking is not needed, as `syslog()` itself is thread-safe. - */ -class syslog_sink : public sink -{ -public: - // - syslog_sink(const std::string& ident = "", int syslog_option=0, int syslog_facility=LOG_USER): - _ident(ident) - { - _priorities[static_cast(level::trace)] = LOG_DEBUG; - _priorities[static_cast(level::debug)] = LOG_DEBUG; - _priorities[static_cast(level::info)] = LOG_INFO; - _priorities[static_cast(level::warn)] = LOG_WARNING; - _priorities[static_cast(level::err)] = LOG_ERR; - _priorities[static_cast(level::critical)] = LOG_CRIT; - _priorities[static_cast(level::off)] = LOG_INFO; - - //set ident to be program name if empty - ::openlog(_ident.empty()? nullptr:_ident.c_str(), syslog_option, syslog_facility); - } - ~syslog_sink() - { - ::closelog(); - } - - syslog_sink(const syslog_sink&) = delete; - syslog_sink& operator=(const syslog_sink&) = delete; - - void log(const details::log_msg &msg) override - { - ::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str()); - } - - void flush() override - { - } - - -private: - std::array _priorities; - //must store the ident because the man says openlog might use the pointer as is and not a string copy - const std::string _ident; - - // - // Simply maps spdlog's log level to syslog priority level. - // - int syslog_prio_from_level(const details::log_msg &msg) const - { - return _priorities[static_cast(msg.level)]; - } -}; -} -} - -#endif diff --git a/archive_old_fs_versions/fs/include/spdlog/sinks/wincolor_sink.h b/archive_old_fs_versions/fs/include/spdlog/sinks/wincolor_sink.h deleted file mode 100644 index 63ecbe2175ac66a5f9425fa603f57d817000edf5..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/sinks/wincolor_sink.h +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright(c) 2016 spdlog -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* - * Windows color console sink. Uses WriteConsoleA to write to the console with colors - */ -template -class wincolor_sink: public base_sink -{ -public: - const WORD BOLD = FOREGROUND_INTENSITY; - const WORD RED = FOREGROUND_RED; - const WORD CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD WHITE = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD YELLOW = FOREGROUND_RED | FOREGROUND_GREEN; - - wincolor_sink(HANDLE std_handle): out_handle_(std_handle) - { - colors_[level::trace] = CYAN; - colors_[level::debug] = CYAN; - colors_[level::info] = WHITE | BOLD; - colors_[level::warn] = YELLOW | BOLD; - colors_[level::err] = RED | BOLD; // red bold - colors_[level::critical] = BACKGROUND_RED | WHITE | BOLD; // white bold on red background - colors_[level::off] = 0; - } - - virtual ~wincolor_sink() - { - flush(); - } - - wincolor_sink(const wincolor_sink& other) = delete; - wincolor_sink& operator=(const wincolor_sink& other) = delete; - - virtual void _sink_it(const details::log_msg& msg) override - { - auto color = colors_[msg.level]; - auto orig_attribs = set_console_attribs(color); - WriteConsoleA(out_handle_, msg.formatted.data(), static_cast(msg.formatted.size()), nullptr, nullptr); - SetConsoleTextAttribute(out_handle_, orig_attribs); //reset to orig colors - } - - virtual void flush() override - { - // windows console always flushed? - } - - // change the color for the given level - void set_color(level::level_enum level, WORD color) - { - std::lock_guard lock(base_sink::_mutex); - colors_[level] = color; - } - -private: - HANDLE out_handle_; - std::map colors_; - - // set color and return the orig console attributes (for resetting later) - WORD set_console_attribs(WORD attribs) - { - CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info; - GetConsoleScreenBufferInfo(out_handle_, &orig_buffer_info); - SetConsoleTextAttribute(out_handle_, attribs); - return orig_buffer_info.wAttributes; //return orig attribs - } -}; - -// -// windows color console to stdout -// -template -class wincolor_stdout_sink: public wincolor_sink -{ -public: - wincolor_stdout_sink() : wincolor_sink(GetStdHandle(STD_OUTPUT_HANDLE)) - {} -}; - -typedef wincolor_stdout_sink wincolor_stdout_sink_mt; -typedef wincolor_stdout_sink wincolor_stdout_sink_st; - -// -// windows color console to stderr -// -template -class wincolor_stderr_sink: public wincolor_sink -{ -public: - wincolor_stderr_sink() : wincolor_sink(GetStdHandle(STD_ERROR_HANDLE)) - {} -}; - -typedef wincolor_stderr_sink wincolor_stderr_sink_mt; -typedef wincolor_stderr_sink wincolor_stderr_sink_st; - -} -} diff --git a/archive_old_fs_versions/fs/include/spdlog/spdlog.h b/archive_old_fs_versions/fs/include/spdlog/spdlog.h deleted file mode 100644 index a505b0031fd1493c83fbcdf4713266a07f34288a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/spdlog.h +++ /dev/null @@ -1,178 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// -// spdlog main header file. -// see example.cpp for usage example - -#pragma once - -#define SPDLOG_VERSION "0.12.0" - -#include -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ - -// -// Return an existing logger or nullptr if a logger with such name doesn't exist. -// example: spdlog::get("my_logger")->info("hello {}", "world"); -// -std::shared_ptr get(const std::string& name); - - -// -// Set global formatting -// example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v"); -// -void set_pattern(const std::string& format_string); -void set_formatter(formatter_ptr f); - -// -// Set global logging level for -// -void set_level(level::level_enum log_level); - -// -// Set global error handler -// -void set_error_handler(log_err_handler); - -// -// Turn on async mode (off by default) and set the queue size for each async_logger. -// effective only for loggers created after this call. -// queue_size: size of queue (must be power of 2): -// Each logger will pre-allocate a dedicated queue with queue_size entries upon construction. -// -// async_overflow_policy (optional, block_retry by default): -// async_overflow_policy::block_retry - if queue is full, block until queue has room for the new log entry. -// async_overflow_policy::discard_log_msg - never block and discard any new messages when queue overflows. -// -// worker_warmup_cb (optional): -// callback function that will be called in worker thread upon start (can be used to init stuff like thread affinity) -// -// worker_teardown_cb (optional): -// callback function that will be called in worker thread upon exit -// -void set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function& worker_teardown_cb = nullptr); - -// Turn off async mode -void set_sync_mode(); - - -// -// Create and register multi/single threaded basic file logger. -// Basic logger simply writes to given file without any limitatons or rotations. -// -std::shared_ptr basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate = false); -std::shared_ptr basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate = false); - -// -// Create and register multi/single threaded rotating file logger -// -std::shared_ptr rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files); -std::shared_ptr rotating_logger_st(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files); - -// -// Create file logger which creates new file on the given time (default in midnight): -// -std::shared_ptr daily_logger_mt(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0); -std::shared_ptr daily_logger_st(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0); - -// -// Create and register stdout/stderr loggers -// -std::shared_ptr stdout_logger_mt(const std::string& logger_name); -std::shared_ptr stdout_logger_st(const std::string& logger_name); -std::shared_ptr stderr_logger_mt(const std::string& logger_name); -std::shared_ptr stderr_logger_st(const std::string& logger_name); -// -// Create and register colored stdout/stderr loggers -// -std::shared_ptr stdout_color_mt(const std::string& logger_name); -std::shared_ptr stdout_color_st(const std::string& logger_name); -std::shared_ptr stderr_color_mt(const std::string& logger_name); -std::shared_ptr stderr_color_st(const std::string& logger_name); - - -// -// Create and register a syslog logger -// -#ifdef SPDLOG_ENABLE_SYSLOG -std::shared_ptr syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0); -#endif - -#if defined(__ANDROID__) -std::shared_ptr android_logger(const std::string& logger_name, const std::string& tag = "spdlog"); -#endif - -// Create and register a logger a single sink -std::shared_ptr create(const std::string& logger_name, const sink_ptr& sink); - -// Create and register a logger with multiple sinks -std::shared_ptr create(const std::string& logger_name, sinks_init_list sinks); -template -std::shared_ptr create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end); - - -// Create and register a logger with templated sink type -// Example: -// spdlog::create("mylog", "dailylog_filename"); -template -std::shared_ptr create(const std::string& logger_name, Args...); - - -// Register the given logger with the given name -void register_logger(std::shared_ptr logger); - -// Apply a user defined function on all registered loggers -// Example: -// spdlog::apply_all([&](std::shared_ptr l) {l->flush();}); -void apply_all(std::function)> fun); - -// Drop the reference to the given logger -void drop(const std::string &name); - -// Drop all references from the registry -void drop_all(); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Trace & Debug can be switched on/off at compile time for zero cost debug statements. -// Uncomment SPDLOG_DEBUG_ON/SPDLOG_TRACE_ON in teakme.h to enable. -// SPDLOG_TRACE(..) will also print current file and line. -// -// Example: -// spdlog::set_level(spdlog::level::trace); -// SPDLOG_TRACE(my_logger, "some trace message"); -// SPDLOG_TRACE(my_logger, "another trace message {} {}", 1, 2); -// SPDLOG_DEBUG(my_logger, "some debug message {} {}", 3, 4); -/////////////////////////////////////////////////////////////////////////////// - -#ifdef SPDLOG_TRACE_ON -#define SPDLOG_STR_H(x) #x -#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x) -#define SPDLOG_TRACE(logger, ...) logger->trace("[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__) -#else -#define SPDLOG_TRACE(logger, ...) -#endif - -#ifdef SPDLOG_DEBUG_ON -#define SPDLOG_DEBUG(logger, ...) logger->debug(__VA_ARGS__) -#else -#define SPDLOG_DEBUG(logger, ...) -#endif - - -} - - -#include diff --git a/archive_old_fs_versions/fs/include/spdlog/tweakme.h b/archive_old_fs_versions/fs/include/spdlog/tweakme.h deleted file mode 100644 index 86f66b9e0901cedf9c4c2048135950fa392cd8b2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/include/spdlog/tweakme.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -/////////////////////////////////////////////////////////////////////////////// -// -// Edit this file to squeeze more performance, and to customize supported features -// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used. -// This clock is less accurate - can be off by dozens of millis - depending on the kernel HZ. -// Uncomment to use it instead of the regular clock. -// -// #define SPDLOG_CLOCK_COARSE -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if date/time logging is not needed and never appear in the log pattern. -// This will prevent spdlog from quering the clock on each log call. -// -// WARNING: If the log pattern contains any date/time while this flag is on, the result is undefined. -// You must set new pattern(spdlog::set_pattern(..") without any date/time in it -// -// #define SPDLOG_NO_DATETIME -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if thread id logging is not needed (i.e. no %t in the log pattern). -// This will prevent spdlog from quering the thread id on each log call. -// -// WARNING: If the log pattern contains thread id (i.e, %t) while this flag is on, the result is undefined. -// -// #define SPDLOG_NO_THREAD_ID -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if logger name logging is not needed. -// This will prevent spdlog from copying the logger name on each log call. -// -// #define SPDLOG_NO_NAME -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros. -// -// #define SPDLOG_DEBUG_ON -// #define SPDLOG_TRACE_ON -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to avoid locking in the registry operations (spdlog::get(), spdlog::drop() spdlog::register()). -// Use only if your code never modifes concurrently the registry. -// Note that upon creating a logger the registry is modified by spdlog.. -// -// #define SPDLOG_NO_REGISTRY_MUTEX -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to avoid spdlog's usage of atomic log levels -// Use only if your code never modifies a logger's log levels concurrently by different threads. -// -// #define SPDLOG_NO_ATOMIC_LEVELS -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable usage of wchar_t for file names on Windows. -// -// #define SPDLOG_WCHAR_FILENAMES -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to override default eol ("\n" or "\r\n" under Linux/Windows) -// -// #define SPDLOG_EOL ";-)\n" -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to use your own copy of the fmt library instead of spdlog's copy. -// In this case spdlog will try to include so set your -I flag accordingly. -// -// #define SPDLOG_FMT_EXTERNAL -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable syslog (disabled by default) -// -// #define SPDLOG_ENABLE_SYSLOG -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to prevent child processes from inheriting log file descriptors -// -// #define SPDLOG_PREVENT_CHILD_FD -/////////////////////////////////////////////////////////////////////////////// diff --git a/archive_old_fs_versions/fs/src/adafs_ops/access.cpp b/archive_old_fs_versions/fs/src/adafs_ops/access.cpp deleted file mode 100644 index ee17872db0f93ece25c85b1786bb870e1a7563ac..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/access.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// -// Created by evie on 3/28/17. -// - -#include "access.h" -#include "metadata_ops.h" - -/** - * Checks access for mask (can be R_OK, W_OK, or X_OK (or combined) AFAIK and not verified) against metadata's mode. - * First the mask is checked agains the 3 bits for the user, then for the 3 bits of the group, and lastly other. - * If all three checks have failed, return -EACCESS (no access) - * @param md - * @param mask - * @return - */ -int chk_access(const Metadata& md, int mask) { - ADAFS_DATA->logger->debug("chk_access() enter: metadata_uid {} fusecontext_uid {}", md.uid(), - fuse_get_context()->uid); - // root user is a god - if (fuse_get_context()->uid == 0) - return 0; - - //check user leftmost 3 bits for rwx in md->mode - if (md.uid() == fuse_get_context()->uid) { - // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare - if ((mask & md.mode() >> 6) == static_cast(mask)) - return 0; - else - return -EACCES; - } - - //check group middle 3 bits for rwx in md->mode - if (md.gid() == fuse_get_context()->gid) { - if ((mask & md.mode() >> 3) == static_cast(mask)) - return 0; - else - return -EACCES; - } - - //check other rightmost 3 bits for rwx in md->mode. - // Because they are the rightmost bits they don't need to be shifted - if ((mask & md.mode()) == static_cast(mask)) { - return 0; - } - - return -EACCES; -} - -/** - * Check if uid from fuse context (i.e., the caller) equals the uid from the object - * @param md - * @return - */ -int chk_uid(const Metadata& md) { - - // root user is a god - if (fuse_get_context()->uid == 0) - return 0; - - // if user is the user of md, he/she has access - if (fuse_get_context()->uid == md.uid()) - return 0; - - // else no permission - return -EPERM; -} - -/** - * Changes the mode from an object to a given mode. Permissions are NOT checked here - * @param md - * @param mode - * @return - */ -// XXX error handling -int change_access(Metadata& md, mode_t mode, const bfs::path& path) { - - auto path_hash = ADAFS_DATA->hashf(path.string()); - md.mode((uint32_t) mode); - - write_metadata_field(md.mode(), path_hash, md_field_map.at(Md_fields::mode)); - -#ifdef ACMtime - md.update_ACM_time(true, true, true); - write_metadata_field(md.atime(), path_hash, md_field_map.at(Md_fields::atime)); - write_metadata_field(md.ctime(), path_hash, md_field_map.at(Md_fields::ctime)); - write_metadata_field(md.mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -#endif - - return 0; -} - -/** - * Changes the uid and gid from an object to a given mode. Only root can actually change gid and uid for now. - * Normal users can't change the uid because they only have one. - * And currently normal users can't change the group either. - * @param md - * @param uid - * @param gid - * @param path - * @return - */ -int change_permissions(Metadata& md, uid_t uid, gid_t gid, const bfs::path& path) { - auto path_hash = ADAFS_DATA->hashf(path.string()); - - // XXX Users should be able to change the group to whatever groups they're belonging to. For now group can only - // XXX be changed to the active group they're belonging to. - if (fuse_get_context()->gid != gid) - return -EPERM; - // if nothing changed, nothing to do - if (md.uid() == uid && md.gid() == gid) - return 0; - - // root can do anything - if (fuse_get_context()->uid == 0) { - md.uid(uid); - md.gid(gid); - write_metadata_field(md.gid(), path_hash, md_field_map.at(Md_fields::gid)); - write_metadata_field(md.uid(), path_hash, md_field_map.at(Md_fields::uid)); - -#ifdef ACMtime - md.update_ACM_time(true, true, true); - write_metadata_field(md.atime(), path_hash, md_field_map.at(Md_fields::atime)); - write_metadata_field(md.ctime(), path_hash, md_field_map.at(Md_fields::ctime)); - write_metadata_field(md.mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -#endif - return 0; - } - // if we get here, users what to change uid or gid to something else which is not permitted - return -EPERM; -} - - diff --git a/archive_old_fs_versions/fs/src/adafs_ops/access.h b/archive_old_fs_versions/fs/src/adafs_ops/access.h deleted file mode 100644 index 9cd9101dac3065de2ada518603ad5fa7a4737772..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/access.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by evie on 3/28/17. -// - -#ifndef FS_ACCESS_H -#define FS_ACCESS_H - -#include "../classes/metadata.h" - - -int chk_access(const Metadata& md, int mask); - -int chk_uid(const Metadata& md); - -int change_access(Metadata& md, mode_t mode, const bfs::path& path); - -int change_permissions(Metadata& md, uid_t uid, gid_t gid, const bfs::path& path); - -#endif //FS_ACCESS_H diff --git a/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.cpp b/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.cpp deleted file mode 100644 index 858923e769fc0d5eba6f46badc622650649eea6b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#include "dentry_ops.h" - -using namespace std; - -/** - * Initializes the dentry directory to hold future dentries - * @param hash - * @return - */ -bool init_dentry_dir(const unsigned long& hash) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path); - d_path /= to_string(hash); - bfs::create_directories(d_path); - - return bfs::exists(d_path); -} - -/** - * Destroys the dentry directory - * @param hash - * @return true if successfully deleted - */ -bool destroy_dentry_dir(const unsigned long& hash) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path); - d_path /= to_string(hash); - - // remove dentry dir - bfs::remove_all(d_path); - - return !bfs::exists(d_path); -} - -/** - * Check if the file name can be found in the directory entries of parent_dir_hash - * @param parent_dir_hash - * @param fname - * @return - */ -bool verify_dentry(const bfs::path& path) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path); - if (path.has_parent_path()) { // non-root - d_path /= to_string(ADAFS_DATA->hashf(path.parent_path().string())); - d_path /= path.filename(); // root - } else { - d_path /= to_string(ADAFS_DATA->hashf(path.string())); - } - // if file path exists leaf name is a valid dentry of parent_dir - return bfs::exists(d_path); -} - - -/** - * Reads all directory entries in a directory with a given @hash. Returns 0 if successful. - * @dir is assumed to be empty - */ -int read_dentries(vector& dir, const unsigned long hash) { - auto path = bfs::path(ADAFS_DATA->dentry_path); - path /= to_string(hash); - if (!bfs::exists(path)) return 1; - // shortcut if path is empty = no files in directory - if (bfs::is_empty(path)) return 0; - - auto dir_it = bfs::directory_iterator(path); - for (const auto& it : dir_it) { - dir.push_back(it.path().filename().string()); - } - - return 0; -} - -/** - * Creates an empty file in the dentry folder of the parent directory, acting as a dentry for lookup - * @param parent_dir - * @param fname - * @return - */ -int create_dentry(const unsigned long parent_dir_hash, const string& fname) { - ADAFS_DATA->logger->debug("create_dentry() enter with fname: {}", fname); - // XXX Errorhandling - auto f_path = bfs::path(ADAFS_DATA->dentry_path); - f_path /= to_string(parent_dir_hash); - if (!bfs::exists(f_path)) return -ENOENT; - - f_path /= fname; - - bfs::ofstream ofs{f_path}; - - // XXX make sure the file has been created - - return 0; -} - -/** - * Removes a dentry from the parent directory - * @param parent_dir_hash - * @param fname - * @return - */ -// XXX errorhandling -int remove_dentry(const unsigned long parent_dir_hash, const string& fname) { - auto f_path = bfs::path(ADAFS_DATA->dentry_path); - f_path /= to_string(parent_dir_hash); - if (!bfs::exists(f_path)) { - ADAFS_DATA->logger->error("remove_dentry() dentry_path '{}' not found", f_path.string()); - return -ENOENT; - } - - f_path /= fname; - // remove dentry here - bfs::remove(f_path); - - // XXX make sure dentry has been deleted - - return 0; -} - -/** - * Checks if a directory has no dentries, i.e., is empty. - * @param adafs_path - * @return bool - */ -bool is_dir_empty(const bfs::path& adafs_path) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path); - // use hash function to path and append it to d_path - d_path /= to_string(ADAFS_DATA->hashf(adafs_path.string())); - - return bfs::is_empty(d_path); -} - -/** - * wraps is_dir_empty(bfs::path) - */ -bool is_dir_empty(const string& adafs_path) { - return is_dir_empty(bfs::path(adafs_path)); -} diff --git a/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.h b/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.h deleted file mode 100644 index 66c0cf3e36ad5332dba3c86ecc18fe6607918a58..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/dentry_ops.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#ifndef FS_DENTRY_OPS_H -#define FS_DENTRY_OPS_H - -#include "../main.h" - -bool init_dentry_dir(const unsigned long& hash); - -bool destroy_dentry_dir(const unsigned long& hash); - -bool verify_dentry(const bfs::path& path); - -int read_dentries(std::vector& dir, const unsigned long hash); - -int create_dentry(const unsigned long parent_dir_hash, const std::string& fname); - -int remove_dentry(const unsigned long parent_dir_hash, const std::string& fname); - -bool is_dir_empty(const bfs::path& adafs_path); - -bool is_dir_empty(const std::string& adafs_path); - -#endif //FS_DENTRY_OPS_H diff --git a/archive_old_fs_versions/fs/src/adafs_ops/io.cpp b/archive_old_fs_versions/fs/src/adafs_ops/io.cpp deleted file mode 100644 index 7f78c62bf7af240ea15ec88d902a3c549f5bdb51..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/io.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// Created by evie on 4/3/17. -// - -#include "io.h" - -using namespace std; - -/** - * Creates the directory in the chunk dir for a file to hold data - * @param hash - * @return - */ -// XXX this might be just a temp function as long as we don't use chunks -// XXX this function creates not only the chunk folder but also a single file which holds the data of the 'real' file -int init_chunk_space(const unsigned long hash) { - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path); - chnk_path /= to_string(hash); - - // create chunk dir - bfs::create_directories(chnk_path); - - // XXX create temp big file. remember also to modify the return value - chnk_path /= "data"s; - bfs::ofstream ofs{chnk_path}; - - return static_cast(bfs::exists(chnk_path)); -} -/** - * Remove the directory in the chunk dir of a file. - * @param hash - * @return - */ -// XXX this might be just a temp function as long as we don't use chunks -int destroy_chunk_space(const unsigned long hash) { - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path); - chnk_path /= to_string(hash); - - // create chunk dir - bfs::remove_all(chnk_path); - - return static_cast(!bfs::exists(chnk_path)); -} diff --git a/archive_old_fs_versions/fs/src/adafs_ops/io.h b/archive_old_fs_versions/fs/src/adafs_ops/io.h deleted file mode 100644 index ecaa8488cef0ed1acedb00de0bf587bdb726fca0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/io.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// Created by evie on 4/3/17. -// - -#ifndef FS_IO_H -#define FS_IO_H - -#include "../main.h" - -int init_chunk_space(const unsigned long hash); - -int destroy_chunk_space(const unsigned long hash); - -#endif //FS_IO_H diff --git a/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.cpp b/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.cpp deleted file mode 100644 index 4d7309e2b5610001a3dcfc0d0ff89560bc41c97a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#include "metadata_ops.h" -#include "dentry_ops.h" - -// TODO error handling. Each read_metadata_field should check for boolean, i.e., if I/O failed. -bool write_all_metadata(const Metadata& md, const unsigned long hash) { - write_metadata_field(md.atime(), hash, md_field_map.at(Md_fields::atime)); - write_metadata_field(md.mtime(), hash, md_field_map.at(Md_fields::mtime)); - write_metadata_field(md.ctime(), hash, md_field_map.at(Md_fields::ctime)); - write_metadata_field(md.uid(), hash, md_field_map.at(Md_fields::uid)); - write_metadata_field(md.gid(), hash, md_field_map.at(Md_fields::gid)); - write_metadata_field(md.mode(), hash, md_field_map.at(Md_fields::mode)); - write_metadata_field(md.inode_no(), hash, md_field_map.at(Md_fields::inode_no)); - write_metadata_field(md.link_count(), hash, md_field_map.at(Md_fields::link_count)); - write_metadata_field(md.size(), hash, md_field_map.at(Md_fields::size)); - write_metadata_field(md.blocks(), hash, md_field_map.at(Md_fields::blocks)); - - return true; -} - -// TODO error handling. Each read_metadata_field should check for nullptr, i.e., if I/O failed. -bool read_all_metadata(Metadata& md, const unsigned long hash) { - md.atime(*read_metadata_field(hash, md_field_map.at(Md_fields::atime))); - md.mtime(*read_metadata_field(hash, md_field_map.at(Md_fields::mtime))); - md.ctime(*read_metadata_field(hash, md_field_map.at(Md_fields::ctime))); - md.uid(*read_metadata_field(hash, md_field_map.at(Md_fields::uid))); - md.gid(*read_metadata_field(hash, md_field_map.at(Md_fields::gid))); - md.mode(*read_metadata_field(hash, md_field_map.at(Md_fields::mode))); - md.inode_no(*read_metadata_field(hash, md_field_map.at(Md_fields::inode_no))); - md.link_count(*read_metadata_field(hash, md_field_map.at(Md_fields::link_count))); - md.size(*read_metadata_field(hash, md_field_map.at(Md_fields::size))); - md.blocks(*read_metadata_field(hash, md_field_map.at(Md_fields::blocks))); - return true; -} - - -int get_metadata(Metadata& md, const string& path) { - return get_metadata(md, bfs::path(path)); -} - -int get_metadata(Metadata& md, const bfs::path& path) { - ADAFS_DATA->logger->debug("get_metadata() enter for path {}", path.string()); - // Verify that the file is a valid dentry of the parent dir - if (verify_dentry(path)) { - // Metadata for file exists - read_all_metadata(md, ADAFS_DATA->hashf(path.string())); - return 0; - } else { - return -ENOENT; - } -} - -/** - * Returns the metadata of an object based on its hash - * @param path - * @return - */ -// XXX Errorhandling -int remove_metadata(const unsigned long hash) { - auto i_path = bfs::path(ADAFS_DATA->inode_path); - i_path /= to_string(hash); - // XXX below could be omitted - if (!bfs::exists(i_path)) { - ADAFS_DATA->logger->error("remove_metadata() metadata_path '{}' not found", i_path.string()); - return -ENOENT; - } - - bfs::remove_all(i_path); - // XXX make sure metadata has been deleted - - return 0; -} - - - - - - diff --git a/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.h b/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.h deleted file mode 100644 index 72c63cd6f8ff56ac0af863754678d5022f99efe1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/adafs_ops/metadata_ops.h +++ /dev/null @@ -1,76 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#ifndef FS_METADATA_OPS_H -#define FS_METADATA_OPS_H - -#include "../main.h" -#include "../classes/metadata.h" - -using namespace std; - -#include -#include - -// mapping of enum to string to get the file names for metadata -enum class Md_fields { atime, mtime, ctime, uid, gid, mode, inode_no, link_count, size, blocks }; - -const std::map md_field_map = { - {Md_fields::atime, "/atime"}, - {Md_fields::mtime, "/mtime"}, - {Md_fields::ctime, "/ctime"}, - {Md_fields::uid, "/uid"}, - {Md_fields::gid, "/gid"}, - {Md_fields::mode, "/mode"}, - {Md_fields::inode_no, "/inode_no"}, - {Md_fields::link_count, "/link_count"}, - {Md_fields::size, "/size"}, - {Md_fields::blocks, "/blocks"} -}; - -bool write_all_metadata(const Metadata& md, const unsigned long hash); - -// TODO error handling. -template -bool write_metadata_field(const T& field, const unsigned long hash, const string& leaf_name) { - auto i_path = bfs::path(ADAFS_DATA->inode_path); - i_path /= to_string(hash); - bfs::create_directories(i_path); - - i_path /= leaf_name; - // for some reason auto ofs = bfs::ofstream(file); does not work. That is why I use the old style. - // std::basic_ofstream does not encounter this problem - bfs::ofstream ofs{i_path}; - // write to disk in binary form - boost::archive::binary_oarchive ba(ofs); - ba << field; - - return true; -} - -bool read_all_metadata(Metadata& md, const unsigned long hash); - -template -unique_ptr read_metadata_field(const unsigned long hash, const string& leaf_name) { - auto path = bfs::path(ADAFS_DATA->inode_path); - path /= to_string(hash); - path /= leaf_name; - if (!bfs::exists(path)) return nullptr; - - bfs::ifstream ifs{path}; - //fast error checking - //ifs.good() - boost::archive::binary_iarchive ba(ifs); - auto field = make_unique(); - ba >> *field; - return field; -} - -int get_metadata(Metadata& md, const std::string& path); - -int get_metadata(Metadata& md, const boost::filesystem::path& path); - -int remove_metadata(const unsigned long hash); - -#endif //FS_METADATA_OPS_H diff --git a/archive_old_fs_versions/fs/src/classes/metadata.cpp b/archive_old_fs_versions/fs/src/classes/metadata.cpp deleted file mode 100644 index 1cf0aef3e11bc860722fc941baa4187a73e717c4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/classes/metadata.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#include "metadata.h" - -time_t Metadata::atime() const { - return atime_; -} - -void Metadata::atime(time_t atime_) { - Metadata::atime_ = atime_; -} - -time_t Metadata::mtime() const { - return mtime_; -} - -void Metadata::mtime(time_t mtime_) { - Metadata::mtime_ = mtime_; -} - -time_t Metadata::ctime() const { - return ctime_; -} - -void Metadata::ctime(time_t ctime_) { - Metadata::ctime_ = ctime_; -} - -uint32_t Metadata::uid() const { - return uid_; -} - -void Metadata::uid(uint32_t uid_) { - Metadata::uid_ = uid_; -} - -uint32_t Metadata::gid() const { - return gid_; -} - -void Metadata::gid(uint32_t gid_) { - Metadata::gid_ = gid_; -} - -uint32_t Metadata::mode() const { - return mode_; -} - -void Metadata::mode(uint32_t mode_) { - Metadata::mode_ = mode_; -} - -uint64_t Metadata::inode_no() const { - return inode_no_; -} - -void Metadata::inode_no(uint64_t inode_no_) { - Metadata::inode_no_ = inode_no_; -} - -uint32_t Metadata::link_count() const { - return link_count_; -} - -void Metadata::link_count(uint32_t link_count_) { - Metadata::link_count_ = link_count_; -} - -uint32_t Metadata::size() const { - return size_; -} - -void Metadata::size(uint32_t size_) { - Metadata::size_ = size_; -} - -uint32_t Metadata::blocks() const { - return blocks_; -} - -void Metadata::blocks(uint32_t blocks_) { - Metadata::blocks_ = blocks_; -} - -//-------------------------------------------- -// By default create an empty metadata object -//Metadata::Metadata() : Metadata(S_IFREG | 0755) {} -Metadata::Metadata() : atime_(), - mtime_(), - ctime_(), - uid_(), - gid_(), - mode_(), - inode_no_(0), - link_count_(0), - size_(0), - blocks_(0) {} - -Metadata::Metadata(mode_t mode) : - atime_(), - mtime_(), - ctime_(), - uid_(fuse_get_context()->uid), - gid_(fuse_get_context()->gid), - mode_(mode), - inode_no_(0), - link_count_(0), - size_(0), - blocks_(0) { - init_ACM_time(); - inode_no_ = util::generate_inode_no(); -} - -void Metadata::init_ACM_time() { - std::time_t time; - std::time(&time); - atime_ = time; - mtime_ = time; - ctime_ = time; -} - -void Metadata::update_ACM_time(bool a, bool c, bool m) { - std::time_t time; - std::time(&time); - if (a) - atime_ = time; - if (c) - ctime_ = time; - if (m) - mtime_ = time; -} diff --git a/archive_old_fs_versions/fs/src/classes/metadata.h b/archive_old_fs_versions/fs/src/classes/metadata.h deleted file mode 100644 index 0714d023c8d9910b26c523e6257af4f9ceb2ed02..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/classes/metadata.h +++ /dev/null @@ -1,76 +0,0 @@ - -#ifndef FS_METADATA_H -#define FS_METADATA_H - -#include "../main.h" - -//TODO we might want to replace this with GOOGLE PROTOBUF -class Metadata { - -private: - time_t atime_; // access time. gets updated on file access unless mounted with noatime - time_t mtime_; // modify time. gets updated when file content is modified. - time_t ctime_; // change time. gets updated when the file attributes are changed AND when file content is modified. - uint32_t uid_; - uint32_t gid_; - uint32_t mode_; - uint64_t inode_no_; - uint32_t link_count_; // number of names for this inode (hardlinks) - uint32_t size_; // size_ in bytes, might be computed instead of stored - uint32_t blocks_; // allocated file system blocks_ - - -public: - Metadata(); - - Metadata(mode_t mode); - - void init_ACM_time(); - - void update_ACM_time(bool a, bool c, bool m); - - //Getter and Setter - time_t atime() const; - - void atime(time_t atime_); - - time_t mtime() const; - - void mtime(time_t mtime_); - - time_t ctime() const; - - void ctime(time_t ctime_); - - uint32_t uid() const; - - void uid(uint32_t uid_); - - uint32_t gid() const; - - void gid(uint32_t gid_); - - uint32_t mode() const; - - void mode(uint32_t mode_); - - uint64_t inode_no() const; - - void inode_no(uint64_t inode_no_); - - uint32_t link_count() const; - - void link_count(uint32_t link_count_); - - uint32_t size() const; - - void size(uint32_t size_); - - uint32_t blocks() const; - - void blocks(uint32_t blocks_); - -}; - - -#endif //FS_METADATA_H diff --git a/archive_old_fs_versions/fs/src/configure.h b/archive_old_fs_versions/fs/src/configure.h deleted file mode 100644 index 81d5682d49ad0bcb7ed6c2dd49ff49f600540cf9..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/configure.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#ifndef FS_CONFIGURE_H -#define FS_CONFIGURE_H - -// To enabled logging with info level -#define LOG_INFO -//#define LOG_DEBUG - -// If ACM time should be considered -#define ACMtime - -// If access permissions should be checked while opening a file -#define CHECK_ACCESS - -#endif //FS_CONFIGURE_H diff --git a/archive_old_fs_versions/fs/src/fuse_ops.h b/archive_old_fs_versions/fs/src/fuse_ops.h deleted file mode 100644 index 82827f7e5439b83f7e3e7093d4f075ebb96706f3..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops.h +++ /dev/null @@ -1,67 +0,0 @@ -// -// Created by evie on 2/23/17. -// - -#ifndef FS_FUSE_OPS_H -#define FS_FUSE_OPS_H - -#include "main.h" - -// file -int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi); - -int adafs_mknod(const char* p, mode_t, dev_t); - -int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi); - -int adafs_open(const char*, struct fuse_file_info* fi); - -int adafs_unlink(const char* p); - -int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi); - -int adafs_release(const char* p, struct fuse_file_info* fi); - - -// directory -int adafs_opendir(const char* p, struct fuse_file_info* fi); - -int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi, - enum fuse_readdir_flags flags); - -int adafs_releasedir(const char* p, struct fuse_file_info* fi); - -int adafs_mkdir(const char* p, mode_t mode); - -int adafs_rmdir(const char* p); - - -// I/O -int adafs_read(const char* p, char* buf, size_t size, off_t offset, struct fuse_file_info* fi); - -int adafs_write(const char* p, const char* buf, size_t size, off_t offset, struct fuse_file_info* fi); - -int adafs_truncate(const char* p, off_t offset, struct fuse_file_info* fi); - - -// -int adafs_flush(const char* p, struct fuse_file_info* fi); - - -// access -int adafs_access(const char* p, int mask); - -int adafs_chmod(const char* p, mode_t mode, struct fuse_file_info* fi); - -int adafs_chown(const char* p, uid_t uid, gid_t gid, struct fuse_file_info* fi); - - -// file system miscellaneous -int adafs_statfs(const char* p, struct statvfs* statvfs); - - -void* adafs_init(struct fuse_conn_info* conn, struct fuse_config* cfg); - -void adafs_destroy(void* adafs_data); - -#endif //FS_FUSE_OPS_H diff --git a/archive_old_fs_versions/fs/src/fuse_ops/access.cpp b/archive_old_fs_versions/fs/src/fuse_ops/access.cpp deleted file mode 100644 index 4af4fc6a7ffbe6451601a54478e1037551bc34f5..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/access.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Created by draze on 3/19/17. -// - -#include "../main.h" -#include "../fuse_ops.h" -#include "../adafs_ops/metadata_ops.h" -#include "../adafs_ops/access.h" - -using namespace std; - -/** - * Check file access permissions - * - * This will be called for the access() system call. If the - * 'default_permissions' mount option is given, this method is not - * called. - * - * This method is not called under Linux kernel versions 2.4.x - */ -int adafs_access(const char* p, int mask) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_access() enter: name '{}' mask {}", p, mask); - auto path = bfs::path(p); - - auto md = make_shared(); - // XXX error handling - auto err = get_metadata(*md, path); - if (err != 0) return err; - - return chk_access(*md, mask); -} - -/** Change the permission bits of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - */ -int adafs_chmod(const char* p, mode_t mode, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_chmod() enter: name '{}' mode {:o}", p, mode); - auto path = bfs::path(p); - auto md = make_shared(); - auto err = get_metadata(*md, path); - - if (err != 0) return err; - - // for change_access only the uid matters AFAIK - err = chk_uid(*md); - if (err != 0) return err; - - return change_access(*md, mode, path); -} - -/** Change the owner and group of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ -int adafs_chown(const char* p, uid_t uid, gid_t gid, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_chown() enter: name '{}' uid {} gid {}", p, uid, gid); - auto path = bfs::path(p); - auto md = make_shared(); - auto err = get_metadata(*md, path); - - if (err != 0) return err; - - // any ownership change requires the user of the object - err = chk_uid(*md); - if (err != 0) return err; - - return change_permissions(*md, uid, gid, path); -} diff --git a/archive_old_fs_versions/fs/src/fuse_ops/directory.cpp b/archive_old_fs_versions/fs/src/fuse_ops/directory.cpp deleted file mode 100644 index 5a5028190c2624bd4c30fcc3f61fc84bdcee60ef..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/directory.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#include "../main.h" -#include "../fuse_ops.h" -#include "../adafs_ops/metadata_ops.h" -#include "../adafs_ops/dentry_ops.h" -#include "../adafs_ops/access.h" - -using namespace std; - -/** Open directory - * - * Unless the 'default_permissions' mount option is given, - * this method should check if opendir is permitted for this - * directory. Optionally opendir may also return an arbitrary - * filehandle in the fuse_file_info structure, which will be - * passed to readdir, closedir and fsyncdir. - */ -int adafs_opendir(const char* p, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_opendir() enter: name '{}'", p); -#ifdef CHECK_ACCESS - // XXX error handling - auto path = bfs::path(p); - auto md = make_shared(); - - get_metadata(*md, path); - - int access = fi->flags & O_ACCMODE; - -// ADAFS_DATA->logger->debug("access variable: {}", access); - switch (access) { - case O_RDONLY: - return chk_access(*md, R_OK); - case O_WRONLY: - return chk_access(*md, W_OK); - case O_RDWR: - return chk_access(*md, R_OK | W_OK); - default: - return -EACCES; - } -#else - return 0; -#endif -} - -/** Read directory - * - * The filesystem may choose between two modes of operation: - * - * 1) The readdir implementation ignores the offset parameter, and - * passes zero to the filler function's offset. The filler - * function will not return '1' (unless an error happens), so the - * whole directory is read in a single readdir operation. - * - * 2) The readdir implementation keeps track of the offsets of the - * directory entries. It uses the offset parameter and always - * passes non-zero offset to the filler function. When the buffer - * is full (or an error happens) the filler function will return - * '1'. - * - * ### We use version 1 ### - */ -int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset, - struct fuse_file_info* fi, enum fuse_readdir_flags flags) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_readdir() enter: name {} readdir_flags '{}'", p, flags); - // XXX ls also reports the number of allocated blocks IN the directory. Non recursive. Currently not considered - - - auto path = bfs::path(p); - auto md = make_shared(); - // first check that dir exists that is trying to be read. I don't know if this is actually needed, - // because opendir should have been called first. I guess it could have been deleted in between - get_metadata(*md, path); - - // XXX permission check here because ls requires read permission (Do we care?) - - // Read all filenames in dir entry folder for inode of md - auto dentries = make_shared>(); - if (read_dentries(*dentries, ADAFS_DATA->hashf(path.string())) != 0) - return 1; // XXX problemo dedected deal with it later (I mean me) - - // visualizing current and parent dir - filler(buf, ".", nullptr, 0, FUSE_FILL_DIR_PLUS); - filler(buf, "..", nullptr, 0, FUSE_FILL_DIR_PLUS); - for (const auto& dentry : *dentries) { - // XXX I have no idea what the last parameter really does... - ADAFS_DATA->logger->debug("readdir entries: dentry: {}", dentry); - filler(buf, dentry.c_str(), nullptr, 0, FUSE_FILL_DIR_PLUS); - } - - return 0; -} - -/** Release directory - */ -int adafs_releasedir(const char* p, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_releasedir() enter: name '{}'", p); - // XXX Dunno what to do with that function yet. Maybe flush dirty dentries that are in cache? - // At the time of this writing I don't have any cache running. So all dirty stuff is immediately written to disk. - return 0; -} - -/** Create a directory - * - * Note that the mode argument may not have the type specification - * bits set, i.e. S_ISDIR(mode) can be false. To obtain the - * correct directory type bits use mode|S_IFDIR - * */ -int adafs_mkdir(const char* p, mode_t mode) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_mkdir() enter: name '{}' mode {}", p, mode); - // XXX mknod and mkdir is strikingly similar. todo merge them. - // XXX Errorhandling and beware of transactions. saving dentry and metadata have to be atomic - auto path = bfs::path(p); - path.remove_trailing_separator(); - - // XXX check if dir exists (how can we omit this? Let's just try to create it and see if it fails) - - // XXX check permissions (omittable) - - // create directory entry for parent directory (can fail) - create_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string()); - - // create metadata of new file - // mode is used here to init metadata - auto md = make_unique(S_IFDIR | mode); - md->size(4096); // XXX just visual. size computation of directory should be done properly at some point - write_all_metadata(*md, ADAFS_DATA->hashf(path.string())); - - // Init structure to hold dentries of new directory - init_dentry_dir(ADAFS_DATA->hashf(path.string())); - - return 0; -} - -/** Remove a directory. Has to be empty */ -// XXX errorhandling err doesnt really work with fuse... -int adafs_rmdir(const char* p) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_rmdir() enter: name '{}'", p); - auto path = bfs::path(p); - - // check that directory is empty - if (!is_dir_empty(path)) return -ENOTEMPTY; - - // remove dentry XXX duplicate code in adafs_unlink() - auto err = remove_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string()); - if (err != 0) return err; - - // remove dentry directory - destroy_dentry_dir(ADAFS_DATA->hashf(path.string())); - - // remove directory inode - err = remove_metadata(ADAFS_DATA->hashf(path.string())); - if (err != 0) return err; - - return 0; -} diff --git a/archive_old_fs_versions/fs/src/fuse_ops/file.cpp b/archive_old_fs_versions/fs/src/fuse_ops/file.cpp deleted file mode 100644 index 756b1b62cb8efad2ff0b46d2348898c0c48723b4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/file.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#include "../main.h" -#include "../fuse_ops.h" -#include "../adafs_ops/metadata_ops.h" -#include "../adafs_ops/dentry_ops.h" -#include "../adafs_ops/access.h" -#include "../adafs_ops/io.h" - -using namespace std; - -/** Get file attributes. - * - * Similar to stat(). The 'st_dev' and 'st_blksize' fields are - * ignored. The 'st_ino' field is ignored except if the 'use_ino' - * mount option is given. - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - */ -int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_getattr() enter: name '{}' initial_inode {}", p, - attr->st_ino); - auto path = bfs::path(p); - auto md = make_shared(); - -// uncomment when mdtest.files should return 0 without actually checking if its there -// if (path.filename().string().find("file.mdtest") == 0) { -// auto md = make_unique(S_IFREG | 664); -// md->init_ACM_time(); -// attr->st_ino = md->inode_no(); -// attr->st_mode = md->mode(); -// attr->st_nlink = md->link_count(); -// attr->st_uid = md->uid(); -// attr->st_gid = md->gid(); -// attr->st_size = md->size(); -// attr->st_blksize = ADAFS_DATA->blocksize; -// attr->st_blocks = md->blocks(); -// attr->st_atim.tv_sec = md->atime(); -// attr->st_mtim.tv_sec = md->mtime(); -// attr->st_ctim.tv_sec = md->ctime(); -// return 0; -// } - - if (get_metadata(*md, path) != -ENOENT) { - attr->st_ino = md->inode_no(); - attr->st_mode = md->mode(); - attr->st_nlink = md->link_count(); - attr->st_uid = md->uid(); - attr->st_gid = md->gid(); - attr->st_size = md->size(); - attr->st_blksize = ADAFS_DATA->blocksize; - attr->st_blocks = md->blocks(); - attr->st_atim.tv_sec = md->atime(); - attr->st_mtim.tv_sec = md->mtime(); - attr->st_ctim.tv_sec = md->ctime(); - return 0; - } - - return -ENOENT; -} - -/** Create a file node - * - * This is called for creation of all non-directory, non-symlink - * nodes. If the filesystem defines a create() method, then for - * regular files that will be called instead. - */ -int adafs_mknod(const char* p, mode_t mode, dev_t dev) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_mknod() enter: name '{}' mode {} dev {}", p, mode, dev); - // XXX Errorhandling and beware of transactions. saving dentry and metadata have to be atomic - auto path = bfs::path(p); -// uncomment if file creates done with mdtest should return immediately without creating the file -// if (path.filename().string().find("file.mdtest") == 0) -// return 0; - - // XXX check if file exists (how can we omit this? Let's just try to create it and see if it fails) - - // XXX check permissions (omittable) - - // create directory entry (can fail) - create_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string()); - - // create metadata of new file - // mode is used here to init metadata - auto md = make_unique(S_IFREG | mode); - write_all_metadata(*md, ADAFS_DATA->hashf(path.string())); - - // create chunk space - init_chunk_space(ADAFS_DATA->hashf(path.string())); - - return 0; -} - -/** - * Create and open a file - * - * If the file does not exist, first create it with the specified - * mode, and then open it. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the mknod() and open() methods - * will be called instead. - */ -int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_create() enter: name '{}' mode {}", p, mode); - - auto err = static_cast(adafs_mknod(p, mode, 0)); - if (err != 0) return err; -#ifdef CHECK_ACCESS - err = adafs_open(p, fi); -#endif - return err; -} - -/** File open operation - * - * No creation (O_CREAT, O_EXCL) and by default also no - * truncation (O_TRUNC) flags will be passed to open(). If an - * application specifies O_TRUNC, fuse first calls truncate() - * and then open(). Only if 'atomic_o_trunc' has been - * specified and kernel version is 2.6.24 or later, O_TRUNC is - * passed on to open. - * - * Unless the 'default_permissions' mount option is given, - * open should check if the operation is permitted for the - * given flags. Optionally open may also return an arbitrary - * filehandle in the fuse_file_info structure, which will be - * passed to all file operations. - */ -int adafs_open(const char* p, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_open() enter: name '{}'", p); -#ifdef CHECK_ACCESS - // XXX error handling - auto path = bfs::path(p); -// uncomment if file creates done with mdtest should return immediately without creating the file -// if (path.filename().string().find("file.mdtest") == 0) -// return 0; - auto md = make_shared(); - - get_metadata(*md, path); - - int access = fi->flags & O_ACCMODE; - - switch (access) { - case O_RDONLY: - return chk_access(*md, R_OK); - case O_WRONLY: - return chk_access(*md, W_OK); - case O_RDWR: - return chk_access(*md, R_OK | W_OK); - default: - return -EACCES; - } -#else - return 0; -#endif -} - -/** Remove a file */ -// XXX Errorhandling err doesnt really work with fuse... -int adafs_unlink(const char* p) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_unlink() enter: name '{}'", p); - auto path = bfs::path(p); - - // XXX I don't think we need to check if path.filename() is not root. Because unlink is only called with files - - // XXX consider hardlinks - - // adafs_access was called first by the VFS. Thus, path exists and access is ok (not guaranteed though!). - auto err = remove_dentry(ADAFS_DATA->hashf(path.parent_path().string()), path.filename().string()); - if (err != 0) return err; - - // remove inode - err = remove_metadata(ADAFS_DATA->hashf(path.string())); - if (err != 0) return err; - - // XXX delete unused data blocks (asynchronously) - // XXX currently just throws away the data directory on disk - destroy_chunk_space(ADAFS_DATA->hashf(path.string())); - - return 0; -} - -/** - * Change the access and modification times of a file with - * nanosecond resolution - * - * This supersedes the old utime() interface. New applications - * should use this. - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * See the utimensat(2) man page for details. - */ -int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_utimens() enter: name '{}'", p); - // XXX ignored for now. Later: Make it configurable - return 0; -} - -/** Release an open file - * - * Release is called when there are no more references to an open - * file: all file descriptors are closed and all memory mappings - * are unmapped. - * - * For every open() call there will be exactly one release() call - * with the same flags and file descriptor. It is possible to - * have a file opened more than once, in which case only the last - * release will mean, that no more reads/writes will happen on the - * file. The return value of release is ignored. - */ -int adafs_release(const char* p, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_release() enter: name '{}'", p); - // XXX Dunno what this function is for yet - return 0; -} diff --git a/archive_old_fs_versions/fs/src/fuse_ops/fs.cpp b/archive_old_fs_versions/fs/src/fuse_ops/fs.cpp deleted file mode 100644 index d47eae36522b5360ee4bec364a3c0c2f2a461946..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/fs.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -// Created by evie on 3/28/17. -// - -#include "../main.h" -#include "../fuse_ops.h" - -/** Get file system statistics - * - * The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored - */ -int adafs_statfs(const char* p, struct statvfs* statvfs) { - ADAFS_DATA->logger->info("##### FUSE FUNC ###### adafs_statfs() enter: name '{}'", p); - // XXX to be implemented for rm -rf - return 0; -} \ No newline at end of file diff --git a/archive_old_fs_versions/fs/src/fuse_ops/io.cpp b/archive_old_fs_versions/fs/src/fuse_ops/io.cpp deleted file mode 100644 index 343836aeaa6465469939da93c43db1173d5834bf..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/io.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// -// Created by evie on 3/30/17. -// - -#include "../main.h" -#include "../fuse_ops.h" -#include "../adafs_ops/metadata_ops.h" - -/** Read data from an open file - * - * Read should return exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the - * 'direct_io' mount option is specified, in which case the return - * value of the read system call will reflect the return value of - * this operation. - */ -// XXX error handling -int adafs_read(const char* p, char* buf, size_t size, off_t offset, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_read() enter: name '{}' size {} offset {}", p, - size, offset); - auto path = bfs::path(p); - auto md = make_shared(); - // access is already checked before through adafs_open() - // get metadata and make sure file exists - get_metadata(*md, path); - - // XXX the chunk path, i.e., the single file that is used for storing the data for now - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path); - chnk_path /= to_string(ADAFS_DATA->hashf(path.string())); - chnk_path /= "data"s; - - int fd = open(chnk_path.c_str(), R_OK); - - if (fd < 0) return -1; - - auto new_size = static_cast(pread(fd, buf, size, offset)); - - close(fd); - - return new_size; -} - -/** Write data to an open file - * - * Write should return exactly the number of bytes requested - * except on error. An exception to this is when the 'direct_io' - * mount option is specified (see read operation). - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ -// XXX error handling -int adafs_write(const char* p, const char* buf, size_t size, off_t offset, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_write() enter: name '{}' O_APPEND {} size {} offset {}", - p, fi->flags & O_APPEND, size, offset); - auto path = bfs::path(p); - auto path_hash = ADAFS_DATA->hashf(path.string()); - - auto md = make_shared(); - // access is already checked before through adafs_open() - // get metadata and make sure file exists - get_metadata(*md, path); - - // XXX the chunk path, i.e., the single file that is used for storing the data for now - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path); - chnk_path /= to_string(ADAFS_DATA->hashf(path.string())); - chnk_path /= "data"s; - - int fd = open(chnk_path.c_str(), W_OK); - - if (fd < 0) return -1; - - pwrite(fd, buf, size, offset); - - // Set new size of the file - if (fi->flags & O_APPEND) { - truncate(chnk_path.c_str(), md->size() + size); - md->size(md->size() + static_cast(size)); - } else { - truncate(chnk_path.c_str(), size); - md->size(static_cast(size)); - } - - close(fd); - - // write it to disk (XXX make it dirty later and write to disk in fsync (I believe)) - write_metadata_field(md->size(), path_hash, md_field_map.at(Md_fields::size)); - -#ifdef ACMtime - md->update_ACM_time(true, true, true); - write_metadata_field(md->atime(), path_hash, md_field_map.at(Md_fields::atime)); - write_metadata_field(md->ctime(), path_hash, md_field_map.at(Md_fields::ctime)); - write_metadata_field(md->mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -#endif - - auto new_size = static_cast(size); - - return new_size; -} - -/** Change the size of a file - * - * `fi` will always be NULL if the file is not currenly open, but - * may also be NULL if the file is open. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - */ -// XXX I thought I know when it is called. But I have no idea really. Watch out in logs -int adafs_truncate(const char* p, off_t offset, struct fuse_file_info* fi) { - ADAFS_DATA->logger->info("##### FUSE FUNC ###### adafs_truncate() enter: name '{}' offset (size) {}", p, offset); -// XXX commented out. Comment in and modify when I know when truncate is actually called -// auto path = bfs::path(p); -// auto path_hash = ADAFS_DATA->hashf(path.string()); -// auto md = make_shared(); -// -// get_metadata(*md, path); -// // XXX might need to check access here. But shouldn't access be checked through adafs_open() before? -// -// // Check the file size limits -// if (offset > numeric_limits::max()) return -EFBIG; -// -// // Set new size of the file -// md->size((uint32_t) offset); -// -// // write it to disk (XXX make it dirty later and write to disk in fsync (I believe)) -// write_metadata_field(md->size(), path_hash, md_field_map.at(Md_fields::size)); -// -//#ifdef ACMtime -// md->update_ACM_time(true, false, true); -// write_metadata_field(md->atime(), path_hash, md_field_map.at(Md_fields::atime)); -// write_metadata_field(md->mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -//#endif - - return 0; -} diff --git a/archive_old_fs_versions/fs/src/fuse_ops/sync.cpp b/archive_old_fs_versions/fs/src/fuse_ops/sync.cpp deleted file mode 100644 index 353156155e329275641537e96c8791fae1c0c4a1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/fuse_ops/sync.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// Created by draze on 3/23/17. -// - -#include "../main.h" -#include "../fuse_ops.h" - -/** Possibly flush cached data - * - * BIG NOTE: This is not equivalent to fsync(). It's not a - * request to sync dirty data. - * - * Flush is called on each close() of a file descriptor. So if a - * filesystem wants to return write errors in close() and the file - * has cached dirty data, this is a good place to write back data - * and return any errors. Since many applications ignore close() - * errors this is not always useful. - * - * NOTE: The flush() method may be called more than once for each - * open(). This happens if more than one file descriptor refers - * to an opened file due to dup(), dup2() or fork() calls. It is - * not possible to determine if a flush is final, so each flush - * should be treated equally. Multiple write-flush sequences are - * relatively rare, so this shouldn't be a problem. - * - * Filesystems shouldn't assume that flush will always be called - * after some writes, or that if will be called at all. - */ -// currently a NO-OP in ADA-FS -int adafs_flush(const char* p, struct fuse_file_info* fi) { - ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_flush() enter: name '{}'", p); - return 0; -} diff --git a/archive_old_fs_versions/fs/src/main.cpp b/archive_old_fs_versions/fs/src/main.cpp deleted file mode 100644 index 122e4b7d3b191c628b3e123f179c343927cb634a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/main.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "main.h" -#include "classes/metadata.h" -#include "adafs_ops/metadata_ops.h" -#include "adafs_ops/dentry_ops.h" -#include "fuse_ops.h" - -static struct fuse_operations adafs_ops; - -using namespace std; - -void* adafs_init(struct fuse_conn_info* conn, struct fuse_config* cfg) { - ADAFS_DATA->logger->debug("Fuse init() enter"s); - // Make sure directory structure exists - bfs::create_directories(ADAFS_DATA->dentry_path); - bfs::create_directories(ADAFS_DATA->inode_path); - bfs::create_directories(ADAFS_DATA->chunk_path); - bfs::create_directories(ADAFS_DATA->mgmt_path); - - // Check if fs already has some data and read the inode count - if (bfs::exists(ADAFS_DATA->mgmt_path + "/inode_count")) - util::read_inode_cnt(); - else - util::init_inode_no(); - - // XXX Dunno if this is of any use - cfg->readdir_ino = 1; - - //Init file system configuration - ADAFS_DATA->blocksize = 4096; - - // Init unordered_map for caching metadata that was already looked up XXX use later - ADAFS_DATA->hashmap = unordered_map(); - ADAFS_DATA->hashf = hash(); - - auto md = make_shared(); - - // Check that root metadata exists. If not initialize it - if (get_metadata(*md, "/"s) == -ENOENT) { - ADAFS_DATA->logger->debug("Root metadata not found. Initializing..."s); - md->init_ACM_time(); - md->mode(S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO); // change_access 777 - md->size(4096); // XXX just visual. size computation of directory should be done properly at some point -// md->mode(S_IFDIR | 0755); - // XXX The gid and uid is the root user for some reason. Should be the user that mounted fuse. - // This is because fuse is mounted through root although it was triggered by the user - md->uid(fuse_get_context()->uid); - md->gid(fuse_get_context()->gid); - md->inode_no(ADAFS_ROOT_INODE); - ADAFS_DATA->logger->debug("Writing / metadata to disk..."s); - write_all_metadata(*md, ADAFS_DATA->hashf("/"s)); - ADAFS_DATA->logger->debug("Initializing dentry for /"s); - init_dentry_dir(ADAFS_DATA->hashf("/"s)); - ADAFS_DATA->logger->debug("Creating Metadata object"s); - } -#ifdef LOG_DEBUG - else - ADAFS_DATA->logger->debug("Metadata object exists"s); -#endif - - return ADAFS_DATA; -} - -void adafs_destroy(void* adafs_data) { - util::write_inode_cnt(); -} - - -static void init_adafs_ops(fuse_operations* ops) { - // file - ops->getattr = adafs_getattr; - ops->mknod = adafs_mknod; - ops->create = adafs_create; - ops->open = adafs_open; - ops->unlink = adafs_unlink; - ops->utimens = adafs_utimens; - ops->release = adafs_release; - - // directory - ops->opendir = adafs_opendir; - ops->readdir = adafs_readdir; - ops->releasedir = adafs_releasedir; - ops->mkdir = adafs_mkdir; - ops->rmdir = adafs_rmdir; - - // I/O - ops->read = adafs_read; - ops->write = adafs_write; - ops->truncate = adafs_truncate; - - ops->flush = adafs_flush; - - // permission - ops->access = adafs_access; - ops->chmod = adafs_chmod; - ops->chown = adafs_chown; - - ops->init = adafs_init; - ops->destroy = adafs_destroy; -} - - -int main(int argc, char* argv[]) { - //Initialize the mapping of Fuse functions - init_adafs_ops(&adafs_ops); - - // create the private data struct - auto a_data = make_shared(); - //set the logger and initialize it with spdlog - a_data->logger = spdlog::basic_logger_mt("basic_logger", "adafs.log"); -#if defined(LOG_DEBUG) - spdlog::set_level(spdlog::level::debug); - a_data->logger->flush_on(spdlog::level::debug); -#elif defined(LOG_INFO) - spdlog::set_level(spdlog::level::info); - a_data->logger->flush_on(spdlog::level::info); -#else - spdlog::set_level(spdlog::level::off); -#endif - //extract the rootdir from argv and put it into rootdir of adafs_data - a_data->rootdir = string(realpath(argv[argc - 2], nullptr)); - argv[argc - 2] = argv[argc - 1]; - argv[argc - 1] = nullptr; - argc--; - //set all paths - a_data->inode_path = a_data->rootdir + "/meta/inodes"s; - a_data->dentry_path = a_data->rootdir + "/meta/dentries"s; - a_data->chunk_path = a_data->rootdir + "/data/chunks"s; - a_data->mgmt_path = a_data->rootdir + "/mgmt"s; - //print version - cout << "Fuse library version: "s + to_string(FUSE_MAJOR_VERSION) + to_string(FUSE_MINOR_VERSION) << endl; - //init fuse and give the private data struct for further reference. - cout << "initializing fuse..." << endl; - auto err = fuse_main(argc, argv, &adafs_ops, a_data.get()); - cout << "about to close fuse" << endl; - - return err; -} diff --git a/archive_old_fs_versions/fs/src/main.h b/archive_old_fs_versions/fs/src/main.h deleted file mode 100644 index 2ecfc9400965411f1990032e696fe71828b52473..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/main.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// Created by lefthy on 1/24/17. -// - -#ifndef MAIN_H -#define MAIN_H - -#define FUSE_USE_VERSION 30 - - -extern "C" { -#include -} - -#include -#include -#include -#include - -//boost libraries -#include -#include - -#include "configure.h" -#include "spdlog/spdlog.h" - -namespace bfs = boost::filesystem; - -struct adafs_data { - std::string rootdir; - // Below paths are needed for future version when we'll get rid of path hashing. - std::string inode_path; // used - std::string dentry_path; // used - std::string chunk_path; // unused - std::string mgmt_path; - - // Caching - std::unordered_map hashmap; - std::hash hashf; - - // Housekeeping - std::shared_ptr logger; - uint64_t inode_count; - std::mutex inode_mutex; - // Later the blocksize will likely be coupled to the chunks to allow individually big chunk sizes. - int32_t blocksize; -}; - -#define ADAFS_DATA ( static_cast(fuse_get_context()->private_data)) -#define ADAFS_ROOT_INODE 1 - -namespace util { - bfs::path adafs_fullpath(const std::string& path); - - int init_inode_no(); - - ino_t generate_inode_no(); - - int read_inode_cnt(); - - int write_inode_cnt(); -} - -#endif //MAIN_H diff --git a/archive_old_fs_versions/fs/src/util.cpp b/archive_old_fs_versions/fs/src/util.cpp deleted file mode 100644 index 7ecc8a87288df9bf2aa44bbbbbb40d4b88eba4d1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fs/src/util.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -#include -#include -#include "main.h" - -namespace util { - - bfs::path adafs_fullpath(const std::string& path) { - return bfs::path(std::string(ADAFS_DATA->rootdir + "/" + path)); - } - - int init_inode_no() { - ADAFS_DATA->inode_count = 1; - return 0; - } - - ino_t generate_inode_no() { - std::lock_guard inode_lock(ADAFS_DATA->inode_mutex); - return static_cast(++ADAFS_DATA->inode_count); - } - - // XXX error handling - int read_inode_cnt() { - auto i_path = bfs::path(ADAFS_DATA->mgmt_path + "/inode_count"); - bfs::ifstream ifs{i_path}; - boost::archive::binary_iarchive ba(ifs); - uint64_t inode_count; - ba >> inode_count; - ADAFS_DATA->inode_count = inode_count; - - return 0; - } - - // XXX error handling - int write_inode_cnt() { - auto i_path = bfs::path(ADAFS_DATA->mgmt_path + "/inode_count"); - bfs::ofstream ofs{i_path}; - boost::archive::binary_oarchive ba(ofs); - ba << ADAFS_DATA->inode_count; - - return 0; - } - - -} diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/AUTHORS b/archive_old_fs_versions/fuse-tutorial-2016-03-25/AUTHORS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/COPYING b/archive_old_fs_versions/fuse-tutorial-2016-03-25/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/ChangeLog b/archive_old_fs_versions/fuse-tutorial-2016-03-25/ChangeLog deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/INSTALL b/archive_old_fs_versions/fuse-tutorial-2016-03-25/INSTALL deleted file mode 100644 index 2099840756e6302d837dcd51b5dcd6262f7adb16..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/INSTALL +++ /dev/null @@ -1,370 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell command `./configure && make && make install' -should configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: - - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile b/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile deleted file mode 100644 index aae9f37350a62e6e81addac2b7469f4a9571224f..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile +++ /dev/null @@ -1,760 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/fuse-tutorial -pkgincludedir = $(includedir)/fuse-tutorial -pkglibdir = $(libdir)/fuse-tutorial -pkglibexecdir = $(libexecdir)/fuse-tutorial -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_$(V)) -am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \ - INSTALL NEWS README compile depcomp install-sh missing -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing aclocal-1.15 -AMTAR = $${TAR-tar} -AM_DEFAULT_VERBOSITY = 1 -AUTOCONF = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoconf -AUTOHEADER = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoheader -AUTOMAKE = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing automake-1.15 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LIBS = -lfuse -pthread -GREP = /bin/grep -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LDFLAGS = -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing makeinfo -MKDIR_P = /bin/mkdir -p -OBJEXT = o -PACKAGE = fuse-tutorial -PACKAGE_BUGREPORT = joseph@pfeifferfamily.net -PACKAGE_NAME = fuse-tutorial -PACKAGE_STRING = fuse-tutorial 2016-03-25 -PACKAGE_TARNAME = fuse-tutorial -PACKAGE_URL = -PACKAGE_VERSION = 2016-03-25 -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -PKG_CONFIG_LIBDIR = -PKG_CONFIG_PATH = -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 2016-03-25 -abs_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -abs_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -abs_top_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -abs_top_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -ac_ct_CC = gcc -am__include = include -am__leading_dot = . -am__quote = -am__tar = $${TAR-tar} chof - "$$tardir" -am__untar = $${TAR-tar} xf - -bindir = ${exec_prefix}/bin -build_alias = -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host_alias = -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = $(MKDIR_P) -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -runstatedir = ${localstatedir}/run -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = -top_builddir = . -top_srcdir = . -SUBDIRS = example html src -EXTRA_DIST = autogen.sh index.html -all: all-recursive - -.SUFFIXES: -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.am b/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.am deleted file mode 100644 index 6d6cc733324bd82de8b968b42fd8f760f824e131..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -SUBDIRS = example html src - -EXTRA_DIST = autogen.sh index.html - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.in b/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.in deleted file mode 100644 index 62b6d313dcf7b777ce83515dfbb1f20387c399fd..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/Makefile.in +++ /dev/null @@ -1,760 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \ - INSTALL NEWS README compile depcomp install-sh missing -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FUSE_CFLAGS = @FUSE_CFLAGS@ -FUSE_LIBS = @FUSE_LIBS@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = example html src -EXTRA_DIST = autogen.sh index.html -all: all-recursive - -.SUFFIXES: -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/NEWS b/archive_old_fs_versions/fuse-tutorial-2016-03-25/NEWS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/README b/archive_old_fs_versions/fuse-tutorial-2016-03-25/README deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/aclocal.m4 b/archive_old_fs_versions/fuse-tutorial-2016-03-25/aclocal.m4 deleted file mode 100644 index a017fa14c8ce11e70ff98202fd58039985289a71..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/aclocal.m4 +++ /dev/null @@ -1,1428 +0,0 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29) -dnl -dnl Copyright © 2004 Scott James Remnant . -dnl Copyright © 2012-2015 Dan Nicholson -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -dnl 02111-1307, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a -dnl configuration script generated by Autoconf, you may include it under -dnl the same distribution terms that you use for the rest of that -dnl program. - -dnl PKG_PREREQ(MIN-VERSION) -dnl ----------------------- -dnl Since: 0.29 -dnl -dnl Verify that the version of the pkg-config macros are at least -dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's -dnl installed version of pkg-config, this checks the developer's version -dnl of pkg.m4 when generating configure. -dnl -dnl To ensure that this macro is defined, also add: -dnl m4_ifndef([PKG_PREREQ], -dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) -dnl -dnl See the "Since" comment for each macro you use to see what version -dnl of the macros you require. -m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29]) -m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, - [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) -])dnl PKG_PREREQ - -dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) -dnl ---------------------------------- -dnl Since: 0.16 -dnl -dnl Search for the pkg-config tool and set the PKG_CONFIG variable to -dnl first found in the path. Checks that the version of pkg-config found -dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is -dnl used since that's the first version where most current features of -dnl pkg-config existed. -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])dnl PKG_PROG_PKG_CONFIG - -dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------------------------------- -dnl Since: 0.18 -dnl -dnl Check to see whether a particular set of modules exists. Similar to -dnl PKG_CHECK_MODULES(), but does not set variables or print errors. -dnl -dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -dnl only at the first occurence in configure.ac, so if the first place -dnl it's called might be skipped (such as if it is within an "if", you -dnl have to call PKG_CHECK_EXISTS manually -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -dnl --------------------------------------------- -dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting -dnl pkg_failed based on the result. -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])dnl _PKG_CONFIG - -dnl _PKG_SHORT_ERRORS_SUPPORTED -dnl --------------------------- -dnl Internal check to see if pkg-config supports short errors. -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])dnl _PKG_SHORT_ERRORS_SUPPORTED - - -dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl -------------------------------------------------------------- -dnl Since: 0.4.0 -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES might not happen, you should be sure to include an -dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])dnl PKG_CHECK_MODULES - - -dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl --------------------------------------------------------------------- -dnl Since: 0.29 -dnl -dnl Checks for existence of MODULES and gathers its build flags with -dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags -dnl and VARIABLE-PREFIX_LIBS from --libs. -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to -dnl include an explicit call to PKG_PROG_PKG_CONFIG in your -dnl configure.ac. -AC_DEFUN([PKG_CHECK_MODULES_STATIC], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -_save_PKG_CONFIG=$PKG_CONFIG -PKG_CONFIG="$PKG_CONFIG --static" -PKG_CHECK_MODULES($@) -PKG_CONFIG=$_save_PKG_CONFIG[]dnl -])dnl PKG_CHECK_MODULES_STATIC - - -dnl PKG_INSTALLDIR([DIRECTORY]) -dnl ------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable pkgconfigdir as the location where a module -dnl should install pkg-config .pc files. By default the directory is -dnl $libdir/pkgconfig, but the default can be changed by passing -dnl DIRECTORY. The user can override through the --with-pkgconfigdir -dnl parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_INSTALLDIR - - -dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) -dnl -------------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable noarch_pkgconfigdir as the location where a -dnl module should install arch-independent pkg-config .pc files. By -dnl default the directory is $datadir/pkgconfig, but the default can be -dnl changed by passing DIRECTORY. The user can override through the -dnl --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_NOARCH_INSTALLDIR - - -dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------- -dnl Since: 0.28 -dnl -dnl Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])dnl PKG_CHECK_VAR - -# Copyright (C) 2002-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi -dnl The trailing newline in this macro's definition is deliberate, for -dnl backward compatibility and to allow trailing 'dnl'-style comments -dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. -]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/autogen.sh b/archive_old_fs_versions/fuse-tutorial-2016-03-25/autogen.sh deleted file mode 100644 index 7a9c5ef78a3db01c8c592c201254863e2e8da4ae..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/autogen.sh +++ /dev/null @@ -1,1491 +0,0 @@ -#!/bin/sh -# a u t o g e n . s h -# -# Copyright (c) 2005-2007 United States Government as represented by -# the U.S. Army Research Laboratory. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -### -# -# Script for automatically preparing the sources for compilation by -# performing the myrid of necessary steps. The script attempts to -# detect proper version support, and outputs warnings about particular -# systems that have autotool peculiarities. -# -# Basically, if everything is set up and installed correctly, the -# script will validate that minimum versions of the GNU Build System -# tools are installed, account for several common configuration -# issues, and then simply run autoreconf for you. -# -# If autoreconf fails, which can happen for many valid configurations, -# this script proceeds to run manual preparation steps effectively -# providing a POSIX shell script (mostly complete) reimplementation of -# autoreconf. -# -# The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER -# environment variables and corresponding _OPTIONS variables (e.g. -# AUTORECONF_OPTIONS) may be used to override the default automatic -# detection behaviors. Similarly the _VERSION variables will override -# the minimum required version numbers. -# -# Examples: -# -# To obtain help on usage: -# ./autogen.sh --help -# -# To obtain verbose output: -# ./autogen.sh --verbose -# -# To skip autoreconf and prepare manually: -# AUTORECONF=false ./autogen.sh -# -# To verbosely try running with an older (unsupported) autoconf: -# AUTOCONF_VERSION=2.50 ./autogen.sh --verbose -# -# Author: Christopher Sean Morrison -# -###################################################################### - -# set to minimum acceptible version of autoconf -if [ "x$AUTOCONF_VERSION" = "x" ] ; then - AUTOCONF_VERSION=2.52 -fi -# set to minimum acceptible version of automake -if [ "x$AUTOMAKE_VERSION" = "x" ] ; then - AUTOMAKE_VERSION=1.6.0 -fi -# set to minimum acceptible version of libtool -if [ "x$LIBTOOL_VERSION" = "x" ] ; then - LIBTOOL_VERSION=1.4.2 -fi - - -################## -# ident function # -################## -ident ( ) { - # extract copyright from header - __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`" - if [ "x$__copyright" = "x" ] ; then - __copyright="`date +%Y`" - fi - - # extract version from CVS Id string - __id="$Id: autogen.sh,v 14.97 2007/06/18 22:25:02 brlcad Exp $" - __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`" - if [ "x$__version" = "x" ] ; then - __version="" - fi - - echo "autogen.sh build preparation script by Christopher Sean Morrison" - echo "revised 3-clause BSD-style license, copyright (c) $__copyright" - echo "script version $__version, ISO/IEC 9945 POSIX shell script" -} - - -################## -# USAGE FUNCTION # -################## -usage ( ) { - echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [--version]" - echo " --help Help on $NAME_OF_AUTOGEN usage" - echo " --verbose Verbose progress output" - echo " --quiet Quiet suppressed progress output" - echo " --version Only perform GNU Build System version checks" - echo - echo "Description: This script will validate that minimum versions of the" - echo "GNU Build System tools are installed and then run autoreconf for you." - echo "Should autoreconf fail, manual preparation steps will be run" - echo "potentially accounting for several common preparation issues. The" - - echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER," - echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS" - echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the" - echo "default automatic detection behavior." - echo - - ident - - return 0 -} - - -########################## -# VERSION_ERROR FUNCTION # -########################## -version_error ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided a version" - exit 1 - fi - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided an application name" - exit 1 - fi - $ECHO - $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch," - $ECHO " at least version $1 of $2 must be installed." - $ECHO - $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will" - $ECHO "run configure or make. Either the GNU Autotools will need to be installed" - $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source" - $ECHO "code on another system and then transferred to here. -- Cheers!" - $ECHO -} - -########################## -# VERSION_CHECK FUNCTION # -########################## -version_check ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_check was not provided a minimum version" - exit 1 - fi - _min="$1" - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version check was not provided a comparison version" - exit 1 - fi - _cur="$2" - - # needed to handle versions like 1.10 and 1.4-p6 - _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - - _min_major="`echo $_min | cut -d. -f1`" - _min_minor="`echo $_min | cut -d. -f2`" - _min_patch="`echo $_min | cut -d. -f3`" - - _cur_major="`echo $_cur | cut -d. -f1`" - _cur_minor="`echo $_cur | cut -d. -f2`" - _cur_patch="`echo $_cur | cut -d. -f3`" - - if [ "x$_min_major" = "x" ] ; then - _min_major=0 - fi - if [ "x$_min_minor" = "x" ] ; then - _min_minor=0 - fi - if [ "x$_min_patch" = "x" ] ; then - _min_patch=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_major=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_minor=0 - fi - if [ "x$_cur_patch" = "x" ] ; then - _cur_patch=0 - fi - - $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}" - - if [ $_min_major -lt $_cur_major ] ; then - return 0 - elif [ $_min_major -eq $_cur_major ] ; then - if [ $_min_minor -lt $_cur_minor ] ; then - return 0 - elif [ $_min_minor -eq $_cur_minor ] ; then - if [ $_min_patch -lt $_cur_patch ] ; then - return 0 - elif [ $_min_patch -eq $_cur_patch ] ; then - return 0 - fi - fi - fi - return 1 -} - - -###################################### -# LOCATE_CONFIGURE_TEMPLATE FUNCTION # -###################################### -locate_configure_template ( ) { - _pwd="`pwd`" - if test -f "./configure.ac" ; then - echo "./configure.ac" - elif test -f "./configure.in" ; then - echo "./configure.in" - elif test -f "$_pwd/configure.ac" ; then - echo "$_pwd/configure.ac" - elif test -f "$_pwd/configure.in" ; then - echo "$_pwd/configure.in" - elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then - echo "$PATH_TO_AUTOGEN/configure.ac" - elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then - echo "$PATH_TO_AUTOGEN/configure.in" - fi -} - - -################## -# argument check # -################## -ARGS="$*" -PATH_TO_AUTOGEN="`dirname $0`" -NAME_OF_AUTOGEN="`basename $0`" -AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN" - -LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4" - -if [ "x$HELP" = "x" ] ; then - HELP=no -fi -if [ "x$QUIET" = "x" ] ; then - QUIET=no -fi -if [ "x$VERBOSE" = "x" ] ; then - VERBOSE=no -fi -if [ "x$VERSION_ONLY" = "x" ] ; then - VERSION_ONLY=no -fi -if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then - AUTORECONF_OPTIONS="-i -f" -fi -if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then - AUTOCONF_OPTIONS="-f" -fi -if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then - AUTOMAKE_OPTIONS="-a -c -f" -fi -ALT_AUTOMAKE_OPTIONS="-a -c" -if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then - LIBTOOLIZE_OPTIONS="--automake -c -f" -fi -ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force" -if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then - ACLOCAL_OPTIONS="" -fi -if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then - AUTOHEADER_OPTIONS="" -fi -for arg in $ARGS ; do - case "x$arg" in - x--help) HELP=yes ;; - x-[hH]) HELP=yes ;; - x--quiet) QUIET=yes ;; - x-[qQ]) QUIET=yes ;; - x--verbose) VERBOSE=yes ;; - x-[vV]) VERBOSE=yes ;; - x--version) VERSION_ONLY=yes ;; - *) - echo "Unknown option: $arg" - echo - usage - exit 1 - ;; - esac -done - - -##################### -# environment check # -##################### - -# sanity check before recursions potentially begin -if [ ! -f "$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: $AUTOGEN_SH does not exist" - if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH" - fi - exit 1 -fi - -# force locale setting to C so things like date output as expected -LC_ALL=C - -# commands that this script expects -for __cmd in echo head tail pwd ; do - echo "test" | $__cmd > /dev/null 2>&1 - if [ $? != 0 ] ; then - echo "INTERNAL ERROR: '${__cmd}' command is required" - exit 2 - fi -done -echo "test" | grep "test" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: grep command is required" - exit 1 -fi -echo "test" | sed "s/test/test/" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: sed command is required" - exit 1 -fi - - -# determine the behavior of echo -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -# determine the behavior of head -case "x`echo 'head' | head -n 1 2>&1`" in - *xhead*) HEAD_N="n " ;; - *) HEAD_N="" ;; -esac - -# determine the behavior of tail -case "x`echo 'tail' | tail -n 1 2>&1`" in - *xtail*) TAIL_N="n " ;; - *) TAIL_N="" ;; -esac - -VERBOSE_ECHO=: -ECHO=: -if [ "x$QUIET" = "xyes" ] ; then - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output quelled by quiet option. Further output disabled." - fi -else - ECHO=echo - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output enabled" - VERBOSE_ECHO=echo - fi -fi - - -# allow a recursive run to disable further recursions -if [ "x$RUN_RECURSIVE" = "x" ] ; then - RUN_RECURSIVE=yes -fi - - -################################################ -# check for help arg and bypass version checks # -################################################ -if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then - HELP=yes -fi -if [ "x$HELP" = "xyes" ] ; then - usage - $ECHO "---" - $ECHO "Help was requested. No preparation or configuration will be performed." - exit 0 -fi - - -####################### -# set up signal traps # -####################### -untrap_abnormal ( ) { - for sig in 1 2 13 15; do - trap - $sig - done -} - -# do this cleanup whenever we exit. -trap ' - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # restore/delete backup files - if test "x$PFC_INIT" = "x1" ; then - recursive_restore - fi -' 0 - -# trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15) -for sig in 1 2 13 15; do - trap ' - $ECHO "" - $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'" - - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # clean up on abnormal exit - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - - if test -f "acinclude.m4.$$.backup" ; then - $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4" - chmod u+w acinclude.m4 - cat acinclude.m4.$$.backup > acinclude.m4 - - $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup" - rm -f acinclude.m4.$$.backup - fi - - { (exit 1); exit 1; } -' $sig -done - - -############################# -# look for a configure file # -############################# -if [ "x$CONFIGURE" = "x" ] ; then - CONFIGURE="`locate_configure_template`" - if [ ! "x$CONFIGURE" = "x" ] ; then - $VERBOSE_ECHO "Found a configure template: $CONFIGURE" - fi -else - $ECHO "Using CONFIGURE environment variable override: $CONFIGURE" -fi -if [ "x$CONFIGURE" = "x" ] ; then - if [ "x$VERSION_ONLY" = "xyes" ] ; then - CONFIGURE=/dev/null - else - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi -fi - -#################### -# get project name # -#################### -if [ "x$PROJECT" = "x" ] ; then - PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if [ "x$PROJECT" = "xAC_INIT" ] ; then - # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead - PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - fi - if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then - PROJECT="project" - fi - if [ "x$PROJECT" = "x" ] ; then - PROJECT="project" - fi -else - $ECHO "Using PROJECT environment variable override: $PROJECT" -fi -$ECHO "Preparing the $PROJECT build system...please wait" -$ECHO - - -######################## -# check for autoreconf # -######################## -HAVE_AUTORECONF=no -if [ "x$AUTORECONF" = "x" ] ; then - for AUTORECONF in autoreconf ; do - $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version" - $AUTORECONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - HAVE_AUTORECONF=yes - break - fi - done -else - HAVE_AUTORECONF=yes - $ECHO "Using AUTORECONF environment variable override: $AUTORECONF" -fi - - -########################## -# autoconf version check # -########################## -_acfound=no -if [ "x$AUTOCONF" = "x" ] ; then - for AUTOCONF in autoconf ; do - $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version" - $AUTOCONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _acfound=yes - break - fi - done -else - _acfound=yes - $ECHO "Using AUTOCONF environment variable override: $AUTOCONF" -fi - -_report_error=no -if [ ! "x$_acfound" = "xyes" ] ; then - $ECHO "ERROR: Unable to locate GNU Autoconf." - _report_error=yes -else - _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Autoconf version $_version" - version_check "$AUTOCONF_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOCONF_VERSION" "GNU Autoconf" - exit 1 -fi - - -########################## -# automake version check # -########################## -_amfound=no -if [ "x$AUTOMAKE" = "x" ] ; then - for AUTOMAKE in automake ; do - $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version" - $AUTOMAKE --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _amfound=yes - break - fi - done -else - _amfound=yes - $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE" -fi - - -_report_error=no -if [ ! "x$_amfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Automake." - _report_error=yes -else - _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Automake version $_version" - version_check "$AUTOMAKE_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOMAKE_VERSION" "GNU Automake" - exit 1 -fi - - -######################## -# check for libtoolize # -######################## -HAVE_LIBTOOLIZE=yes -HAVE_ALT_LIBTOOLIZE=no -_ltfound=no -if [ "x$LIBTOOLIZE" = "x" ] ; then - LIBTOOLIZE=libtoolize - $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version" - $LIBTOOLIZE --version > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - HAVE_LIBTOOLIZE=no - $ECHO - if [ "x$HAVE_AUTORECONF" = "xno" ] ; then - $ECHO "Warning: libtoolize does not appear to be available." - else - $ECHO "Warning: libtoolize does not appear to be available. This means that" - $ECHO "the automatic build preparation via autoreconf will probably not work." - $ECHO "Preparing the build by running each step individually, however, should" - $ECHO "work and will be done automatically for you if autoreconf fails." - fi - - # look for some alternates - for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do - $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version" - _glibtoolize="`$tool --version > /dev/null 2>&1`" - if [ $? = 0 ] ; then - $VERBOSE_ECHO "Found $tool --version" - _glti="`which $tool`" - if [ "x$_glti" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool with which" - continue; - fi - if test ! -f "$_glti" ; then - $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file" - continue; - fi - _gltidir="`dirname $_glti`" - if [ "x$_gltidir" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti" - continue; - fi - if test ! -d "$_gltidir" ; then - $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory" - continue; - fi - HAVE_ALT_LIBTOOLIZE=yes - LIBTOOLIZE="$tool" - $ECHO - $ECHO "Fortunately, $tool was found which means that your system may simply" - $ECHO "have a non-standard or incomplete GNU Autotools install. If you have" - $ECHO "sufficient system access, it may be possible to quell this warning by" - $ECHO "running:" - $ECHO - sudo -V > /dev/null 2>&1 - if [ $? = 0 ] ; then - $ECHO " sudo ln -s $_glti $_gltidir/libtoolize" - $ECHO - else - $ECHO " ln -s $_glti $_gltidir/libtoolize" - $ECHO - $ECHO "Run that as root or with proper permissions to the $_gltidir directory" - $ECHO - fi - _ltfound=yes - break - fi - done - else - _ltfound=yes - fi -else - _ltfound=yes - $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE" -fi - - -############################ -# libtoolize version check # -############################ -_report_error=no -if [ ! "x$_ltfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Libtool." - _report_error=yes -else - _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Libtool version $_version" - version_check "$LIBTOOL_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$LIBTOOL_VERSION" "GNU Libtool" - exit 1 -fi - - -##################### -# check for aclocal # -##################### -if [ "x$ACLOCAL" = "x" ] ; then - for ACLOCAL in aclocal ; do - $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version" - $ACLOCAL --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using ACLOCAL environment variable override: $ACLOCAL" -fi - - -######################## -# check for autoheader # -######################## -if [ "x$AUTOHEADER" = "x" ] ; then - for AUTOHEADER in autoheader ; do - $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version" - $AUTOHEADER --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER" -fi - - -######################### -# check if version only # -######################### -$VERBOSE_ECHO "Checking whether to only output version information" -if [ "x$VERSION_ONLY" = "xyes" ] ; then - $ECHO - ident - $ECHO "---" - $ECHO "Version requested. No preparation or configuration will be performed." - exit 0 -fi - - -################################# -# PROTECT_FROM_CLOBBER FUNCTION # -################################# -protect_from_clobber ( ) { - PFC_INIT=1 - - # protect COPYING & INSTALL from overwrite by automake. the - # automake force option will (inappropriately) ignore the existing - # contents of a COPYING and/or INSTALL files (depending on the - # version) instead of just forcing *missing* files like it does - # for AUTHORS, NEWS, and README. this is broken but extremely - # prevalent behavior, so we protect against it by keeping a backup - # of the file that can later be restored. - - if test -f COPYING ; then - if test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up COPYING in `pwd`" - else - $VERBOSE_ECHO "Backing up COPYING in `pwd`" - $VERBOSE_ECHO "cp -p COPYING COPYING.$$.protect_from_automake.backup" - cp -p COPYING COPYING.$$.protect_from_automake.backup - fi - fi - if test -f INSTALL ; then - if test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up INSTALL in `pwd`" - else - $VERBOSE_ECHO "Backing up INSTALL in `pwd`" - $VERBOSE_ECHO "cp -p INSTALL INSTALL.$$.protect_from_automake.backup" - cp -p INSTALL INSTALL.$$.protect_from_automake.backup - fi - fi -} - - -############################## -# RECURSIVE_PROTECT FUNCTION # -############################## -recursive_protect ( ) { - - # for projects using recursive configure, run the build - # preparation steps for the subdirectories. this function assumes - # START_PATH was set to pwd before recursion begins so that - # relative paths work. - - # git 'r done, protect COPYING and INSTALL from being clobbered - protect_from_clobber - - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure" - - # look for subdirs - # $VERBOSE_ECHO "Looking for subdirs in `pwd`" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Protecting files from automake in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r done - recursive_protect - done - fi -} # end of recursive_protect - - -############################# -# RESTORE_CLOBBERED FUNCION # -############################# -restore_clobbered ( ) { - - # The automake (and autoreconf by extension) -f/--force-missing - # option may overwrite COPYING and INSTALL even if they do exist. - # Here we restore the files if necessary. - - spacer=no - - # COPYING - if test -f COPYING.$$.protect_from_automake.backup ; then - if test -f COPYING ; then - # compare entire content, restore if needed - if test "x`cat COPYING`" != "x`cat COPYING.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring COPYING from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f COPYING" - rm -f COPYING - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # check contents - elif test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # -f COPYING - - # just in case - $VERBOSE_ECHO "rm -f COPYING.$$.protect_from_automake.backup" - rm -f COPYING.$$.protect_from_automake.backup - fi # -f COPYING.$$.protect_from_automake.backup - - # INSTALL - if test -f INSTALL.$$.protect_from_automake.backup ; then - if test -f INSTALL ; then - # compare entire content, restore if needed - if test "x`cat INSTALL`" != "x`cat INSTALL.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring INSTALL from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f INSTALL" - rm -f INSTALL - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # check contents - elif test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # -f INSTALL - - # just in case - $VERBOSE_ECHO "rm -f INSTALL.$$.protect_from_automake.backup" - rm -f INSTALL.$$.protect_from_automake.backup - fi # -f INSTALL.$$.protect_from_automake.backup - - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - return - fi - - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - fi - - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\"" - rm -f "${_aux_dir}/${file}.backup" - fi - done -} # end of restore_clobbered - - -############################## -# RECURSIVE_RESTORE FUNCTION # -############################## -recursive_restore ( ) { - - # restore COPYING and INSTALL from backup if they were clobbered - # for each directory recursively. - - # git 'r undone - restore_clobbered - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - - # look for subdirs - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Checking files for automake damage in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r undone - recursive_restore - done - fi -} # end of recursive_restore - - -####################### -# INITIALIZE FUNCTION # -####################### -initialize ( ) { - - # this routine performs a variety of directory-specific - # initializations. some are sanity checks, some are preventive, - # and some are necessary setup detection. - # - # this function sets: - # CONFIGURE - # SEARCH_DIRS - # CONFIG_SUBDIRS - - ################################## - # check for a configure template # - ################################## - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi - - ##################### - # detect an aux dir # - ##################### - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - else - $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir" - fi - - ################################ - # detect a recursive configure # - ################################ - CONFIG_SUBDIRS="" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir" - CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir" - fi - done - - ########################################## - # make sure certain required files exist # - ########################################## - for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do - if test ! -f $file ; then - $VERBOSE_ECHO "Touching ${file} since it does not exist" - touch $file - fi - done - - ################################################## - # make sure certain generated files do not exist # - ################################################## - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\"" - mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup" - fi - done - - ############################ - # search alternate m4 dirs # - ############################ - SEARCH_DIRS="" - for dir in m4 ; do - if [ -d $dir ] ; then - $VERBOSE_ECHO "Found extra aclocal search directory: $dir" - SEARCH_DIRS="$SEARCH_DIRS -I $dir" - fi - done - - ###################################### - # remove any previous build products # - ###################################### - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi -# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it -# if test -f aclocal.m4 ; then -# $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it" -# $VERBOSE_ECHO "rm -f aclocal.m4" -# rm -f aclocal.m4 -# fi - -} # end of initialize() - - -############## -# initialize # -############## - -# stash path -START_PATH="`pwd`" - -# Before running autoreconf or manual steps, some prep detection work -# is necessary or useful. Only needs to occur once per directory, but -# does need to traverse the entire subconfigure hierarchy to protect -# files from being clobbered even by autoreconf. -recursive_protect - -# start from where we started -cd "$START_PATH" - -# get ready to process -initialize - - -############################################ -# prepare build via autoreconf or manually # -############################################ -reconfigure_manually=no -if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then - $ECHO - $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C" - - $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS" - autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoreconf_output" - - if [ ! $ret = 0 ] ; then - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then - $ECHO - $ECHO "Warning: autoreconf failed but due to what is usually a common libtool" - $ECHO "misconfiguration issue. This problem is encountered on systems that" - $ECHO "have installed libtoolize under a different name without providing a" - $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable." - $ECHO - $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE" - - export LIBTOOLIZE - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi - - $ECHO "Warning: $AUTORECONF failed" - - if test -f ltmain.sh ; then - $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should" - fi - - $ECHO "Attempting to run the preparation steps individually" - reconfigure_manually=yes - fi -else - reconfigure_manually=yes -fi - - -############################ -# LIBTOOL_FAILURE FUNCTION # -############################ -libtool_failure ( ) { - - # libtool is rather error-prone in comparison to the other - # autotools and this routine attempts to compensate for some - # common failures. the output after a libtoolize failure is - # parsed for an error related to AC_PROG_LIBTOOL and if found, we - # attempt to inject a project-provided libtool.m4 file. - - _autoconf_output="$1" - - if [ "x$RUN_RECURSIVE" = "xno" ] ; then - # we already tried the libtool.m4, don't try again - return 1 - fi - - if test -f "$LIBTOOL_M4" ; then - found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`" - if test ! "x$found_libtool" = "x" ; then - if test -f acinclude.m4 ; then - rm -f acinclude.m4.$$.backup - $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup" - cat acinclude.m4 > acinclude.m4.$$.backup - fi - $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4" - chmod u+w acinclude.m4 - cat "$LIBTOOL_M4" >> acinclude.m4 - - # don't keep doing this - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $ECHO - $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4" - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi -} - - -########################### -# MANUAL_AUTOGEN FUNCTION # -########################### -manual_autogen ( ) { - - ################################################## - # Manual preparation steps taken are as follows: # - # aclocal [-I m4] # - # libtoolize --automake -c -f # - # aclocal [-I m4] # - # autoconf -f # - # autoheader # - # automake -a -c -f # - ################################################## - - ########### - # aclocal # - ########### - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi - - ############## - # libtoolize # - ############## - need_libtoolize=no - for feature in AC_PROG_LIBTOOL LT_INIT ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_libtoolize=yes - break - fi - done - if [ "x$need_libtoolize" = "xyes" ] ; then - if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - else - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - fi - fi - - ########### - # aclocal # - ########### - # re-run again as instructed by libtoolize - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - - # libtoolize might put ltmain.sh in the wrong place - if test -f ltmain.sh ; then - if test ! -f "${_aux_dir}/ltmain.sh" ; then - $ECHO - $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory" - $ECHO - $ECHO "Fortunately, the problem can be worked around by simply copying the" - $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you." - $ECHO - $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\"" - cp -p ltmain.sh "${_aux_dir}/ltmain.sh" - $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" - fi - fi # ltmain.sh - fi # need_libtoolize - - ############ - # autoconf # - ############ - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS" - autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # retry without the -f and check for usage of macros that are too new - ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE" - ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE" - ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T" - - macros_to_search="" - ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`" - ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`" - - if [ $ac_major -lt 2 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - else - if [ $ac_minor -lt 54 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - elif [ $ac_minor -lt 55 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros" - elif [ $ac_minor -lt 59 ] ; then - macros_to_search="$ac2_59_macros" - fi - fi - - configure_ac_macros=__none__ - for feature in $macros_to_search ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - if [ "x$configure_ac_macros" = "x__none__" ] ; then - configure_ac_macros="$feature" - else - configure_ac_macros="$feature $configure_ac_macros" - fi - fi - done - if [ ! "x$configure_ac_macros" = "x__none__" ] ; then - $ECHO - $ECHO "Warning: Unsupported macros were found in $CONFIGURE" - $ECHO - $ECHO "The `echo $CONFIGURE | basename` file was scanned in order to determine if any" - $ECHO "unsupported macros are used that exceed the minimum version" - $ECHO "settings specified within this file. As such, the following macros" - $ECHO "should be removed from configure.ac or the version numbers in this" - $ECHO "file should be increased:" - $ECHO - $ECHO "$configure_ac_macros" - $ECHO - $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C" - fi - - ################### - # autoconf, retry # - ################### - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF" - autoconf_output="`$AUTOCONF 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # test if libtool is busted - libtool_failure "$autoconf_output" - - # let the user know what went wrong - cat <. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.log b/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.log deleted file mode 100644 index 79f2d7d66da2f2e1e1333e9498fa0d813b4f725c..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.log +++ /dev/null @@ -1,936 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by fuse-tutorial configure 2016-03-25, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ ./configure - -## --------- ## -## Platform. ## -## --------- ## - -hostname = macgentoo -uname -m = x86_64 -uname -r = 4.4.26-gentoo -uname -s = Linux -uname -v = #1 SMP Mon Oct 24 13:42:51 CEST 2016 - -/usr/bin/uname -p = Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -/usr/bin/hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/local/bin -PATH: /usr/bin -PATH: /bin -PATH: /opt/bin -PATH: /usr/x86_64-pc-linux-gnu/gcc-bin/4.9.4 -PATH: /home/lefthy/.opam/system/bin - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:2382: checking for a BSD-compatible install -configure:2450: result: /usr/bin/install -c -configure:2461: checking whether build environment is sane -configure:2516: result: yes -configure:2667: checking for a thread-safe mkdir -p -configure:2706: result: /bin/mkdir -p -configure:2713: checking for gawk -configure:2729: found /usr/bin/gawk -configure:2740: result: gawk -configure:2751: checking whether make sets $(MAKE) -configure:2773: result: yes -configure:2802: checking whether make supports nested variables -configure:2819: result: yes -configure:2998: checking for gcc -configure:3014: found /usr/bin/gcc -configure:3025: result: gcc -configure:3254: checking for C compiler version -configure:3263: gcc --version >&5 -gcc (Gentoo 4.9.4 p1.0, pie-0.6.4) 4.9.4 -Copyright (C) 2015 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -configure:3274: $? = 0 -configure:3263: gcc -v >&5 -Using built-in specs. -COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.4/gcc -COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.4/lto-wrapper -Target: x86_64-pc-linux-gnu -Configured with: /var/tmp/portage/sys-devel/gcc-4.9.4/work/gcc-4.9.4/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.9.4/python --enable-languages=c,c++,java,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.9.4 p1.0, pie-0.6.4' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --enable-vtable-verify --enable-libvtv --enable-lto --without-cloog --enable-libsanitizer -Thread model: posix -gcc version 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4) -configure:3274: $? = 0 -configure:3263: gcc -V >&5 -gcc: error: unrecognized command line option '-V' -gcc: fatal error: no input files -compilation terminated. -configure:3274: $? = 1 -configure:3263: gcc -qversion >&5 -gcc: error: unrecognized command line option '-qversion' -gcc: fatal error: no input files -compilation terminated. -configure:3274: $? = 1 -configure:3294: checking whether the C compiler works -configure:3316: gcc conftest.c >&5 -configure:3320: $? = 0 -configure:3368: result: yes -configure:3371: checking for C compiler default output file name -configure:3373: result: a.out -configure:3379: checking for suffix of executables -configure:3386: gcc -o conftest conftest.c >&5 -configure:3390: $? = 0 -configure:3412: result: -configure:3434: checking whether we are cross compiling -configure:3442: gcc -o conftest conftest.c >&5 -configure:3446: $? = 0 -configure:3453: ./conftest -configure:3457: $? = 0 -configure:3472: result: no -configure:3477: checking for suffix of object files -configure:3499: gcc -c conftest.c >&5 -configure:3503: $? = 0 -configure:3524: result: o -configure:3528: checking whether we are using the GNU C compiler -configure:3547: gcc -c conftest.c >&5 -configure:3547: $? = 0 -configure:3556: result: yes -configure:3565: checking whether gcc accepts -g -configure:3585: gcc -c -g conftest.c >&5 -configure:3585: $? = 0 -configure:3626: result: yes -configure:3643: checking for gcc option to accept ISO C89 -configure:3706: gcc -c -g -O2 conftest.c >&5 -configure:3706: $? = 0 -configure:3719: result: none needed -configure:3744: checking whether gcc understands -c and -o together -configure:3766: gcc -c conftest.c -o conftest2.o -configure:3769: $? = 0 -configure:3766: gcc -c conftest.c -o conftest2.o -configure:3769: $? = 0 -configure:3781: result: yes -configure:3809: checking for style of include used by make -configure:3837: result: GNU -configure:3863: checking dependency style of gcc -configure:3974: result: gcc3 -configure:3997: checking how to run the C preprocessor -configure:4028: gcc -E conftest.c -configure:4028: $? = 0 -configure:4042: gcc -E conftest.c -conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory - #include - ^ -compilation terminated. -configure:4042: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| /* end confdefs.h. */ -| #include -configure:4067: result: gcc -E -configure:4087: gcc -E conftest.c -configure:4087: $? = 0 -configure:4101: gcc -E conftest.c -conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory - #include - ^ -compilation terminated. -configure:4101: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| /* end confdefs.h. */ -| #include -configure:4130: checking for grep that handles long lines and -e -configure:4188: result: /bin/grep -configure:4193: checking for egrep -configure:4255: result: /bin/grep -E -configure:4260: checking for ANSI C header files -configure:4280: gcc -c -g -O2 conftest.c >&5 -configure:4280: $? = 0 -configure:4353: gcc -o conftest -g -O2 conftest.c >&5 -configure:4353: $? = 0 -configure:4353: ./conftest -configure:4353: $? = 0 -configure:4364: result: yes -configure:4377: checking for sys/types.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for sys/stat.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for stdlib.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for string.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for memory.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for strings.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for inttypes.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for stdint.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4377: checking for unistd.h -configure:4377: gcc -c -g -O2 conftest.c >&5 -configure:4377: $? = 0 -configure:4377: result: yes -configure:4392: checking fcntl.h usability -configure:4392: gcc -c -g -O2 conftest.c >&5 -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking fcntl.h presence -configure:4392: gcc -E conftest.c -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking for fcntl.h -configure:4392: result: yes -configure:4392: checking limits.h usability -configure:4392: gcc -c -g -O2 conftest.c >&5 -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking limits.h presence -configure:4392: gcc -E conftest.c -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking for limits.h -configure:4392: result: yes -configure:4392: checking for stdlib.h -configure:4392: result: yes -configure:4392: checking for string.h -configure:4392: result: yes -configure:4392: checking sys/statvfs.h usability -configure:4392: gcc -c -g -O2 conftest.c >&5 -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking sys/statvfs.h presence -configure:4392: gcc -E conftest.c -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking for sys/statvfs.h -configure:4392: result: yes -configure:4392: checking for unistd.h -configure:4392: result: yes -configure:4392: checking utime.h usability -configure:4392: gcc -c -g -O2 conftest.c >&5 -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking utime.h presence -configure:4392: gcc -E conftest.c -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking for utime.h -configure:4392: result: yes -configure:4392: checking sys/xattr.h usability -configure:4392: gcc -c -g -O2 conftest.c >&5 -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking sys/xattr.h presence -configure:4392: gcc -E conftest.c -configure:4392: $? = 0 -configure:4392: result: yes -configure:4392: checking for sys/xattr.h -configure:4392: result: yes -configure:4458: checking for pkg-config -configure:4476: found /usr/bin/pkg-config -configure:4488: result: /usr/bin/pkg-config -configure:4513: checking pkg-config is at least version 0.9.0 -configure:4516: result: yes -configure:4526: checking for FUSE -configure:4533: $PKG_CONFIG --exists --print-errors "fuse" -configure:4536: $? = 0 -configure:4550: $PKG_CONFIG --exists --print-errors "fuse" -configure:4553: $? = 0 -configure:4611: result: yes -configure:4617: checking for uid_t in sys/types.h -configure:4636: result: yes -configure:4647: checking for mode_t -configure:4647: gcc -c -g -O2 conftest.c >&5 -configure:4647: $? = 0 -configure:4647: gcc -c -g -O2 conftest.c >&5 -conftest.c: In function 'main': -conftest.c:65:21: error: expected expression before ')' token - if (sizeof ((mode_t))) - ^ -configure:4647: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| #define STDC_HEADERS 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_FCNTL_H 1 -| #define HAVE_LIMITS_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_SYS_STATVFS_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_UTIME_H 1 -| #define HAVE_SYS_XATTR_H 1 -| /* end confdefs.h. */ -| #include -| #ifdef HAVE_SYS_TYPES_H -| # include -| #endif -| #ifdef HAVE_SYS_STAT_H -| # include -| #endif -| #ifdef STDC_HEADERS -| # include -| # include -| #else -| # ifdef HAVE_STDLIB_H -| # include -| # endif -| #endif -| #ifdef HAVE_STRING_H -| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H -| # include -| # endif -| # include -| #endif -| #ifdef HAVE_STRINGS_H -| # include -| #endif -| #ifdef HAVE_INTTYPES_H -| # include -| #endif -| #ifdef HAVE_STDINT_H -| # include -| #endif -| #ifdef HAVE_UNISTD_H -| # include -| #endif -| int -| main () -| { -| if (sizeof ((mode_t))) -| return 0; -| ; -| return 0; -| } -configure:4647: result: yes -configure:4658: checking for off_t -configure:4658: gcc -c -g -O2 conftest.c >&5 -configure:4658: $? = 0 -configure:4658: gcc -c -g -O2 conftest.c >&5 -conftest.c: In function 'main': -conftest.c:65:20: error: expected expression before ')' token - if (sizeof ((off_t))) - ^ -configure:4658: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| #define STDC_HEADERS 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_FCNTL_H 1 -| #define HAVE_LIMITS_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_SYS_STATVFS_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_UTIME_H 1 -| #define HAVE_SYS_XATTR_H 1 -| /* end confdefs.h. */ -| #include -| #ifdef HAVE_SYS_TYPES_H -| # include -| #endif -| #ifdef HAVE_SYS_STAT_H -| # include -| #endif -| #ifdef STDC_HEADERS -| # include -| # include -| #else -| # ifdef HAVE_STDLIB_H -| # include -| # endif -| #endif -| #ifdef HAVE_STRING_H -| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H -| # include -| # endif -| # include -| #endif -| #ifdef HAVE_STRINGS_H -| # include -| #endif -| #ifdef HAVE_INTTYPES_H -| # include -| #endif -| #ifdef HAVE_STDINT_H -| # include -| #endif -| #ifdef HAVE_UNISTD_H -| # include -| #endif -| int -| main () -| { -| if (sizeof ((off_t))) -| return 0; -| ; -| return 0; -| } -configure:4658: result: yes -configure:4669: checking for pid_t -configure:4669: gcc -c -g -O2 conftest.c >&5 -configure:4669: $? = 0 -configure:4669: gcc -c -g -O2 conftest.c >&5 -conftest.c: In function 'main': -conftest.c:65:20: error: expected expression before ')' token - if (sizeof ((pid_t))) - ^ -configure:4669: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| #define STDC_HEADERS 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_FCNTL_H 1 -| #define HAVE_LIMITS_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_SYS_STATVFS_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_UTIME_H 1 -| #define HAVE_SYS_XATTR_H 1 -| /* end confdefs.h. */ -| #include -| #ifdef HAVE_SYS_TYPES_H -| # include -| #endif -| #ifdef HAVE_SYS_STAT_H -| # include -| #endif -| #ifdef STDC_HEADERS -| # include -| # include -| #else -| # ifdef HAVE_STDLIB_H -| # include -| # endif -| #endif -| #ifdef HAVE_STRING_H -| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H -| # include -| # endif -| # include -| #endif -| #ifdef HAVE_STRINGS_H -| # include -| #endif -| #ifdef HAVE_INTTYPES_H -| # include -| #endif -| #ifdef HAVE_STDINT_H -| # include -| #endif -| #ifdef HAVE_UNISTD_H -| # include -| #endif -| int -| main () -| { -| if (sizeof ((pid_t))) -| return 0; -| ; -| return 0; -| } -configure:4669: result: yes -configure:4680: checking for size_t -configure:4680: gcc -c -g -O2 conftest.c >&5 -configure:4680: $? = 0 -configure:4680: gcc -c -g -O2 conftest.c >&5 -conftest.c: In function 'main': -conftest.c:65:21: error: expected expression before ')' token - if (sizeof ((size_t))) - ^ -configure:4680: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "fuse-tutorial" -| #define PACKAGE_TARNAME "fuse-tutorial" -| #define PACKAGE_VERSION "2016-03-25" -| #define PACKAGE_STRING "fuse-tutorial 2016-03-25" -| #define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -| #define PACKAGE_URL "" -| #define PACKAGE "fuse-tutorial" -| #define VERSION "2016-03-25" -| #define STDC_HEADERS 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_FCNTL_H 1 -| #define HAVE_LIMITS_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_SYS_STATVFS_H 1 -| #define HAVE_UNISTD_H 1 -| #define HAVE_UTIME_H 1 -| #define HAVE_SYS_XATTR_H 1 -| /* end confdefs.h. */ -| #include -| #ifdef HAVE_SYS_TYPES_H -| # include -| #endif -| #ifdef HAVE_SYS_STAT_H -| # include -| #endif -| #ifdef STDC_HEADERS -| # include -| # include -| #else -| # ifdef HAVE_STDLIB_H -| # include -| # endif -| #endif -| #ifdef HAVE_STRING_H -| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H -| # include -| # endif -| # include -| #endif -| #ifdef HAVE_STRINGS_H -| # include -| #endif -| #ifdef HAVE_INTTYPES_H -| # include -| #endif -| #ifdef HAVE_STDINT_H -| # include -| #endif -| #ifdef HAVE_UNISTD_H -| # include -| #endif -| int -| main () -| { -| if (sizeof ((size_t))) -| return 0; -| ; -| return 0; -| } -configure:4680: result: yes -configure:4691: checking for struct stat.st_blksize -configure:4691: gcc -c -g -O2 conftest.c >&5 -configure:4691: $? = 0 -configure:4691: result: yes -configure:4701: checking for struct stat.st_blocks -configure:4701: gcc -c -g -O2 conftest.c >&5 -configure:4701: $? = 0 -configure:4701: result: yes -configure:4721: checking for struct stat.st_rdev -configure:4721: gcc -c -g -O2 conftest.c >&5 -configure:4721: $? = 0 -configure:4721: result: yes -configure:4731: checking for uint64_t -configure:4731: gcc -c -g -O2 conftest.c >&5 -configure:4731: $? = 0 -configure:4731: result: yes -configure:4749: checking for unistd.h -configure:4749: result: yes -configure:4759: checking for working chown -configure:4792: gcc -o conftest -g -O2 conftest.c >&5 -configure:4792: $? = 0 -configure:4792: ./conftest -configure:4792: $? = 0 -configure:4804: result: yes -configure:4812: checking whether lstat correctly handles trailing slash -configure:4838: gcc -o conftest -g -O2 conftest.c >&5 -configure:4838: $? = 0 -configure:4838: ./conftest -configure:4838: $? = 0 -configure:4855: result: yes -configure:4876: checking for stdlib.h -configure:4876: result: yes -configure:4886: checking for GNU libc compatible malloc -configure:4910: gcc -o conftest -g -O2 conftest.c >&5 -configure:4910: $? = 0 -configure:4910: ./conftest -configure:4910: $? = 0 -configure:4920: result: yes -configure:4944: checking for ftruncate -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for mkdir -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for mkfifo -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for realpath -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for rmdir -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for strerror -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4944: checking for utime -configure:4944: gcc -o conftest -g -O2 conftest.c >&5 -configure:4944: $? = 0 -configure:4944: result: yes -configure:4957: checking for fdatasync -configure:4957: gcc -o conftest -g -O2 conftest.c >&5 -configure:4957: $? = 0 -configure:4957: result: yes -configure:5078: checking that generated files are newer than configure -configure:5084: result: done -configure:5107: creating ./config.status - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by fuse-tutorial config.status 2016-03-25, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on macgentoo - -config.status:885: creating Makefile -config.status:885: creating html/Makefile -config.status:885: creating src/Makefile -config.status:885: creating src/config.h -config.status:1114: executing depfiles commands - -## ---------------- ## -## Cache variables. ## -## ---------------- ## - -ac_cv_c_compiler_gnu=yes -ac_cv_c_uint64_t=yes -ac_cv_env_CC_set= -ac_cv_env_CC_value= -ac_cv_env_CFLAGS_set= -ac_cv_env_CFLAGS_value= -ac_cv_env_CPPFLAGS_set= -ac_cv_env_CPPFLAGS_value= -ac_cv_env_CPP_set= -ac_cv_env_CPP_value= -ac_cv_env_FUSE_CFLAGS_set= -ac_cv_env_FUSE_CFLAGS_value= -ac_cv_env_FUSE_LIBS_set= -ac_cv_env_FUSE_LIBS_value= -ac_cv_env_LDFLAGS_set= -ac_cv_env_LDFLAGS_value= -ac_cv_env_LIBS_set= -ac_cv_env_LIBS_value= -ac_cv_env_PKG_CONFIG_LIBDIR_set= -ac_cv_env_PKG_CONFIG_LIBDIR_value= -ac_cv_env_PKG_CONFIG_PATH_set= -ac_cv_env_PKG_CONFIG_PATH_value= -ac_cv_env_PKG_CONFIG_set= -ac_cv_env_PKG_CONFIG_value= -ac_cv_env_build_alias_set= -ac_cv_env_build_alias_value= -ac_cv_env_host_alias_set= -ac_cv_env_host_alias_value= -ac_cv_env_target_alias_set= -ac_cv_env_target_alias_value= -ac_cv_func_chown_works=yes -ac_cv_func_fdatasync=yes -ac_cv_func_ftruncate=yes -ac_cv_func_lstat_dereferences_slashed_symlink=yes -ac_cv_func_malloc_0_nonnull=yes -ac_cv_func_mkdir=yes -ac_cv_func_mkfifo=yes -ac_cv_func_realpath=yes -ac_cv_func_rmdir=yes -ac_cv_func_strerror=yes -ac_cv_func_utime=yes -ac_cv_header_fcntl_h=yes -ac_cv_header_inttypes_h=yes -ac_cv_header_limits_h=yes -ac_cv_header_memory_h=yes -ac_cv_header_stdc=yes -ac_cv_header_stdint_h=yes -ac_cv_header_stdlib_h=yes -ac_cv_header_string_h=yes -ac_cv_header_strings_h=yes -ac_cv_header_sys_stat_h=yes -ac_cv_header_sys_statvfs_h=yes -ac_cv_header_sys_types_h=yes -ac_cv_header_sys_xattr_h=yes -ac_cv_header_unistd_h=yes -ac_cv_header_utime_h=yes -ac_cv_member_struct_stat_st_blksize=yes -ac_cv_member_struct_stat_st_blocks=yes -ac_cv_member_struct_stat_st_rdev=yes -ac_cv_objext=o -ac_cv_path_EGREP='/bin/grep -E' -ac_cv_path_GREP=/bin/grep -ac_cv_path_ac_pt_PKG_CONFIG=/usr/bin/pkg-config -ac_cv_path_install='/usr/bin/install -c' -ac_cv_path_mkdir=/bin/mkdir -ac_cv_prog_AWK=gawk -ac_cv_prog_CPP='gcc -E' -ac_cv_prog_ac_ct_CC=gcc -ac_cv_prog_cc_c89= -ac_cv_prog_cc_g=yes -ac_cv_prog_make_make_set=yes -ac_cv_type_mode_t=yes -ac_cv_type_off_t=yes -ac_cv_type_pid_t=yes -ac_cv_type_size_t=yes -ac_cv_type_uid_t=yes -am_cv_CC_dependencies_compiler_type=gcc3 -am_cv_make_support_nested_variables=yes -am_cv_prog_cc_c_o=yes -pkg_cv_FUSE_CFLAGS='-D_FILE_OFFSET_BITS=64 -I/usr/include/fuse ' -pkg_cv_FUSE_LIBS='-lfuse -pthread ' - -## ----------------- ## -## Output variables. ## -## ----------------- ## - -ACLOCAL='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing aclocal-1.15' -AMDEPBACKSLASH='\' -AMDEP_FALSE='#' -AMDEP_TRUE='' -AMTAR='$${TAR-tar}' -AM_BACKSLASH='\' -AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -AM_DEFAULT_VERBOSITY='1' -AM_V='$(V)' -AUTOCONF='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoconf' -AUTOHEADER='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoheader' -AUTOMAKE='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing automake-1.15' -AWK='gawk' -CC='gcc' -CCDEPMODE='depmode=gcc3' -CFLAGS='-g -O2' -CPP='gcc -E' -CPPFLAGS='' -CYGPATH_W='echo' -DEFS='-DHAVE_CONFIG_H' -DEPDIR='.deps' -ECHO_C='' -ECHO_N='-n' -ECHO_T='' -EGREP='/bin/grep -E' -EXEEXT='' -FUSE_CFLAGS='-D_FILE_OFFSET_BITS=64 -I/usr/include/fuse ' -FUSE_LIBS='-lfuse -pthread ' -GREP='/bin/grep' -INSTALL_DATA='${INSTALL} -m 644' -INSTALL_PROGRAM='${INSTALL}' -INSTALL_SCRIPT='${INSTALL}' -INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' -LDFLAGS='' -LIBOBJS='' -LIBS='' -LTLIBOBJS='' -MAKEINFO='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing makeinfo' -MKDIR_P='/bin/mkdir -p' -OBJEXT='o' -PACKAGE='fuse-tutorial' -PACKAGE_BUGREPORT='joseph@pfeifferfamily.net' -PACKAGE_NAME='fuse-tutorial' -PACKAGE_STRING='fuse-tutorial 2016-03-25' -PACKAGE_TARNAME='fuse-tutorial' -PACKAGE_URL='' -PACKAGE_VERSION='2016-03-25' -PATH_SEPARATOR=':' -PKG_CONFIG='/usr/bin/pkg-config' -PKG_CONFIG_LIBDIR='' -PKG_CONFIG_PATH='' -SET_MAKE='' -SHELL='/bin/sh' -STRIP='' -VERSION='2016-03-25' -ac_ct_CC='gcc' -am__EXEEXT_FALSE='' -am__EXEEXT_TRUE='#' -am__fastdepCC_FALSE='#' -am__fastdepCC_TRUE='' -am__include='include' -am__isrc='' -am__leading_dot='.' -am__nodep='_no' -am__quote='' -am__tar='$${TAR-tar} chof - "$$tardir"' -am__untar='$${TAR-tar} xf -' -bindir='${exec_prefix}/bin' -build_alias='' -datadir='${datarootdir}' -datarootdir='${prefix}/share' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -dvidir='${docdir}' -exec_prefix='${prefix}' -host_alias='' -htmldir='${docdir}' -includedir='${prefix}/include' -infodir='${datarootdir}/info' -install_sh='${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/install-sh' -libdir='${exec_prefix}/lib' -libexecdir='${exec_prefix}/libexec' -localedir='${datarootdir}/locale' -localstatedir='${prefix}/var' -mandir='${datarootdir}/man' -mkdir_p='$(MKDIR_P)' -oldincludedir='/usr/include' -pdfdir='${docdir}' -prefix='/usr/local' -program_transform_name='s,x,x,' -psdir='${docdir}' -runstatedir='${localstatedir}/run' -sbindir='${exec_prefix}/sbin' -sharedstatedir='${prefix}/com' -sysconfdir='${prefix}/etc' -target_alias='' - -## ----------- ## -## confdefs.h. ## -## ----------- ## - -/* confdefs.h */ -#define PACKAGE_NAME "fuse-tutorial" -#define PACKAGE_TARNAME "fuse-tutorial" -#define PACKAGE_VERSION "2016-03-25" -#define PACKAGE_STRING "fuse-tutorial 2016-03-25" -#define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" -#define PACKAGE_URL "" -#define PACKAGE "fuse-tutorial" -#define VERSION "2016-03-25" -#define STDC_HEADERS 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_FCNTL_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_STATVFS_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_UTIME_H 1 -#define HAVE_SYS_XATTR_H 1 -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 -#define HAVE_ST_BLOCKS 1 -#define HAVE_STRUCT_STAT_ST_RDEV 1 -#define HAVE_UNISTD_H 1 -#define HAVE_CHOWN 1 -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MALLOC 1 -#define HAVE_FTRUNCATE 1 -#define HAVE_MKDIR 1 -#define HAVE_MKFIFO 1 -#define HAVE_REALPATH 1 -#define HAVE_RMDIR 1 -#define HAVE_STRERROR 1 -#define HAVE_UTIME 1 -#define HAVE_FDATASYNC 1 - -configure: exit 0 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.status b/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.status deleted file mode 100644 index 9c9adf2aa9896ff3bd2021eac338f21ec9a5453d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/config.status +++ /dev/null @@ -1,1219 +0,0 @@ -#! /bin/sh -# Generated by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by fuse-tutorial $as_me 2016-03-25, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -# Files that config.status was made for. -config_files=" Makefile html/Makefile src/Makefile" -config_headers=" src/config.h" -config_commands=" depfiles" - -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -ac_cs_config="" -ac_cs_version="\ -fuse-tutorial config.status 2016-03-25 -configured by ./configure, generated by GNU Autoconf 2.69, - with options \"$ac_cs_config\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='/home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25' -srcdir='.' -INSTALL='/usr/bin/install -c' -MKDIR_P='/bin/mkdir -p' -AWK='gawk' -test -n "$AWK" || AWK=awk -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion - shift - $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 - CONFIG_SHELL='/bin/sh' - export CONFIG_SHELL - exec "$@" -fi - -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -# -# INIT-COMMANDS -# -AMDEP_TRUE="" ac_aux_dir="." - - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "html/Makefile") CONFIG_FILES="$CONFIG_FILES html/Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && -S["am__EXEEXT_FALSE"]="" -S["am__EXEEXT_TRUE"]="#" -S["LTLIBOBJS"]="" -S["LIBOBJS"]="" -S["FUSE_LIBS"]="-lfuse -pthread " -S["FUSE_CFLAGS"]="-D_FILE_OFFSET_BITS=64 -I/usr/include/fuse " -S["PKG_CONFIG_LIBDIR"]="" -S["PKG_CONFIG_PATH"]="" -S["PKG_CONFIG"]="/usr/bin/pkg-config" -S["EGREP"]="/bin/grep -E" -S["GREP"]="/bin/grep" -S["CPP"]="gcc -E" -S["am__fastdepCC_FALSE"]="#" -S["am__fastdepCC_TRUE"]="" -S["CCDEPMODE"]="depmode=gcc3" -S["am__nodep"]="_no" -S["AMDEPBACKSLASH"]="\\" -S["AMDEP_FALSE"]="#" -S["AMDEP_TRUE"]="" -S["am__quote"]="" -S["am__include"]="include" -S["DEPDIR"]=".deps" -S["OBJEXT"]="o" -S["EXEEXT"]="" -S["ac_ct_CC"]="gcc" -S["CPPFLAGS"]="" -S["LDFLAGS"]="" -S["CFLAGS"]="-g -O2" -S["CC"]="gcc" -S["AM_BACKSLASH"]="\\" -S["AM_DEFAULT_VERBOSITY"]="1" -S["AM_DEFAULT_V"]="$(AM_DEFAULT_VERBOSITY)" -S["AM_V"]="$(V)" -S["am__untar"]="$${TAR-tar} xf -" -S["am__tar"]="$${TAR-tar} chof - \"$$tardir\"" -S["AMTAR"]="$${TAR-tar}" -S["am__leading_dot"]="." -S["SET_MAKE"]="" -S["AWK"]="gawk" -S["mkdir_p"]="$(MKDIR_P)" -S["MKDIR_P"]="/bin/mkdir -p" -S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s" -S["STRIP"]="" -S["install_sh"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/install-sh" -S["MAKEINFO"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing makeinfo" -S["AUTOHEADER"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoheader" -S["AUTOMAKE"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing automake-1.15" -S["AUTOCONF"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoconf" -S["ACLOCAL"]="${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing aclocal-1.15" -S["VERSION"]="2016-03-25" -S["PACKAGE"]="fuse-tutorial" -S["CYGPATH_W"]="echo" -S["am__isrc"]="" -S["INSTALL_DATA"]="${INSTALL} -m 644" -S["INSTALL_SCRIPT"]="${INSTALL}" -S["INSTALL_PROGRAM"]="${INSTALL}" -S["target_alias"]="" -S["host_alias"]="" -S["build_alias"]="" -S["LIBS"]="" -S["ECHO_T"]="" -S["ECHO_N"]="-n" -S["ECHO_C"]="" -S["DEFS"]="-DHAVE_CONFIG_H" -S["mandir"]="${datarootdir}/man" -S["localedir"]="${datarootdir}/locale" -S["libdir"]="${exec_prefix}/lib" -S["psdir"]="${docdir}" -S["pdfdir"]="${docdir}" -S["dvidir"]="${docdir}" -S["htmldir"]="${docdir}" -S["infodir"]="${datarootdir}/info" -S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" -S["oldincludedir"]="/usr/include" -S["includedir"]="${prefix}/include" -S["runstatedir"]="${localstatedir}/run" -S["localstatedir"]="${prefix}/var" -S["sharedstatedir"]="${prefix}/com" -S["sysconfdir"]="${prefix}/etc" -S["datadir"]="${datarootdir}" -S["datarootdir"]="${prefix}/share" -S["libexecdir"]="${exec_prefix}/libexec" -S["sbindir"]="${exec_prefix}/sbin" -S["bindir"]="${exec_prefix}/bin" -S["program_transform_name"]="s,x,x," -S["prefix"]="/usr/local" -S["exec_prefix"]="${prefix}" -S["PACKAGE_URL"]="" -S["PACKAGE_BUGREPORT"]="joseph@pfeifferfamily.net" -S["PACKAGE_STRING"]="fuse-tutorial 2016-03-25" -S["PACKAGE_VERSION"]="2016-03-25" -S["PACKAGE_TARNAME"]="fuse-tutorial" -S["PACKAGE_NAME"]="fuse-tutorial" -S["PATH_SEPARATOR"]=":" -S["SHELL"]="/bin/sh" -_ACAWK -cat >>"$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -D["PACKAGE_NAME"]=" \"fuse-tutorial\"" -D["PACKAGE_TARNAME"]=" \"fuse-tutorial\"" -D["PACKAGE_VERSION"]=" \"2016-03-25\"" -D["PACKAGE_STRING"]=" \"fuse-tutorial 2016-03-25\"" -D["PACKAGE_BUGREPORT"]=" \"joseph@pfeifferfamily.net\"" -D["PACKAGE_URL"]=" \"\"" -D["PACKAGE"]=" \"fuse-tutorial\"" -D["VERSION"]=" \"2016-03-25\"" -D["STDC_HEADERS"]=" 1" -D["HAVE_SYS_TYPES_H"]=" 1" -D["HAVE_SYS_STAT_H"]=" 1" -D["HAVE_STDLIB_H"]=" 1" -D["HAVE_STRING_H"]=" 1" -D["HAVE_MEMORY_H"]=" 1" -D["HAVE_STRINGS_H"]=" 1" -D["HAVE_INTTYPES_H"]=" 1" -D["HAVE_STDINT_H"]=" 1" -D["HAVE_UNISTD_H"]=" 1" -D["HAVE_FCNTL_H"]=" 1" -D["HAVE_LIMITS_H"]=" 1" -D["HAVE_STDLIB_H"]=" 1" -D["HAVE_STRING_H"]=" 1" -D["HAVE_SYS_STATVFS_H"]=" 1" -D["HAVE_UNISTD_H"]=" 1" -D["HAVE_UTIME_H"]=" 1" -D["HAVE_SYS_XATTR_H"]=" 1" -D["HAVE_STRUCT_STAT_ST_BLKSIZE"]=" 1" -D["HAVE_STRUCT_STAT_ST_BLOCKS"]=" 1" -D["HAVE_ST_BLOCKS"]=" 1" -D["HAVE_STRUCT_STAT_ST_RDEV"]=" 1" -D["HAVE_UNISTD_H"]=" 1" -D["HAVE_CHOWN"]=" 1" -D["LSTAT_FOLLOWS_SLASHED_SYMLINK"]=" 1" -D["HAVE_STDLIB_H"]=" 1" -D["HAVE_MALLOC"]=" 1" -D["HAVE_FTRUNCATE"]=" 1" -D["HAVE_MKDIR"]=" 1" -D["HAVE_MKFIFO"]=" 1" -D["HAVE_REALPATH"]=" 1" -D["HAVE_RMDIR"]=" 1" -D["HAVE_STRERROR"]=" 1" -D["HAVE_UTIME"]=" 1" -D["HAVE_FDATASYNC"]=" 1" - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ { - line = $ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} - ac_datarootdir_hack=' - s&@datadir@&${datarootdir}&g - s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g - s&@infodir@&${datarootdir}/info&g - s&@localedir@&${datarootdir}/locale&g - s&@mandir@&${datarootdir}/man&g - s&\${datarootdir}&${prefix}/share&g' ;; -esac -ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure b/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure deleted file mode 100644 index 281ceee75c65649e6940f6af9038bce1983ed50d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure +++ /dev/null @@ -1,6424 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for fuse-tutorial 2016-03-25. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: joseph@pfeifferfamily.net about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='fuse-tutorial' -PACKAGE_TARNAME='fuse-tutorial' -PACKAGE_VERSION='2016-03-25' -PACKAGE_STRING='fuse-tutorial 2016-03-25' -PACKAGE_BUGREPORT='joseph@pfeifferfamily.net' -PACKAGE_URL='' - -ac_unique_file="src/bbfs.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -FUSE_LIBS -FUSE_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -EGREP -GREP -CPP -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -runstatedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_dependency_tracking -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -FUSE_CFLAGS -FUSE_LIBS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures fuse-tutorial 2016-03-25 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/fuse-tutorial] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of fuse-tutorial 2016-03-25:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - FUSE_CFLAGS C compiler flags for FUSE, overriding pkg-config - FUSE_LIBS linker flags for FUSE, overriding pkg-config - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -fuse-tutorial configure 2016-03-25 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------- ## -## Report this to joseph@pfeifferfamily.net ## -## ---------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_uintX_t - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by fuse-tutorial $as_me 2016-03-25, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -am__api_version='1.15' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='fuse-tutorial' - VERSION='2016-03-25' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - - -ac_config_headers="$ac_config_headers src/config.h" - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -# Checks for header files. - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in fcntl.h limits.h stdlib.h string.h sys/statvfs.h unistd.h utime.h sys/xattr.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Check for FUSE development environment - - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FUSE" >&5 -$as_echo_n "checking for FUSE... " >&6; } - -if test -n "$FUSE_CFLAGS"; then - pkg_cv_FUSE_CFLAGS="$FUSE_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$FUSE_LIBS"; then - pkg_cv_FUSE_LIBS="$FUSE_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - FUSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fuse" 2>&1` - else - FUSE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fuse" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$FUSE_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (fuse) were not met: - -$FUSE_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables FUSE_CFLAGS -and FUSE_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables FUSE_CFLAGS -and FUSE_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - FUSE_CFLAGS=$pkg_cv_FUSE_CFLAGS - FUSE_LIBS=$pkg_cv_FUSE_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then : - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no -fi -rm -f conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then - -$as_echo "#define uid_t int" >>confdefs.h - - -$as_echo "#define gid_t int" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define off_t long int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -_ACEOF - - -fi - -ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 -_ACEOF - - -$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" fileblocks.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF - - -fi - -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT64_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t -_ACEOF -;; - esac - - -# Checks for library functions. -for ac_header in unistd.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_UNISTD_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 -$as_echo_n "checking for working chown... " >&6; } -if ${ac_cv_func_chown_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_chown_works=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -#include - -int -main () -{ - char *f = "conftest.chown"; - struct stat before, after; - - if (creat (f, 0600) < 0) - return 1; - if (stat (f, &before) < 0) - return 1; - if (chown (f, (uid_t) -1, (gid_t) -1) == -1) - return 1; - if (stat (f, &after) < 0) - return 1; - return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_chown_works=yes -else - ac_cv_func_chown_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -rm -f conftest.chown - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 -$as_echo "$ac_cv_func_chown_works" >&6; } -if test $ac_cv_func_chown_works = yes; then - -$as_echo "#define HAVE_CHOWN 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest.sym conftest.file -echo >conftest.file -if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then : - ac_cv_func_lstat_dereferences_slashed_symlink=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - /* Linux will dereference the symlink and fail, as required by POSIX. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_lstat_dereferences_slashed_symlink=yes -else - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -else - # If the `ln -s' command failed, then we probably don't even - # have an lstat function. - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f conftest.sym conftest.file - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } - -test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && - -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF - - -if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then - case " $LIBOBJS " in - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" - ;; -esac - -fi - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -for ac_func in ftruncate mkdir mkfifo realpath rmdir strerror utime -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# Not all systems that support FUSE also support fdatasync (notably freebsd) -for ac_func in fdatasync -do : - ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync" -if test "x$ac_cv_func_fdatasync" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_FDATASYNC 1 -_ACEOF - -fi -done - - -ac_config_files="$ac_config_files Makefile html/Makefile src/Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by fuse-tutorial $as_me 2016-03-25, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -fuse-tutorial config.status 2016-03-25 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "html/Makefile") CONFIG_FILES="$CONFIG_FILES html/Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure.ac b/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure.ac deleted file mode 100644 index 9a678c8c3ae1b06759a31706bc1644cbc7aa660a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/configure.ac +++ /dev/null @@ -1,40 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([fuse-tutorial], [2016-03-25], [joseph@pfeifferfamily.net]) -AM_INIT_AUTOMAKE -AC_CONFIG_SRCDIR([src/bbfs.c]) -AC_CONFIG_HEADERS([src/config.h]) - -# Checks for programs. -AC_PROG_CC - -# Checks for header files. -AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/statvfs.h unistd.h utime.h sys/xattr.h]) - -# Check for FUSE development environment -PKG_CHECK_MODULES(FUSE, fuse) - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_UID_T -AC_TYPE_MODE_T -AC_TYPE_OFF_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_CHECK_MEMBERS([struct stat.st_blksize]) -AC_STRUCT_ST_BLOCKS -AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_TYPE_UINT64_T - -# Checks for library functions. -AC_FUNC_CHOWN -AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK -AC_FUNC_MALLOC -AC_CHECK_FUNCS([ftruncate mkdir mkfifo realpath rmdir strerror utime]) - -# Not all systems that support FUSE also support fdatasync (notably freebsd) -AC_CHECK_FUNCS([fdatasync]) - -AC_CONFIG_FILES([Makefile html/Makefile src/Makefile]) -AC_OUTPUT diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/depcomp b/archive_old_fs_versions/fuse-tutorial-2016-03-25/depcomp deleted file mode 100644 index fc98710e2a1df7159cd72a01ffc011784748c3bc..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/depcomp +++ /dev/null @@ -1,791 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2013-05-30.07; # UTC - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the - # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" - echo >> "$depfile" - # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/example/Makefile b/archive_old_fs_versions/fuse-tutorial-2016-03-25/example/Makefile deleted file mode 100644 index 15ee4708b0c19419884e00f306393cd78811da6d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/example/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -all: - mkdir -p mountdir - mkdir -p rootdir - echo "bogus file" > rootdir/bogus.txt - -distdir: - cp Makefile $(distdir) - -mostlyclean clean distclean mainainer-clean: - rm -r mountdir rootdir diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile deleted file mode 100644 index a905e4a56b5a413e827ef894cebe8fecd3899d7d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile +++ /dev/null @@ -1,408 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# html/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/fuse-tutorial -pkgincludedir = $(includedir)/fuse-tutorial -pkglibdir = $(libdir)/fuse-tutorial -pkglibexecdir = $(libexecdir)/fuse-tutorial -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = html -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_$(V)) -am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing aclocal-1.15 -AMTAR = $${TAR-tar} -AM_DEFAULT_VERBOSITY = 1 -AUTOCONF = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoconf -AUTOHEADER = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoheader -AUTOMAKE = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing automake-1.15 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LIBS = -lfuse -pthread -GREP = /bin/grep -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LDFLAGS = -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing makeinfo -MKDIR_P = /bin/mkdir -p -OBJEXT = o -PACKAGE = fuse-tutorial -PACKAGE_BUGREPORT = joseph@pfeifferfamily.net -PACKAGE_NAME = fuse-tutorial -PACKAGE_STRING = fuse-tutorial 2016-03-25 -PACKAGE_TARNAME = fuse-tutorial -PACKAGE_URL = -PACKAGE_VERSION = 2016-03-25 -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -PKG_CONFIG_LIBDIR = -PKG_CONFIG_PATH = -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 2016-03-25 -abs_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/html -abs_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/html -abs_top_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -abs_top_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -ac_ct_CC = gcc -am__include = include -am__leading_dot = . -am__quote = -am__tar = $${TAR-tar} chof - "$$tardir" -am__untar = $${TAR-tar} xf - -bindir = ${exec_prefix}/bin -build_alias = -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host_alias = -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = $(MKDIR_P) -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -runstatedir = ${localstatedir}/run -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = ../ -top_builddir = .. -top_srcdir = .. -EXTRA_DIST = callbacks.html files.html index.html init.html private.html running.html security.html thanks.html unclear.html -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu html/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu html/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ - ctags-am distclean distclean-generic distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.am b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.am deleted file mode 100644 index ae4d889a2b870566b3a5f1b1c66829a76dab4d50..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -EXTRA_DIST = callbacks.html files.html index.html init.html private.html running.html security.html thanks.html unclear.html - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.in b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.in deleted file mode 100644 index 88660444cc715b5528c519e5da127c2b5457dad0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/Makefile.in +++ /dev/null @@ -1,408 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = html -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FUSE_CFLAGS = @FUSE_CFLAGS@ -FUSE_LIBS = @FUSE_LIBS@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = callbacks.html files.html index.html init.html private.html running.html security.html thanks.html unclear.html -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu html/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu html/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ - ctags-am distclean distclean-generic distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# these are overrides for a bunch of targets I don't want to be created -install install-data install-exec uninstall installdirs check installcheck: - echo this tutorial is not intended to be installed - -install-dvi install-html install-info install-ps install-pdf dvi pdf ps info html: - echo this tutorial's documentation is intended to be accessed from within the tutorial - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/callbacks.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/callbacks.html deleted file mode 100644 index 8fdca9006368613a15b3aefdd70d83129dc83668..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/callbacks.html +++ /dev/null @@ -1,183 +0,0 @@ - - -Callbacks and struct fuse_operations - - - -

Callbacks and struct fuse_operations

-

-A FUSE filesystem is a program that listens on a socket for file -operations to perform, and performs them. The FUSE library -(libfuse) provides the communication with the socket, and -passes the requests on to your code. It accomplishes this by using a -"callback" mechanism. -

- -

-The callbacks are a set of functions you write to implement the -file operations, and a struct fuse_operations -containing pointers to them. -

- -

-In the case of BBFS, the callback struct is named -bb_oper. There are a total of 34 file operations -defined in bbfs.c with pointers in bb_oper. -The initialization uses a syntax that not everyone is familiar with; -looking at a part of the initialization of the struct we -see -

- -
-
-struct fuse_operations bb_oper = {
-  .getattr = bb_getattr,
-  .readlink = bb_readlink,
-  .open = bb_open,
-  .read = bb_read
-};
-
-
-
-(this isn't the complete struct, of course — just enough to get -a sense of what's going on) -

- -

This indicates that bb_oper.getattr points to -bb_getattr(), bb_oper.readlink points to -bb_readlink(), bb_oper.open points to -bb_open(), and bb_oper.read points to -bb_read(). Each of these functions is my -re-implementation of the corresponding filesystem function: when a -user program calls read(), my bb_read() -function ends up getting called. In general, what all of my -reimplementations do is to log some information about the call, -and then call the original system implementation of the operation on -the underlyng filesystem. -

- -

-Let's take a look at two of these in particular: -bb_open() (my re-implementation of open(), -and bb_read() (my re-implementation of -read(). -

-

-Here's bb_open(): -

-
-int bb_open(const char *path, struct fuse_file_info *fi)
-{
-    int retstat = 0;
-    int fd;
-    char fpath[PATH_MAX];
-
-    bb_fullpath(fpath, path);
-    
-    log_msg("bb_open(fpath\"%s\", fi=0x%08x)\n",
-	    fpath,  (int) fi);
-    
-    fd = open(fpath, fi->flags);
-    if (fd < 0)
-	retstat = bb_error("bb_open open");
-    
-    fi->fh = fd;
-    log_fi(fi);
-    
-    return retstat;
-}
-
-

-When the function is called, it is passed two parameters: a -file path (which is relative to the root of the mounted file -system), and a pointer to a -struct fuse_file_info which is used to maintain -information about the file. -

-

-bb_open() starts by translating the relative path it was given -to a full path in the underlying filesystem using my -bb_fullpath() function. It then logs the full path, and -the address of the fi pointer. It passes the call on -down to the underlying fileystem, and sees if it was successful. If -it was, it stores away the file descriptor returned by -open() (so I'll be able to use it later), and returns 0. -If it failed, it returns -errno. About the return value: -

- -
    -
  1. - 0 should be returned on success. This is the normal behavior for - most of the calls in the libraries; exceptions are documented. -
  2. - -
  3. A negative return value denotes failure. If I return a value of - -i, a -1 will be returned to the caller and - errno is set to i. My - bb_error() function looks up errno as set - by the system open() call, logs the error, and returns - -errno to this function so I can pass it to the user.
  4. -
- -

-Notice that FUSE performs some translations. The -open() system call is documented as returning a file -descriptor (behavior I'm depending on), not 0 — so when my -return is passed to the original caller, FUSE recognizes that I sent a -0 and returns an appropriate file descriptor (not necessarily the same -one I got from my call to open()!). Meanwhile, I've got -the underlying file open, and I've got its file descriptor in -fi. Future calls to my code will include this pointer, so -I'll be able to get the file descriptor and work with it. So... the -user program has an open file in the mounted filesystem, and a file -descriptor that it is keeping track of. Whenever that program tries -to do anything with that file descriptor, the operation is intercepted -by the kernel and sent to the bbfs program. Within my -program, I also have a file open in the underlying directory, and a -file descriptor. When the operation is sent to my program, I'll log -it and then perform the same operation on my file. -

- -

-To make this concrete, let's take a look at bb_read(): -

-
-int bb_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
-{
-    int retstat = 0;
-    
-    log_msg("bb_read(path=\"%s\", buf=0x%08x, size=%d, offset=%lld, fi=0x%08x)\n",
-	    path,  (int) buf, size,  offset,  (int) fi);
-    
-    retstat = pread(fi->fh, buf, size, offset);
-    if (retstat < 0)
-	retstat = bb_error("bb_read read");
-    
-    return retstat;
-}
-
-
-

-This function allows us to read data from some specified offset from -the beginning of a file (so it corresponds more directly to the -pread() function than to read()). -

-

-The main thing to point out about this function is that I use my file -descriptor, which I put in fi when I opened the file, to -read it. Also, if I get a non-error return from pread(), -I pass this value up to the caller. In this case FUSE -doesn't perform any translations, it just returns the value I gave -it. To return an error, I use the same technique as in -bb_open(). -

-
-

-Next: Parsing the Command Line and Initializing FUSE -

-
-
-Last modified: Thu Jun 12 18:12:31 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/files.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/files.html deleted file mode 100644 index 2d17bb39a4879669620451bcd20fa51fe83f5b45..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/files.html +++ /dev/null @@ -1,73 +0,0 @@ - - -Files and Naming Conventions - - - -

Files and Naming Conventions

-

Before we get into the details of using FUSE, and of the Big - Brother File System, let's see how the files are organized. -

-

The code for the BBFS running example is in subdirectory ../src

- -

-

Makefile -
As usual, a Makefile is used to direct the - compilation of the code. The code is so simple that I just - hard-coded a Makefile rather than using automake; it requires - pkg-config (and of course FUSE!), but everything else - ought to be available in any Linux system used for development. -

-

-

bbfs.c -
The code re-implementing the Linux file operations is in - this file. Every function defined in this file starts with - bb_, so it's easy to tell my code from system - code. -

-

- The file also contains a - struct fuse_operations  named - bb_oper, containing pointers to the functions (we'll - discuss this struct in the next section) -

-

- The functions that are pointed to by fields in the - struct fuse data structure all have names - derived from their field names by prepending the standard - bb_ prefix. So, for instance, the - open() function is bb_open(). -

-

-

log.c and log.h -
The logging code, reporting all the operations that are - performed, is in log.c. Their names all start with - log_, again to help identify the logging code. - log.h contains prototypes for the functions that - are called from elsewhere (and, of course, the only "elsewhere" - in this project is bbfs.c). -

-

-

params.h -
This defines which version of the FUSE API is being used, - defines a symbol that give me access to the pread() - system call, and defines a struct bb_state - that stores filesystem state. -

-
- -

-I should also mention that nearly all of the documentation on FUSE -itself is in the #include file -/usr/include/fuse/fuse.h. This is where prototypes are -given for all functions, and comments describe their use. My -bbfs.c file started as a copy of that file, with my code -inserted. -

-

-Next: Compiling and Running BBFS -

-
-
-Last modified: Thu Jun 12 17:33:14 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/index.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/index.html deleted file mode 100644 index ad76fe77660e940ab584add6e8bf6acb12bd4433..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/index.html +++ /dev/null @@ -1,71 +0,0 @@ - - -Writing a FUSE Filesystem: a Tutorial - - - -

Organization

-

-The tutorial is divided into the following sections: -

- -
-

-

Files and Naming Conventions in This Tutorial -
This section describes the files distributed as a part of this - tutorial, and the naming conventions for the functions in the - BBFS filesystem. It's really there to provide an - overview of the whole tutorial and filesystem, not to directly - provide information on FUSE. -

- -

-

Running BBFS -
A little bit of information on mounting a filesystem - with bbfs, watching the log, and unmounting it. -

- -

-

Callbacks and struct fuse_operations -
This is the heart of a FUSE filesystem, and of this tutorial. - The central concepts are discussed here. -

- -

-

Parsing the Command Line and Initializing FUSE -
Getting your program started. -

- -

-

Private Data and Related Topics -
Maintaining filesystem state. -

- -

-

Extra Information on Unclear FUSE Functions -
The intent of this section is to give some extra information on - FUSE functions that seem a little unclear. Write now, this section - covers readdir() and FUSE's handling of the file - creation flags to open(). -

- -

-

Security Considerations and Race Conditions -
Running a FUSE filesystem may raise some security issues that - you should be aware of. Also, since the FUSE server is multithreaded, - there may be some race conditions you need to think about. -

- -

-

Thanks and Other Resources -
I'd like to acknowledge people who've helped by noticing bugs - (or in any other way). Also, this is not the only resource on FUSE - on the web. -

-
-

-Next: Files and Naming Conventions in This Tutorial

-
-
-Last modified: Thu Jun 12 18:15:04 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/init.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/init.html deleted file mode 100644 index ab0729ee512e42b8d6303385e1f57f0f1c506bc1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/init.html +++ /dev/null @@ -1,69 +0,0 @@ - - -Parsing the Command Line and Initializing FUSE - - - -

Parsing the Command Line and Initializing FUSE

-

-You actually have to do very little command-line parsing: FUSE -understands a large number of command-line arguments, and parses -them itself. Most importantly, FUSE expects the mountpoint to be one -of the members of the argv[] array. -

-

-I'm simplifying things for myself by assuming that the root directory -and mount point will be the last two arguments on the command line, -with the root directory preceding the mount point. So, my command -line parsing happens in two short sections. First, I do some sanity -checking: I make sure I've got enough arguments on the command line, -and that the last two arguments aren't options. -

-
-
-if ((argc < 3) || (argv[argc-2][0] == '-') || (argv[argc-1][0] == '-'))
-    bb_usage();
-
-
-

-A few lines later, I pull the root directory out of the argument list, -use the C library realpath() function to translate it to -a canonicalized absolute pathname, and save it in my private data -(I'll be describing private data in the next section)

-
-
-bb_data->rootdir = realpath(argv[argc-2], NULL);
-argv[argc-2] = argv[argc-1];
-argv[argc-1] = NULL;
-argc--;
-
-
-

-The last thing I do before turning control over to the FUSE library is -to open the log file, and save its stream pointer in my private data -as well. -

-

-Once I'm ready to start the filesystem, I call -fuse_main(). Its parameters are argc and -argv (as modified by my main() function), -the bb_oper struct containing pointers to my -re-implementations of the POSIX file operations, and a -struct bb_data, used for storing private data. -

-

fuse_main() parses the rest of the command line, -mounts the directory specified on the command line, and performs other -initializations. Then, it calls an initialization function to -perform any initialization defined by my code. bb_oper->init -points to my bb_init() function, so it is what gets called. -My bb_init() function is really small; all it does is -log the fact that it has been called. -

-
-

-Next: Private Data -

-
-
-Last modified: Thu Jun 12 18:13:36 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/private.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/private.html deleted file mode 100644 index cedb6fd14228b7cbda90c1cc4a88875c68306c68..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/private.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - -

Private Data

-

-One more piece of information on using FUSE that's very helpful is -how it lets you store and access data that you've defined. -

-

-FUSE has a struct fuse_context which contains a -little bit of extra information about a filesystem. One very useful -field in this struct is -void* private_data, a pointer to arbitrary data -stored by your filesystem. -

-

-From inside any FUSE operation, it's possible to obtain the context by -calling fuse_get_context(); this means we can use -fuse_get_context()->private_data to get the private data. -

-

-We can see how to use this by looking at my log_msg() -function. Here it is: -

-
-void log_msg(const char *format, ...)
-{
-    va_list ap;
-    va_start(ap, format);
-
-    vfprintf(BB_DATA->logfile, format, ap);
-}
-
-

-It uses a macro I defined:

-
-
-#define BB_DATA ((struct bb_state *) fuse_get_context()->private_data)
-
-
-

-to obtain the private data field and cast it to a -struct bb_state *. -

-

-You can see how I created the struct bb_struct by -looking at params.h where I defined the -struct: -

-
-struct bb_state {
-    FILE *logfile;
-    char *rootdir;
-};
-
-

It has two fields: the FILE* for the log file, and -the path to the directory we're accessing through BBFS. -

-

-I malloc() the structure and set the values of the -fields in my main() function (see last section) so -they'll be available to me later. -

-
-

-Next: Extra Information About Unclear Functions -

-
-
-Last modified: Thu Jun 12 18:14:08 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/running.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/running.html deleted file mode 100644 index 72b46a91e261c583a762e69da3d91407605bbfcb..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/running.html +++ /dev/null @@ -1,172 +0,0 @@ - - -Compiling and Running - - - -

Configuring, Compiling and Running

-

-This page of the tutorial explains how to build the BBFS filesystem -program and use it to mount a directory. -

-

Configuring and Compiling

-

This tutorial uses the GNU autotools system for configuration. As -is the case with all autotools-based projects, you can configure and -compile it by going to the top-level directory and typing -

-
-./configure
-make
-
-
-and the code should be compiled and ready to go.

-

-Unlike most software, the code from this tutorial is not intended to -be installed. Consequently, I've tried to disable all the various -installation targets; if I've missed one please let me know. -

-

Mounting a BBFS Filesystem

-

-You mount a BBFS filesystem by running the command bbfs -(in general, a FUSE filesystem is implemented by a program, and you -mount it by running that program). -bbfs has two required arguments: the root directory (which -contains the actual directory data) and the mount directory. The -tutorial tarball includes an example directory, which -contains two subdirectories named rootdir and -mountdir. You can verify that rootdir -contains a single file named bogus.txt, while -mountdir is empty -

-

Here's what it looks like when you try it:

-

-snowball:655$ pwd
-/home/joseph/fuse-tutorial/example
-snowball:656$ ls -lR
-.:
-total 12
--rw-r--r-- 1 joseph users  185 Jun  9 15:56 Makefile
-drwxr-xr-x 2 joseph users 4096 Jun 12 17:16 mountdir/
-drwxr-xr-x 2 joseph users 4096 Jun 12 17:16 rootdir/
-
-./mountdir:
-total 0
-
-./rootdir:
-total 4
--rw-r--r-- 1 joseph users 11 Jun 12 17:16 bogus.txt
-
-

Now, if you go into the example directory and execute

-
-../src/bbfs rootdir mountdir
-
-

all of the files that are really in rootdir appear to also -be in mountdir" -

-

-snowball:657$ ../src/bbfs rootdir/ mountdir/
-about to call fuse_main
-snowball:658$ ls -lR
-.:
-total 40
--rw-r--r-- 1 joseph users   185 Jun  9 15:56 Makefile
--rw-r--r-- 1 joseph users 25632 Jun 12 17:51 bbfs.log
-drwxr-xr-x 2 joseph users  4096 Jun 12 17:16 mountdir/
-drwxr-xr-x 2 joseph users  4096 Jun 12 17:16 rootdir/
-
-./mountdir:
-total 4
--rw-r--r-- 1 joseph users 11 Jun 12 17:16 bogus.txt
-
-./rootdir:
-total 4
--rw-r--r-- 1 joseph users 11 Jun 12 17:16 bogus.txt
-
-
-

-But, every time you perform any file -operation in mountdir, the operation (and a whole bunch -of both relevant and irrelevant stuff) gets logged to a new file in the -current working directory called bbfs.log If you execute

-
-tail -F bbfslog
-
-

in another terminal window, you can watch the operations get -logged.

-

Finally, you can see that the operating system sees -mountdir as a filesystem:

-

-snowball:660$ mount | grep mountdir
-bbfs on /home/joseph/fuse-tutorial/example/mountdir type fuse.bbfs (rw,nosuid,nodev,relatime,user_id=1248,group_id=1005)
-
-

Unmounting

-

Finally, you can unmount the filesystem with

-
-snowball:661$ fusermount -u mountdir
-snowball:662$ ls -lR
-.:
-total 40
--rw-r--r-- 1 joseph users   185 Jun  9 15:56 Makefile
--rw-r--r-- 1 joseph users 27520 Jun 12 17:57 bbfs.log
-drwxr-xr-x 2 joseph users  4096 Jun 12 17:16 mountdir/
-drwxr-xr-x 2 joseph users  4096 Jun 12 17:16 rootdir/
-
-./mountdir:
-total 0
-
-./rootdir:
-total 4
--rw-r--r-- 1 joseph users 11 Jun 12 17:16 bogus.txt
-
-

(note that fusermount isn't part of this tutorial -— it comes along with FUSE).

- -

pkg-config

-

One thing to mention about configuring the software is the line -

PKG_CHECK_MODULES(FUSE, fuse)
-in configure.ac -

-

-This translates to two invocations of pkg-config to -obtain the C compilation flags and libraries needed to compile and -link the code in the tutorial. -

-
-`pkg-config fuse --cflags`
-
-

says to use pkg-config to determine what C -compiler flags are necessary to compile a source file that makes use -of FUSE. The back-quotes around the command are important — -they take the output of the command and insert it into the -command-line as command-line operations (note — it's important -those are back-quotes aka accent graves. They can't be forward quotes, -nor double quotes). The other place it's used, -

-`pkg-config fuse --libs`
-
-

-gives the extra command-line arguments to link the program with -libfuse. -

-

-An earlier version of this tutorial used these invocations directly in -the Makefile, like this: -

-

-bbfs : bbfs.o log.o
-        gcc -g -o bbfs bbfs.o log.o `pkg-config fuse --libs`
-
-bbfs.o : bbfs.c log.h params.h
-        gcc -g -Wall `pkg-config fuse --cflags` -c bbfs.c
-
-log.o : log.c log.h params.h
-        gcc -g -Wall `pkg-config fuse --cflags` -c log.c
-
-
-

-Next: Callbacks and -struct fuse_operations

-
-
-Last modified: Thu Jun 12 18:12:16 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/security.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/security.html deleted file mode 100644 index 013dca3e33dc6b8539157556bde708900fc05a14..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/security.html +++ /dev/null @@ -1,152 +0,0 @@ - - -Security Concerns - - - -

Security Concerns

-

Writing and using a FUSE filesystem can have some Metrodome-sized -security concerns that may or may not be obvious, but deserve some -mention. In this section, I'll be talking about privilege escalation, -giving some notes on checking access rights, and mentioning race -conditions. -

-

Privilege Escalation

-

-The main point -to make is that the filesystem itself executes with the access -privileges of the process running it, not those of the -process making use of the filesystem. Here's how this plays -out in some typical scenarios:

- -

The Common Case: a User Runs the Filesystem Without the -allow_other Option

-

-This is the normal case; the filesystem runs with the privileges of -the user that ran it, and only that user can access the filesystem. -FUSE doesn't open up any particular security issues in this case. -

- -

A User Runs the Filesystem With the allow_other -Option

-

-In this case, the filesystem runs with the privileges of the user -that invoked it, not the privileges of any user who happens -to make use of the filesystem. It's the responsibility of the user who -mounts the filesystem to ensure inappropriate access privileges aren't -being granted to other users. In general, users can only hurt -themselves this way, since they can only grant privileges that they -themselves already have. -

-

-It should be noted that an option, user_allow_other, must -be set in /etc/fuse.conf to enable this option. -

-

Root Runs a Filesystem

-

-This is really the same as the previous two cases (depending on -whether the allow_other option is set), but root is a -sufficiently special case that it deserves mention. In this case, any -user making use of the filesystem has root privileges on that -filesystem! If the process has access to the actual filesystem, this -could easily be used to gain pretty much unlimited access. -

-

-The next subsection will talk a little bit about checking access -rights, but the simplest way out here is to not allow root to mount the -filesystem. Due to BBFS's intended role as a simple tutorial, that's -what I do. There's a little bit of code right at the start of -main(): - -

-if ((getuid() == 0) || (geteuid() == 0)) {
-    fprintf(stderr, "Running BBFS as root opens unnacceptable security holes\n");
-    return 1;
-}
-
- -

-

-Of course, this means that while I've got code for -bb_chown(), it doesn't actually work since only root is -able to change the ownership of a file in the underlying filesystem. -

-

Checking Access Rights

-

-In general, a filesystem that might be executed with the -allow_other flag will need to take steps to ensure its -own security. fuse.h documents that several calls -need to check that the requested access is permitted; in addition to -those, there are several others that also require access checks (such -as chown(). It is strictly the programmer's -responsibility to make sure these cautions are followed! -

-

-The most important function for checking access rights is -fuse_get_context() which (as the name implies) returns a -pointer to a struct fuse_context object. The UID and GID -of the process performing the operation is in fields named -uid and gid. -

- -

Simultaneous Access and Race Conditions

-

-By default, FUSE runs multi-threaded: this means (in brief) that a -second request can be handled by the filesystem before an earlier -request has completed; this in turn raises the possibility that -different threads can be simultaneously modifying a single data -structure, which will cause very difficult-to-debug bugs. -

-

There are a couple of things that can be done about the -problem:

-
    -
  • - If the filesystem is executed with the -s option, - it is run single-threaded. this eliminates the problem, at a cost - in performance -- frankly, given the nature and intent of many fuse - filesystems, it seems to me like the default should be - single-threaded and multi-threaded should require an option. But I - didn't write it, so it's not my call. -
  • -
  • - You can analyse your code for critical sections, and insert the - normal syncronization primitives (such as semaphores) to ensure no - dangerous races occur. Of course, there are several places where - FUSE translates a single call into a sequence of calls to your - functions; I haven't investigated whether FUSE takes any steps to - ensure the atomicity of these calls. If it doesn't (and I suspect - that's the case; trying to do so in any meaningful way in the absence - of knowledge of the data you're exposing through your filesystem - seems somewhere between difficult and impossible to me), then trying - to do it yourself seems really, really hard. -
  • -
-

Note that even if you do make your filesystem single-threaded, that -doesn't guard against access to the underlying data structures through -some other means. Taking BBFS as an example:

-
    -
  • - You can have a single underlying directory mounted through two - different mountpoints by using two invocations of bbfs. -
  • -
  • - A directory that has a BBFS filesystem mounted on top of it is still - accessible to normal filesystem operations. -
  • -
-

-Either of these facts is sufficient to completely negate any efforts -made in your filesystem to guard atomicity. -

-

-I should note that the FUSE code itself is careful about locking its -own code and data structures. So far as I know, dangerous race -conditions won't occur outside of your code. -

-

-Next: Thanks and Other Resources -

-
-
-Last modified: Sat Jan 1 21:53:06 MST 2011 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/thanks.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/thanks.html deleted file mode 100644 index 80c2278fc83e6d6aa2485aedb4a257948945c59e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/thanks.html +++ /dev/null @@ -1,42 +0,0 @@ - - -Thanks and Other Resources - - - -

Thanks

-

Several sharp-eyed readers of this tutorial have noticed bugs, and -in some cases supplied patches. Thanks!

- - - - - - - - - -
Neeraj RawatThe code wasn't portable to FreeBSD. - It's thanks to Neeraj that I switched to GNU autotools, and made - several changes for compatibility with FreeBSD
David Terret:bb_readlink() was returning number of - bytes read instead of 0
Patrick Ulam:bb_release() wasn't closing the - file
Patrick Ulam and Bernardo F Costa:bb_readlink() - wasn't null-terminating the string. Patrick and Bernardo also - supplied patches! The current bb_readlink() code is - Bernardo's
Bernardo F Costa:Command-line argument parsing - wasn't handling -o correctly
Bernardo F Costa:Got me thinking about security implications
Diogo Molo and Sivan Tal:Makefile order - of arguments was wrong and caused link errors for some (but not - all!) users
Skippy VonDrakePointed out the code I used to - use for command line parsing was confusing, so I wound up - rewriting it
-

Other Resources

-

FUSE Filesystem home -page

-

Singh, Sumit, Develop your own filesystem with FUSE on IBM -Developerworks

-

Documentation of FUSE on OpenSolaris

-
-
-Last modified: Thu Jun 12 18:49:24 MDT 2014 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/unclear.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/unclear.html deleted file mode 100644 index 6cbdb89ee81a0228c2fe37f2369840cebc45abd6..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/html/unclear.html +++ /dev/null @@ -1,169 +0,0 @@ - - -Unclear FUSE Functions - - - -

Extra Information on Unclear FUSE Functions

-

-The intent of this page is to give a little bit of extra information -on calls that seem a little obscure in the FUSE documentation. Two -cases requiring extra explanation have come up so far: -readdir(), and FUSE's handling of the file creation flags -in open(). -

-

Directories and readdir()

-

-FUSE provides a mechanism to place entries in a -directory structure. The directory structure itself is opaque, so the -basic mechanism is to create the data and call a FUSE-supplied -function to put it in the structure. -

- -

-When your readdir() callback is invoked, one of -the parameters is a function called filler(). The -purpose of this function is to insert directory entries into the -directory structure, which is also passed to your callback as -buf. -

- -

-filler()'s prototype looks like this: -

-
-
-int fuse_fill_dir_t(void *buf, const char *name,
-				const struct stat *stbuf, off_t off);
-
-
- -

-You insert an entry into buf (the same buffer that -is passed to readdir()) by calling -filler() with the filename and optionally a -pointer to a -struct stat containing the file type. -

- -

-bb_readdir() uses filler() in as -simple a way as possible to just copy the underlying directory's -filenames into the mounted directory. Notice that the offset passed -to bb_readdir() is ignored, and an offset of 0 is -passed to filler(). This tells filler() -to manage the offsets into the directory structure for itself. Here's -the code: -

-
-int bb_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset,
-               struct fuse_file_info *fi)
-{
-    int retstat = 0;
-    DIR *dp;
-    struct dirent *de;
-    
-    log_msg("bb_readdir(path=\"%s\", buf=0x%08x, filler=0x%08x, offset=%lld, fi=0x%08x)\n",
-            path, (int) buf, (int) filler,  offset, (int) fi);
-    
-    dp = (DIR *) (uintptr_t) fi->fh;
-
-    // Every directory contains at least two entries: . and ..  If my
-    // first call to the system readdir() returns NULL I've got an
-    // error; near as I can tell, that's the only condition under
-    // which I can get an error from readdir()
-    de = readdir(dp);
-    if (de == 0)
-        return -errno;
-
-    // This will copy the entire directory into the buffer.  The loop exits
-    // when either the system readdir() returns NULL, or filler()
-    // returns something non-zero.  The first case just means I've
-    // read the whole directory; the second means the buffer is full.
-    do {
-        log_msg("calling filler with name %s\n", de->d_name);
-        if (filler(buf, de->d_name, NULL, 0) != 0)
-            return -ENOMEM;
-    } while ((de = readdir(dp)) != NULL);
-    
-    log_fi(fi);
-    
-    return retstat;
-}
-
- -

File Creation Flags

-

The open() system call is documented as taking both file -access mode and file creation flags (the file creation flags are -O_CREAT, O_EXCL, O_NOCTTY, and -O_TRUNC). fuse.h documents that -O_CREAT and O_EXCL are not passed to your -open() function, and further that O_TRUNC is -not passed by default. -

-

The reason for this turns out to be that FUSE handles these flags -internally, and modifies which of your functions are called depending -on their status, and on the results of a call to your -getattr() (your getattr() is always called -before the file is opened). If those flags are set, the call is handled -as follows: -

-
- -

-

O_CREAT -
If the file didn't previously exist, your create() - function is called instead of your open() function - (if it did exist, then your open() is called). After - the call to your create() function, your - fgetattr() function is called, though I haven't been - able to determine why. One possible use is that you could use - this to modify the semantics of creating a file that you yourself - don't have access to (note that the standard semantics will only - apply the file access mode you specify to subsequent - open()s). -

-

- If the file did not exist, and the flag is not set, FUSE only - calls your getattr() function (so neither your - create() nor your open() function is - called in this case). -

- -

-

O_EXCL -
The behavior of this flag is only defined when - O_CREAT is also specified. If the file did not - previously exist your create() and - fgetatter()functions are called; if it did, FUSE returns - failure after the getattr() call (so neither your - open() nor your create() is called in this - case). -

- -

-

O_NOCTTY -
So far as I've been able to determine, this flag is simply - discarded. -

- -

-

O_TRUNC -
Handling of this flag is determined by whether or not the - filesystem is mounted with the -o atomic_o_trunc - flag. If not, then FUSE will call your truncate() - function before calling your open(). If the - atomic_o_trunc option was set, the flag is passed to - your open() function instead (note that this means I - don't have any code that explicitly handles the flag: if it gets - passed to bb_open(), I just pass it along to - open(). -

-
-

-Security Considerations and Race Conditions -

-
-
-Last modified: Sat Jan 1 21:45:06 MST 2011 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/index.html b/archive_old_fs_versions/fuse-tutorial-2016-03-25/index.html deleted file mode 100644 index d42c6fcb44a0ff04197189f84045493c15760347..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/index.html +++ /dev/null @@ -1,126 +0,0 @@ - - -Writing a FUSE Filesystem: a Tutorial - - - -

Writing a FUSE Filesystem: a Tutorial

-

Joseph J. Pfeiffer, Jr., Ph.D.
-Emeritus Professor
-Department of Computer Science
-New Mexico State University
-pfeiffer@cs.nmsu.edu

-

Version of 2016-03-25

-

One of the real contributions of Unix has been the view that -"everything is a file". A tremendous number of radically -different sorts of objects, from data storage to file format -conversions to internal operating system data structures, have been -mapped to the file abstraction. -

- -

-One of the more recent directions this view has taken has been -Filesystems in User Space, or FUSE (no, the acronym really doesn't -work. Oh well). The idea here is that if you can envision -your interaction with an object in terms of a directory structure -and filesystem operations, you can write a FUSE file system to -provide that interaction. You just write code that implements -file operations like open(), read(), and -write(); when your filesystem is mounted, programs -are able to access the data using the standard file operation -system calls, which call your code. -

-

-FUSE filesystems have been written to do everything from providing -remote access to files on a different host without using NFS or CIFS -(see SSHFS at https://github.com/libfuse/sshfs) to implementing a filesystem to -talk to devices using the Media Transfer protocol (see jmtpfs at https://github.com/kiorky/jmtpfs) to organizing a music -collection with directories based on MP3 tags (see id3fs at http://erislabs.net/ianb/projects/id3fs/id3fsd.html) to, really, -almost anything. The possibilities are only limited by your -imagination! -

-

-There are many documents on the web describing how FUSE works and -how to install and use a FUSE filesystem, but I haven't come across -any that try to describe how to go about actually writing one. The -goal of this tutorial is to meet what I see as a need for such a -document. -

- -

-This tutorial introduces FUSE using a filesystem I call the "Big Brother -File System" (the reason for the name is that "Big Brother is -watching"). The filesystem simply passes every operation down to an -underlying directory, but logs the operation. -

- -

-This tutorial, together with its associated example filesystem, is -available as a tarball at - -http://www.cs.nmsu.edu/~pfeiffer/fuse-tutorial.tgz. -

- -

-Audience: This tutorial is aimed at developers who have some -familiarity with general programming in Linux (and Unix-like operating -systems in general), so you know how to untar a tarball, how Makefiles -work, and so forth. I won't be going through the details of how to -perform those tasks; I'll be focussing on what you need to know that's -specific to using FUSE filesystems. -

- -

-I am not affiliated with the FUSE project in any way, except as a -user. My descriptions of the interface to fuse, and of techniques to -work with it, are a distillation of my reading of the existing -documentation, and my experience working with it. Consequently, any -errors are mine (and corrections are welcome!). -

- -

Organization

-

-You will find three subdirectories under this one: -

-
    -
  • - html contains the tutorial itself, in html format. - I suggest you click here to start - reading the tutorial. -
  • - -
  • - src contains the code for the BBFS filesystem itself. -
  • - -
  • - example contains a couple of directories for use in - exploring BBFS. -
  • -
- -

Consulting

-

-I'm happy to answer any questions you may have regarding BBFS or FUSE -in general. Also, I am available for consulting on FUSE or other -Linux system, or PIC microprocessor, development. If you're interested, send me an email at - joseph@pfeifferfamily.net -

-

License

-Creative Commons License
Writing a FUSE Filesystem: a Tutorial by Joseph J. Pfeiffer, Jr., PhD is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. -

-The code found in src/bbfs.c is derived from the -function prototypes found in /usr/include/fuse/fuse.h, -which is licensed under the LGPLv2. My code is being released under -the GPLv3. See the file -src/COPYING -

-
-
-Last modified: Sat Mar 26 21:25:03 MDT 2016 - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/install-sh b/archive_old_fs_versions/fuse-tutorial-2016-03-25/install-sh deleted file mode 100644 index 59990a10492675f2e87d5e5df17b566d145d9aee..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/install-sh +++ /dev/null @@ -1,508 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2014-09-12.12; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # $RANDOM is not portable (e.g. dash); use it when possible to - # lower collision chance - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # As "mkdir -p" follows symlinks and we work in /tmp possibly; so - # create the $tmpdir first (and fail if unsuccessful) to make sure - # that nobody tries to guess the $tmpdir name. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/missing b/archive_old_fs_versions/fuse-tutorial-2016-03-25/missing deleted file mode 100644 index f62bbae306c7e1bc28896aab8fe7bfb700a9a33e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/missing +++ /dev/null @@ -1,215 +0,0 @@ -#! /bin/sh -# Common wrapper for a few potentially missing GNU programs. - -scriptversion=2013-10-28.13; # UTC - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# Originally written by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" - exit 1 -fi - -case $1 in - - --is-lightweight) - # Used by our autoconf macros to check whether the available missing - # script is modern enough. - exit 0 - ;; - - --run) - # Back-compat with the calling convention used by older automake. - shift - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due -to PROGRAM being missing or too old. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal autoconf autoheader autom4te automake makeinfo - bison yacc flex lex help2man - -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" - exit 1 - ;; - -esac - -# Run the given program, remember its exit status. -"$@"; st=$? - -# If it succeeded, we are done. -test $st -eq 0 && exit 0 - -# Also exit now if we it failed (or wasn't found), and '--version' was -# passed; such an option is passed most likely to detect whether the -# program is present and works. -case $2 in --version|--help) exit $st;; esac - -# Exit code 63 means version mismatch. This often happens when the user -# tries to use an ancient version of a tool on a file that requires a -# minimum version. -if test $st -eq 63; then - msg="probably too old" -elif test $st -eq 127; then - # Program was missing. - msg="missing on your system" -else - # Program was found and executed, but failed. Give up. - exit $st -fi - -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software - -program_details () -{ - case $1 in - aclocal|automake) - echo "The '$1' program is part of the GNU Automake package:" - echo "<$gnu_software_URL/automake>" - echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/autoconf>" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - autoconf|autom4te|autoheader) - echo "The '$1' program is part of the GNU Autoconf package:" - echo "<$gnu_software_URL/autoconf/>" - echo "It also requires GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - esac -} - -give_advice () -{ - # Normalize program name to check for. - normalized_program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - - printf '%s\n' "'$1' is $msg." - - configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - case $normalized_program in - autoconf*) - echo "You should only need it if you modified 'configure.ac'," - echo "or m4 files included by it." - program_details 'autoconf' - ;; - autoheader*) - echo "You should only need it if you modified 'acconfig.h' or" - echo "$configure_deps." - program_details 'autoheader' - ;; - automake*) - echo "You should only need it if you modified 'Makefile.am' or" - echo "$configure_deps." - program_details 'automake' - ;; - aclocal*) - echo "You should only need it if you modified 'acinclude.m4' or" - echo "$configure_deps." - program_details 'aclocal' - ;; - autom4te*) - echo "You might have modified some maintainer files that require" - echo "the 'autom4te' program to be rebuilt." - program_details 'autom4te' - ;; - bison*|yacc*) - echo "You should only need it if you modified a '.y' file." - echo "You may want to install the GNU Bison package:" - echo "<$gnu_software_URL/bison/>" - ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; - help2man*) - echo "You should only need it if you modified a dependency" \ - "of a man page." - echo "You may want to install the GNU Help2man package:" - echo "<$gnu_software_URL/help2man/>" - ;; - makeinfo*) - echo "You should only need it if you modified a '.texi' file, or" - echo "any other file indirectly affecting the aspect of the manual." - echo "You might want to install the Texinfo package:" - echo "<$gnu_software_URL/texinfo/>" - echo "The spurious makeinfo call might also be the consequence of" - echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" - echo "want to install GNU make:" - echo "<$gnu_software_URL/make/>" - ;; - *) - echo "You might have modified some files without having the proper" - echo "tools for further handling them. Check the 'README' file, it" - echo "often tells you about the needed prerequisites for installing" - echo "this package. You may also peek at any GNU archive site, in" - echo "case some other package contains this missing '$1' program." - ;; - esac -} - -give_advice "$1" | sed -e '1s/^/WARNING: /' \ - -e '2,$s/^/ /' >&2 - -# Propagate the correct exit status (expected to be 127 for a program -# not found, 63 for a program that failed due to version mismatch). -exit $st - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/bbfs.Po b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/bbfs.Po deleted file mode 100644 index 0b8f82d3705b0218cee518ded2a03a129c001fb4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/bbfs.Po +++ /dev/null @@ -1,191 +0,0 @@ -bbfs.o: bbfs.c /usr/include/stdc-predef.h params.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/limits.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/syslimits.h \ - /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/stdio.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stddef.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/getopt.h \ - /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ - /usr/include/ctype.h /usr/include/endian.h /usr/include/bits/endian.h \ - /usr/include/dirent.h /usr/include/bits/dirent.h /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/fcntl.h \ - /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h \ - /usr/include/time.h /usr/include/bits/stat.h /usr/include/bits/fcntl2.h \ - /usr/include/fuse/fuse.h /usr/include/fuse/fuse_common.h \ - /usr/include/fuse/fuse_opt.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/sys/types.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/time.h \ - /usr/include/utime.h /usr/include/sys/stat.h /usr/include/sys/statvfs.h \ - /usr/include/bits/statvfs.h /usr/include/sys/uio.h \ - /usr/include/bits/uio.h /usr/include/libgen.h /usr/include/stdlib.h \ - /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/bits/stdlib.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ - /usr/include/bits/string3.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/bits/unistd.h log.h - -/usr/include/stdc-predef.h: - -params.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/limits.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/syslimits.h: - -/usr/include/limits.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-64.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/stdio.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stddef.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/getopt.h: - -/usr/include/bits/stdio.h: - -/usr/include/bits/stdio2.h: - -/usr/include/ctype.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/dirent.h: - -/usr/include/bits/dirent.h: - -/usr/include/errno.h: - -/usr/include/bits/errno.h: - -/usr/include/linux/errno.h: - -/usr/include/asm/errno.h: - -/usr/include/asm-generic/errno.h: - -/usr/include/asm-generic/errno-base.h: - -/usr/include/fcntl.h: - -/usr/include/bits/fcntl.h: - -/usr/include/bits/fcntl-linux.h: - -/usr/include/time.h: - -/usr/include/bits/stat.h: - -/usr/include/bits/fcntl2.h: - -/usr/include/fuse/fuse.h: - -/usr/include/fuse/fuse_common.h: - -/usr/include/fuse/fuse_opt.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdint.h: - -/usr/include/stdint.h: - -/usr/include/bits/wchar.h: - -/usr/include/sys/types.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/bits/time.h: - -/usr/include/utime.h: - -/usr/include/sys/stat.h: - -/usr/include/sys/statvfs.h: - -/usr/include/bits/statvfs.h: - -/usr/include/sys/uio.h: - -/usr/include/bits/uio.h: - -/usr/include/libgen.h: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/bits/stdlib-bsearch.h: - -/usr/include/bits/stdlib-float.h: - -/usr/include/bits/stdlib.h: - -/usr/include/string.h: - -/usr/include/bits/string.h: - -/usr/include/bits/string2.h: - -/usr/include/bits/string3.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/bits/unistd.h: - -log.h: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/log.Po b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/log.Po deleted file mode 100644 index 3d2e0192bd8752c67d47f609321eb20e74decb20..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/.deps/log.Po +++ /dev/null @@ -1,183 +0,0 @@ -log.o: log.c /usr/include/stdc-predef.h params.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/limits.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/syslimits.h \ - /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/stdio.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stddef.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/getopt.h \ - /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ - /usr/include/errno.h /usr/include/bits/errno.h \ - /usr/include/linux/errno.h /usr/include/asm/errno.h \ - /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ - /usr/include/fuse/fuse.h /usr/include/fuse/fuse_common.h \ - /usr/include/fuse/fuse_opt.h \ - /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/sys/types.h \ - /usr/include/time.h /usr/include/bits/pthreadtypes.h \ - /usr/include/fcntl.h /usr/include/bits/fcntl.h \ - /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h \ - /usr/include/bits/fcntl2.h /usr/include/bits/time.h /usr/include/utime.h \ - /usr/include/sys/stat.h /usr/include/sys/statvfs.h \ - /usr/include/bits/statvfs.h /usr/include/sys/uio.h \ - /usr/include/bits/uio.h /usr/include/stdlib.h \ - /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/bits/stdlib.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ - /usr/include/endian.h /usr/include/bits/endian.h \ - /usr/include/bits/string3.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/bits/unistd.h log.h - -/usr/include/stdc-predef.h: - -params.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/limits.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include-fixed/syslimits.h: - -/usr/include/limits.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-64.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/stdio.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stddef.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/getopt.h: - -/usr/include/bits/stdio.h: - -/usr/include/bits/stdio2.h: - -/usr/include/errno.h: - -/usr/include/bits/errno.h: - -/usr/include/linux/errno.h: - -/usr/include/asm/errno.h: - -/usr/include/asm-generic/errno.h: - -/usr/include/asm-generic/errno-base.h: - -/usr/include/fuse/fuse.h: - -/usr/include/fuse/fuse_common.h: - -/usr/include/fuse/fuse_opt.h: - -/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/stdint.h: - -/usr/include/stdint.h: - -/usr/include/bits/wchar.h: - -/usr/include/sys/types.h: - -/usr/include/time.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/fcntl.h: - -/usr/include/bits/fcntl.h: - -/usr/include/bits/fcntl-linux.h: - -/usr/include/bits/stat.h: - -/usr/include/bits/fcntl2.h: - -/usr/include/bits/time.h: - -/usr/include/utime.h: - -/usr/include/sys/stat.h: - -/usr/include/sys/statvfs.h: - -/usr/include/bits/statvfs.h: - -/usr/include/sys/uio.h: - -/usr/include/bits/uio.h: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/bits/stdlib-bsearch.h: - -/usr/include/bits/stdlib-float.h: - -/usr/include/bits/stdlib.h: - -/usr/include/string.h: - -/usr/include/bits/string.h: - -/usr/include/bits/string2.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/bits/string3.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/bits/unistd.h: - -log.h: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile deleted file mode 100644 index be9ceec886c12cba09d79960e777716313ce076e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile +++ /dev/null @@ -1,588 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# src/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - - -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/fuse-tutorial -pkgincludedir = $(includedir)/fuse-tutorial -pkglibdir = $(libdir)/fuse-tutorial -pkglibexecdir = $(libexecdir)/fuse-tutorial -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -bin_PROGRAMS = bbfs$(EXEEXT) -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am_bbfs_OBJECTS = bbfs.$(OBJEXT) log.$(OBJEXT) -bbfs_OBJECTS = $(am_bbfs_OBJECTS) -bbfs_LDADD = $(LDADD) -bbfs_DEPENDENCIES = -AM_V_P = $(am__v_P_$(V)) -am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(bbfs_SOURCES) -DIST_SOURCES = $(bbfs_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing aclocal-1.15 -AMTAR = $${TAR-tar} -AM_DEFAULT_VERBOSITY = 1 -AUTOCONF = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoconf -AUTOHEADER = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing autoheader -AUTOMAKE = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing automake-1.15 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LIBS = -lfuse -pthread -GREP = /bin/grep -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LDFLAGS = -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/missing makeinfo -MKDIR_P = /bin/mkdir -p -OBJEXT = o -PACKAGE = fuse-tutorial -PACKAGE_BUGREPORT = joseph@pfeifferfamily.net -PACKAGE_NAME = fuse-tutorial -PACKAGE_STRING = fuse-tutorial 2016-03-25 -PACKAGE_TARNAME = fuse-tutorial -PACKAGE_URL = -PACKAGE_VERSION = 2016-03-25 -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -PKG_CONFIG_LIBDIR = -PKG_CONFIG_PATH = -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 2016-03-25 -abs_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/src -abs_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/src -abs_top_builddir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -abs_top_srcdir = /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25 -ac_ct_CC = gcc -am__include = include -am__leading_dot = . -am__quote = -am__tar = $${TAR-tar} chof - "$$tardir" -am__untar = $${TAR-tar} xf - -bindir = ${exec_prefix}/bin -build_alias = -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host_alias = -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/lefthy/ownCloud/Promotion/gogs_git/ada-fs/fuse-tutorial-2016-03-25/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = $(MKDIR_P) -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -runstatedir = ${localstatedir}/run -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = ../ -top_builddir = .. -top_srcdir = .. -bbfs_SOURCES = bbfs.c log.c log.h params.h -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -LDADD = -lfuse -pthread -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status src/config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -bbfs$(EXEEXT): $(bbfs_OBJECTS) $(bbfs_DEPENDENCIES) $(EXTRA_bbfs_DEPENDENCIES) - @rm -f bbfs$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bbfs_OBJECTS) $(bbfs_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/bbfs.Po -include ./$(DEPDIR)/log.Po - -.c.o: - $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< - $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -# $(AM_V_CC)source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< - -.c.obj: - $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` - $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -# $(AM_V_CC)source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) config.h -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: all install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ - clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic distclean-hdr \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-binPROGRAMS - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.am b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.am deleted file mode 100644 index 7b58b3901dd6703be911ba62e68bcf1fd60d6996..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_PROGRAMS = bbfs -bbfs_SOURCES = bbfs.c log.c log.h params.h -AM_CFLAGS = @FUSE_CFLAGS@ -LDADD = @FUSE_LIBS@ diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.in b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.in deleted file mode 100644 index 6a46b5b21e027b806b3870135a90e4de69253cef..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/Makefile.in +++ /dev/null @@ -1,588 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -bin_PROGRAMS = bbfs$(EXEEXT) -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am_bbfs_OBJECTS = bbfs.$(OBJEXT) log.$(OBJEXT) -bbfs_OBJECTS = $(am_bbfs_OBJECTS) -bbfs_LDADD = $(LDADD) -bbfs_DEPENDENCIES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(bbfs_SOURCES) -DIST_SOURCES = $(bbfs_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FUSE_CFLAGS = @FUSE_CFLAGS@ -FUSE_LIBS = @FUSE_LIBS@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -bbfs_SOURCES = bbfs.c log.c log.h params.h -AM_CFLAGS = @FUSE_CFLAGS@ -LDADD = @FUSE_LIBS@ -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status src/config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -bbfs$(EXEEXT): $(bbfs_OBJECTS) $(bbfs_DEPENDENCIES) $(EXTRA_bbfs_DEPENDENCIES) - @rm -f bbfs$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bbfs_OBJECTS) $(bbfs_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bbfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) config.h -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: all install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ - clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic distclean-hdr \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-binPROGRAMS - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/bbfs.c b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/bbfs.c deleted file mode 100644 index 72ddaccd7360c537df078eaa870b1270e34a9af8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/bbfs.c +++ /dev/null @@ -1,911 +0,0 @@ -/* - Big Brother File System - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - This code is derived from function prototypes found /usr/include/fuse/fuse.h - Copyright (C) 2001-2007 Miklos Szeredi - His code is licensed under the LGPLv2. - A copy of that code is included in the file fuse.h - - The point of this FUSE filesystem is to provide an introduction to - FUSE. It was my first FUSE filesystem as I got to know the - software; hopefully, the comments in this code will help people who - follow later to get a gentler introduction. - - This might be called a no-op filesystem: it doesn't impose - filesystem semantics on top of any other existing structure. It - simply reports the requests that come in, and passes them to an - underlying filesystem. The information is saved in a logfile named - bbfs.log, in the directory from which you run bbfs. -*/ - -#include "params.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_SYS_XATTR_H -#include -#endif - -#include "log.h" - -// All the paths I see are relative to the root of the mounted -// filesystem. In order to get to the underlying filesystem, I need to -// have the mountpoint. I'll save it away early on in main(), and then -// whenever I need a path for something I'll call this to construct -// it. -static void bb_fullpath(char fpath[PATH_MAX], const char *path) -{ - strcpy(fpath, BB_DATA->rootdir); - strncat(fpath, path, PATH_MAX); // ridiculously long paths will - // break here - - log_msg(" bb_fullpath: rootdir = \"%s\", path = \"%s\", fpath = \"%s\"\n", - BB_DATA->rootdir, path, fpath); -} - -/////////////////////////////////////////////////////////// -// -// Prototypes for all these functions, and the C-style comments, -// come from /usr/include/fuse.h -// -/** Get file attributes. - * - * Similar to stat(). The 'st_dev' and 'st_blksize' fields are - * ignored. The 'st_ino' field is ignored except if the 'use_ino' - * mount option is given. - */ -int bb_getattr(const char *path, struct stat *statbuf) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("\nbb_getattr(path=\"%s\", statbuf=0x%08x)\n", - path, statbuf); - bb_fullpath(fpath, path); - - retstat = log_syscall("lstat", lstat(fpath, statbuf), 0); - - log_stat(statbuf); - - return retstat; -} - -/** Read the target of a symbolic link - * - * The buffer should be filled with a null terminated string. The - * buffer size argument includes the space for the terminating - * null character. If the linkname is too long to fit in the - * buffer, it should be truncated. The return value should be 0 - * for success. - */ -// Note the system readlink() will truncate and lose the terminating -// null. So, the size passed to to the system readlink() must be one -// less than the size passed to bb_readlink() -// bb_readlink() code by Bernardo F Costa (thanks!) -int bb_readlink(const char *path, char *link, size_t size) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("bb_readlink(path=\"%s\", link=\"%s\", size=%d)\n", - path, link, size); - bb_fullpath(fpath, path); - - retstat = log_syscall("fpath", readlink(fpath, link, size - 1), 0); - if (retstat >= 0) { - link[retstat] = '\0'; - retstat = 0; - } - - return retstat; -} - -/** Create a file node - * - * There is no create() operation, mknod() will be called for - * creation of all non-directory, non-symlink nodes. - */ -// shouldn't that comment be "if" there is no.... ? -int bb_mknod(const char *path, mode_t mode, dev_t dev) -{ - int retstat; - char fpath[PATH_MAX]; - - log_msg("\nbb_mknod(path=\"%s\", mode=0%3o, dev=%lld)\n", - path, mode, dev); - bb_fullpath(fpath, path); - - // On Linux this could just be 'mknod(path, mode, dev)' but this - // tries to be be more portable by honoring the quote in the Linux - // mknod man page stating the only portable use of mknod() is to - // make a fifo, but saying it should never actually be used for - // that. - if (S_ISREG(mode)) { - retstat = log_syscall("open", open(fpath, O_CREAT | O_EXCL | O_WRONLY, mode), 0); - if (retstat >= 0) - retstat = log_syscall("close", close(retstat), 0); - } else - if (S_ISFIFO(mode)) - retstat = log_syscall("mkfifo", mkfifo(fpath, mode), 0); - else - retstat = log_syscall("mknod", mknod(fpath, mode, dev), 0); - - return retstat; -} - -/** Create a directory */ -int bb_mkdir(const char *path, mode_t mode) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_mkdir(path=\"%s\", mode=0%3o)\n", - path, mode); - bb_fullpath(fpath, path); - - return log_syscall("mkdir", mkdir(fpath, mode), 0); -} - -/** Remove a file */ -int bb_unlink(const char *path) -{ - char fpath[PATH_MAX]; - - log_msg("bb_unlink(path=\"%s\")\n", - path); - bb_fullpath(fpath, path); - - return log_syscall("unlink", unlink(fpath), 0); -} - -/** Remove a directory */ -int bb_rmdir(const char *path) -{ - char fpath[PATH_MAX]; - - log_msg("bb_rmdir(path=\"%s\")\n", - path); - bb_fullpath(fpath, path); - - return log_syscall("rmdir", rmdir(fpath), 0); -} - -/** Create a symbolic link */ -// The parameters here are a little bit confusing, but do correspond -// to the symlink() system call. The 'path' is where the link points, -// while the 'link' is the link itself. So we need to leave the path -// unaltered, but insert the link into the mounted directory. -int bb_symlink(const char *path, const char *link) -{ - char flink[PATH_MAX]; - - log_msg("\nbb_symlink(path=\"%s\", link=\"%s\")\n", - path, link); - bb_fullpath(flink, link); - - return log_syscall("symlink", symlink(path, flink), 0); -} - -/** Rename a file */ -// both path and newpath are fs-relative -int bb_rename(const char *path, const char *newpath) -{ - char fpath[PATH_MAX]; - char fnewpath[PATH_MAX]; - - log_msg("\nbb_rename(fpath=\"%s\", newpath=\"%s\")\n", - path, newpath); - bb_fullpath(fpath, path); - bb_fullpath(fnewpath, newpath); - - return log_syscall("rename", rename(fpath, fnewpath), 0); -} - -/** Create a hard link to a file */ -int bb_link(const char *path, const char *newpath) -{ - char fpath[PATH_MAX], fnewpath[PATH_MAX]; - - log_msg("\nbb_link(path=\"%s\", newpath=\"%s\")\n", - path, newpath); - bb_fullpath(fpath, path); - bb_fullpath(fnewpath, newpath); - - return log_syscall("link", link(fpath, fnewpath), 0); -} - -/** Change the permission bits of a file */ -int bb_chmod(const char *path, mode_t mode) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_chmod(fpath=\"%s\", mode=0%03o)\n", - path, mode); - bb_fullpath(fpath, path); - - return log_syscall("chmod", chmod(fpath, mode), 0); -} - -/** Change the owner and group of a file */ -int bb_chown(const char *path, uid_t uid, gid_t gid) - -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_chown(path=\"%s\", uid=%d, gid=%d)\n", - path, uid, gid); - bb_fullpath(fpath, path); - - return log_syscall("chown", chown(fpath, uid, gid), 0); -} - -/** Change the size of a file */ -int bb_truncate(const char *path, off_t newsize) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_truncate(path=\"%s\", newsize=%lld)\n", - path, newsize); - bb_fullpath(fpath, path); - - return log_syscall("truncate", truncate(fpath, newsize), 0); -} - -/** Change the access and/or modification times of a file */ -/* note -- I'll want to change this as soon as 2.6 is in debian testing */ -int bb_utime(const char *path, struct utimbuf *ubuf) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_utime(path=\"%s\", ubuf=0x%08x)\n", - path, ubuf); - bb_fullpath(fpath, path); - - return log_syscall("utime", utime(fpath, ubuf), 0); -} - -/** File open operation - * - * No creation, or truncation flags (O_CREAT, O_EXCL, O_TRUNC) - * will be passed to open(). Open should check if the operation - * is permitted for the given flags. Optionally open may also - * return an arbitrary filehandle in the fuse_file_info structure, - * which will be passed to all file operations. - * - * Changed in version 2.2 - */ -int bb_open(const char *path, struct fuse_file_info *fi) -{ - int retstat = 0; - int fd; - char fpath[PATH_MAX]; - - log_msg("\nbb_open(path\"%s\", fi=0x%08x)\n", - path, fi); - bb_fullpath(fpath, path); - - // if the open call succeeds, my retstat is the file descriptor, - // else it's -errno. I'm making sure that in that case the saved - // file descriptor is exactly -1. - fd = log_syscall("open", open(fpath, fi->flags), 0); - if (fd < 0) - retstat = log_error("open"); - - fi->fh = fd; - - log_fi(fi); - - return retstat; -} - -/** Read data from an open file - * - * Read should return exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the - * 'direct_io' mount option is specified, in which case the return - * value of the read system call will reflect the return value of - * this operation. - * - * Changed in version 2.2 - */ -// I don't fully understand the documentation above -- it doesn't -// match the documentation for the read() system call which says it -// can return with anything up to the amount of data requested. nor -// with the fusexmp code which returns the amount of data also -// returned by read. -int bb_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_read(path=\"%s\", buf=0x%08x, size=%d, offset=%lld, fi=0x%08x)\n", - path, buf, size, offset, fi); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return log_syscall("pread", pread(fi->fh, buf, size, offset), 0); -} - -/** Write data to an open file - * - * Write should return exactly the number of bytes requested - * except on error. An exception to this is when the 'direct_io' - * mount option is specified (see read operation). - * - * Changed in version 2.2 - */ -// As with read(), the documentation above is inconsistent with the -// documentation for the write() system call. -int bb_write(const char *path, const char *buf, size_t size, off_t offset, - struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_write(path=\"%s\", buf=0x%08x, size=%d, offset=%lld, fi=0x%08x)\n", - path, buf, size, offset, fi - ); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return log_syscall("pwrite", pwrite(fi->fh, buf, size, offset), 0); -} - -/** Get file system statistics - * - * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored - * - * Replaced 'struct statfs' parameter with 'struct statvfs' in - * version 2.5 - */ -int bb_statfs(const char *path, struct statvfs *statv) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_statfs(path=\"%s\", statv=0x%08x)\n", - path, statv); - bb_fullpath(fpath, path); - - // get stats for underlying filesystem - retstat = log_syscall("statvfs", statvfs(fpath, statv), 0); - - log_statvfs(statv); - - return retstat; -} - -/** Possibly flush cached data - * - * BIG NOTE: This is not equivalent to fsync(). It's not a - * request to sync dirty data. - * - * Flush is called on each close() of a file descriptor. So if a - * filesystem wants to return write errors in close() and the file - * has cached dirty data, this is a good place to write back data - * and return any errors. Since many applications ignore close() - * errors this is not always useful. - * - * NOTE: The flush() method may be called more than once for each - * open(). This happens if more than one file descriptor refers - * to an opened file due to dup(), dup2() or fork() calls. It is - * not possible to determine if a flush is final, so each flush - * should be treated equally. Multiple write-flush sequences are - * relatively rare, so this shouldn't be a problem. - * - * Filesystems shouldn't assume that flush will always be called - * after some writes, or that if will be called at all. - * - * Changed in version 2.2 - */ -// this is a no-op in BBFS. It just logs the call and returns success -int bb_flush(const char *path, struct fuse_file_info *fi) -{ - log_msg("\nbb_flush(path=\"%s\", fi=0x%08x)\n", path, fi); - // no need to get fpath on this one, since I work from fi->fh not the path - log_fi(fi); - - return 0; -} - -/** Release an open file - * - * Release is called when there are no more references to an open - * file: all file descriptors are closed and all memory mappings - * are unmapped. - * - * For every open() call there will be exactly one release() call - * with the same flags and file descriptor. It is possible to - * have a file opened more than once, in which case only the last - * release will mean, that no more reads/writes will happen on the - * file. The return value of release is ignored. - * - * Changed in version 2.2 - */ -int bb_release(const char *path, struct fuse_file_info *fi) -{ - log_msg("\nbb_release(path=\"%s\", fi=0x%08x)\n", - path, fi); - log_fi(fi); - - // We need to close the file. Had we allocated any resources - // (buffers etc) we'd need to free them here as well. - return log_syscall("close", close(fi->fh), 0); -} - -/** Synchronize file contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data. - * - * Changed in version 2.2 - */ -int bb_fsync(const char *path, int datasync, struct fuse_file_info *fi) -{ - log_msg("\nbb_fsync(path=\"%s\", datasync=%d, fi=0x%08x)\n", - path, datasync, fi); - log_fi(fi); - - // some unix-like systems (notably freebsd) don't have a datasync call -#ifdef HAVE_FDATASYNC - if (datasync) - return log_syscall("fdatasync", fdatasync(fi->fh), 0); - else -#endif - return log_syscall("fsync", fsync(fi->fh), 0); -} - -#ifdef HAVE_SYS_XATTR_H -/** Set extended attributes */ -int bb_setxattr(const char *path, const char *name, const char *value, size_t size, int flags) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_setxattr(path=\"%s\", name=\"%s\", value=\"%s\", size=%d, flags=0x%08x)\n", - path, name, value, size, flags); - bb_fullpath(fpath, path); - - return log_syscall("lsetxattr", lsetxattr(fpath, name, value, size, flags), 0); -} - -/** Get extended attributes */ -int bb_getxattr(const char *path, const char *name, char *value, size_t size) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_getxattr(path = \"%s\", name = \"%s\", value = 0x%08x, size = %d)\n", - path, name, value, size); - bb_fullpath(fpath, path); - - retstat = log_syscall("lgetxattr", lgetxattr(fpath, name, value, size), 0); - if (retstat >= 0) - log_msg(" value = \"%s\"\n", value); - - return retstat; -} - -/** List extended attributes */ -int bb_listxattr(const char *path, char *list, size_t size) -{ - int retstat = 0; - char fpath[PATH_MAX]; - char *ptr; - - log_msg("bb_listxattr(path=\"%s\", list=0x%08x, size=%d)\n", - path, list, size - ); - bb_fullpath(fpath, path); - - retstat = log_syscall("llistxattr", llistxattr(fpath, list, size), 0); - if (retstat >= 0) { - log_msg(" returned attributes (length %d):\n", retstat); - for (ptr = list; ptr < list + retstat; ptr += strlen(ptr)+1) - log_msg(" \"%s\"\n", ptr); - } - - return retstat; -} - -/** Remove extended attributes */ -int bb_removexattr(const char *path, const char *name) -{ - char fpath[PATH_MAX]; - - log_msg("\nbb_removexattr(path=\"%s\", name=\"%s\")\n", - path, name); - bb_fullpath(fpath, path); - - return log_syscall("lremovexattr", lremovexattr(fpath, name), 0); -} -#endif - -/** Open directory - * - * This method should check if the open operation is permitted for - * this directory - * - * Introduced in version 2.3 - */ -int bb_opendir(const char *path, struct fuse_file_info *fi) -{ - DIR *dp; - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_opendir(path=\"%s\", fi=0x%08x)\n", - path, fi); - bb_fullpath(fpath, path); - - // since opendir returns a pointer, takes some custom handling of - // return status. - dp = opendir(fpath); - log_msg(" opendir returned 0x%p\n", dp); - if (dp == NULL) - retstat = log_error("bb_opendir opendir"); - - fi->fh = (intptr_t) dp; - - log_fi(fi); - - return retstat; -} - -/** Read directory - * - * This supersedes the old getdir() interface. New applications - * should use this. - * - * The filesystem may choose between two modes of operation: - * - * 1) The readdir implementation ignores the offset parameter, and - * passes zero to the filler function's offset. The filler - * function will not return '1' (unless an error happens), so the - * whole directory is read in a single readdir operation. This - * works just like the old getdir() method. - * - * 2) The readdir implementation keeps track of the offsets of the - * directory entries. It uses the offset parameter and always - * passes non-zero offset to the filler function. When the buffer - * is full (or an error happens) the filler function will return - * '1'. - * - * Introduced in version 2.3 - */ - -int bb_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, - struct fuse_file_info *fi) -{ - int retstat = 0; - DIR *dp; - struct dirent *de; - - log_msg("\nbb_readdir(path=\"%s\", buf=0x%08x, filler=0x%08x, offset=%lld, fi=0x%08x)\n", - path, buf, filler, offset, fi); - // once again, no need for fullpath -- but note that I need to cast fi->fh - dp = (DIR *) (uintptr_t) fi->fh; - - // Every directory contains at least two entries: . and .. If my - // first call to the system readdir() returns NULL I've got an - // error; near as I can tell, that's the only condition under - // which I can get an error from readdir() - de = readdir(dp); - log_msg(" readdir returned 0x%p\n", de); - if (de == 0) { - retstat = log_error("bb_readdir readdir"); - return retstat; - } - - // This will copy the entire directory into the buffer. The loop exits - // when either the system readdir() returns NULL, or filler() - // returns something non-zero. The first case just means I've - // read the whole directory; the second means the buffer is full. - do { - log_msg("calling filler with name %s\n", de->d_name); - if (filler(buf, de->d_name, NULL, 0) != 0) { - log_msg(" ERROR bb_readdir filler: buffer full"); - return -ENOMEM; - } - } while ((de = readdir(dp)) != NULL); - - log_fi(fi); - - return retstat; -} - -/** Release directory - * - * Introduced in version 2.3 - */ -int bb_releasedir(const char *path, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_releasedir(path=\"%s\", fi=0x%08x)\n", - path, fi); - log_fi(fi); - - closedir((DIR *) (uintptr_t) fi->fh); - - return retstat; -} - -/** Synchronize directory contents - * - * If the datasync parameter is non-zero, then only the user data - * should be flushed, not the meta data - * - * Introduced in version 2.3 - */ -// when exactly is this called? when a user calls fsync and it -// happens to be a directory? ??? >>> I need to implement this... -int bb_fsyncdir(const char *path, int datasync, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_fsyncdir(path=\"%s\", datasync=%d, fi=0x%08x)\n", - path, datasync, fi); - log_fi(fi); - - return retstat; -} - -/** - * Initialize filesystem - * - * The return value will passed in the private_data field of - * fuse_context to all file operations and as a parameter to the - * destroy() method. - * - * Introduced in version 2.3 - * Changed in version 2.6 - */ -// Undocumented but extraordinarily useful fact: the fuse_context is -// set up before this function is called, and -// fuse_get_context()->private_data returns the user_data passed to -// fuse_main(). Really seems like either it should be a third -// parameter coming in here, or else the fact should be documented -// (and this might as well return void, as it did in older versions of -// FUSE). -void *bb_init(struct fuse_conn_info *conn) -{ - log_msg("\nbb_init()\n"); - - log_conn(conn); - log_fuse_context(fuse_get_context()); - - return BB_DATA; -} - -/** - * Clean up filesystem - * - * Called on filesystem exit. - * - * Introduced in version 2.3 - */ -void bb_destroy(void *userdata) -{ - log_msg("\nbb_destroy(userdata=0x%08x)\n", userdata); -} - -/** - * Check file access permissions - * - * This will be called for the access() system call. If the - * 'default_permissions' mount option is given, this method is not - * called. - * - * This method is not called under Linux kernel versions 2.4.x - * - * Introduced in version 2.5 - */ -int bb_access(const char *path, int mask) -{ - int retstat = 0; - char fpath[PATH_MAX]; - - log_msg("\nbb_access(path=\"%s\", mask=0%o)\n", - path, mask); - bb_fullpath(fpath, path); - - retstat = access(fpath, mask); - - if (retstat < 0) - retstat = log_error("bb_access access"); - - return retstat; -} - -/** - * Create and open a file - * - * If the file does not exist, first create it with the specified - * mode, and then open it. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the mknod() and open() methods - * will be called instead. - * - * Introduced in version 2.5 - */ -// Not implemented. I had a version that used creat() to create and -// open the file, which it turned out opened the file write-only. - -/** - * Change the size of an open file - * - * This method is called instead of the truncate() method if the - * truncation was invoked from an ftruncate() system call. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the truncate() method will be - * called instead. - * - * Introduced in version 2.5 - */ -int bb_ftruncate(const char *path, off_t offset, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_ftruncate(path=\"%s\", offset=%lld, fi=0x%08x)\n", - path, offset, fi); - log_fi(fi); - - retstat = ftruncate(fi->fh, offset); - if (retstat < 0) - retstat = log_error("bb_ftruncate ftruncate"); - - return retstat; -} - -/** - * Get attributes from an open file - * - * This method is called instead of the getattr() method if the - * file information is available. - * - * Currently this is only called after the create() method if that - * is implemented (see above). Later it may be called for - * invocations of fstat() too. - * - * Introduced in version 2.5 - */ -int bb_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) -{ - int retstat = 0; - - log_msg("\nbb_fgetattr(path=\"%s\", statbuf=0x%08x, fi=0x%08x)\n", - path, statbuf, fi); - log_fi(fi); - - // On FreeBSD, trying to do anything with the mountpoint ends up - // opening it, and then using the FD for an fgetattr. So in the - // special case of a path of "/", I need to do a getattr on the - // underlying root directory instead of doing the fgetattr(). - if (!strcmp(path, "/")) - return bb_getattr(path, statbuf); - - retstat = fstat(fi->fh, statbuf); - if (retstat < 0) - retstat = log_error("bb_fgetattr fstat"); - - log_stat(statbuf); - - return retstat; -} - -struct fuse_operations bb_oper = { - .getattr = bb_getattr, - .readlink = bb_readlink, - // no .getdir -- that's deprecated - .getdir = NULL, - .mknod = bb_mknod, - .mkdir = bb_mkdir, - .unlink = bb_unlink, - .rmdir = bb_rmdir, - .symlink = bb_symlink, - .rename = bb_rename, - .link = bb_link, - .chmod = bb_chmod, - .chown = bb_chown, - .truncate = bb_truncate, - .utime = bb_utime, - .open = bb_open, - .read = bb_read, - .write = bb_write, - /** Just a placeholder, don't set */ // huh??? - .statfs = bb_statfs, - .flush = bb_flush, - .release = bb_release, - .fsync = bb_fsync, - -#ifdef HAVE_SYS_XATTR_H - .setxattr = bb_setxattr, - .getxattr = bb_getxattr, - .listxattr = bb_listxattr, - .removexattr = bb_removexattr, -#endif - - .opendir = bb_opendir, - .readdir = bb_readdir, - .releasedir = bb_releasedir, - .fsyncdir = bb_fsyncdir, - .init = bb_init, - .destroy = bb_destroy, - .access = bb_access, - .ftruncate = bb_ftruncate, - .fgetattr = bb_fgetattr -}; - -void bb_usage() -{ - fprintf(stderr, "usage: bbfs [FUSE and mount options] rootDir mountPoint\n"); - abort(); -} - -int main(int argc, char *argv[]) -{ - int fuse_stat; - struct bb_state *bb_data; - - // bbfs doesn't do any access checking on its own (the comment - // blocks in fuse.h mention some of the functions that need - // accesses checked -- but note there are other functions, like - // chown(), that also need checking!). Since running bbfs as root - // will therefore open Metrodome-sized holes in the system - // security, we'll check if root is trying to mount the filesystem - // and refuse if it is. The somewhat smaller hole of an ordinary - // user doing it with the allow_other flag is still there because - // I don't want to parse the options string. - if ((getuid() == 0) || (geteuid() == 0)) { - fprintf(stderr, "Running BBFS as root opens unnacceptable security holes\n"); - return 1; - } - - // See which version of fuse we're running - fprintf(stderr, "Fuse library version %d.%d\n", FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION); - - // Perform some sanity checking on the command line: make sure - // there are enough arguments, and that neither of the last two - // start with a hyphen (this will break if you actually have a - // rootpoint or mountpoint whose name starts with a hyphen, but so - // will a zillion other programs) - if ((argc < 3) || (argv[argc-2][0] == '-') || (argv[argc-1][0] == '-')) - bb_usage(); - - bb_data = malloc(sizeof(struct bb_state)); - if (bb_data == NULL) { - perror("main calloc"); - abort(); - } - - // Pull the rootdir out of the argument list and save it in my - // internal data - bb_data->rootdir = realpath(argv[argc-2], NULL); - argv[argc-2] = argv[argc-1]; - argv[argc-1] = NULL; - argc--; - - bb_data->logfile = log_open(); - - // turn over control to fuse - fprintf(stderr, "about to call fuse_main\n"); - fuse_stat = fuse_main(argc, argv, &bb_oper, bb_data); - fprintf(stderr, "fuse_main returned %d\n", fuse_stat); - - return fuse_stat; -} diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h deleted file mode 100644 index 30f0a8b09497b5fd568fa56d54de50dd0a2e74bd..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h +++ /dev/null @@ -1,149 +0,0 @@ -/* src/config.h. Generated from config.h.in by configure. */ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if your system has a working `chown' function. */ -#define HAVE_CHOWN 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fdatasync' function. */ -#define HAVE_FDATASYNC 1 - -/* Define to 1 if you have the `ftruncate' function. */ -#define HAVE_FTRUNCATE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkdir' function. */ -#define HAVE_MKDIR 1 - -/* Define to 1 if you have the `mkfifo' function. */ -#define HAVE_MKFIFO 1 - -/* Define to 1 if you have the `realpath' function. */ -#define HAVE_REALPATH 1 - -/* Define to 1 if you have the `rmdir' function. */ -#define HAVE_RMDIR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if `st_blocks' is a member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 - -/* Define to 1 if `st_rdev' is a member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_RDEV 1 - -/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#define HAVE_ST_BLOCKS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STATVFS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_XATTR_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `utime' function. */ -#define HAVE_UTIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 - -/* Name of package */ -#define PACKAGE "fuse-tutorial" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "joseph@pfeifferfamily.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "fuse-tutorial" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "fuse-tutorial 2016-03-25" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "fuse-tutorial" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2016-03-25" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "2016-03-25" - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - -/* Define to `int' if doesn't define. */ -/* #undef gid_t */ - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `int' if does not define. */ -/* #undef mode_t */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `int' if does not define. */ -/* #undef pid_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if doesn't define. */ -/* #undef uid_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h.in b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h.in deleted file mode 100644 index 747964ef12b43579e504b73df44fe31222d16c76..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/config.h.in +++ /dev/null @@ -1,148 +0,0 @@ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if your system has a working `chown' function. */ -#undef HAVE_CHOWN - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fdatasync' function. */ -#undef HAVE_FDATASYNC - -/* Define to 1 if you have the `ftruncate' function. */ -#undef HAVE_FTRUNCATE - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define to 1 if you have the `mkfifo' function. */ -#undef HAVE_MKFIFO - -/* Define to 1 if you have the `realpath' function. */ -#undef HAVE_REALPATH - -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLKSIZE - -/* Define to 1 if `st_blocks' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - -/* Define to 1 if `st_rdev' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#undef HAVE_ST_BLOCKS - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATVFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_XATTR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `utime' function. */ -#undef HAVE_UTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT64_T - -/* Define to `int' if doesn't define. */ -#undef gid_t - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to `int' if does not define. */ -#undef mode_t - -/* Define to `long int' if does not define. */ -#undef off_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to `int' if doesn't define. */ -#undef uid_t - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -#undef uint64_t diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.c b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.c deleted file mode 100644 index 01b30e46dce223fa52c0d0ebb1bd724217313a4d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - Since the point of this filesystem is to learn FUSE and its - datastructures, I want to see *everything* that happens related to - its data structures. This file contains macros and functions to - accomplish this. -*/ - -#include "params.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "log.h" - -FILE *log_open() -{ - FILE *logfile; - - // very first thing, open up the logfile and mark that we got in - // here. If we can't open the logfile, we're dead. - logfile = fopen("bbfs.log", "w"); - if (logfile == NULL) { - perror("logfile"); - exit(EXIT_FAILURE); - } - - // set logfile to line buffering - setvbuf(logfile, NULL, _IOLBF, 0); - - return logfile; -} - -void log_msg(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - - vfprintf(BB_DATA->logfile, format, ap); -} - -// Report errors to logfile and give -errno to caller -int log_error(char *func) -{ - int ret = -errno; - - log_msg(" ERROR %s: %s\n", func, strerror(errno)); - - return ret; -} - -// fuse context -void log_fuse_context(struct fuse_context *context) -{ - log_msg(" context:\n"); - - /** Pointer to the fuse object */ - // struct fuse *fuse; - log_struct(context, fuse, %08x, ); - - /** User ID of the calling process */ - // uid_t uid; - log_struct(context, uid, %d, ); - - /** Group ID of the calling process */ - // gid_t gid; - log_struct(context, gid, %d, ); - - /** Thread ID of the calling process */ - // pid_t pid; - log_struct(context, pid, %d, ); - - /** Private filesystem data */ - // void *private_data; - log_struct(context, private_data, %08x, ); - log_struct(((struct bb_state *)context->private_data), logfile, %08x, ); - log_struct(((struct bb_state *)context->private_data), rootdir, %s, ); - - /** Umask of the calling process (introduced in version 2.8) */ - // mode_t umask; - log_struct(context, umask, %05o, ); -} - -// struct fuse_conn_info contains information about the socket -// connection being used. I don't actually use any of this -// information in bbfs -void log_conn(struct fuse_conn_info *conn) -{ - log_msg(" conn:\n"); - - /** Major version of the protocol (read-only) */ - // unsigned proto_major; - log_struct(conn, proto_major, %d, ); - - /** Minor version of the protocol (read-only) */ - // unsigned proto_minor; - log_struct(conn, proto_minor, %d, ); - - /** Is asynchronous read supported (read-write) */ - // unsigned async_read; - log_struct(conn, async_read, %d, ); - - /** Maximum size of the write buffer */ - // unsigned max_write; - log_struct(conn, max_write, %d, ); - - /** Maximum readahead */ - // unsigned max_readahead; - log_struct(conn, max_readahead, %d, ); - - /** Capability flags, that the kernel supports */ - // unsigned capable; - log_struct(conn, capable, %08x, ); - - /** Capability flags, that the filesystem wants to enable */ - // unsigned want; - log_struct(conn, want, %08x, ); - - /** Maximum number of backgrounded requests */ - // unsigned max_background; - log_struct(conn, max_background, %d, ); - - /** Kernel congestion threshold parameter */ - // unsigned congestion_threshold; - log_struct(conn, congestion_threshold, %d, ); - - /** For future use. */ - // unsigned reserved[23]; -} - -// struct fuse_file_info keeps information about files (surprise!). -// This dumps all the information in a struct fuse_file_info. The struct -// definition, and comments, come from /usr/include/fuse/fuse_common.h -// Duplicated here for convenience. -void log_fi (struct fuse_file_info *fi) -{ - log_msg(" fi:\n"); - - /** Open flags. Available in open() and release() */ - // int flags; - log_struct(fi, flags, 0x%08x, ); - - /** Old file handle, don't use */ - // unsigned long fh_old; - log_struct(fi, fh_old, 0x%08lx, ); - - /** In case of a write operation indicates if this was caused by a - writepage */ - // int writepage; - log_struct(fi, writepage, %d, ); - - /** Can be filled in by open, to use direct I/O on this file. - Introduced in version 2.4 */ - // unsigned int keep_cache : 1; - log_struct(fi, direct_io, %d, ); - - /** Can be filled in by open, to indicate, that cached file data - need not be invalidated. Introduced in version 2.4 */ - // unsigned int flush : 1; - log_struct(fi, keep_cache, %d, ); - - /** Padding. Do not use*/ - // unsigned int padding : 29; - - /** File handle. May be filled in by filesystem in open(). - Available in all other file operations */ - // uint64_t fh; - log_struct(fi, fh, 0x%016llx, ); - - /** Lock owner id. Available in locking operations and flush */ - // uint64_t lock_owner; - log_struct(fi, lock_owner, 0x%016llx, ); -} - -void log_retstat(char *func, int retstat) -{ - int errsave = errno; - log_msg(" %s returned %d\n", func, retstat); - errno = errsave; -} - -// make a system call, checking (and reporting) return status and -// possibly logging error -int log_syscall(char *func, int retstat, int min_ret) -{ - log_retstat(func, retstat); - - if (retstat < min_ret) { - log_error(func); - retstat = -errno; - } - - return retstat; -} - -// This dumps the info from a struct stat. The struct is defined in -// ; this is indirectly included from -void log_stat(struct stat *si) -{ - log_msg(" si:\n"); - - // dev_t st_dev; /* ID of device containing file */ - log_struct(si, st_dev, %lld, ); - - // ino_t st_ino; /* inode number */ - log_struct(si, st_ino, %lld, ); - - // mode_t st_mode; /* protection */ - log_struct(si, st_mode, 0%o, ); - - // nlink_t st_nlink; /* number of hard links */ - log_struct(si, st_nlink, %d, ); - - // uid_t st_uid; /* user ID of owner */ - log_struct(si, st_uid, %d, ); - - // gid_t st_gid; /* group ID of owner */ - log_struct(si, st_gid, %d, ); - - // dev_t st_rdev; /* device ID (if special file) */ - log_struct(si, st_rdev, %lld, ); - - // off_t st_size; /* total size, in bytes */ - log_struct(si, st_size, %lld, ); - - // blksize_t st_blksize; /* blocksize for filesystem I/O */ - log_struct(si, st_blksize, %ld, ); - - // blkcnt_t st_blocks; /* number of blocks allocated */ - log_struct(si, st_blocks, %lld, ); - - // time_t st_atime; /* time of last access */ - log_struct(si, st_atime, 0x%08lx, ); - - // time_t st_mtime; /* time of last modification */ - log_struct(si, st_mtime, 0x%08lx, ); - - // time_t st_ctime; /* time of last status change */ - log_struct(si, st_ctime, 0x%08lx, ); - -} - -void log_statvfs(struct statvfs *sv) -{ - log_msg(" sv:\n"); - - // unsigned long f_bsize; /* file system block size */ - log_struct(sv, f_bsize, %ld, ); - - // unsigned long f_frsize; /* fragment size */ - log_struct(sv, f_frsize, %ld, ); - - // fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ - log_struct(sv, f_blocks, %lld, ); - - // fsblkcnt_t f_bfree; /* # free blocks */ - log_struct(sv, f_bfree, %lld, ); - - // fsblkcnt_t f_bavail; /* # free blocks for non-root */ - log_struct(sv, f_bavail, %lld, ); - - // fsfilcnt_t f_files; /* # inodes */ - log_struct(sv, f_files, %lld, ); - - // fsfilcnt_t f_ffree; /* # free inodes */ - log_struct(sv, f_ffree, %lld, ); - - // fsfilcnt_t f_favail; /* # free inodes for non-root */ - log_struct(sv, f_favail, %lld, ); - - // unsigned long f_fsid; /* file system ID */ - log_struct(sv, f_fsid, %ld, ); - - // unsigned long f_flag; /* mount flags */ - log_struct(sv, f_flag, 0x%08lx, ); - - // unsigned long f_namemax; /* maximum filename length */ - log_struct(sv, f_namemax, %ld, ); - -} - -void log_utime(struct utimbuf *buf) -{ - log_msg(" buf:\n"); - - // time_t actime; - log_struct(buf, actime, 0x%08lx, ); - - // time_t modtime; - log_struct(buf, modtime, 0x%08lx, ); -} - diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.h b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.h deleted file mode 100644 index c92f70dcf36dde33f81792bbf74cde8b9fc26228..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/log.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. -*/ - -#ifndef _LOG_H_ -#define _LOG_H_ -#include - -// macro to log fields in structs. -#define log_struct(st, field, format, typecast) \ - log_msg(" " #field " = " #format "\n", typecast st->field) - -FILE *log_open(void); -void log_msg(const char *format, ...); -void log_conn(struct fuse_conn_info *conn); -int log_error(char *func); -void log_fi(struct fuse_file_info *fi); -void log_fuse_context(struct fuse_context *context); -void log_retstat(char *func, int retstat); -void log_stat(struct stat *si); -void log_statvfs(struct statvfs *sv); -int log_syscall(char *func, int retstat, int min_ret); -void log_utime(struct utimbuf *buf); - -#endif diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/params.h b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/params.h deleted file mode 100644 index f37430ff18614347c15f29d05aae50c9891ccd60..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/params.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2012 Joseph J. Pfeiffer, Jr., Ph.D. - - This program can be distributed under the terms of the GNU GPLv3. - See the file COPYING. - - There are a couple of symbols that need to be #defined before - #including all the headers. -*/ - -#ifndef _PARAMS_H_ -#define _PARAMS_H_ - -// The FUSE API has been changed a number of times. So, our code -// needs to define the version of the API that we assume. As of this -// writing, the most current API version is 26 -#define FUSE_USE_VERSION 26 - -// need this to get pwrite(). I have to use setvbuf() instead of -// setlinebuf() later in consequence. -#define _XOPEN_SOURCE 500 - -// maintain bbfs state in here -#include -#include -struct bb_state { - FILE *logfile; - char *rootdir; -}; -#define BB_DATA ((struct bb_state *) fuse_get_context()->private_data) - -#endif diff --git a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/stamp-h1 b/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/stamp-h1 deleted file mode 100644 index 57ea58e405b37b3e2f964c89cc2f42aea6073003..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/fuse-tutorial-2016-03-25/src/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for src/config.h diff --git a/archive_old_fs_versions/lfs/.gitignore b/archive_old_fs_versions/lfs/.gitignore deleted file mode 100644 index e39e76ad8719706765570f38652f4b15bcf014a7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ - - -# IDEA FILES # -##################### -.idea/ - -# BUILD # -######### - -build/ - -# DEBUG # -######### - -cmake-build-debug/ -cmake-build-release/ -playground/ - diff --git a/archive_old_fs_versions/lfs/CMake/FindAbt-Snoozer.cmake b/archive_old_fs_versions/lfs/CMake/FindAbt-Snoozer.cmake deleted file mode 100644 index 967b74b29def3478bad6dd6aba45a018664a838c..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindAbt-Snoozer.cmake +++ /dev/null @@ -1,41 +0,0 @@ -find_path(ABT_SNOOZER_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_path(ABT_SNOOZER_INCLUDE_DIR abt-snoozer.h - HINTS - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${ABT_SNOOZER_DIR} - PATH_SUFFIXES include - ) - -find_library(ABT_SNOOZER_LIBRARY abt-snoozer - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${ABT_SNOOZER_DIR} - # PATH SUFFIXES lib - # PATH_SUFFIXES lib/margo - ) - -set(ABT_SNOOZER_INCLUDE_DIRS ${ABT_SNOOZER_INCLUDE_DIR}) -set(ABT_SNOOZER_LIBRARIES ${ABT_SNOOZER_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Abt-Snoozer DEFAULT_MSG ABT_SNOOZER_LIBRARY ABT_SNOOZER_INCLUDE_DIR) - -mark_as_advanced( - ABT_SNOOZER_DIR - ABT_SNOOZER_LIBRARY - ABT_SNOOZER_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindAbt.cmake b/archive_old_fs_versions/lfs/CMake/FindAbt.cmake deleted file mode 100644 index c80e515f96096bb0bf3c82a2e34111076d4b61fe..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindAbt.cmake +++ /dev/null @@ -1,41 +0,0 @@ -find_path(ABT_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_path(ABT_INCLUDE_DIR abt.h - HINTS - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${ABT_DIR} - PATH_SUFFIXES include - ) - -find_library(ABT_LIBRARY abt - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${ABT_DIR} - # PATH SUFFIXES lib - # PATH_SUFFIXES lib/margo - ) - -set(ABT_INCLUDE_DIRS ${ABT_INCLUDE_DIR}) -set(ABT_LIBRARIES ${ABT_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Abt DEFAULT_MSG ABT_LIBRARY ABT_INCLUDE_DIR) - -mark_as_advanced( - ABT_DIR - ABT_LIBRARY - ABT_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindAbtIO.cmake b/archive_old_fs_versions/lfs/CMake/FindAbtIO.cmake deleted file mode 100644 index f3232f79448026f0a07bccf204762b90edbb40c2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindAbtIO.cmake +++ /dev/null @@ -1,39 +0,0 @@ -find_path(ABT_IO_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_path(ABT_IO_INCLUDE_DIR abt-io.h - HINTS - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${ABT_IO_DIR} - PATH_SUFFIXES include - ) - -find_library(ABT_IO_LIBRARY abt-io - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${ABT_IO_DIR} - ) - -set(ABT_IO_INCLUDE_DIRS ${ABT_IO_INCLUDE_DIR}) -set(ABT_IO_LIBRARIES ${ABT_IO_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Abt-IO DEFAULT_MSG ABT_IO_LIBRARY ABT_IO_INCLUDE_DIR) - -mark_as_advanced( - ABT_IO_DIR - ABT_IO_LIBRARY - ABT_IO_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindBMI.cmake b/archive_old_fs_versions/lfs/CMake/FindBMI.cmake deleted file mode 100644 index f06123dc5865b34da382abc180094ebf6a513cf7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindBMI.cmake +++ /dev/null @@ -1,41 +0,0 @@ -find_path(BMI_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - $ENV{HOME}/adafs/install - ) - -find_path(BMI_INCLUDE_DIR bmi.h - HINTS - $ENV{HOME}/adafs/install - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${BMI_DIR} - PATH_SUFFIXES include - ) - -find_library(BMI_LIBRARY bmi - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${BMI_DIR} - ) - -set(BMI_INCLUDE_DIRS ${BMI_INCLUDE_DIR}) -set(BMI_LIBRARIES ${BMI_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BMI DEFAULT_MSG BMI_LIBRARY BMI_INCLUDE_DIR) - -mark_as_advanced( - BMI_DIR - BMI_LIBRARY - BMI_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindCCI.cmake b/archive_old_fs_versions/lfs/CMake/FindCCI.cmake deleted file mode 100644 index 7687ca82c33e17d8e299752089974b3f23c4487a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindCCI.cmake +++ /dev/null @@ -1,41 +0,0 @@ -find_path(CCI_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - $ENV{HOME}/adafs/install - ) - -find_path(CCI_INCLUDE_DIR cci.h - HINTS - $ENV{HOME}/adafs/install - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${CCI_DIR} - PATH_SUFFIXES include - ) - -find_library(CCI_LIBRARY cci - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${CCI_DIR} - ) - -set(CCI_INCLUDE_DIRS ${CCI_INCLUDE_DIR}) -set(CCI_LIBRARIES ${CCI_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CCI DEFAULT_MSG CCI_LIBRARY CCI_INCLUDE_DIR) - -mark_as_advanced( - CCI_DIR - CCI_LIBRARY - CCI_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindFUSE.cmake b/archive_old_fs_versions/lfs/CMake/FindFUSE.cmake deleted file mode 100644 index bd178e26a6e28d63df43a43181df9b6279e224d8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindFUSE.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Find the FUSE includes and library -# -# FUSE_INCLUDE_DIR - where to find fuse.h, etc. -# FUSE_LIBRARIES - List of libraries when using FUSE. -# FUSE_FOUND - True if FUSE lib is found. - -# check if already in cache, be silent -IF (FUSE_INCLUDE_DIR) - SET (FUSE_FIND_QUIETLY TRUE) -ENDIF (FUSE_INCLUDE_DIR) - -# find includes -FIND_PATH (FUSE_INCLUDE_DIR fuse.h - /usr/local/include/osxfuse - /usr/local/include - /usr/include - ) - -# find lib -if (APPLE) - SET(FUSE_NAMES libosxfuse.dylib fuse) -else (APPLE) - SET(FUSE_NAMES fuse) -endif (APPLE) -FIND_LIBRARY(FUSE_LIBRARIES - NAMES ${FUSE_NAMES} - PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu - ) - -include ("FindPackageHandleStandardArgs") -find_package_handle_standard_args ("FUSE" DEFAULT_MSG - FUSE_INCLUDE_DIR FUSE_LIBRARIES) - -mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindFUSE3.cmake b/archive_old_fs_versions/lfs/CMake/FindFUSE3.cmake deleted file mode 100644 index ab2e822f143d3911d52aca98c793d6a5f4daf562..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindFUSE3.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Try to find fuse (devel) -# Once done, this will define -# -# FUSE3_FOUND - system has fuse -# FUSE3_INCLUDE_DIRS - the fuse include directories -# FUSE3_LIBRARIES - fuse libraries directories - -if(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - set(FUSE3_FIND_QUIETLY TRUE) -endif(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - -find_path( FUSE3_INCLUDE_DIR fuse3/fuse_lowlevel.h - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES include ) - -find_library( FUSE3_LIBRARY fuse3 - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES lib ) - -set(FUSE3_INCLUDE_DIRS ${FUSE3_INCLUDE_DIR}) -set(FUSE3_LIBRARIES ${FUSE3_LIBRARY}) - -# handle the QUIETLY and REQUIRED arguments and set FUSE3_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(fuse3 DEFAULT_MSG FUSE3_INCLUDE_DIR FUSE3_LIBRARY) - -mark_as_advanced(FUSE3_INCLUDE_DIR FUSE3_LIBRARY) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindGFlags.cmake b/archive_old_fs_versions/lfs/CMake/FindGFlags.cmake deleted file mode 100644 index 08d26941184a7ab1cf101c9c8399f2bc76d22cf7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindGFlags.cmake +++ /dev/null @@ -1,86 +0,0 @@ -# - Try to find GFlags -# -# The following variables are optionally searched for defaults -# GFlags_ROOT_DIR: Base directory where all GFlags components are found -# -# The following are set after configuration is done: -# GFlags_FOUND -# GFlags_INCLUDE_DIRS -# GFlags_LIBS -# GFlags_LIBRARY_DIRS -cmake_minimum_required(VERSION 2.6) -cmake_policy(SET CMP0011 OLD) - -set(GFlags_ROOT_DIR) -if (WIN32) - FIND_PATH(GFlags_ROOT_DIR - src/gflags.cc - HINTS - $ENV{GFLAGS_ROOT}) -else (WIN32) - FIND_PATH(GFlags_ROOT_DIR - libgflags.dylib - HINTS - /usr/local/lib - ) -endif (WIN32) - -if (UNIX) - FIND_PATH(GFlags_ROOT_DIR - libgflags.so - HINTS - /usr/local/lib - ) -endif (UNIX) - -IF (GFlags_ROOT_DIR) - # We are testing only a couple of files in the include directories - if (WIN32) - FIND_PATH(GFlags_INCLUDE_DIRS - gflags/gflags.h - HINTS - ${GFlags_ROOT_DIR}/src/windows - ) - else (WIN32) - FIND_PATH(GFlags_INCLUDE_DIRS - gflags/gflags.h - HINTS - /usr/local/include - ${GFlags_ROOT_DIR}/src - ) - endif (WIN32) - - # Find the libraries - SET(GFlags_LIBRARY_DIRS ${GFlags_ROOT_DIR}) - - # TODO: This can use some per-component linking - if (MSVC) - SET(_gflags_libpath_suffixes /Release /Debug) - FIND_LIBRARY(GFlags_lib_release - NAMES libgflags - HINTS - ${GFlags_LIBRARY_DIRS} - PATH_SUFFIXES ${_gflags_libpath_suffixes}) - FIND_LIBRARY(GFlags_lib_debug - NAMES libgflags-debug - HINTS - ${GFlags_LIBRARY_DIRS} - PATH_SUFFIXES ${_gflags_libpath_suffixes}) - SET(GFlags_lib optimized ${GFlags_lib_release} debug ${GFlags_lib_debug}) - else () - FIND_LIBRARY(GFlags_lib gflags ${GFlags_LIBRARY_DIRS}) - endif () - - # set up include and link directory - include_directories(${GFlags_INCLUDE_DIRS}) - link_directories(${GFlags_LIBRARY_DIRS}) - message(STATUS "gflags library found at ${GFlags_lib}") - SET(GFlags_LIBS ${GFlags_lib}) - SET(GFlags_FOUND true) - MARK_AS_ADVANCED(GFlags_INCLUDE_DIRS) -ELSE (GFlags_ROOT_DIR) - FIND_PATH(GFlags_ROOT_DIR src) - MARK_AS_ADVANCED(GFlags_ROOT_DIR) - MESSAGE(STATUS "Cannot find Root directory of gflags") - SET(GFlags_FOUND false) -ENDIF (GFlags_ROOT_DIR) diff --git a/archive_old_fs_versions/lfs/CMake/FindLZ4.cmake b/archive_old_fs_versions/lfs/CMake/FindLZ4.cmake deleted file mode 100644 index 9b70f304da886cf6ab18c17207c7fabb4db1fe53..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindLZ4.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Finds liblz4. -# -# This module defines: -# LZ4_FOUND -# LZ4_INCLUDE_DIR -# LZ4_LIBRARY -# - -find_path(LZ4_INCLUDE_DIR NAMES lz4.h) -find_library(LZ4_LIBRARY NAMES lz4) - -# We require LZ4_compress_default() which was added in v1.7.0 -if (LZ4_LIBRARY) - include(CheckCSourceRuns) - set(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) - set(CMAKE_REQUIRED_LIBRARIES ${LZ4_LIBRARY}) - check_c_source_runs(" -#include -int main() { - int good = (LZ4_VERSION_MAJOR > 1) || - ((LZ4_VERSION_MAJOR == 1) && (LZ4_VERSION_MINOR >= 7)); -return !good; -}" LZ4_GOOD_VERSION) - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_LIBRARIES) -endif () - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - LZ4 DEFAULT_MSG - LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_GOOD_VERSION) - -if (NOT LZ4_FOUND) - message(STATUS "Using third-party bundled LZ4") -else () - message(STATUS "Found LZ4: ${LZ4_LIBRARY}") -endif (NOT LZ4_FOUND) - -mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindLibev.cmake b/archive_old_fs_versions/lfs/CMake/FindLibev.cmake deleted file mode 100644 index cfa9fec00ea6938a580fa42ef7a4a3be4c68b80c..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindLibev.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Try to find libev -# Once done, this will define -# -# LIBEV_FOUND - system has libev -# LIBEV_INCLUDE_DIRS - libev include directories -# LIBEV_LIBRARIES - libraries needed to use libev - -if (LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES) - set(LIBEV_FIND_QUIETLY TRUE) -else () - find_path( - LIBEV_INCLUDE_DIR - NAMES ev.h - HINTS ${LIBEV_ROOT_DIR} - PATH_SUFFIXES include) - - find_library( - LIBEV_LIBRARY - NAME ev - HINTS ${LIBEV_ROOT_DIR} - PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}) - - set(LIBEV_INCLUDE_DIRS ${LIBEV_INCLUDE_DIR}) - set(LIBEV_LIBRARIES ${LIBEV_LIBRARY}) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args( - libev DEFAULT_MSG LIBEV_LIBRARY LIBEV_INCLUDE_DIR) - - mark_as_advanced(LIBEV_LIBRARY LIBEV_INCLUDE_DIR) -endif () \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindMargo.cmake b/archive_old_fs_versions/lfs/CMake/FindMargo.cmake deleted file mode 100644 index f0342a6cedb40c61acde0c92a46eef535c16fa86..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindMargo.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# Try to find Margo headers and library. -# -# Usage of this module as follows: -# -# find_package(Margo) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# MARGO_ROOT_DIR Set this variable to the root installation of -# Margo if the module has problems finding the -# proper installation path. -# -# Variables defined by this module: -# -# MARGO_FOUND System has Margo library/headers. -# MARGO_LIBRARIES The Margo library. -# MARGO_INCLUDE_DIRS The location of Margo headers. - -find_path(MARGO_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_path(MARGO_INCLUDE_DIR margo.h - HINTS - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${MARGO_DIR} - PATH_SUFFIXES include - ) - -find_library(MARGO_LIBRARY margo - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${MARGO_DIR} - PATH SUFFIXES lib - PATH_SUFFIXES lib/margo - ) - -set(MARGO_INCLUDE_DIRS ${MARGO_INCLUDE_DIR}) -set(MARGO_LIBRARIES ${MARGO_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Margo DEFAULT_MSG MARGO_LIBRARY MARGO_INCLUDE_DIR) - -mark_as_advanced( - MARGO_DIR - MARGO_LIBRARY - MARGO_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindMercury.cmake b/archive_old_fs_versions/lfs/CMake/FindMercury.cmake deleted file mode 100644 index 964a56004f5d7c1ce7eedd86666b6a6c931a6009..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindMercury.cmake +++ /dev/null @@ -1,40 +0,0 @@ -find_path(MERCURY_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_path(MERCURY_INCLUDE_DIR mercury.h - HINTS - $ENV{HOME}/adafs/install - /usr - /usr/local - /usr/local/adafs - ${MERCURY_DIR} - PATH_SUFFIXES include - ) - -find_library(MERCURY_LIBRARY - NAMES mercury - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${MERCURY_DIR} - ) - -set(MERCURY_INCLUDE_DIRS ${MERCURY_INCLUDE_DIR}) -set(MERCURY_LIBRARIES ${MERCURY_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Mercury DEFAULT_MSG MERCURY_LIBRARY MERCURY_INCLUDE_DIR) - -mark_as_advanced( - MERCURY_DIR - MERCURY_LIBRARY - MERCURY_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindMercuryUtil.cmake b/archive_old_fs_versions/lfs/CMake/FindMercuryUtil.cmake deleted file mode 100644 index cb9e2528fba58990e8d5291282ab6e73d3d8ed19..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindMercuryUtil.cmake +++ /dev/null @@ -1,29 +0,0 @@ -find_path(MERCURY_UTIL_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - $ENV{HOME}/adafs/install - ) - -find_library(MERCURY_UTIL_LIBRARY - NAMES mercury_util - HINTS - $ENV{HOME}/adafs/install/lib - /usr - /usr/local - /usr/local/adafs - ${MERCURY_UTIL_DIR} - ) - -set(MERCURY_UTIL_LIBRARIES ${MERCURY_UTIL_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Mercury_Util DEFAULT_MSG MERCURY_UTIL_LIBRARY) - -mark_as_advanced( - MERCURY_UTIL_DIR - MERCURY_UTIL_LIBRARY - MERCURY_UTIL_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindRocksDB.cmake b/archive_old_fs_versions/lfs/CMake/FindRocksDB.cmake deleted file mode 100644 index fda924dc5e871bfc8b45c7bf4a3363ae449a0506..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindRocksDB.cmake +++ /dev/null @@ -1,64 +0,0 @@ -# Try to find RocksDB headers and library. -# -# Usage of this module as follows: -# -# find_package(RocksDB) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# ROCKSDB_ROOT_DIR Set this variable to the root installation of -# RocksDB if the module has problems finding the -# proper installation path. -# -# Variables defined by this module: -# -# ROCKSDB_FOUND System has RocksDB library/headers. -# ROCKSDB_LIBRARIES The RocksDB library. -# ROCKSDB_INCLUDE_DIRS The location of RocksDB headers. - -find_path(ROCKSDB_DIR - HINTS - /usr - /usr/local - /usr/local/adafs/ - ) - -find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h - HINTS - $ENV{HOME}/adafs/git/rocksdb - /usr - /usr/local - /usr/local/adafs - ${ROCKSDB_DIR} - PATH_SUFFIXES include - ) - -find_library(ROCKSDB_LIBRARY rocksdb - HINTS - $ENV{HOME}/adafs/git/rocksdb - /usr - /usr/local - /usr/local/adafs - ${ROCKSDB_DIR} - PATH SUFFIXES lib - PATH_SUFFIXES lib/rocksdb - # ${ROCKSDB_ROOT_DIR}/lib - # ${ROCKSDB_ROOT_DIR}/lib/rocksdb - ) - -set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIR}) -set(ROCKSDB_LIBRARIES ${ROCKSDB_LIBRARY}) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(RocksDB DEFAULT_MSG - ROCKSDB_INCLUDE_DIR - ROCKSDB_LIBRARY - ) - -mark_as_advanced( - ROCKSDB_DIR - ROCKSDB_LIBRARY - ROCKSDB_INCLUDE_DIR -) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/FindZStd.cmake b/archive_old_fs_versions/lfs/CMake/FindZStd.cmake deleted file mode 100644 index 03d2e340bed600c2b43fb842ecebe0680a214bc4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/FindZStd.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# -# - Try to find Facebook zstd library -# This will define -# ZSTD_FOUND -# ZSTD_INCLUDE_DIR -# ZSTD_LIBRARIES -# - -find_path( - ZSTD_INCLUDE_DIR - NAMES "zstd.h" - HINTS - "/usr/include" -) - -find_library( - ZSTD_LIBRARY - NAMES zstd - HINTS - "/usr/lib" -) - -set(ZSTD_LIBRARIES ${ZSTD_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - ZSTD DEFAULT_MSG ZSTD_INCLUDE_DIR ZSTD_LIBRARIES) - -mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARIES ZSTD_FOUND) - -if (ZSTD_FOUND AND NOT ZSTD_FIND_QUIETLY) - message(STATUS "ZSTD: ${ZSTD_INCLUDE_DIR}") -endif () \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMake/Findsnappy.cmake b/archive_old_fs_versions/lfs/CMake/Findsnappy.cmake deleted file mode 100644 index f8b380aa4bb7c9ea84392f087087083837ad89f9..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMake/Findsnappy.cmake +++ /dev/null @@ -1,36 +0,0 @@ - -# This code is released under the -# Apache License Version 2.0 http://www.apache.org/licenses/. -# -# Copyright (c) 2012 Louis Dionne -# -# Find snappy compression library and includes. This module defines: -# snappy_INCLUDE_DIRS - The directories containing snappy's headers. -# snappy_LIBRARIES - A list of snappy's libraries. -# snappy_FOUND - Whether snappy was found. -# -# This module can be controlled by setting the following variables: -# snappy_ROOT - The root directory where to find snappy. If this is not -# set, the default paths are searched. - -if (NOT snappy_ROOT) - find_path(snappy_INCLUDE_DIRS snappy.h) - find_library(snappy_LIBRARIES NAMES snappy) -else () - find_path(snappy_INCLUDE_DIRS snappy.h NO_DEFAULT_PATH PATHS ${snappy_ROOT}) - find_library(snappy_LIBRARIES NAMES snappy NO_DEFAULT_PATH PATHS ${snappy_ROOT}) -endif () - -if (snappy_INCLUDE_DIRS AND snappy_LIBRARIES) - set(snappy_FOUND TRUE) -else () - set(snappy_FOUND FALSE) - set(snappy_INCLUDE_DIR) - set(snappy_LIBRARIES) -endif () - -find_package_handle_standard_args(snappy DEFAULT_MSG - snappy_INCLUDE_DIRS snappy_LIBRARIES - ) - -mark_as_advanced(snappy_LIBRARIES snappy_INCLUDE_DIRS) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/CMakeLists.txt b/archive_old_fs_versions/lfs/CMakeLists.txt deleted file mode 100644 index ec1f02e5033688e53da1c0b7fce452c3ed3bea31..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/CMakeLists.txt +++ /dev/null @@ -1,89 +0,0 @@ -cmake_minimum_required(VERSION 3.4 FATAL_ERROR) -project(lfs VERSION 0.0.1) - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall --pedantic -g -pg") - -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - - -# required packages -find_package(FUSE3 REQUIRED) -# Rocksdb dependencies -find_package(LZ4 REQUIRED) -find_package(ZLIB REQUIRED) -find_package(BZip2 REQUIRED) -find_package(GFlags REQUIRED) -find_package(snappy REQUIRED) -find_package(ZStd REQUIRED) -find_package(RocksDB REQUIRED) -# margo dependencies -find_package(Libev REQUIRED) -find_package(CCI REQUIRED) -#find_package(BMI REQUIRED) -find_package(Mercury REQUIRED) -find_package(MercuryUtil REQUIRED) -find_package(Abt REQUIRED) -find_package(Abt-Snoozer REQUIRED) -find_package(Margo REQUIRED) -# Optional dependencies -#find_package(AbtIO) -#option(WITH_AbtIO "AbtIO enabled" ON) -#if (WITH_AbtIO) -# add_definitions(-DUSE_AbtIO=1) -#else () -# add_definitions(-DUSE_AbtIO=0) -#endif () - - -# boost dependencies, system is required for filesystem #TODO VERSION UNTESTED. I USE 1.62 -find_package(Boost 1.58 REQUIRED COMPONENTS system filesystem serialization) - -include_directories(${FUSE3_INCLUDE_DIR} ${ROCKSDB_INCLUDE_DIR} include/ - # margo paths - ${MARGO_INCLUDE_DIR} ${ABT_INCLUDE_DIR} ${ABT_SNOOZER_INCLUDE_DIR} ${MERCURY_INCLUDE_DIR} ${LIBEV_INCLUDE_DIRS} ${ABT_IO_INCLUDE_DIRS} - ) -set(SOURCE_FILES src/main.cpp src/main.hpp src/fuse_ops.hpp src/configure.hpp - # classes header - src/classes/metadata.hpp src/classes/fs_data.hpp src/classes/dentry.hpp src/classes/rpc_data.hpp - # adafs_ops header - src/adafs_ops/mdata_ops.hpp src/adafs_ops/dentry_ops.hpp src/adafs_ops/access.hpp src/adafs_ops/io.hpp - # db header - src/db/db_ops.hpp src/db/db_txn_ops.hpp src/db/db_util.hpp - # rpc header - src/rpc/rpc_util.hpp src/rpc/rpc_types.hpp src/rpc/rpc_defs.hpp - - # rpcs header - src/rpc/client/c_metadata.hpp src/rpc/client/c_dentry.hpp src/rpc/client/c_data.hpp - - # util - src/util.cpp - # fuse ops - src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/sync.cpp src/fuse_ops/access.cpp src/fuse_ops/io.cpp - # classes - src/classes/metadata.cpp src/classes/fs_data.cpp src/classes/dentry.cpp src/classes/rpc_data.cpp - # adafs_ops - src/adafs_ops/mdata_ops.cpp src/adafs_ops/dentry_ops.cpp src/adafs_ops/access.cpp src/adafs_ops/io.cpp - # db src - src/db/db_ops.cpp src/db/db_txn_ops.cpp src/db/db_util.cpp - # rpc src - src/rpc/rpc_util.cpp - - # rpcs src server - src/rpc/server/s_metadata.cpp src/rpc/server/s_dentry.cpp src/rpc/server/s_data.cpp - # rpcs src client - src/rpc/client/c_metadata.cpp src/rpc/client/c_dentry.cpp src/rpc/client/c_data.cpp - ) -add_executable(adafs ${SOURCE_FILES} src/main.cpp) -target_link_libraries(adafs ${FUSE3_LIBRARIES} ${ROCKSDB_LIBRARIES} - # rocksdb libs - ${snappy_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ZSTD_LIBRARIES} ${gflags_LIBRARIES} ${LZ4_LIBRARY} - # margo libs - ${CCI_LIBRARIES} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${ABT_IO_LIBRARIES} ${MARGO_LIBRARIES} - -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options -pg) diff --git a/archive_old_fs_versions/lfs/cci.conf b/archive_old_fs_versions/lfs/cci.conf deleted file mode 100644 index 885a9c32eb648918eeafee3653593a8ca5ec55da..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/cci.conf +++ /dev/null @@ -1,13 +0,0 @@ -[mercury] -# use this example for TCP -transport = tcp -#interface = lo # switch this to eth0 or an external hostname for non-localhost use -interface = eno1 # switch this to eth0 or an external hostname for non-localhost use - -## use this example instead for shared memory -# transport = sm - -## use this example instead for InfiniBand -# transport = verbs -# interface = ib0 - diff --git a/archive_old_fs_versions/lfs/clone_all.sh b/archive_old_fs_versions/lfs/clone_all.sh deleted file mode 100644 index a5ebbc35ce6c86636336583f4dad9a55a69d6d8d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/clone_all.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -HOME=/home/evie -GIT=$HOME/adafs/git - -mkdir -p $GIT -cd $GIT - -git clone https://github.com/CCI/cci -cd $GIT/cci -git checkout tags/v2.1 - -cd $GIT -git clone --recurse-submodules https://github.com/mercury-hpc/mercury -git clone https://github.com/pmodels/argobots -cd $GIT/argobots -git checkout tags/v1.0a1 - -cd $GIT -git clone https://xgitlab.cels.anl.gov/sds/abt-snoozer -git clone https://xgitlab.cels.anl.gov/sds/margo diff --git a/archive_old_fs_versions/lfs/compile_all.sh b/archive_old_fs_versions/lfs/compile_all.sh deleted file mode 100644 index ed000f58f5c093d6ed07ea9dfbe5306d7d0f9cc9..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/compile_all.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -HOME=/home/evie -GIT=$HOME/adafs/git -INSTALL=$HOME/adafs/install - -#echo "Installing BMI" -# BMI -#CURR=$GIT/bmi - -#rm -rf $CURR/build/* -#cd $CURR -#./prepare -#cd $CURR/build -#../configure --prefix=$INSTALL --enable-shared --enable-bmi-only -#make -j8 -#make install - -echo "Installing CCI" -# CCI -CURR=$GIT/cci -./autogen.pl -if [ ! -d "$CURR/build" ]; then - mkdir $CURR/build -fi -cd $CURR/build -../configure --prefix=$INSTALL -make -j8 -make install - -echo "Installing Mercury" - -# Mercury -CURR=$GIT/mercury -if [ ! -d "$CURR/build" ]; then - mkdir $CURR/build -fi -rm -rf $CURR/build/* -cd $CURR/build -cmake -DMERCURY_USE_SELF_FORWARD:BOOL=ON -DMERCURY_USE_CHECKSUMS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DMERCURY_USE_BOOST_PP:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_INSTALL_PREFIX=$INSTALL -DCMAKE_BUILD_TYPE:STRING=Release -DNA_USE_CCI:BOOL=ON ../ -make -j8 -make install - -echo "Installing Argobots" - -# Argobots -CURR=$GIT/argobots -if [ ! -d "$CURR/build" ]; then - mkdir $CURR/build -fi -rm -rf $CURR/build/* -cd $CURR -./autogen.sh -cd $CURR/build -../configure --prefix=$INSTALL -make -j8 -make install -make check - -echo "Installing Abt-snoozer" -# Abt snoozer -CURR=$GIT/abt-snoozer -if [ ! -d "$CURR/build" ]; then - mkdir $CURR/build -fi -rm -rf $CURR/build/* -cd $CURR -./prepare.sh -cd $CURR/build -../configure --prefix=$INSTALL PKG_CONFIG_PATH=$INSTALL/lib/pkgconfig -make -j8 -make install -make check - -echo "Installing Margo" -# Margo -CURR=$GIT/margo -if [ ! -d "$CURR/build" ]; then - mkdir $CURR/build -fi -rm -rf $CURR/build/* -cd $CURR -./prepare.sh -cd $CURR/build -../configure --prefix=$INSTALL PKG_CONFIG_PATH=$INSTALL/lib/pkgconfig CFLAGS="-g -Wall" -make -j8 -make install -make check - -echo "Done" diff --git a/archive_old_fs_versions/lfs/include/extern/lrucache/LRUCache11.hpp b/archive_old_fs_versions/lfs/include/extern/lrucache/LRUCache11.hpp deleted file mode 100644 index fc0073cd2b70804cc5f8be2738e7aa6b24259225..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/lrucache/LRUCache11.hpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * LRUCache11 - a templated C++11 based LRU cache class that allows - * specification of - * key, value and optionally the map container type (defaults to - * std::unordered_map) - * By using the std::map and a linked list of keys it allows O(1) insert, delete - * and - * refresh operations. - * - * This is a header-only library and all you need is the LRUCache11.hpp file - * - * Github: https://github.com/mohaps/lrucache11 - * - * This is a follow-up to the LRUCache project - - * https://github.com/mohaps/lrucache - * - * Copyright (c) 2012-22 SAURAV MOHAPATRA - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace lru11 { -/** - * base class to prevent copy - * use as ClassName : private NoCopy {} - * to prevent copy constructor of ClassName and assignment by copy - */ - class NoCopy { - public: - virtual ~NoCopy() = default; - - protected: - NoCopy() = default; - - private: - NoCopy(const NoCopy&) = delete; - - const NoCopy& operator=(const NoCopy&) = delete; - }; - -/* - * a noop lockable concept that can be used in place of std::mutex - */ - class NullLock { - public: - void lock() {} - - void unlock() {} - - bool try_lock() { return true; } - }; - -/** - * error raised when a key not in cache is passed to get() - */ - class KeyNotFound : public std::invalid_argument { - public: - KeyNotFound() : std::invalid_argument("key_not_found") {} - }; - - template - struct KeyValuePair { - public: - K key; - V value; - - KeyValuePair(const K& k, const V& v) : key(k), value(v) {} - }; - -/** - * The LRU Cache class templated by - * Key - key type - * Value - value type - * MapType - an associative container like std::unordered_map - * LockType - a lock type derived from the Lock class (default: - *NullLock = no synchronization) - * - * The default NullLock based template is not thread-safe, however passing - *Lock=std::mutex will make it - * thread-safe - */ - template>::iterator>> - class Cache : private NoCopy { - public: - typedef KeyValuePair node_type; - typedef std::list> list_type; - typedef Map map_type; - typedef Lock lock_type; - using Guard = std::lock_guard; - - /** - * the max size is the hard limit of keys and (maxSize + elasticity) is the - * soft limit - * the cache is allowed to grow till maxSize + elasticity and is pruned back - * to maxSize keys - * set maxSize = 0 for an unbounded cache (but in that case, you're better off - * using a std::unordered_map - * directly anyway! :) - */ - explicit Cache(size_t maxSize = 64, size_t elasticity = 10) - : maxSize_(maxSize), elasticity_(elasticity) {} - - virtual ~Cache() = default; - - size_t size() const { - Guard g(lock_); - return cache_.size(); - } - - bool empty() const { - Guard g(lock_); - return cache_.empty(); - } - - void clear() { - Guard g(lock_); - cache_.clear(); - keys_.clear(); - } - - void insert(const Key& k, const Value& v) { - Guard g(lock_); - const auto iter = cache_.find(k); - if (iter != cache_.end()) { - iter->second->value = v; - keys_.splice(keys_.begin(), keys_, iter->second); - return; - } - - keys_.emplace_front(k, v); - cache_[k] = keys_.begin(); - prune(); - } - - bool tryGet(const Key& kIn, Value& vOut) { - Guard g(lock_); - const auto iter = cache_.find(kIn); - if (iter == cache_.end()) { - return false; - } - keys_.splice(keys_.begin(), keys_, iter->second); - vOut = iter->second->value; - return true; - } - - const Value& get(const Key& k) { - Guard g(lock_); - const auto iter = cache_.find(k); - if (iter == cache_.end()) { - throw KeyNotFound(); - } - keys_.splice(keys_.begin(), keys_, iter->second); - return iter->second->value; - } - - bool remove(const Key& k) { - Guard g(lock_); - auto iter = cache_.find(k); - if (iter == cache_.end()) { - return false; - } - keys_.erase(iter->second); - cache_.erase(iter); - return true; - } - - bool contains(const Key& k) { - Guard g(lock_); - return cache_.find(k) != cache_.end(); - } - - size_t getMaxSize() const { return maxSize_; } - - size_t getElasticity() const { return elasticity_; } - - size_t getMaxAllowedSize() const { return maxSize_ + elasticity_; } - - template - void cwalk(F& f) const { - Guard g(lock_); - std::for_each(keys_.begin(), keys_.end(), f); - } - - protected: - size_t prune() { - size_t maxAllowed = maxSize_ + elasticity_; - if (maxSize_ == 0 || cache_.size() < maxAllowed) { - return 0; - } - size_t count = 0; - while (cache_.size() > maxSize_) { - cache_.erase(keys_.back().key); - keys_.pop_back(); - ++count; - } - return count; - } - - private: - mutable Lock lock_; - Map cache_; - list_type keys_; - size_t maxSize_; - size_t elasticity_; - }; - -} // namespace LRUCache11 diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/async_logger.h b/archive_old_fs_versions/lfs/include/extern/spdlog/async_logger.h deleted file mode 100644 index 77a65e3b9f64d6e179d273735125eb5f3fbe060b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/async_logger.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Very fast asynchronous logger (millions of logs per second on an average desktop) -// Uses pre allocated lockfree queue for maximum throughput even under large number of threads. -// Creates a single back thread to pop messages from the queue and log them. -// -// Upon each log write the logger: -// 1. Checks if its log level is enough to log the message -// 2. Push a new copy of the message to a queue (or block the caller until space is available in the queue) -// 3. will throw spdlog_ex upon log exceptions -// Upon destruction, logs all remaining messages in the queue before destructing.. - -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ - -namespace details -{ -class async_log_helper; -} - -class async_logger :public logger -{ -public: - template - async_logger(const std::string& name, - const It& begin, - const It& end, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - async_logger(const std::string& logger_name, - sinks_init_list sinks, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - async_logger(const std::string& logger_name, - sink_ptr single_sink, - size_t queue_size, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - //Wait for the queue to be empty, and flush synchronously - //Warning: this can potentialy last forever as we wait it to complete - void flush() override; -protected: - void _sink_it(details::log_msg& msg) override; - void _set_formatter(spdlog::formatter_ptr msg_formatter) override; - void _set_pattern(const std::string& pattern) override; - -private: - std::unique_ptr _async_log_helper; -}; -} - - -#include diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/common.h b/archive_old_fs_versions/lfs/include/extern/spdlog/common.h deleted file mode 100644 index 9b35ad0d3eb35625d0fbf62bb410cd4768465ea5..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/common.h +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -#include -#include -#endif - -#include - -//visual studio upto 2013 does not support noexcept nor constexpr -#if defined(_MSC_VER) && (_MSC_VER < 1900) -#define SPDLOG_NOEXCEPT throw() -#define SPDLOG_CONSTEXPR -#else -#define SPDLOG_NOEXCEPT noexcept -#define SPDLOG_CONSTEXPR constexpr -#endif - -#if defined(__GNUC__) || defined(__clang__) -#define SPDLOG_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define SPDLOG_DEPRECATED __declspec(deprecated) -#else -#define SPDLOG_DEPRECATED -#endif - - -#include - -namespace spdlog -{ - -class formatter; - -namespace sinks -{ -class sink; -} - -using log_clock = std::chrono::system_clock; -using sink_ptr = std::shared_ptr < sinks::sink >; -using sinks_init_list = std::initializer_list < sink_ptr >; -using formatter_ptr = std::shared_ptr; -#if defined(SPDLOG_NO_ATOMIC_LEVELS) -using level_t = details::null_atomic_int; -#else -using level_t = std::atomic; -#endif - -using log_err_handler = std::function; - -//Log level enum -namespace level -{ -typedef enum -{ - trace = 0, - debug = 1, - info = 2, - warn = 3, - err = 4, - critical = 5, - off = 6 -} level_enum; - -static const char* level_names[] { "trace", "debug", "info", "warning", "error", "critical", "off" }; - -static const char* short_level_names[] { "T", "D", "I", "W", "E", "C", "O" }; - -inline const char* to_str(spdlog::level::level_enum l) -{ - return level_names[l]; -} - -inline const char* to_short_str(spdlog::level::level_enum l) -{ - return short_level_names[l]; -} -} //level - - -// -// Async overflow policy - block by default. -// -enum class async_overflow_policy -{ - block_retry, // Block / yield / sleep until message can be enqueued - discard_log_msg // Discard the message it enqueue fails -}; - - -// -// Log exception -// -namespace details -{ -namespace os -{ -std::string errno_str(int err_num); -} -} -class spdlog_ex: public std::exception -{ -public: - spdlog_ex(const std::string& msg):_msg(msg) - {} - spdlog_ex(const std::string& msg, int last_errno) - { - _msg = msg + ": " + details::os::errno_str(last_errno); - } - const char* what() const SPDLOG_NOEXCEPT override - { - return _msg.c_str(); - } -private: - std::string _msg; - -}; - -// -// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) -// -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -using filename_t = std::wstring; -#else -using filename_t = std::string; -#endif - - -} //spdlog diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_log_helper.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_log_helper.h deleted file mode 100644 index 69ebf5c4401a03b2f9dfdfc7016dee753d6d2662..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_log_helper.h +++ /dev/null @@ -1,378 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -// async log helper : -// Process logs asynchronously using a back thread. -// -// If the internal queue of log messages reaches its max size, -// then the client call will block until there is more room. -// -// If the back thread throws during logging, a spdlog::spdlog_ex exception -// will be thrown in client's thread when tries to log the next message - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ - -class async_log_helper -{ - // Async msg to move to/from the queue - // Movable only. should never be copied - enum class async_msg_type - { - log, - flush, - terminate - }; - struct async_msg - { - std::string logger_name; - level::level_enum level; - log_clock::time_point time; - size_t thread_id; - std::string txt; - async_msg_type msg_type; - - async_msg() = default; - ~async_msg() = default; - - -async_msg(async_msg&& other) SPDLOG_NOEXCEPT: - logger_name(std::move(other.logger_name)), - level(std::move(other.level)), - time(std::move(other.time)), - txt(std::move(other.txt)), - msg_type(std::move(other.msg_type)) - {} - - async_msg(async_msg_type m_type) :msg_type(m_type) - {} - - async_msg& operator=(async_msg&& other) SPDLOG_NOEXCEPT - { - logger_name = std::move(other.logger_name); - level = other.level; - time = std::move(other.time); - thread_id = other.thread_id; - txt = std::move(other.txt); - msg_type = other.msg_type; - return *this; - } - - // never copy or assign. should only be moved.. - async_msg(const async_msg&) = delete; - async_msg& operator=(const async_msg& other) = delete; - - // construct from log_msg - async_msg(const details::log_msg& m) : - level(m.level), - time(m.time), - thread_id(m.thread_id), - txt(m.raw.data(), m.raw.size()), - msg_type(async_msg_type::log) - { -#ifndef SPDLOG_NO_NAME - logger_name = *m.logger_name; -#endif - } - - - // copy into log_msg - void fill_log_msg(log_msg &msg) - { - msg.logger_name = &logger_name; - msg.level = level; - msg.time = time; - msg.thread_id = thread_id; - msg.raw << txt; - } - }; - -public: - - using item_type = async_msg; - using q_type = details::mpmc_bounded_queue; - - using clock = std::chrono::steady_clock; - - - async_log_helper(formatter_ptr formatter, - const std::vector& sinks, - size_t queue_size, - const log_err_handler err_handler, - const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, - const std::function& worker_warmup_cb = nullptr, - const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), - const std::function& worker_teardown_cb = nullptr); - - void log(const details::log_msg& msg); - - // stop logging and join the back thread - ~async_log_helper(); - - void set_formatter(formatter_ptr); - - void flush(bool wait_for_q); - - -private: - formatter_ptr _formatter; - std::vector> _sinks; - - // queue of messages to log - q_type _q; - - log_err_handler _err_handler; - - bool _flush_requested; - - bool _terminate_requested; - - - // overflow policy - const async_overflow_policy _overflow_policy; - - // worker thread warmup callback - one can set thread priority, affinity, etc - const std::function _worker_warmup_cb; - - // auto periodic sink flush parameter - const std::chrono::milliseconds _flush_interval_ms; - - // worker thread teardown callback - const std::function _worker_teardown_cb; - - // worker thread - std::thread _worker_thread; - - void push_msg(async_msg&& new_msg); - - // worker thread main loop - void worker_loop(); - - // pop next message from the queue and process it. will set the last_pop to the pop time - // return false if termination of the queue is required - bool process_next_msg(log_clock::time_point& last_pop, log_clock::time_point& last_flush); - - void handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush); - - // sleep,yield or return immediatly using the time passed since last message as a hint - static void sleep_or_yield(const spdlog::log_clock::time_point& now, const log_clock::time_point& last_op_time); - - // wait until the queue is empty - void wait_empty_q(); - -}; -} -} - -/////////////////////////////////////////////////////////////////////////////// -// async_sink class implementation -/////////////////////////////////////////////////////////////////////////////// -inline spdlog::details::async_log_helper::async_log_helper( - formatter_ptr formatter, - const std::vector& sinks, - size_t queue_size, - log_err_handler err_handler, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb): - _formatter(formatter), - _sinks(sinks), - _q(queue_size), - _err_handler(err_handler), - _flush_requested(false), - _terminate_requested(false), - _overflow_policy(overflow_policy), - _worker_warmup_cb(worker_warmup_cb), - _flush_interval_ms(flush_interval_ms), - _worker_teardown_cb(worker_teardown_cb), - _worker_thread(&async_log_helper::worker_loop, this) -{} - -// Send to the worker thread termination message(level=off) -// and wait for it to finish gracefully -inline spdlog::details::async_log_helper::~async_log_helper() -{ - try - { - push_msg(async_msg(async_msg_type::terminate)); - _worker_thread.join(); - } - catch (...) // don't crash in destructor - {} -} - - -//Try to push and block until succeeded (if the policy is not to discard when the queue is full) -inline void spdlog::details::async_log_helper::log(const details::log_msg& msg) -{ - push_msg(async_msg(msg)); -} - -inline void spdlog::details::async_log_helper::push_msg(details::async_log_helper::async_msg&& new_msg) -{ - if (!_q.enqueue(std::move(new_msg)) && _overflow_policy != async_overflow_policy::discard_log_msg) - { - auto last_op_time = details::os::now(); - auto now = last_op_time; - do - { - now = details::os::now(); - sleep_or_yield(now, last_op_time); - } - while (!_q.enqueue(std::move(new_msg))); - } -} - -// optionally wait for the queue be empty and request flush from the sinks -inline void spdlog::details::async_log_helper::flush(bool wait_for_q) -{ - push_msg(async_msg(async_msg_type::flush)); - if(wait_for_q) - wait_empty_q(); //return only make after the above flush message was processed -} - -inline void spdlog::details::async_log_helper::worker_loop() -{ - try - { - if (_worker_warmup_cb) _worker_warmup_cb(); - auto last_pop = details::os::now(); - auto last_flush = last_pop; - while(process_next_msg(last_pop, last_flush)); - if (_worker_teardown_cb) _worker_teardown_cb(); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - -// process next message in the queue -// return true if this thread should still be active (while no terminate msg was received) -inline bool spdlog::details::async_log_helper::process_next_msg(log_clock::time_point& last_pop, log_clock::time_point& last_flush) -{ - async_msg incoming_async_msg; - - if (_q.dequeue(incoming_async_msg)) - { - last_pop = details::os::now(); - switch (incoming_async_msg.msg_type) - { - case async_msg_type::flush: - _flush_requested = true; - break; - - case async_msg_type::terminate: - _flush_requested = true; - _terminate_requested = true; - break; - - default: - log_msg incoming_log_msg; - incoming_async_msg.fill_log_msg(incoming_log_msg); - _formatter->format(incoming_log_msg); - for (auto &s : _sinks) - { - if(s->should_log( incoming_log_msg.level)) - { - s->log(incoming_log_msg); - } - } - } - return true; - } - - // Handle empty queue.. - // This is the only place where the queue can terminate or flush to avoid losing messages already in the queue - else - { - auto now = details::os::now(); - handle_flush_interval(now, last_flush); - sleep_or_yield(now, last_pop); - return !_terminate_requested; - } -} - -// flush all sinks if _flush_interval_ms has expired -inline void spdlog::details::async_log_helper::handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush) -{ - auto should_flush = _flush_requested || (_flush_interval_ms != std::chrono::milliseconds::zero() && now - last_flush >= _flush_interval_ms); - if (should_flush) - { - for (auto &s : _sinks) - s->flush(); - now = last_flush = details::os::now(); - _flush_requested = false; - } -} - -inline void spdlog::details::async_log_helper::set_formatter(formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; -} - - -// spin, yield or sleep. use the time passed since last message as a hint -inline void spdlog::details::async_log_helper::sleep_or_yield(const spdlog::log_clock::time_point& now, const spdlog::log_clock::time_point& last_op_time) -{ - using namespace std::this_thread; - using std::chrono::milliseconds; - using std::chrono::microseconds; - - auto time_since_op = now - last_op_time; - - // spin upto 50 micros - if (time_since_op <= microseconds(50)) - return; - - // yield upto 150 micros - if (time_since_op <= microseconds(100)) - return std::this_thread::yield(); - - // sleep for 20 ms upto 200 ms - if (time_since_op <= milliseconds(200)) - return sleep_for(milliseconds(20)); - - // sleep for 200 ms - return sleep_for(milliseconds(200)); -} - -// wait for the queue to be empty -inline void spdlog::details::async_log_helper::wait_empty_q() -{ - auto last_op = details::os::now(); - while (_q.approx_size() > 0) - { - sleep_or_yield(details::os::now(), last_op); - } -} - - - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_logger_impl.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_logger_impl.h deleted file mode 100644 index bd701c3d90da56a5dfdf61bcf26eab3737ccc505..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/async_logger_impl.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Async Logger implementation -// Use an async_sink (queue per logger) to perform the logging in a worker thread - -#include -#include - -#include -#include -#include -#include - -template -inline spdlog::async_logger::async_logger(const std::string& logger_name, - const It& begin, - const It& end, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - logger(logger_name, begin, end), - _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, _err_handler, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb)) -{ -} - -inline spdlog::async_logger::async_logger(const std::string& logger_name, - sinks_init_list sinks_list, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - async_logger(logger_name, sinks_list.begin(), sinks_list.end(), queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {} - -inline spdlog::async_logger::async_logger(const std::string& logger_name, - sink_ptr single_sink, - size_t queue_size, - const async_overflow_policy overflow_policy, - const std::function& worker_warmup_cb, - const std::chrono::milliseconds& flush_interval_ms, - const std::function& worker_teardown_cb) : - async_logger(logger_name, -{ - single_sink -}, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {} - - -inline void spdlog::async_logger::flush() -{ - _async_log_helper->flush(true); -} - -inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; - _async_log_helper->set_formatter(_formatter); -} - -inline void spdlog::async_logger::_set_pattern(const std::string& pattern) -{ - _formatter = std::make_shared(pattern); - _async_log_helper->set_formatter(_formatter); -} - - -inline void spdlog::async_logger::_sink_it(details::log_msg& msg) -{ - try - { - _async_log_helper->log(msg); - if (_should_flush_on(msg)) - _async_log_helper->flush(false); // do async flush - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/file_helper.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/file_helper.h deleted file mode 100644 index e079cbb6f892fede85a750dd55dca1c777b57fc1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/file_helper.h +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Helper class for file sink -// When failing to open a file, retry several times(5) with small delay between the tries(10 ms) -// Can be set to auto flush on every line -// Throw spdlog_ex exception on errors - -#include -#include - -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ - -class file_helper -{ - -public: - const int open_tries = 5; - const int open_interval = 10; - - explicit file_helper() : - _fd(nullptr) - {} - - file_helper(const file_helper&) = delete; - file_helper& operator=(const file_helper&) = delete; - - ~file_helper() - { - close(); - } - - - void open(const filename_t& fname, bool truncate = false) - { - - close(); - auto *mode = truncate ? SPDLOG_FILENAME_T("wb") : SPDLOG_FILENAME_T("ab"); - _filename = fname; - for (int tries = 0; tries < open_tries; ++tries) - { - if (!os::fopen_s(&_fd, fname, mode)) - return; - - std::this_thread::sleep_for(std::chrono::milliseconds(open_interval)); - } - - throw spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno); - } - - void reopen(bool truncate) - { - if (_filename.empty()) - throw spdlog_ex("Failed re opening file - was not opened before"); - open(_filename, truncate); - - } - - void flush() - { - std::fflush(_fd); - } - - void close() - { - if (_fd) - { - std::fclose(_fd); - _fd = nullptr; - } - } - - void write(const log_msg& msg) - { - - size_t msg_size = msg.formatted.size(); - auto data = msg.formatted.data(); - if (std::fwrite(data, 1, msg_size, _fd) != msg_size) - throw spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno); - } - - size_t size() - { - if (!_fd) - throw spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename)); - return os::filesize(_fd); - } - - const filename_t& filename() const - { - return _filename; - } - - static bool file_exists(const filename_t& name) - { - - return os::file_exists(name); - } - -private: - FILE* _fd; - filename_t _filename; -}; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/log_msg.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/log_msg.h deleted file mode 100644 index c0c42f812bfc933d9bcfa5ea02a3be71ea99f8fb..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/log_msg.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - - -#include -#include - -namespace spdlog -{ -namespace details -{ -struct log_msg -{ - log_msg() = default; - log_msg(const std::string *loggers_name, level::level_enum lvl) : logger_name(loggers_name), level(lvl) - { -#ifndef SPDLOG_NO_DATETIME - time = os::now(); -#endif - -#ifndef SPDLOG_NO_THREAD_ID - thread_id = os::thread_id(); -#endif - } - - log_msg(const log_msg& other) = delete; - log_msg& operator=(log_msg&& other) = delete; - log_msg(log_msg&& other) = delete; - - - const std::string *logger_name; - level::level_enum level; - log_clock::time_point time; - size_t thread_id; - fmt::MemoryWriter raw; - fmt::MemoryWriter formatted; -}; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/logger_impl.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/logger_impl.h deleted file mode 100644 index c67c5dc564d0deb100c23f13f5688d2bfff25d8d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/logger_impl.h +++ /dev/null @@ -1,298 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - - -// create logger with given name, sinks and the default pattern formatter -// all other ctors will call this one -template -inline spdlog::logger::logger(const std::string& logger_name, const It& begin, const It& end): - _name(logger_name), - _sinks(begin, end), - _formatter(std::make_shared("%+")) -{ - _level = level::info; - _flush_level = level::off; - _last_err_time = 0; - _err_handler = [this](const std::string &msg) - { - this->_default_err_handler(msg); - }; -} - -// ctor with sinks as init list -inline spdlog::logger::logger(const std::string& logger_name, sinks_init_list sinks_list): - logger(logger_name, sinks_list.begin(), sinks_list.end()) -{} - - -// ctor with single sink -inline spdlog::logger::logger(const std::string& logger_name, spdlog::sink_ptr single_sink): - logger(logger_name, -{ - single_sink -}) -{} - - -inline spdlog::logger::~logger() = default; - - -inline void spdlog::logger::set_formatter(spdlog::formatter_ptr msg_formatter) -{ - _set_formatter(msg_formatter); -} - -inline void spdlog::logger::set_pattern(const std::string& pattern) -{ - _set_pattern(pattern); -} - - -template -inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Args&... args) -{ - if (!should_log(lvl)) return; - - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw.write(fmt, args...); - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - -template -inline void spdlog::logger::log(level::level_enum lvl, const char* msg) -{ - if (!should_log(lvl)) return; - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw << msg; - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } - -} - -template -inline void spdlog::logger::log(level::level_enum lvl, const T& msg) -{ - if (!should_log(lvl)) return; - try - { - details::log_msg log_msg(&_name, lvl); - log_msg.raw << msg; - _sink_it(log_msg); - } - catch (const std::exception &ex) - { - _err_handler(ex.what()); - } - catch (...) - { - _err_handler("Unknown exception"); - } -} - - -template -inline void spdlog::logger::trace(const char* fmt, const Args&... args) -{ - log(level::trace, fmt, args...); -} - -template -inline void spdlog::logger::debug(const char* fmt, const Args&... args) -{ - log(level::debug, fmt, args...); -} - -template -inline void spdlog::logger::info(const char* fmt, const Args&... args) -{ - log(level::info, fmt, args...); -} - - -template -inline void spdlog::logger::warn(const char* fmt, const Args&... args) -{ - log(level::warn, fmt, args...); -} - -template -inline void spdlog::logger::error(const char* fmt, const Args&... args) -{ - log(level::err, fmt, args...); -} - -template -inline void spdlog::logger::critical(const char* fmt, const Args&... args) -{ - log(level::critical, fmt, args...); -} - - -template -inline void spdlog::logger::trace(const T& msg) -{ - log(level::trace, msg); -} - -template -inline void spdlog::logger::debug(const T& msg) -{ - log(level::debug, msg); -} - - -template -inline void spdlog::logger::info(const T& msg) -{ - log(level::info, msg); -} - - -template -inline void spdlog::logger::warn(const T& msg) -{ - log(level::warn, msg); -} - -template -inline void spdlog::logger::error(const T& msg) -{ - log(level::err, msg); -} - -template -inline void spdlog::logger::critical(const T& msg) -{ - log(level::critical, msg); -} - - - - -// -// name and level -// -inline const std::string& spdlog::logger::name() const -{ - return _name; -} - -inline void spdlog::logger::set_level(spdlog::level::level_enum log_level) -{ - _level.store(log_level); -} - -inline void spdlog::logger::set_error_handler(spdlog::log_err_handler err_handler) -{ - _err_handler = err_handler; -} - -inline spdlog::log_err_handler spdlog::logger::error_handler() -{ - return _err_handler; -} - - -inline void spdlog::logger::flush_on(level::level_enum log_level) -{ - _flush_level.store(log_level); -} - -inline spdlog::level::level_enum spdlog::logger::level() const -{ - return static_cast(_level.load(std::memory_order_relaxed)); -} - -inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) const -{ - return msg_level >= _level.load(std::memory_order_relaxed); -} - -// -// protected virtual called at end of each user log call (if enabled) by the line_logger -// -inline void spdlog::logger::_sink_it(details::log_msg& msg) -{ - _formatter->format(msg); - for (auto &sink : _sinks) - { - if( sink->should_log( msg.level)) - { - sink->log(msg); - } - } - - if(_should_flush_on(msg)) - flush(); -} - -inline void spdlog::logger::_set_pattern(const std::string& pattern) -{ - _formatter = std::make_shared(pattern); -} -inline void spdlog::logger::_set_formatter(formatter_ptr msg_formatter) -{ - _formatter = msg_formatter; -} - -inline void spdlog::logger::flush() -{ - for (auto& sink : _sinks) - sink->flush(); -} - -inline void spdlog::logger::_default_err_handler(const std::string &msg) -{ - auto now = time(nullptr); - if (now - _last_err_time < 60) - return; - auto tm_time = details::os::localtime(now); - char date_buf[100]; - std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); - details::log_msg err_msg; - err_msg.formatted.write("[*** LOG ERROR ***] [{}] [{}] [{}]{}", name(), msg, date_buf, details::os::eol); - sinks::stderr_sink_mt::instance()->log(err_msg); - _last_err_time = now; -} - -inline bool spdlog::logger::_should_flush_on(const details::log_msg &msg) -{ - const auto flush_level = _flush_level.load(std::memory_order_relaxed); - return (msg.level >= flush_level) && (msg.level != level::off); -} - -inline const std::vector& spdlog::logger::sinks() const -{ - return _sinks; -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/mpmc_bounded_q.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/mpmc_bounded_q.h deleted file mode 100644 index a6e2df0b0a8758c3622913ddc5fa31dc3dd85a39..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/mpmc_bounded_q.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -A modified version of Bounded MPMC queue by Dmitry Vyukov. - -Original code from: -http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue - -licensed by Dmitry Vyukov under the terms below: - -Simplified BSD license - -Copyright (c) 2010-2011 Dmitry Vyukov. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list -of conditions and the following disclaimer in the documentation and/or other materials -provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY DMITRY VYUKOV "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL DMITRY VYUKOV OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the authors and -should not be interpreted as representing official policies, either expressed or implied, of Dmitry Vyukov. -*/ - -/* -The code in its current form adds the license below: - -Copyright(c) 2015 Gabi Melman. -Distributed under the MIT License (http://opensource.org/licenses/MIT) - -*/ - -#pragma once - -#include - -#include -#include - -namespace spdlog -{ -namespace details -{ - -template -class mpmc_bounded_queue -{ -public: - - using item_type = T; - mpmc_bounded_queue(size_t buffer_size) - :max_size_(buffer_size), - buffer_(new cell_t [buffer_size]), - buffer_mask_(buffer_size - 1) - { - //queue size must be power of two - if(!((buffer_size >= 2) && ((buffer_size & (buffer_size - 1)) == 0))) - throw spdlog_ex("async logger queue size must be power of two"); - - for (size_t i = 0; i != buffer_size; i += 1) - buffer_[i].sequence_.store(i, std::memory_order_relaxed); - enqueue_pos_.store(0, std::memory_order_relaxed); - dequeue_pos_.store(0, std::memory_order_relaxed); - } - - ~mpmc_bounded_queue() - { - delete [] buffer_; - } - - - bool enqueue(T&& data) - { - cell_t* cell; - size_t pos = enqueue_pos_.load(std::memory_order_relaxed); - for (;;) - { - cell = &buffer_[pos & buffer_mask_]; - size_t seq = cell->sequence_.load(std::memory_order_acquire); - intptr_t dif = (intptr_t)seq - (intptr_t)pos; - if (dif == 0) - { - if (enqueue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed)) - break; - } - else if (dif < 0) - { - return false; - } - else - { - pos = enqueue_pos_.load(std::memory_order_relaxed); - } - } - cell->data_ = std::move(data); - cell->sequence_.store(pos + 1, std::memory_order_release); - return true; - } - - bool dequeue(T& data) - { - cell_t* cell; - size_t pos = dequeue_pos_.load(std::memory_order_relaxed); - for (;;) - { - cell = &buffer_[pos & buffer_mask_]; - size_t seq = - cell->sequence_.load(std::memory_order_acquire); - intptr_t dif = (intptr_t)seq - (intptr_t)(pos + 1); - if (dif == 0) - { - if (dequeue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed)) - break; - } - else if (dif < 0) - return false; - else - pos = dequeue_pos_.load(std::memory_order_relaxed); - } - data = std::move(cell->data_); - cell->sequence_.store(pos + buffer_mask_ + 1, std::memory_order_release); - return true; - } - - size_t approx_size() - { - size_t first_pos = dequeue_pos_.load(std::memory_order_relaxed); - size_t last_pos = enqueue_pos_.load(std::memory_order_relaxed); - if (last_pos <= first_pos) - return 0; - auto size = last_pos - first_pos; - return size < max_size_ ? size : max_size_; - } - -private: - struct cell_t - { - std::atomic sequence_; - T data_; - }; - - size_t const max_size_; - - static size_t const cacheline_size = 64; - typedef char cacheline_pad_t [cacheline_size]; - - cacheline_pad_t pad0_; - cell_t* const buffer_; - size_t const buffer_mask_; - cacheline_pad_t pad1_; - std::atomic enqueue_pos_; - cacheline_pad_t pad2_; - std::atomic dequeue_pos_; - cacheline_pad_t pad3_; - - mpmc_bounded_queue(mpmc_bounded_queue const&) = delete; - void operator= (mpmc_bounded_queue const&) = delete; -}; - -} // ns details -} // ns spdlog diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/null_mutex.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/null_mutex.h deleted file mode 100644 index 67b0aeee004c3120d33d54e546a18854ac4d0ecc..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/null_mutex.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -// null, no cost dummy "mutex" and dummy "atomic" int - -namespace spdlog -{ -namespace details -{ -struct null_mutex -{ - void lock() {} - void unlock() {} - bool try_lock() - { - return true; - } -}; - -struct null_atomic_int -{ - int value; - null_atomic_int() = default; - - null_atomic_int(int val):value(val) - {} - - int load(std::memory_order) const - { - return value; - } - - void store(int val) - { - value = val; - } -}; - -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/os.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/os.h deleted file mode 100644 index 69f08fa1bfdd90aa09dc2511c6cf0a45cd8e8ce0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/os.h +++ /dev/null @@ -1,406 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 - -#ifndef NOMINMAX -#define NOMINMAX //prevent windows redefining min/max -#endif - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include // _get_pid support -#include // _get_osfhandle support - -#ifdef __MINGW32__ -#include -#endif - -#else // unix - -#include -#include - -#ifdef __linux__ -#include //Use gettid() syscall under linux to get thread id - -#elif __FreeBSD__ -#include //Use thr_self() syscall under FreeBSD to get thread id -#endif - -#endif //unix - -#ifndef __has_feature // Clang - feature checking macros. -#define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif - - -namespace spdlog -{ -namespace details -{ -namespace os -{ - -inline spdlog::log_clock::time_point now() -{ - -#if defined __linux__ && defined SPDLOG_CLOCK_COARSE - timespec ts; - ::clock_gettime(CLOCK_REALTIME_COARSE, &ts); - return std::chrono::time_point( - std::chrono::duration_cast( - std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec))); - - -#else - return log_clock::now(); -#endif - -} -inline std::tm localtime(const std::time_t &time_tt) -{ - -#ifdef _WIN32 - std::tm tm; - localtime_s(&tm, &time_tt); -#else - std::tm tm; - localtime_r(&time_tt, &tm); -#endif - return tm; -} - -inline std::tm localtime() -{ - std::time_t now_t = time(nullptr); - return localtime(now_t); -} - - -inline std::tm gmtime(const std::time_t &time_tt) -{ - -#ifdef _WIN32 - std::tm tm; - gmtime_s(&tm, &time_tt); -#else - std::tm tm; - gmtime_r(&time_tt, &tm); -#endif - return tm; -} - -inline std::tm gmtime() -{ - std::time_t now_t = time(nullptr); - return gmtime(now_t); -} -inline bool operator==(const std::tm& tm1, const std::tm& tm2) -{ - return (tm1.tm_sec == tm2.tm_sec && - tm1.tm_min == tm2.tm_min && - tm1.tm_hour == tm2.tm_hour && - tm1.tm_mday == tm2.tm_mday && - tm1.tm_mon == tm2.tm_mon && - tm1.tm_year == tm2.tm_year && - tm1.tm_isdst == tm2.tm_isdst); -} - -inline bool operator!=(const std::tm& tm1, const std::tm& tm2) -{ - return !(tm1 == tm2); -} - -// eol definition -#if !defined (SPDLOG_EOL) -#ifdef _WIN32 -#define SPDLOG_EOL "\r\n" -#else -#define SPDLOG_EOL "\n" -#endif -#endif - -SPDLOG_CONSTEXPR static const char* eol = SPDLOG_EOL; -SPDLOG_CONSTEXPR static int eol_size = sizeof(SPDLOG_EOL) - 1; - -inline void prevent_child_fd(FILE *f) -{ -#ifdef _WIN32 - auto file_handle = (HANDLE)_get_osfhandle(_fileno(f)); - if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) - throw spdlog_ex("SetHandleInformation failed", errno); -#else - auto fd = fileno(f); - if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - throw spdlog_ex("fcntl with FD_CLOEXEC failed", errno); -#endif -} - - -//fopen_s on non windows for writing -inline int fopen_s(FILE** fp, const filename_t& filename, const filename_t& mode) -{ -#ifdef _WIN32 -#ifdef SPDLOG_WCHAR_FILENAMES - *fp = _wfsopen((filename.c_str()), mode.c_str(), _SH_DENYWR); -#else - *fp = _fsopen((filename.c_str()), mode.c_str(), _SH_DENYWR); -#endif -#else //unix - *fp = fopen((filename.c_str()), mode.c_str()); -#endif - -#ifdef SPDLOG_PREVENT_CHILD_FD - if(*fp != nullptr) - prevent_child_fd(*fp); -#endif - return *fp == nullptr; -} - - -inline int remove(const filename_t &filename) -{ -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) - return _wremove(filename.c_str()); -#else - return std::remove(filename.c_str()); -#endif -} - -inline int rename(const filename_t& filename1, const filename_t& filename2) -{ -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) - return _wrename(filename1.c_str(), filename2.c_str()); -#else - return std::rename(filename1.c_str(), filename2.c_str()); -#endif -} - - -//Return if file exists -inline bool file_exists(const filename_t& filename) -{ -#ifdef _WIN32 -#ifdef SPDLOG_WCHAR_FILENAMES - auto attribs = GetFileAttributesW(filename.c_str()); -#else - auto attribs = GetFileAttributesA(filename.c_str()); -#endif - return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); -#else //common linux/unix all have the stat system call - struct stat buffer; - return (stat (filename.c_str(), &buffer) == 0); -#endif -} - - - - -//Return file size according to open FILE* object -inline size_t filesize(FILE *f) -{ - if (f == nullptr) - throw spdlog_ex("Failed getting file size. fd is null"); -#ifdef _WIN32 - int fd = _fileno(f); -#if _WIN64 //64 bits - struct _stat64 st; - if (_fstat64(fd, &st) == 0) - return st.st_size; - -#else //windows 32 bits - long ret = _filelength(fd); - if (ret >= 0) - return static_cast(ret); -#endif - -#else // unix - int fd = fileno(f); - //64 bits(but not in osx, where fstat64 is deprecated) -#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) - struct stat64 st; - if (fstat64(fd, &st) == 0) - return static_cast(st.st_size); -#else // unix 32 bits or osx - struct stat st; - if (fstat(fd, &st) == 0) - return static_cast(st.st_size); -#endif -#endif - throw spdlog_ex("Failed getting file size from fd", errno); -} - - - - -//Return utc offset in minutes or throw spdlog_ex on failure -inline int utc_minutes_offset(const std::tm& tm = details::os::localtime()) -{ - -#ifdef _WIN32 -#if _WIN32_WINNT < _WIN32_WINNT_WS08 - TIME_ZONE_INFORMATION tzinfo; - auto rv = GetTimeZoneInformation(&tzinfo); -#else - DYNAMIC_TIME_ZONE_INFORMATION tzinfo; - auto rv = GetDynamicTimeZoneInformation(&tzinfo); -#endif - if (rv == TIME_ZONE_ID_INVALID) - throw spdlog::spdlog_ex("Failed getting timezone info. ", errno); - - int offset = -tzinfo.Bias; - if (tm.tm_isdst) - offset -= tzinfo.DaylightBias; - else - offset -= tzinfo.StandardBias; - return offset; -#else - -#if defined(sun) || defined(__sun) - // 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris - struct helper - { - static long int calculate_gmt_offset(const std::tm & localtm = details::os::localtime(), const std::tm & gmtm = details::os::gmtime()) - { - int local_year = localtm.tm_year + (1900 - 1); - int gmt_year = gmtm.tm_year + (1900 - 1); - - long int days = ( - // difference in day of year - localtm.tm_yday - gmtm.tm_yday - - // + intervening leap days - + ((local_year >> 2) - (gmt_year >> 2)) - - (local_year / 100 - gmt_year / 100) - + ((local_year / 100 >> 2) - (gmt_year / 100 >> 2)) - - // + difference in years * 365 */ - + (long int)(local_year - gmt_year) * 365 - ); - - long int hours = (24 * days) + (localtm.tm_hour - gmtm.tm_hour); - long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min); - long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec); - - return secs; - } - }; - - long int offset_seconds = helper::calculate_gmt_offset(tm); -#else - long int offset_seconds = tm.tm_gmtoff; -#endif - - return static_cast(offset_seconds / 60); -#endif -} - -//Return current thread id as size_t -//It exists because the std::this_thread::get_id() is much slower(espcially under VS 2013) -inline size_t _thread_id() -{ -#ifdef _WIN32 - return static_cast(::GetCurrentThreadId()); -#elif __linux__ -# if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) -# define SYS_gettid __NR_gettid -# endif - return static_cast(syscall(SYS_gettid)); -#elif __FreeBSD__ - long tid; - thr_self(&tid); - return static_cast(tid); -#else //Default to standard C++11 (OSX and other Unix) - return static_cast(std::hash()(std::this_thread::get_id())); -#endif -} - -//Return current thread id as size_t (from thread local storage) -inline size_t thread_id() -{ -#if defined(_MSC_VER) && (_MSC_VER < 1900) || defined(__clang__) && !__has_feature(cxx_thread_local) - return _thread_id(); -#else - static thread_local const size_t tid = _thread_id(); - return tid; -#endif -} - - - - -// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) -#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) -#define SPDLOG_FILENAME_T(s) L ## s -inline std::string filename_to_str(const filename_t& filename) -{ - std::wstring_convert, wchar_t> c; - return c.to_bytes(filename); -} -#else -#define SPDLOG_FILENAME_T(s) s -inline std::string filename_to_str(const filename_t& filename) -{ - return filename; -} -#endif - - -// Return errno string (thread safe) -inline std::string errno_str(int err_num) -{ - char buf[256]; - SPDLOG_CONSTEXPR auto buf_size = sizeof(buf); - -#ifdef _WIN32 - if(strerror_s(buf, buf_size, err_num) == 0) - return std::string(buf); - else - return "Unkown error"; - -#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(ANDROID) || defined(__SUNPRO_CC) || \ - ((_POSIX_C_SOURCE >= 200112L) && ! defined(_GNU_SOURCE)) // posix version - - if (strerror_r(err_num, buf, buf_size) == 0) - return std::string(buf); - else - return "Unkown error"; - -#else // gnu version (might not use the given buf, so its retval pointer must be used) - return std::string(strerror_r(err_num, buf, buf_size)); -#endif -} - -inline int pid() -{ - -#ifdef _WIN32 - return ::_getpid(); -#else - return static_cast(::getpid()); -#endif - -} - -} //os -} //details -} //spdlog diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/pattern_formatter_impl.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/pattern_formatter_impl.h deleted file mode 100644 index 95b6ef267e5f10c37072f4ff29f0af04ded0abb4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/pattern_formatter_impl.h +++ /dev/null @@ -1,670 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -class flag_formatter -{ -public: - virtual ~flag_formatter() - {} - virtual void format(details::log_msg& msg, const std::tm& tm_time) = 0; -}; - -/////////////////////////////////////////////////////////////////////// -// name & level pattern appenders -/////////////////////////////////////////////////////////////////////// -namespace -{ -class name_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << *msg.logger_name; - } -}; -} - -// log level appender -class level_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << level::to_str(msg.level); - } -}; - -// short log level appender -class short_level_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << level::to_short_str(msg.level); - } -}; - -/////////////////////////////////////////////////////////////////////// -// Date time pattern appenders -/////////////////////////////////////////////////////////////////////// - -static const char* ampm(const tm& t) -{ - return t.tm_hour >= 12 ? "PM" : "AM"; -} - -static int to12h(const tm& t) -{ - return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour; -} - -//Abbreviated weekday name -using days_array = std::array; -static const days_array& days() -{ - static const days_array arr{ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } }; - return arr; -} -class a_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << days()[tm_time.tm_wday]; - } -}; - -//Full weekday name -static const days_array& full_days() -{ - static const days_array arr{ { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } }; - return arr; -} -class A_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << full_days()[tm_time.tm_wday]; - } -}; - -//Abbreviated month -using months_array = std::array; -static const months_array& months() -{ - static const months_array arr{ { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" } }; - return arr; -} -class b_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << months()[tm_time.tm_mon]; - } -}; - -//Full month name -static const months_array& full_months() -{ - static const months_array arr{ { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } }; - return arr; -} -class B_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << full_months()[tm_time.tm_mon]; - } -}; - - -//write 2 ints seperated by sep with padding of 2 -static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, char sep) -{ - w << fmt::pad(v1, 2, '0') << sep << fmt::pad(v2, 2, '0'); - return w; -} - -//write 3 ints seperated by sep with padding of 2 -static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v3, char sep) -{ - w << fmt::pad(v1, 2, '0') << sep << fmt::pad(v2, 2, '0') << sep << fmt::pad(v3, 2, '0'); - return w; -} - - -//Date and time representation (Thu Aug 23 15:35:46 2014) -class c_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << days()[tm_time.tm_wday] << ' ' << months()[tm_time.tm_mon] << ' ' << tm_time.tm_mday << ' '; - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec, ':') << ' ' << tm_time.tm_year + 1900; - } -}; - - -// year - 2 digit -class C_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_year % 100, 2, '0'); - } -}; - - - -// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01 -class D_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_mon + 1, tm_time.tm_mday, tm_time.tm_year % 100, '/'); - } -}; - - -// year - 4 digit -class Y_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << tm_time.tm_year + 1900; - } -}; - -// month 1-12 -class m_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_mon + 1, 2, '0'); - } -}; - -// day of month 1-31 -class d_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_mday, 2, '0'); - } -}; - -// hours in 24 format 0-23 -class H_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_hour, 2, '0'); - } -}; - -// hours in 12 format 1-12 -class I_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(to12h(tm_time), 2, '0'); - } -}; - -// minutes 0-59 -class M_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_min, 2, '0'); - } -}; - -// seconds 0-59 -class S_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << fmt::pad(tm_time.tm_sec, 2, '0'); - } -}; - -// milliseconds -class e_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto millis = std::chrono::duration_cast(duration).count() % 1000; - msg.formatted << fmt::pad(static_cast(millis), 3, '0'); - } -}; - -// microseconds -class f_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto micros = std::chrono::duration_cast(duration).count() % 1000000; - msg.formatted << fmt::pad(static_cast(micros), 6, '0'); - } -}; - -// nanoseconds -class F_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - auto duration = msg.time.time_since_epoch(); - auto ns = std::chrono::duration_cast(duration).count() % 1000000000; - msg.formatted << fmt::pad(static_cast(ns), 9, '0'); - } -}; - -// AM/PM -class p_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - msg.formatted << ampm(tm_time); - } -}; - - -// 12 hour clock 02:55:02 pm -class r_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, to12h(tm_time), tm_time.tm_min, tm_time.tm_sec, ':') << ' ' << ampm(tm_time); - } -}; - -// 24-hour HH:MM time, equivalent to %H:%M -class R_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, ':'); - } -}; - -// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S -class T_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { - pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec, ':'); - } -}; - - -// ISO 8601 offset from UTC in timezone (+-HH:MM) -class z_formatter:public flag_formatter -{ -public: - const std::chrono::seconds cache_refresh = std::chrono::seconds(5); - - z_formatter():_last_update(std::chrono::seconds(0)) - {} - z_formatter(const z_formatter&) = delete; - z_formatter& operator=(const z_formatter&) = delete; - - void format(details::log_msg& msg, const std::tm& tm_time) override - { -#ifdef _WIN32 - int total_minutes = get_cached_offset(msg, tm_time); -#else - // No need to chache under gcc, - // it is very fast (already stored in tm.tm_gmtoff) - int total_minutes = os::utc_minutes_offset(tm_time); -#endif - bool is_negative = total_minutes < 0; - char sign; - if (is_negative) - { - total_minutes = -total_minutes; - sign = '-'; - } - else - { - sign = '+'; - } - - int h = total_minutes / 60; - int m = total_minutes % 60; - msg.formatted << sign; - pad_n_join(msg.formatted, h, m, ':'); - } -private: - log_clock::time_point _last_update; - int _offset_minutes; - std::mutex _mutex; - - int get_cached_offset(const log_msg& msg, const std::tm& tm_time) - { - using namespace std::chrono; - std::lock_guard l(_mutex); - if (msg.time - _last_update >= cache_refresh) - { - _offset_minutes = os::utc_minutes_offset(tm_time); - _last_update = msg.time; - } - return _offset_minutes; - } -}; - - - -// Thread id -class t_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << msg.thread_id; - } -}; - -// Current pid -class pid_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << details::os::pid(); - } -}; - - -class v_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << fmt::StringRef(msg.raw.data(), msg.raw.size()); - } -}; - -class ch_formatter:public flag_formatter -{ -public: - explicit ch_formatter(char ch): _ch(ch) - {} - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << _ch; - } -private: - char _ch; -}; - - -//aggregate user chars to display as is -class aggregate_formatter:public flag_formatter -{ -public: - aggregate_formatter() - {} - void add_ch(char ch) - { - _str += ch; - } - void format(details::log_msg& msg, const std::tm&) override - { - msg.formatted << _str; - } -private: - std::string _str; -}; - -// Full info formatter -// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v -class full_formatter:public flag_formatter -{ - void format(details::log_msg& msg, const std::tm& tm_time) override - { -#ifndef SPDLOG_NO_DATETIME - auto duration = msg.time.time_since_epoch(); - auto millis = std::chrono::duration_cast(duration).count() % 1000; - - /* Slower version(while still very fast - about 3.2 million lines/sec under 10 threads), - msg.formatted.write("[{:d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:03d}] [{}] [{}] {} ", - tm_time.tm_year + 1900, - tm_time.tm_mon + 1, - tm_time.tm_mday, - tm_time.tm_hour, - tm_time.tm_min, - tm_time.tm_sec, - static_cast(millis), - msg.logger_name, - level::to_str(msg.level), - msg.raw.str());*/ - - - // Faster (albeit uglier) way to format the line (5.6 million lines/sec under 10 threads) - msg.formatted << '[' << static_cast(tm_time.tm_year + 1900) << '-' - << fmt::pad(static_cast(tm_time.tm_mon + 1), 2, '0') << '-' - << fmt::pad(static_cast(tm_time.tm_mday), 2, '0') << ' ' - << fmt::pad(static_cast(tm_time.tm_hour), 2, '0') << ':' - << fmt::pad(static_cast(tm_time.tm_min), 2, '0') << ':' - << fmt::pad(static_cast(tm_time.tm_sec), 2, '0') << '.' - << fmt::pad(static_cast(millis), 3, '0') << "] "; - - //no datetime needed -#else - (void)tm_time; -#endif - -#ifndef SPDLOG_NO_NAME - msg.formatted << '[' << *msg.logger_name << "] "; -#endif - - msg.formatted << '[' << level::to_str(msg.level) << "] "; - msg.formatted << fmt::StringRef(msg.raw.data(), msg.raw.size()); - } -}; - - - -} -} -/////////////////////////////////////////////////////////////////////////////// -// pattern_formatter inline impl -/////////////////////////////////////////////////////////////////////////////// -inline spdlog::pattern_formatter::pattern_formatter(const std::string& pattern) -{ - compile_pattern(pattern); -} - -inline void spdlog::pattern_formatter::compile_pattern(const std::string& pattern) -{ - auto end = pattern.end(); - std::unique_ptr user_chars; - for (auto it = pattern.begin(); it != end; ++it) - { - if (*it == '%') - { - if (user_chars) //append user chars found so far - _formatters.push_back(std::move(user_chars)); - - if (++it != end) - handle_flag(*it); - else - break; - } - else // chars not following the % sign should be displayed as is - { - if (!user_chars) - user_chars = std::unique_ptr(new details::aggregate_formatter()); - user_chars->add_ch(*it); - } - } - if (user_chars) //append raw chars found so far - { - _formatters.push_back(std::move(user_chars)); - } - -} -inline void spdlog::pattern_formatter::handle_flag(char flag) -{ - switch (flag) - { - // logger name - case 'n': - _formatters.push_back(std::unique_ptr(new details::name_formatter())); - break; - - case 'l': - _formatters.push_back(std::unique_ptr(new details::level_formatter())); - break; - - case 'L': - _formatters.push_back(std::unique_ptr(new details::short_level_formatter())); - break; - - case('t'): - _formatters.push_back(std::unique_ptr(new details::t_formatter())); - break; - - case('v'): - _formatters.push_back(std::unique_ptr(new details::v_formatter())); - break; - - case('a'): - _formatters.push_back(std::unique_ptr(new details::a_formatter())); - break; - - case('A'): - _formatters.push_back(std::unique_ptr(new details::A_formatter())); - break; - - case('b'): - case('h'): - _formatters.push_back(std::unique_ptr(new details::b_formatter())); - break; - - case('B'): - _formatters.push_back(std::unique_ptr(new details::B_formatter())); - break; - case('c'): - _formatters.push_back(std::unique_ptr(new details::c_formatter())); - break; - - case('C'): - _formatters.push_back(std::unique_ptr(new details::C_formatter())); - break; - - case('Y'): - _formatters.push_back(std::unique_ptr(new details::Y_formatter())); - break; - - case('D'): - case('x'): - - _formatters.push_back(std::unique_ptr(new details::D_formatter())); - break; - - case('m'): - _formatters.push_back(std::unique_ptr(new details::m_formatter())); - break; - - case('d'): - _formatters.push_back(std::unique_ptr(new details::d_formatter())); - break; - - case('H'): - _formatters.push_back(std::unique_ptr(new details::H_formatter())); - break; - - case('I'): - _formatters.push_back(std::unique_ptr(new details::I_formatter())); - break; - - case('M'): - _formatters.push_back(std::unique_ptr(new details::M_formatter())); - break; - - case('S'): - _formatters.push_back(std::unique_ptr(new details::S_formatter())); - break; - - case('e'): - _formatters.push_back(std::unique_ptr(new details::e_formatter())); - break; - - case('f'): - _formatters.push_back(std::unique_ptr(new details::f_formatter())); - break; - case('F'): - _formatters.push_back(std::unique_ptr(new details::F_formatter())); - break; - - case('p'): - _formatters.push_back(std::unique_ptr(new details::p_formatter())); - break; - - case('r'): - _formatters.push_back(std::unique_ptr(new details::r_formatter())); - break; - - case('R'): - _formatters.push_back(std::unique_ptr(new details::R_formatter())); - break; - - case('T'): - case('X'): - _formatters.push_back(std::unique_ptr(new details::T_formatter())); - break; - - case('z'): - _formatters.push_back(std::unique_ptr(new details::z_formatter())); - break; - - case ('+'): - _formatters.push_back(std::unique_ptr(new details::full_formatter())); - break; - - case ('P'): - _formatters.push_back(std::unique_ptr(new details::pid_formatter())); - break; - - default: //Unkown flag appears as is - _formatters.push_back(std::unique_ptr(new details::ch_formatter('%'))); - _formatters.push_back(std::unique_ptr(new details::ch_formatter(flag))); - break; - } -} - - -inline void spdlog::pattern_formatter::format(details::log_msg& msg) -{ - -#ifndef SPDLOG_NO_DATETIME - auto tm_time = details::os::localtime(log_clock::to_time_t(msg.time)); -#else - std::tm tm_time; -#endif - for (auto &f : _formatters) - { - f->format(msg, tm_time); - } - //write eol - msg.formatted.write(details::os::eol, details::os::eol_size); -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/registry.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/registry.h deleted file mode 100644 index a2cc7f681ce48d867be307025067715ddb8ebe49..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/registry.h +++ /dev/null @@ -1,185 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Loggers registy of unique name->logger pointer -// An attempt to create a logger with an already existing name will be ignored -// If user requests a non existing logger, nullptr will be returned -// This class is thread safe - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -template class registry_t -{ -public: - - void register_logger(std::shared_ptr logger) - { - std::lock_guard lock(_mutex); - auto logger_name = logger->name(); - throw_if_exists(logger_name); - _loggers[logger_name] = logger; - } - - - std::shared_ptr get(const std::string& logger_name) - { - std::lock_guard lock(_mutex); - auto found = _loggers.find(logger_name); - return found == _loggers.end() ? nullptr : found->second; - } - - template - std::shared_ptr create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end) - { - std::lock_guard lock(_mutex); - throw_if_exists(logger_name); - std::shared_ptr new_logger; - if (_async_mode) - new_logger = std::make_shared(logger_name, sinks_begin, sinks_end, _async_q_size, _overflow_policy, _worker_warmup_cb, _flush_interval_ms, _worker_teardown_cb); - else - new_logger = std::make_shared(logger_name, sinks_begin, sinks_end); - - if (_formatter) - new_logger->set_formatter(_formatter); - - if (_err_handler) - new_logger->set_error_handler(_err_handler); - - new_logger->set_level(_level); - - - //Add to registry - _loggers[logger_name] = new_logger; - return new_logger; - } - - void apply_all(std::function)> fun) - { - std::lock_guard lock(_mutex); - for (auto &l : _loggers) - fun(l.second); - } - - void drop(const std::string& logger_name) - { - std::lock_guard lock(_mutex); - _loggers.erase(logger_name); - } - - void drop_all() - { - std::lock_guard lock(_mutex); - _loggers.clear(); - } - std::shared_ptr create(const std::string& logger_name, sinks_init_list sinks) - { - return create(logger_name, sinks.begin(), sinks.end()); - } - - std::shared_ptr create(const std::string& logger_name, sink_ptr sink) - { - return create(logger_name, { sink }); - } - - - void formatter(formatter_ptr f) - { - std::lock_guard lock(_mutex); - _formatter = f; - for (auto& l : _loggers) - l.second->set_formatter(_formatter); - } - - void set_pattern(const std::string& pattern) - { - std::lock_guard lock(_mutex); - _formatter = std::make_shared(pattern); - for (auto& l : _loggers) - l.second->set_formatter(_formatter); - } - - void set_level(level::level_enum log_level) - { - std::lock_guard lock(_mutex); - for (auto& l : _loggers) - l.second->set_level(log_level); - _level = log_level; - } - - void set_error_handler(log_err_handler handler) - { - for (auto& l : _loggers) - l.second->set_error_handler(handler); - _err_handler = handler; - } - - void set_async_mode(size_t q_size, const async_overflow_policy overflow_policy, const std::function& worker_warmup_cb, const std::chrono::milliseconds& flush_interval_ms, const std::function& worker_teardown_cb) - { - std::lock_guard lock(_mutex); - _async_mode = true; - _async_q_size = q_size; - _overflow_policy = overflow_policy; - _worker_warmup_cb = worker_warmup_cb; - _flush_interval_ms = flush_interval_ms; - _worker_teardown_cb = worker_teardown_cb; - } - - void set_sync_mode() - { - std::lock_guard lock(_mutex); - _async_mode = false; - } - - static registry_t& instance() - { - static registry_t s_instance; - return s_instance; - } - -private: - registry_t() {} - registry_t(const registry_t&) = delete; - registry_t& operator=(const registry_t&) = delete; - - void throw_if_exists(const std::string &logger_name) - { - if (_loggers.find(logger_name) != _loggers.end()) - throw spdlog_ex("logger with name '" + logger_name + "' already exists"); - } - Mutex _mutex; - std::unordered_map > _loggers; - formatter_ptr _formatter; - level::level_enum _level = level::info; - log_err_handler _err_handler; - bool _async_mode = false; - size_t _async_q_size = 0; - async_overflow_policy _overflow_policy = async_overflow_policy::block_retry; - std::function _worker_warmup_cb = nullptr; - std::chrono::milliseconds _flush_interval_ms; - std::function _worker_teardown_cb = nullptr; -}; -#ifdef SPDLOG_NO_REGISTRY_MUTEX -typedef registry_t registry; -#else -typedef registry_t registry; -#endif -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/details/spdlog_impl.h b/archive_old_fs_versions/lfs/include/extern/spdlog/details/spdlog_impl.h deleted file mode 100644 index ac7f47e1838e68677ed03e266b433e91a8a4eee2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/details/spdlog_impl.h +++ /dev/null @@ -1,246 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// -// Global registry functions -// -#include -#include -#include -#include -#ifdef SPDLOG_ENABLE_SYSLOG -#include -#endif - -#ifdef _WIN32 -#include -#else - -#include -#endif - - -#ifdef __ANDROID__ -#include -#endif - -#include -#include -#include -#include - -inline void spdlog::register_logger(std::shared_ptr logger) -{ - return details::registry::instance().register_logger(logger); -} - -inline std::shared_ptr spdlog::get(const std::string& name) -{ - return details::registry::instance().get(name); -} - -inline void spdlog::drop(const std::string &name) -{ - details::registry::instance().drop(name); -} - -// Create multi/single threaded simple file logger -inline std::shared_ptr spdlog::basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate) -{ - return create(logger_name, filename, truncate); -} - -inline std::shared_ptr spdlog::basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate) -{ - return create(logger_name, filename, truncate); -} - -// Create multi/single threaded rotating file logger -inline std::shared_ptr spdlog::rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files) -{ - return create(logger_name, filename, max_file_size, max_files); -} - -inline std::shared_ptr spdlog::rotating_logger_st(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files) -{ - return create(logger_name, filename, max_file_size, max_files); -} - -// Create file logger which creates new file at midnight): -inline std::shared_ptr spdlog::daily_logger_mt(const std::string& logger_name, const filename_t& filename, int hour, int minute) -{ - return create(logger_name, filename, hour, minute); -} - -inline std::shared_ptr spdlog::daily_logger_st(const std::string& logger_name, const filename_t& filename, int hour, int minute) -{ - return create(logger_name, filename, hour, minute); -} - - -// -// stdout/stderr loggers -// -inline std::shared_ptr spdlog::stdout_logger_mt(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_mt::instance()); -} - -inline std::shared_ptr spdlog::stdout_logger_st(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_st::instance()); -} - -inline std::shared_ptr spdlog::stderr_logger_mt(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_mt::instance()); -} - -inline std::shared_ptr spdlog::stderr_logger_st(const std::string& logger_name) -{ - return spdlog::details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_st::instance()); -} - -// -// stdout/stderr color loggers -// -#ifdef _WIN32 -inline std::shared_ptr spdlog::stdout_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stdout_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - - -inline std::shared_ptr spdlog::stderr_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -#else //ansi terminal colors - -inline std::shared_ptr spdlog::stdout_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stdout_sink_mt::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stdout_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stdout_sink_st::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_mt(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stderr_sink_mt::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} - -inline std::shared_ptr spdlog::stderr_color_st(const std::string& logger_name) -{ - auto sink = std::make_shared(spdlog::sinks::stderr_sink_st::instance()); - return spdlog::details::registry::instance().create(logger_name, sink); -} -#endif - -#ifdef SPDLOG_ENABLE_SYSLOG -// Create syslog logger -inline std::shared_ptr spdlog::syslog_logger(const std::string& logger_name, const std::string& syslog_ident, int syslog_option) -{ - return create(logger_name, syslog_ident, syslog_option); -} -#endif - -#ifdef __ANDROID__ -inline std::shared_ptr spdlog::android_logger(const std::string& logger_name, const std::string& tag) -{ - return create(logger_name, tag); -} -#endif - -// Create and register a logger a single sink -inline std::shared_ptr spdlog::create(const std::string& logger_name, const spdlog::sink_ptr& sink) -{ - return details::registry::instance().create(logger_name, sink); -} - -//Create logger with multiple sinks - -inline std::shared_ptr spdlog::create(const std::string& logger_name, spdlog::sinks_init_list sinks) -{ - return details::registry::instance().create(logger_name, sinks); -} - - -template -inline std::shared_ptr spdlog::create(const std::string& logger_name, Args... args) -{ - sink_ptr sink = std::make_shared(args...); - return details::registry::instance().create(logger_name, { sink }); -} - - -template -inline std::shared_ptr spdlog::create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end) -{ - return details::registry::instance().create(logger_name, sinks_begin, sinks_end); -} - -inline void spdlog::set_formatter(spdlog::formatter_ptr f) -{ - details::registry::instance().formatter(f); -} - -inline void spdlog::set_pattern(const std::string& format_string) -{ - return details::registry::instance().set_pattern(format_string); -} - -inline void spdlog::set_level(level::level_enum log_level) -{ - return details::registry::instance().set_level(log_level); -} - -inline void spdlog::set_error_handler(log_err_handler handler) -{ - return details::registry::instance().set_error_handler(handler); -} - - -inline void spdlog::set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy, const std::function& worker_warmup_cb, const std::chrono::milliseconds& flush_interval_ms, const std::function& worker_teardown_cb) -{ - details::registry::instance().set_async_mode(queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb); -} - -inline void spdlog::set_sync_mode() -{ - details::registry::instance().set_sync_mode(); -} - -inline void spdlog::apply_all(std::function)> fun) -{ - details::registry::instance().apply_all(fun); -} - -inline void spdlog::drop_all() -{ - details::registry::instance().drop_all(); -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.cc b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.cc deleted file mode 100644 index fd8855be4c3f9a0cb631ac6a718e573dceea2d80..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.cc +++ /dev/null @@ -1,583 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "format.h" - -#include - -#include -#include -#include -#include -#include -#include // for std::ptrdiff_t - -#if defined(_WIN32) && defined(__MINGW32__) -# include -#endif - -#if FMT_USE_WINDOWS_H -# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX) -# include -# else -# define NOMINMAX -# include -# undef NOMINMAX -# endif -#endif - -using fmt::internal::Arg; - -#if FMT_EXCEPTIONS -# define FMT_TRY try -# define FMT_CATCH(x) catch (x) -#else -# define FMT_TRY if (true) -# define FMT_CATCH(x) if (false) -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -# pragma warning(disable: 4702) // unreachable code -// Disable deprecation warning for strerror. The latter is not called but -// MSVC fails to detect it. -# pragma warning(disable: 4996) -#endif - -// Dummy implementations of strerror_r and strerror_s called if corresponding -// system functions are not available. -static inline fmt::internal::Null<> strerror_r(int, char *, ...) -{ - return fmt::internal::Null<>(); -} -static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) -{ - return fmt::internal::Null<>(); -} - -namespace fmt { - - FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT - {} - FMT_FUNC FormatError::~FormatError() FMT_DTOR_NOEXCEPT - {} - FMT_FUNC SystemError::~SystemError() FMT_DTOR_NOEXCEPT - {} - - namespace { - -#ifndef _MSC_VER -# define FMT_SNPRINTF snprintf -#else // _MSC_VER - inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) - { - va_list args; - va_start(args, format); - int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args); - va_end(args); - return result; - } -# define FMT_SNPRINTF fmt_snprintf -#endif // _MSC_VER - -#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) -# define FMT_SWPRINTF snwprintf -#else -# define FMT_SWPRINTF swprintf -#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) - - const char RESET_COLOR[] = "\x1b[0m"; - - typedef void(*FormatFunc)(Writer &, int, StringRef); - - // Portable thread-safe version of strerror. - // Sets buffer to point to a string describing the error code. - // This can be either a pointer to a string stored in buffer, - // or a pointer to some static immutable string. - // Returns one of the following values: - // 0 - success - // ERANGE - buffer is not large enough to store the error message - // other - failure - // Buffer should be at least of size 1. - int safe_strerror( - int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT - { - FMT_ASSERT(buffer != 0 && buffer_size != 0, "invalid buffer"); - - class StrError - { - private: - int error_code_; - char *&buffer_; - std::size_t buffer_size_; - - // A noop assignment operator to avoid bogus warnings. - void operator=(const StrError &) - {} - - // Handle the result of XSI-compliant version of strerror_r. - int handle(int result) - { - // glibc versions before 2.13 return result in errno. - return result == -1 ? errno : result; - } - - // Handle the result of GNU-specific version of strerror_r. - int handle(char *message) - { - // If the buffer is full then the message is probably truncated. - if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1) - return ERANGE; - buffer_ = message; - return 0; - } - - // Handle the case when strerror_r is not available. - int handle(internal::Null<>) - { - return fallback(strerror_s(buffer_, buffer_size_, error_code_)); - } - - // Fallback to strerror_s when strerror_r is not available. - int fallback(int result) - { - // If the buffer is full then the message is probably truncated. - return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? - ERANGE : result; - } - - // Fallback to strerror if strerror_r and strerror_s are not available. - int fallback(internal::Null<>) - { - errno = 0; - buffer_ = strerror(error_code_); - return errno; - } - - public: - StrError(int err_code, char *&buf, std::size_t buf_size) - : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) - {} - - int run() - { - // Suppress a warning about unused strerror_r. - strerror_r(0, FMT_NULL, ""); - return handle(strerror_r(error_code_, buffer_, buffer_size_)); - } - }; - return StrError(error_code, buffer, buffer_size).run(); - } - - void format_error_code(Writer &out, int error_code, - StringRef message) FMT_NOEXCEPT - { - // Report error code making sure that the output fits into - // INLINE_BUFFER_SIZE to avoid dynamic memory allocation and potential - // bad_alloc. - out.clear(); - static const char SEP[] = ": "; - static const char ERROR_STR[] = "error "; - // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. - std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; - typedef internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(error_code); - if (internal::is_negative(error_code)) { - abs_value = 0 - abs_value; - ++error_code_size; - } - error_code_size += internal::count_digits(abs_value); - if (message.size() <= internal::INLINE_BUFFER_SIZE - error_code_size) - out << message << SEP; - out << ERROR_STR << error_code; - assert(out.size() <= internal::INLINE_BUFFER_SIZE); - } - - void report_error(FormatFunc func, int error_code, - StringRef message) FMT_NOEXCEPT - { - MemoryWriter full_message; - func(full_message, error_code, message); - // Use Writer::data instead of Writer::c_str to avoid potential memory - // allocation. - std::fwrite(full_message.data(), full_message.size(), 1, stderr); - std::fputc('\n', stderr); - } - } // namespace - - namespace internal { - - // This method is used to preserve binary compatibility with fmt 3.0. - // It can be removed in 4.0. - FMT_FUNC void format_system_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - fmt::format_system_error(out, error_code, message); - } - } // namespace internal - - FMT_FUNC void SystemError::init( - int err_code, CStringRef format_str, ArgList args) - { - error_code_ = err_code; - MemoryWriter w; - format_system_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); - } - - template - int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, T value) - { - if (width == 0) { - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, value) : - FMT_SNPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, width, value) : - FMT_SNPRINTF(buffer, size, format, width, precision, value); - } - - template - int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, T value) - { - if (width == 0) { - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, value) : - FMT_SWPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, width, value) : - FMT_SWPRINTF(buffer, size, format, width, precision, value); - } - - template - const char internal::BasicData::DIGITS[] = - "0001020304050607080910111213141516171819" - "2021222324252627282930313233343536373839" - "4041424344454647484950515253545556575859" - "6061626364656667686970717273747576777879" - "8081828384858687888990919293949596979899"; - -#define FMT_POWERS_OF_10(factor) \ - factor * 10, \ - factor * 100, \ - factor * 1000, \ - factor * 10000, \ - factor * 100000, \ - factor * 1000000, \ - factor * 10000000, \ - factor * 100000000, \ - factor * 1000000000 - - template - const uint32_t internal::BasicData::POWERS_OF_10_32[] = { - 0, FMT_POWERS_OF_10(1) - }; - - template - const uint64_t internal::BasicData::POWERS_OF_10_64[] = { - 0, - FMT_POWERS_OF_10(1), - FMT_POWERS_OF_10(ULongLong(1000000000)), - // Multiply several constants instead of using a single long long constant - // to avoid warnings about C++98 not supporting long long. - ULongLong(1000000000) * ULongLong(1000000000) * 10 - }; - - FMT_FUNC void internal::report_unknown_type(char code, const char *type) - { - (void)type; - if (std::isprint(static_cast(code))) { - FMT_THROW(FormatError( - format("unknown format code '{}' for {}", code, type))); - } - FMT_THROW(FormatError( - format("unknown format code '\\x{:02x}' for {}", - static_cast(code), type))); - } - -#if FMT_USE_WINDOWS_H - - FMT_FUNC internal::UTF8ToUTF16::UTF8ToUTF16(StringRef s) - { - static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16"; - if (s.size() > INT_MAX) - FMT_THROW(WindowsError(ERROR_INVALID_PARAMETER, ERROR_MSG)); - int s_size = static_cast(s.size()); - int length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, FMT_NULL, 0); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_.resize(length + 1); - length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, &buffer_[0], length); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_[length] = 0; - } - - FMT_FUNC internal::UTF16ToUTF8::UTF16ToUTF8(WStringRef s) - { - if (int error_code = convert(s)) { - FMT_THROW(WindowsError(error_code, - "cannot convert string from UTF-16 to UTF-8")); - } - } - - FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) - { - if (s.size() > INT_MAX) - return ERROR_INVALID_PARAMETER; - int s_size = static_cast(s.size()); - int length = WideCharToMultiByte( - CP_UTF8, 0, s.data(), s_size, FMT_NULL, 0, FMT_NULL, FMT_NULL); - if (length == 0) - return GetLastError(); - buffer_.resize(length + 1); - length = WideCharToMultiByte( - CP_UTF8, 0, s.data(), s_size, &buffer_[0], length, FMT_NULL, FMT_NULL); - if (length == 0) - return GetLastError(); - buffer_[length] = 0; - return 0; - } - - FMT_FUNC void WindowsError::init( - int err_code, CStringRef format_str, ArgList args) - { - error_code_ = err_code; - MemoryWriter w; - internal::format_windows_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); - } - - FMT_FUNC void internal::format_windows_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - FMT_TRY{ - MemoryBuffer buffer; - buffer.resize(INLINE_BUFFER_SIZE); - for (;;) { - wchar_t *system_message = &buffer[0]; - int result = FormatMessageW( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - FMT_NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - system_message, static_cast(buffer.size()), FMT_NULL); - if (result != 0) { - UTF16ToUTF8 utf8_message; - if (utf8_message.convert(system_message) == ERROR_SUCCESS) { - out << message << ": " << utf8_message; - return; - } - break; - } - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) - {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. - } - -#endif // FMT_USE_WINDOWS_H - - FMT_FUNC void format_system_error( - Writer &out, int error_code, StringRef message) FMT_NOEXCEPT - { - FMT_TRY{ - internal::MemoryBuffer buffer; - buffer.resize(internal::INLINE_BUFFER_SIZE); - for (;;) { - char *system_message = &buffer[0]; - int result = safe_strerror(error_code, system_message, buffer.size()); - if (result == 0) { - out << message << ": " << system_message; - return; - } - if (result != ERANGE) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) - {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. - } - - template - void internal::ArgMap::init(const ArgList &args) - { - if (!map_.empty()) - return; - typedef internal::NamedArg NamedArg; - const NamedArg *named_arg = FMT_NULL; - bool use_values = - args.type(ArgList::MAX_PACKED_ARGS - 1) == internal::Arg::NONE; - if (use_values) { - for (unsigned i = 0;/*nothing*/; ++i) { - internal::Arg::Type arg_type = args.type(i); - switch (arg_type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.values_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } - return; - } - for (unsigned i = 0; i != ArgList::MAX_PACKED_ARGS; ++i) { - internal::Arg::Type arg_type = args.type(i); - if (arg_type == internal::Arg::NAMED_ARG) { - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - } - } - for (unsigned i = ArgList::MAX_PACKED_ARGS;/*nothing*/; ++i) { - switch (args.args_[i].type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } - } - - template - void internal::FixedBuffer::grow(std::size_t) - { - FMT_THROW(std::runtime_error("buffer overflow")); - } - - FMT_FUNC Arg internal::FormatterBase::do_get_arg( - unsigned arg_index, const char *&error) - { - Arg arg = args_[arg_index]; - switch (arg.type) { - case Arg::NONE: - error = "argument index out of range"; - break; - case Arg::NAMED_ARG: - arg = *static_cast(arg.pointer); - break; - default: - /*nothing*/; - } - return arg; - } - - FMT_FUNC void report_system_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT - { - // 'fmt::' is for bcc32. - report_error(format_system_error, error_code, message); - } - -#if FMT_USE_WINDOWS_H - FMT_FUNC void report_windows_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT - { - // 'fmt::' is for bcc32. - report_error(internal::format_windows_error, error_code, message); - } -#endif - - FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args) - { - MemoryWriter w; - w.write(format_str, args); - std::fwrite(w.data(), 1, w.size(), f); - } - - FMT_FUNC void print(CStringRef format_str, ArgList args) - { - print(stdout, format_str, args); - } - - FMT_FUNC void print_colored(Color c, CStringRef format, ArgList args) - { - char escape[] = "\x1b[30m"; - escape[3] = static_cast('0' + c); - std::fputs(escape, stdout); - print(format, args); - std::fputs(RESET_COLOR, stdout); - } - -#ifndef FMT_HEADER_ONLY - - template struct internal::BasicData; - - // Explicit instantiations for char. - - template void internal::FixedBuffer::grow(std::size_t); - - template void internal::ArgMap::init(const ArgList &args); - - template int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, double value); - - template int internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, long double value); - - // Explicit instantiations for wchar_t. - - template void internal::FixedBuffer::grow(std::size_t); - - template void internal::ArgMap::init(const ArgList &args); - - template int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, double value); - - template int internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, long double value); - -#endif // FMT_HEADER_ONLY - -} // namespace fmt - -#ifdef _MSC_VER -# pragma warning(pop) -#endif diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.h b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.h deleted file mode 100644 index e5e2e2ef93346cb9daafe77b33d7e65597621408..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/format.h +++ /dev/null @@ -1,4645 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef FMT_FORMAT_H_ -#define FMT_FORMAT_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 30002 - -#ifdef _SECURE_SCL -# define FMT_SECURE_SCL _SECURE_SCL -#else -# define FMT_SECURE_SCL 0 -#endif - -#if FMT_SECURE_SCL -# include -#endif - -#ifdef _MSC_VER -# define FMT_MSC_VER _MSC_VER -#else -# define FMT_MSC_VER 0 -#endif - -#if FMT_MSC_VER && FMT_MSC_VER <= 1500 -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int64 intmax_t; -#else -#include -#endif - -#if !defined(FMT_HEADER_ONLY) && defined(_WIN32) -# ifdef FMT_EXPORT -# define FMT_API __declspec(dllexport) -# elif defined(FMT_SHARED) -# define FMT_API __declspec(dllimport) -# endif -#endif -#ifndef FMT_API -# define FMT_API -#endif - -#ifdef __GNUC__ -# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -# define FMT_GCC_EXTENSION __extension__ -# if FMT_GCC_VERSION >= 406 -# pragma GCC diagnostic push -// Disable the warning about "long long" which is sometimes reported even -// when using __extension__. -# pragma GCC diagnostic ignored "-Wlong-long" -// Disable the warning about declaration shadowing because it affects too -// many valid cases. -# pragma GCC diagnostic ignored "-Wshadow" -// Disable the warning about implicit conversions that may change the sign of -// an integer; silencing it otherwise would require many explicit casts. -# pragma GCC diagnostic ignored "-Wsign-conversion" -# endif -# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ -# define FMT_HAS_GXX_CXX11 1 -# endif -#else -# define FMT_GCC_EXTENSION -#endif - -#if defined(__INTEL_COMPILER) -# define FMT_ICC_VERSION __INTEL_COMPILER -#elif defined(__ICL) -# define FMT_ICC_VERSION __ICL -#endif - -#if defined(__clang__) && !defined(FMT_ICC_VERSION) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" -# pragma clang diagnostic ignored "-Wpadded" -#endif - -#ifdef __GNUC_LIBSTD__ -# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__) -#endif - -#ifdef __has_feature -# define FMT_HAS_FEATURE(x) __has_feature(x) -#else -# define FMT_HAS_FEATURE(x) 0 -#endif - -#ifdef __has_builtin -# define FMT_HAS_BUILTIN(x) __has_builtin(x) -#else -# define FMT_HAS_BUILTIN(x) 0 -#endif - -#ifdef __has_cpp_attribute -# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define FMT_HAS_CPP_ATTRIBUTE(x) 0 -#endif - -#ifndef FMT_USE_VARIADIC_TEMPLATES -// Variadic templates are available in GCC since version 4.4 -// (http://gcc.gnu.org/projects/cxx0x.html) and in Visual C++ -// since version 2013. -# define FMT_USE_VARIADIC_TEMPLATES \ - (FMT_HAS_FEATURE(cxx_variadic_templates) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800) -#endif - -#ifndef FMT_USE_RVALUE_REFERENCES -// Don't use rvalue references when compiling with clang and an old libstdc++ -// as the latter doesn't provide std::move. -# if defined(FMT_GNUC_LIBSTD_VERSION) && FMT_GNUC_LIBSTD_VERSION <= 402 -# define FMT_USE_RVALUE_REFERENCES 0 -# else -# define FMT_USE_RVALUE_REFERENCES \ - (FMT_HAS_FEATURE(cxx_rvalue_references) || \ - (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1600) -# endif -#endif - -#if FMT_USE_RVALUE_REFERENCES -# include // for std::move -#endif - -// Check if exceptions are disabled. -#if defined(__GNUC__) && !defined(__EXCEPTIONS) -# define FMT_EXCEPTIONS 0 -#endif -#if FMT_MSC_VER && !_HAS_EXCEPTIONS -# define FMT_EXCEPTIONS 0 -#endif -#ifndef FMT_EXCEPTIONS -# define FMT_EXCEPTIONS 1 -#endif - -#ifndef FMT_THROW -# if FMT_EXCEPTIONS -# define FMT_THROW(x) throw x -# else -# define FMT_THROW(x) assert(false) -# endif -#endif - -// Define FMT_USE_NOEXCEPT to make fmt use noexcept (C++11 feature). -#ifndef FMT_USE_NOEXCEPT -# define FMT_USE_NOEXCEPT 0 -#endif - -#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1900 -# define FMT_DETECTED_NOEXCEPT noexcept -#else -# define FMT_DETECTED_NOEXCEPT throw() -#endif - -#ifndef FMT_NOEXCEPT -# if FMT_EXCEPTIONS -# define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT -# else -# define FMT_NOEXCEPT -# endif -#endif - -// This is needed because GCC still uses throw() in its headers when exceptions -// are disabled. -#if FMT_GCC_VERSION -# define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT -#else -# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT -#endif - -#ifndef FMT_OVERRIDE -# if (defined(FMT_USE_OVERRIDE) && FMT_USE_OVERRIDE) || FMT_HAS_FEATURE(cxx_override) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1900 -# define FMT_OVERRIDE override -# else -# define FMT_OVERRIDE -# endif -#endif - -#ifndef FMT_NULL -# if FMT_HAS_FEATURE(cxx_nullptr) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - FMT_MSC_VER >= 1600 -# define FMT_NULL nullptr -# else -# define FMT_NULL NULL -# endif -#endif - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#ifndef FMT_USE_DELETED_FUNCTIONS -# define FMT_USE_DELETED_FUNCTIONS 0 -#endif - -#if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 -# define FMT_DELETED_OR_UNDEFINED = delete -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) = delete; \ - TypeName& operator=(const TypeName&) = delete -#else -# define FMT_DELETED_OR_UNDEFINED -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - TypeName& operator=(const TypeName&) -#endif - -#ifndef FMT_USE_USER_DEFINED_LITERALS -// All compilers which support UDLs also support variadic templates. This -// makes the fmt::literals implementation easier. However, an explicit check -// for variadic templates is added here just in case. -// For Intel's compiler both it and the system gcc/msc must support UDLs. -# define FMT_USE_USER_DEFINED_LITERALS \ - FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \ - (FMT_HAS_FEATURE(cxx_user_literals) || \ - (FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900) && \ - (!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500) -#endif - -#ifndef FMT_USE_EXTERN_TEMPLATES -// Clang doesn't have a feature check for extern templates so we check -// for variadic templates which were introduced in the same version. -// For GCC according to cppreference.com they were introduced in 3.3. -# define FMT_USE_EXTERN_TEMPLATES \ - ((__clang__ && FMT_USE_VARIADIC_TEMPLATES) || \ - (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11)) -#endif - -#ifdef FMT_HEADER_ONLY -// If header only do not use extern templates. -# undef FMT_USE_EXTERN_TEMPLATES -# define FMT_USE_EXTERN_TEMPLATES 0 -#endif - -#ifndef FMT_ASSERT -# define FMT_ASSERT(condition, message) assert((condition) && message) -#endif - -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) -# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) -#endif - -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) -# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) -#endif - -// Some compilers masquerade as both MSVC and GCC-likes or -// otherwise support __builtin_clz and __builtin_clzll, so -// only define FMT_BUILTIN_CLZ using the MSVC intrinsics -// if the clz and clzll builtins are not available. -#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) -# include // _BitScanReverse, _BitScanReverse64 - -namespace fmt -{ -namespace internal -{ -# pragma intrinsic(_BitScanReverse) -inline uint32_t clz(uint32_t x) -{ - unsigned long r = 0; - _BitScanReverse(&r, x); - - assert(x != 0); - // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, - // which the callers guarantee to not happen. -# pragma warning(suppress: 6102) - return 31 - r; -} -# define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n) - -# ifdef _WIN64 -# pragma intrinsic(_BitScanReverse64) -# endif - -inline uint32_t clzll(uint64_t x) -{ - unsigned long r = 0; -# ifdef _WIN64 - _BitScanReverse64(&r, x); -# else - // Scan the high 32 bits. - if (_BitScanReverse(&r, static_cast(x >> 32))) - return 63 - (r + 32); - - // Scan the low 32 bits. - _BitScanReverse(&r, static_cast(x)); -# endif - - assert(x != 0); - // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, - // which the callers guarantee to not happen. -# pragma warning(suppress: 6102) - return 63 - r; -} -# define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n) -} -} -#endif - -namespace fmt -{ -namespace internal -{ -struct DummyInt -{ - int data[2]; - operator int() const - { - return 0; - } -}; -typedef std::numeric_limits FPUtil; - -// Dummy implementations of system functions such as signbit and ecvt called -// if the latter are not available. -inline DummyInt signbit(...) -{ - return DummyInt(); -} -inline DummyInt _ecvt_s(...) -{ - return DummyInt(); -} -inline DummyInt isinf(...) -{ - return DummyInt(); -} -inline DummyInt _finite(...) -{ - return DummyInt(); -} -inline DummyInt isnan(...) -{ - return DummyInt(); -} -inline DummyInt _isnan(...) -{ - return DummyInt(); -} - -// A helper function to suppress bogus "conditional expression is constant" -// warnings. -template -inline T const_check(T value) -{ - return value; -} -} -} // namespace fmt - -namespace std -{ -// Standard permits specialization of std::numeric_limits. This specialization -// is used to resolve ambiguity between isinf and std::isinf in glibc: -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891 -// and the same for isnan and signbit. -template <> -class numeric_limits: - public std::numeric_limits -{ -public: - // Portable version of isinf. - template - static bool isinfinity(T x) - { - using namespace fmt::internal; - // The resolution "priority" is: - // isinf macro > std::isinf > ::isinf > fmt::internal::isinf - if (const_check(sizeof(isinf(x)) == sizeof(bool) || - sizeof(isinf(x)) == sizeof(int))) - { - return isinf(x) != 0; - } - return !_finite(static_cast(x)); - } - - // Portable version of isnan. - template - static bool isnotanumber(T x) - { - using namespace fmt::internal; - if (const_check(sizeof(isnan(x)) == sizeof(bool) || - sizeof(isnan(x)) == sizeof(int))) - { - return isnan(x) != 0; - } - return _isnan(static_cast(x)) != 0; - } - - // Portable version of signbit. - static bool isnegative(double x) - { - using namespace fmt::internal; - if (const_check(sizeof(signbit(x)) == sizeof(bool) || - sizeof(signbit(x)) == sizeof(int))) - { - return signbit(x) != 0; - } - if (x < 0) return true; - if (!isnotanumber(x)) return false; - int dec = 0, sign = 0; - char buffer[2]; // The buffer size must be >= 2 or _ecvt_s will fail. - _ecvt_s(buffer, sizeof(buffer), x, 0, &dec, &sign); - return sign != 0; - } -}; -} // namespace std - -namespace fmt -{ - -// Fix the warning about long long on older versions of GCC -// that don't support the diagnostic pragma. -FMT_GCC_EXTENSION typedef long long LongLong; -FMT_GCC_EXTENSION typedef unsigned long long ULongLong; - -#if FMT_USE_RVALUE_REFERENCES -using std::move; -#endif - -template -class BasicWriter; - -typedef BasicWriter Writer; -typedef BasicWriter WWriter; - -template -class ArgFormatter; - -template -class BasicPrintfArgFormatter; - -template > -class BasicFormatter; - -/** -\rst -A string reference. It can be constructed from a C string or ``std::string``. - -You can use one of the following typedefs for common character types: - -+------------+-------------------------+ -| Type | Definition | -+============+=========================+ -| StringRef | BasicStringRef | -+------------+-------------------------+ -| WStringRef | BasicStringRef | -+------------+-------------------------+ - -This class is most useful as a parameter type to allow passing -different types of strings to a function, for example:: - -template -std::string format(StringRef format_str, const Args & ... args); - -format("{}", 42); -format(std::string("{}"), 42); -\endrst -*/ -template -class BasicStringRef -{ -private: - const Char *data_; - std::size_t size_; - -public: - /** Constructs a string reference object from a C string and a size. */ - BasicStringRef(const Char *s, std::size_t size): data_(s), size_(size) - {} - - /** - \rst - Constructs a string reference object from a C string computing - the size with ``std::char_traits::length``. - \endrst - */ - BasicStringRef(const Char *s) - : data_(s), size_(std::char_traits::length(s)) - {} - - /** - \rst - Constructs a string reference from an ``std::string`` object. - \endrst - */ - BasicStringRef(const std::basic_string &s) - : data_(s.c_str()), size_(s.size()) - {} - - /** - \rst - Converts a string reference to an ``std::string`` object. - \endrst - */ - std::basic_string to_string() const - { - return std::basic_string(data_, size_); - } - - /** Returns a pointer to the string data. */ - const Char *data() const - { - return data_; - } - - /** Returns the string size. */ - std::size_t size() const - { - return size_; - } - - // Lexicographically compare this string reference to other. - int compare(BasicStringRef other) const - { - std::size_t size = size_ < other.size_ ? size_ : other.size_; - int result = std::char_traits::compare(data_, other.data_, size); - if (result == 0) - result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1); - return result; - } - - friend bool operator==(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) == 0; - } - friend bool operator!=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) != 0; - } - friend bool operator<(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) < 0; - } - friend bool operator<=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) <= 0; - } - friend bool operator>(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) > 0; - } - friend bool operator>=(BasicStringRef lhs, BasicStringRef rhs) - { - return lhs.compare(rhs) >= 0; - } -}; - -typedef BasicStringRef StringRef; -typedef BasicStringRef WStringRef; - -/** -\rst -A reference to a null terminated string. It can be constructed from a C -string or ``std::string``. - -You can use one of the following typedefs for common character types: - -+-------------+--------------------------+ -| Type | Definition | -+=============+==========================+ -| CStringRef | BasicCStringRef | -+-------------+--------------------------+ -| WCStringRef | BasicCStringRef | -+-------------+--------------------------+ - -This class is most useful as a parameter type to allow passing -different types of strings to a function, for example:: - -template -std::string format(CStringRef format_str, const Args & ... args); - -format("{}", 42); -format(std::string("{}"), 42); -\endrst -*/ -template -class BasicCStringRef -{ -private: - const Char *data_; - -public: - /** Constructs a string reference object from a C string. */ - BasicCStringRef(const Char *s): data_(s) - {} - - /** - \rst - Constructs a string reference from an ``std::string`` object. - \endrst - */ - BasicCStringRef(const std::basic_string &s): data_(s.c_str()) - {} - - /** Returns the pointer to a C string. */ - const Char *c_str() const - { - return data_; - } -}; - -typedef BasicCStringRef CStringRef; -typedef BasicCStringRef WCStringRef; - -/** A formatting error such as invalid format string. */ -class FormatError: public std::runtime_error -{ -public: - explicit FormatError(CStringRef message) - : std::runtime_error(message.c_str()) - {} - FormatError(const FormatError &ferr): std::runtime_error(ferr) - {} - ~FormatError() FMT_DTOR_NOEXCEPT; -}; - -namespace internal -{ - -// MakeUnsigned::Type gives an unsigned type corresponding to integer type T. -template -struct MakeUnsigned -{ - typedef T Type; -}; - -#define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \ - template <> \ - struct MakeUnsigned { typedef U Type; } - -FMT_SPECIALIZE_MAKE_UNSIGNED(char, unsigned char); -FMT_SPECIALIZE_MAKE_UNSIGNED(signed char, unsigned char); -FMT_SPECIALIZE_MAKE_UNSIGNED(short, unsigned short); -FMT_SPECIALIZE_MAKE_UNSIGNED(int, unsigned); -FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long); -FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong); - -// Casts nonnegative integer to unsigned. -template -inline typename MakeUnsigned::Type to_unsigned(Int value) -{ - FMT_ASSERT(value >= 0, "negative value"); - return static_cast::Type>(value); -} - -// The number of characters to store in the MemoryBuffer object itself -// to avoid dynamic memory allocation. -enum -{ - INLINE_BUFFER_SIZE = 500 -}; - -#if FMT_SECURE_SCL -// Use checked iterator to avoid warnings on MSVC. -template -inline stdext::checked_array_iterator make_ptr(T *ptr, std::size_t size) -{ - return stdext::checked_array_iterator(ptr, size); -} -#else -template -inline T *make_ptr(T *ptr, std::size_t) -{ - return ptr; -} -#endif -} // namespace internal - -/** -\rst -A buffer supporting a subset of ``std::vector``'s operations. -\endrst -*/ -template -class Buffer -{ -private: - FMT_DISALLOW_COPY_AND_ASSIGN(Buffer); - -protected: - T *ptr_; - std::size_t size_; - std::size_t capacity_; - - Buffer(T *ptr = FMT_NULL, std::size_t capacity = 0) - : ptr_(ptr), size_(0), capacity_(capacity) - {} - - /** - \rst - Increases the buffer capacity to hold at least *size* elements updating - ``ptr_`` and ``capacity_``. - \endrst - */ - virtual void grow(std::size_t size) = 0; - -public: - virtual ~Buffer() - {} - - /** Returns the size of this buffer. */ - std::size_t size() const - { - return size_; - } - - /** Returns the capacity of this buffer. */ - std::size_t capacity() const - { - return capacity_; - } - - /** - Resizes the buffer. If T is a POD type new elements may not be initialized. - */ - void resize(std::size_t new_size) - { - if (new_size > capacity_) - grow(new_size); - size_ = new_size; - } - - /** - \rst - Reserves space to store at least *capacity* elements. - \endrst - */ - void reserve(std::size_t capacity) - { - if (capacity > capacity_) - grow(capacity); - } - - void clear() FMT_NOEXCEPT - { - size_ = 0; - } - - void push_back(const T &value) - { - if (size_ == capacity_) - grow(size_ + 1); - ptr_[size_++] = value; - } - - /** Appends data to the end of the buffer. */ - template - void append(const U *begin, const U *end); - - T &operator[](std::size_t index) - { - return ptr_[index]; - } - const T &operator[](std::size_t index) const - { - return ptr_[index]; - } -}; - -template -template -void Buffer::append(const U *begin, const U *end) -{ - std::size_t new_size = size_ + internal::to_unsigned(end - begin); - if (new_size > capacity_) - grow(new_size); - std::uninitialized_copy(begin, end, - internal::make_ptr(ptr_, capacity_) + size_); - size_ = new_size; -} - -namespace internal -{ - -// A memory buffer for trivially copyable/constructible types with the first -// SIZE elements stored in the object itself. -template > -class MemoryBuffer: private Allocator, public Buffer -{ -private: - T data_[SIZE]; - - // Deallocate memory allocated by the buffer. - void deallocate() - { - if (this->ptr_ != data_) Allocator::deallocate(this->ptr_, this->capacity_); - } - -protected: - void grow(std::size_t size) FMT_OVERRIDE; - -public: - explicit MemoryBuffer(const Allocator &alloc = Allocator()) - : Allocator(alloc), Buffer(data_, SIZE) - {} - ~MemoryBuffer() - { - deallocate(); - } - -#if FMT_USE_RVALUE_REFERENCES -private: - // Move data from other to this buffer. - void move(MemoryBuffer &other) - { - Allocator &this_alloc = *this, &other_alloc = other; - this_alloc = std::move(other_alloc); - this->size_ = other.size_; - this->capacity_ = other.capacity_; - if (other.ptr_ == other.data_) - { - this->ptr_ = data_; - std::uninitialized_copy(other.data_, other.data_ + this->size_, - make_ptr(data_, this->capacity_)); - } - else - { - this->ptr_ = other.ptr_; - // Set pointer to the inline array so that delete is not called - // when deallocating. - other.ptr_ = other.data_; - } - } - -public: - MemoryBuffer(MemoryBuffer &&other) - { - move(other); - } - - MemoryBuffer &operator=(MemoryBuffer &&other) - { - assert(this != &other); - deallocate(); - move(other); - return *this; - } -#endif - - // Returns a copy of the allocator associated with this buffer. - Allocator get_allocator() const - { - return *this; - } -}; - -template -void MemoryBuffer::grow(std::size_t size) -{ - std::size_t new_capacity = this->capacity_ + this->capacity_ / 2; - if (size > new_capacity) - new_capacity = size; - T *new_ptr = this->allocate(new_capacity, FMT_NULL); - // The following code doesn't throw, so the raw pointer above doesn't leak. - std::uninitialized_copy(this->ptr_, this->ptr_ + this->size_, - make_ptr(new_ptr, new_capacity)); - std::size_t old_capacity = this->capacity_; - T *old_ptr = this->ptr_; - this->capacity_ = new_capacity; - this->ptr_ = new_ptr; - // deallocate may throw (at least in principle), but it doesn't matter since - // the buffer already uses the new storage and will deallocate it in case - // of exception. - if (old_ptr != data_) - Allocator::deallocate(old_ptr, old_capacity); -} - -// A fixed-size buffer. -template -class FixedBuffer: public fmt::Buffer -{ -public: - FixedBuffer(Char *array, std::size_t size): fmt::Buffer(array, size) - {} - -protected: - FMT_API void grow(std::size_t size) FMT_OVERRIDE; -}; - -template -class BasicCharTraits -{ -public: -#if FMT_SECURE_SCL - typedef stdext::checked_array_iterator CharPtr; -#else - typedef Char *CharPtr; -#endif - static Char cast(int value) - { - return static_cast(value); - } -}; - -template -class CharTraits; - -template <> -class CharTraits: public BasicCharTraits -{ -private: - // Conversion from wchar_t to char is not allowed. - static char convert(wchar_t); - -public: - static char convert(char value) - { - return value; - } - - // Formats a floating-point number. - template - FMT_API static int format_float(char *buffer, std::size_t size, - const char *format, unsigned width, int precision, T value); -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template int CharTraits::format_float -(char *buffer, std::size_t size, - const char* format, unsigned width, int precision, double value); -extern template int CharTraits::format_float -(char *buffer, std::size_t size, - const char* format, unsigned width, int precision, long double value); -#endif - -template <> -class CharTraits: public BasicCharTraits -{ -public: - static wchar_t convert(char value) - { - return value; - } - static wchar_t convert(wchar_t value) - { - return value; - } - - template - FMT_API static int format_float(wchar_t *buffer, std::size_t size, - const wchar_t *format, unsigned width, int precision, T value); -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template int CharTraits::format_float -(wchar_t *buffer, std::size_t size, - const wchar_t* format, unsigned width, int precision, double value); -extern template int CharTraits::format_float -(wchar_t *buffer, std::size_t size, - const wchar_t* format, unsigned width, int precision, long double value); -#endif - -// Checks if a number is negative - used to avoid warnings. -template -struct SignChecker -{ - template - static bool is_negative(T value) - { - return value < 0; - } -}; - -template <> -struct SignChecker -{ - template - static bool is_negative(T) - { - return false; - } -}; - -// Returns true if value is negative, false otherwise. -// Same as (value < 0) but doesn't produce warnings if T is an unsigned type. -template -inline bool is_negative(T value) -{ - return SignChecker::is_signed>::is_negative(value); -} - -// Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise. -template -struct TypeSelector -{ - typedef uint32_t Type; -}; - -template <> -struct TypeSelector -{ - typedef uint64_t Type; -}; - -template -struct IntTraits -{ - // Smallest of uint32_t and uint64_t that is large enough to represent - // all values of T. - typedef typename - TypeSelector::digits <= 32>::Type MainType; -}; - -FMT_API void report_unknown_type(char code, const char *type); - -// Static data is placed in this class template to allow header-only -// configuration. -template -struct FMT_API BasicData -{ - static const uint32_t POWERS_OF_10_32[]; - static const uint64_t POWERS_OF_10_64[]; - static const char DIGITS[]; -}; - -#if FMT_USE_EXTERN_TEMPLATES -extern template struct BasicData; -#endif - -typedef BasicData<> Data; - -#ifdef FMT_BUILTIN_CLZLL -// Returns the number of decimal digits in n. Leading zeros are not counted -// except for n == 0 in which case count_digits returns 1. -inline unsigned count_digits(uint64_t n) -{ - // Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - // and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits. - int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12; - return to_unsigned(t) - (n < Data::POWERS_OF_10_64[t]) + 1; -} -#else -// Fallback version of count_digits used when __builtin_clz is not available. -inline unsigned count_digits(uint64_t n) -{ - unsigned count = 1; - for (;;) - { - // Integer division is slow so do it for a group of four digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - if (n < 10) return count; - if (n < 100) return count + 1; - if (n < 1000) return count + 2; - if (n < 10000) return count + 3; - n /= 10000u; - count += 4; - } -} -#endif - -#ifdef FMT_BUILTIN_CLZ -// Optional version of count_digits for better performance on 32-bit platforms. -inline unsigned count_digits(uint32_t n) -{ - int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12; - return to_unsigned(t) - (n < Data::POWERS_OF_10_32[t]) + 1; -} -#endif - -// A functor that doesn't add a thousands separator. -struct NoThousandsSep -{ - template - void operator()(Char *) - {} -}; - -// A functor that adds a thousands separator. -class ThousandsSep -{ -private: - fmt::StringRef sep_; - - // Index of a decimal digit with the least significant digit having index 0. - unsigned digit_index_; - -public: - explicit ThousandsSep(fmt::StringRef sep): sep_(sep), digit_index_(0) - {} - - template - void operator()(Char *&buffer) - { - if (++digit_index_ % 3 != 0) - return; - buffer -= sep_.size(); - std::uninitialized_copy(sep_.data(), sep_.data() + sep_.size(), - internal::make_ptr(buffer, sep_.size())); - } -}; - -// Formats a decimal unsigned integer value writing into buffer. -// thousands_sep is a functor that is called after writing each char to -// add a thousands separator if necessary. -template -inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, - ThousandsSep thousands_sep) -{ - buffer += num_digits; - while (value >= 100) - { - // Integer division is slow so do it for a group of two digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - unsigned index = static_cast((value % 100) * 2); - value /= 100; - *--buffer = Data::DIGITS[index + 1]; - thousands_sep(buffer); - *--buffer = Data::DIGITS[index]; - thousands_sep(buffer); - } - if (value < 10) - { - *--buffer = static_cast('0' + value); - return; - } - unsigned index = static_cast(value * 2); - *--buffer = Data::DIGITS[index + 1]; - thousands_sep(buffer); - *--buffer = Data::DIGITS[index]; -} - -template -inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) -{ - format_decimal(buffer, value, num_digits, NoThousandsSep()); - return; -} - -#ifndef _WIN32 -# define FMT_USE_WINDOWS_H 0 -#elif !defined(FMT_USE_WINDOWS_H) -# define FMT_USE_WINDOWS_H 1 -#endif - -// Define FMT_USE_WINDOWS_H to 0 to disable use of windows.h. -// All the functionality that relies on it will be disabled too. -#if FMT_USE_WINDOWS_H -// A converter from UTF-8 to UTF-16. -// It is only provided for Windows since other systems support UTF-8 natively. -class UTF8ToUTF16 -{ -private: - MemoryBuffer buffer_; - -public: - FMT_API explicit UTF8ToUTF16(StringRef s); - operator WStringRef() const - { - return WStringRef(&buffer_[0], size()); - } - size_t size() const - { - return buffer_.size() - 1; - } - const wchar_t *c_str() const - { - return &buffer_[0]; - } - std::wstring str() const - { - return std::wstring(&buffer_[0], size()); - } -}; - -// A converter from UTF-16 to UTF-8. -// It is only provided for Windows since other systems support UTF-8 natively. -class UTF16ToUTF8 -{ -private: - MemoryBuffer buffer_; - -public: - UTF16ToUTF8() - {} - FMT_API explicit UTF16ToUTF8(WStringRef s); - operator StringRef() const - { - return StringRef(&buffer_[0], size()); - } - size_t size() const - { - return buffer_.size() - 1; - } - const char *c_str() const - { - return &buffer_[0]; - } - std::string str() const - { - return std::string(&buffer_[0], size()); - } - - // Performs conversion returning a system error code instead of - // throwing exception on conversion error. This method may still throw - // in case of memory allocation error. - FMT_API int convert(WStringRef s); -}; - -FMT_API void format_windows_error(fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT; -#endif - -// A formatting argument value. -struct Value -{ - template - struct StringValue - { - const Char *value; - std::size_t size; - }; - - typedef void(*FormatFunc)( - void *formatter, const void *arg, void *format_str_ptr); - - struct CustomValue - { - const void *value; - FormatFunc format; - }; - - union - { - int int_value; - unsigned uint_value; - LongLong long_long_value; - ULongLong ulong_long_value; - double double_value; - long double long_double_value; - const void *pointer; - StringValue string; - StringValue sstring; - StringValue ustring; - StringValue wstring; - CustomValue custom; - }; - - enum Type - { - NONE, NAMED_ARG, - // Integer types should go first, - INT, UINT, LONG_LONG, ULONG_LONG, BOOL, CHAR, LAST_INTEGER_TYPE = CHAR, - // followed by floating-point types. - DOUBLE, LONG_DOUBLE, LAST_NUMERIC_TYPE = LONG_DOUBLE, - CSTRING, STRING, WSTRING, POINTER, CUSTOM - }; -}; - -// A formatting argument. It is a trivially copyable/constructible type to -// allow storage in internal::MemoryBuffer. -struct Arg: Value -{ - Type type; -}; - -template -struct NamedArg; -template -struct NamedArgWithType; - -template -struct Null -{}; - -// A helper class template to enable or disable overloads taking wide -// characters and strings in MakeValue. -template -struct WCharHelper -{ - typedef Null Supported; - typedef T Unsupported; -}; - -template -struct WCharHelper -{ - typedef T Supported; - typedef Null Unsupported; -}; - -typedef char Yes[1]; -typedef char No[2]; - -template -T &get(); - -// These are non-members to workaround an overload resolution bug in bcc32. -Yes &convert(fmt::ULongLong); -No &convert(...); - -template -struct ConvertToIntImpl -{ - enum - { - value = ENABLE_CONVERSION - }; -}; - -template -struct ConvertToIntImpl2 -{ - enum - { - value = false - }; -}; - -template -struct ConvertToIntImpl2 -{ - enum - { - // Don't convert numeric types. - value = ConvertToIntImpl::is_specialized>::value - }; -}; - -template -struct ConvertToInt -{ - enum - { - enable_conversion = sizeof(fmt::internal::convert(get())) == sizeof(Yes) - }; - enum - { - value = ConvertToIntImpl2::value - }; -}; - -#define FMT_DISABLE_CONVERSION_TO_INT(Type) \ - template <> \ - struct ConvertToInt { enum { value = 0 }; } - -// Silence warnings about convering float to int. -FMT_DISABLE_CONVERSION_TO_INT(float); -FMT_DISABLE_CONVERSION_TO_INT(double); -FMT_DISABLE_CONVERSION_TO_INT(long double); - -template -struct EnableIf -{}; - -template -struct EnableIf -{ - typedef T type; -}; - -template -struct Conditional -{ - typedef T type; -}; - -template -struct Conditional -{ - typedef F type; -}; - -// For bcc32 which doesn't understand ! in template arguments. -template -struct Not -{ - enum - { - value = 0 - }; -}; - -template <> -struct Not -{ - enum - { - value = 1 - }; -}; - -template -struct False -{ - enum - { - value = 0 - }; -}; - -template struct LConvCheck -{ - LConvCheck(int) - {} -}; - -// Returns the thousands separator for the current locale. -// We check if ``lconv`` contains ``thousands_sep`` because on Android -// ``lconv`` is stubbed as an empty struct. -template -inline StringRef thousands_sep( - LConv *lc, LConvCheck = 0) -{ - return lc->thousands_sep; -} - -inline fmt::StringRef thousands_sep(...) -{ - return ""; -} - -#define FMT_CONCAT(a, b) a##b - -#if FMT_GCC_VERSION >= 303 -# define FMT_UNUSED __attribute__((unused)) -#else -# define FMT_UNUSED -#endif - -#ifndef FMT_USE_STATIC_ASSERT -# define FMT_USE_STATIC_ASSERT 0 -#endif - -#if FMT_USE_STATIC_ASSERT || FMT_HAS_FEATURE(cxx_static_assert) || \ - (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600 -# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message) -#else -# define FMT_CONCAT_(a, b) FMT_CONCAT(a, b) -# define FMT_STATIC_ASSERT(cond, message) \ - typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED -#endif - -template -void format_arg(Formatter &, const Char *, const T &) -{ - FMT_STATIC_ASSERT(False::value, - "Cannot format argument. To enable the use of ostream " - "operator<< include fmt/ostream.h. Otherwise provide " - "an overload of format_arg."); -} - -// Makes an Arg object from any type. -template -class MakeValue: public Arg -{ -public: - typedef typename Formatter::Char Char; - -private: - // The following two methods are private to disallow formatting of - // arbitrary pointers. If you want to output a pointer cast it to - // "void *" or "const void *". In particular, this forbids formatting - // of "[const] volatile char *" which is printed as bool by iostreams. - // Do not implement! - template - MakeValue(const T *value); - template - MakeValue(T *value); - - // The following methods are private to disallow formatting of wide - // characters and strings into narrow strings as in - // fmt::format("{}", L"test"); - // To fix this, use a wide format string: fmt::format(L"{}", L"test"). -#if !FMT_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED) - MakeValue(typename WCharHelper::Unsupported); -#endif - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - MakeValue(typename WCharHelper::Unsupported); - - void set_string(StringRef str) - { - string.value = str.data(); - string.size = str.size(); - } - - void set_string(WStringRef str) - { - wstring.value = str.data(); - wstring.size = str.size(); - } - - // Formats an argument of a custom type, such as a user-defined class. - template - static void format_custom_arg( - void *formatter, const void *arg, void *format_str_ptr) - { - format_arg(*static_cast(formatter), - *static_cast(format_str_ptr), - *static_cast(arg)); - } - -public: - MakeValue() - {} - -#define FMT_MAKE_VALUE_(Type, field, TYPE, rhs) \ - MakeValue(Type value) { field = rhs; } \ - static uint64_t type(Type) { return Arg::TYPE; } - -#define FMT_MAKE_VALUE(Type, field, TYPE) \ - FMT_MAKE_VALUE_(Type, field, TYPE, value) - - FMT_MAKE_VALUE(bool, int_value, BOOL) - FMT_MAKE_VALUE(short, int_value, INT) - FMT_MAKE_VALUE(unsigned short, uint_value, UINT) - FMT_MAKE_VALUE(int, int_value, INT) - FMT_MAKE_VALUE(unsigned, uint_value, UINT) - - MakeValue(long value) - { - // To minimize the number of types we need to deal with, long is - // translated either to int or to long long depending on its size. - if (const_check(sizeof(long) == sizeof(int))) - int_value = static_cast(value); - else - long_long_value = value; - } - static uint64_t type(long) - { - return sizeof(long) == sizeof(int) ? Arg::INT : Arg::LONG_LONG; - } - - MakeValue(unsigned long value) - { - if (const_check(sizeof(unsigned long) == sizeof(unsigned))) - uint_value = static_cast(value); - else - ulong_long_value = value; - } - static uint64_t type(unsigned long) - { - return sizeof(unsigned long) == sizeof(unsigned) ? - Arg::UINT : Arg::ULONG_LONG; - } - - FMT_MAKE_VALUE(LongLong, long_long_value, LONG_LONG) - FMT_MAKE_VALUE(ULongLong, ulong_long_value, ULONG_LONG) - FMT_MAKE_VALUE(float, double_value, DOUBLE) - FMT_MAKE_VALUE(double, double_value, DOUBLE) - FMT_MAKE_VALUE(long double, long_double_value, LONG_DOUBLE) - FMT_MAKE_VALUE(signed char, int_value, INT) - FMT_MAKE_VALUE(unsigned char, uint_value, UINT) - FMT_MAKE_VALUE(char, int_value, CHAR) - -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) - MakeValue(typename WCharHelper::Supported value) - { - int_value = value; - } - static uint64_t type(wchar_t) - { - return Arg::CHAR; - } -#endif - -#define FMT_MAKE_STR_VALUE(Type, TYPE) \ - MakeValue(Type value) { set_string(value); } \ - static uint64_t type(Type) { return Arg::TYPE; } - - FMT_MAKE_VALUE(char *, string.value, CSTRING) - FMT_MAKE_VALUE(const char *, string.value, CSTRING) - FMT_MAKE_VALUE(signed char *, sstring.value, CSTRING) - FMT_MAKE_VALUE(const signed char *, sstring.value, CSTRING) - FMT_MAKE_VALUE(unsigned char *, ustring.value, CSTRING) - FMT_MAKE_VALUE(const unsigned char *, ustring.value, CSTRING) - FMT_MAKE_STR_VALUE(const std::string &, STRING) - FMT_MAKE_STR_VALUE(StringRef, STRING) - FMT_MAKE_VALUE_(CStringRef, string.value, CSTRING, value.c_str()) - -#define FMT_MAKE_WSTR_VALUE(Type, TYPE) \ - MakeValue(typename WCharHelper::Supported value) { \ - set_string(value); \ - } \ - static uint64_t type(Type) { return Arg::TYPE; } - - FMT_MAKE_WSTR_VALUE(wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const std::wstring &, WSTRING) - FMT_MAKE_WSTR_VALUE(WStringRef, WSTRING) - - FMT_MAKE_VALUE(void *, pointer, POINTER) - FMT_MAKE_VALUE(const void *, pointer, POINTER) - - template - MakeValue(const T &value, - typename EnableIf::value>::value, int>::type = 0) - { - custom.value = &value; - custom.format = &format_custom_arg; - } - - template - MakeValue(const T &value, - typename EnableIf::value, int>::type = 0) - { - int_value = value; - } - - template - static uint64_t type(const T &) - { - return ConvertToInt::value ? Arg::INT : Arg::CUSTOM; - } - - // Additional template param `Char_` is needed here because make_type always - // uses char. - template - MakeValue(const NamedArg &value) - { - pointer = &value; - } - template - MakeValue(const NamedArgWithType &value) - { - pointer = &value; - } - - template - static uint64_t type(const NamedArg &) - { - return Arg::NAMED_ARG; - } - template - static uint64_t type(const NamedArgWithType &) - { - return Arg::NAMED_ARG; - } -}; - -template -class MakeArg: public Arg -{ -public: - MakeArg() - { - type = Arg::NONE; - } - - template - MakeArg(const T &value) - : Arg(MakeValue(value)) - { - type = static_cast(MakeValue::type(value)); - } -}; - -template -struct NamedArg: Arg -{ - BasicStringRef name; - - template - NamedArg(BasicStringRef argname, const T &value) - : Arg(MakeArg< BasicFormatter >(value)), name(argname) - {} -}; - -template -struct NamedArgWithType: NamedArg -{ - NamedArgWithType(BasicStringRef argname, const T &value) - : NamedArg(argname, value) - {} -}; - -class RuntimeError: public std::runtime_error -{ -protected: - RuntimeError(): std::runtime_error("") - {} - RuntimeError(const RuntimeError &rerr): std::runtime_error(rerr) - {} - ~RuntimeError() FMT_DTOR_NOEXCEPT; -}; - -template -class ArgMap; -} // namespace internal - -/** An argument list. */ -class ArgList -{ -private: - // To reduce compiled code size per formatting function call, types of first - // MAX_PACKED_ARGS arguments are passed in the types_ field. - uint64_t types_; - union - { - // If the number of arguments is less than MAX_PACKED_ARGS, the argument - // values are stored in values_, otherwise they are stored in args_. - // This is done to reduce compiled code size as storing larger objects - // may require more code (at least on x86-64) even if the same amount of - // data is actually copied to stack. It saves ~10% on the bloat test. - const internal::Value *values_; - const internal::Arg *args_; - }; - - internal::Arg::Type type(unsigned index) const - { - return type(types_, index); - } - - template - friend class internal::ArgMap; - -public: - // Maximum number of arguments with packed types. - enum - { - MAX_PACKED_ARGS = 16 - }; - - ArgList(): types_(0) - {} - - ArgList(ULongLong types, const internal::Value *values) - : types_(types), values_(values) - {} - ArgList(ULongLong types, const internal::Arg *args) - : types_(types), args_(args) - {} - - uint64_t types() const - { - return types_; - } - - /** Returns the argument at specified index. */ - internal::Arg operator[](unsigned index) const - { - using internal::Arg; - Arg arg; - bool use_values = type(MAX_PACKED_ARGS - 1) == Arg::NONE; - if (index < MAX_PACKED_ARGS) - { - Arg::Type arg_type = type(index); - internal::Value &val = arg; - if (arg_type != Arg::NONE) - val = use_values ? values_[index] : args_[index]; - arg.type = arg_type; - return arg; - } - if (use_values) - { - // The index is greater than the number of arguments that can be stored - // in values, so return a "none" argument. - arg.type = Arg::NONE; - return arg; - } - for (unsigned i = MAX_PACKED_ARGS; i <= index; ++i) - { - if (args_[i].type == Arg::NONE) - return args_[i]; - } - return args_[index]; - } - - static internal::Arg::Type type(uint64_t types, unsigned index) - { - unsigned shift = index * 4; - uint64_t mask = 0xf; - return static_cast( - (types & (mask << shift)) >> shift); - } -}; - -#define FMT_DISPATCH(call) static_cast(this)->call - -/** -\rst -An argument visitor based on the `curiously recurring template pattern -`_. - -To use `~fmt::ArgVisitor` define a subclass that implements some or all of the -visit methods with the same signatures as the methods in `~fmt::ArgVisitor`, -for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. Then calling -`~fmt::ArgVisitor::visit` for some argument will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::ArgVisitor` will be called. - -**Example**:: - -class MyArgVisitor : public fmt::ArgVisitor { -public: -void visit_int(int value) { fmt::print("{}", value); } -void visit_double(double value) { fmt::print("{}", value ); } -}; -\endrst -*/ -template -class ArgVisitor -{ -private: - typedef internal::Arg Arg; - -public: - void report_unhandled_arg() - {} - - Result visit_unhandled_arg() - { - FMT_DISPATCH(report_unhandled_arg()); - return Result(); - } - - /** Visits an ``int`` argument. **/ - Result visit_int(int value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``long long`` argument. **/ - Result visit_long_long(LongLong value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an ``unsigned`` argument. **/ - Result visit_uint(unsigned value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an ``unsigned long long`` argument. **/ - Result visit_ulong_long(ULongLong value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``bool`` argument. **/ - Result visit_bool(bool value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits a ``char`` or ``wchar_t`` argument. **/ - Result visit_char(int value) - { - return FMT_DISPATCH(visit_any_int(value)); - } - - /** Visits an argument of any integral type. **/ - template - Result visit_any_int(T) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a ``double`` argument. **/ - Result visit_double(double value) - { - return FMT_DISPATCH(visit_any_double(value)); - } - - /** Visits a ``long double`` argument. **/ - Result visit_long_double(long double value) - { - return FMT_DISPATCH(visit_any_double(value)); - } - - /** Visits a ``double`` or ``long double`` argument. **/ - template - Result visit_any_double(T) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a null-terminated C string (``const char *``) argument. **/ - Result visit_cstring(const char *) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a string argument. **/ - Result visit_string(Arg::StringValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a wide string argument. **/ - Result visit_wstring(Arg::StringValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits a pointer argument. **/ - Result visit_pointer(const void *) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** Visits an argument of a custom (user-defined) type. **/ - Result visit_custom(Arg::CustomValue) - { - return FMT_DISPATCH(visit_unhandled_arg()); - } - - /** - \rst - Visits an argument dispatching to the appropriate visit method based on - the argument type. For example, if the argument type is ``double`` then - the `~fmt::ArgVisitor::visit_double()` method of the *Impl* class will be - called. - \endrst - */ - Result visit(const Arg &arg) - { - switch (arg.type) - { - case Arg::NONE: - case Arg::NAMED_ARG: - FMT_ASSERT(false, "invalid argument type"); - break; - case Arg::INT: - return FMT_DISPATCH(visit_int(arg.int_value)); - case Arg::UINT: - return FMT_DISPATCH(visit_uint(arg.uint_value)); - case Arg::LONG_LONG: - return FMT_DISPATCH(visit_long_long(arg.long_long_value)); - case Arg::ULONG_LONG: - return FMT_DISPATCH(visit_ulong_long(arg.ulong_long_value)); - case Arg::BOOL: - return FMT_DISPATCH(visit_bool(arg.int_value != 0)); - case Arg::CHAR: - return FMT_DISPATCH(visit_char(arg.int_value)); - case Arg::DOUBLE: - return FMT_DISPATCH(visit_double(arg.double_value)); - case Arg::LONG_DOUBLE: - return FMT_DISPATCH(visit_long_double(arg.long_double_value)); - case Arg::CSTRING: - return FMT_DISPATCH(visit_cstring(arg.string.value)); - case Arg::STRING: - return FMT_DISPATCH(visit_string(arg.string)); - case Arg::WSTRING: - return FMT_DISPATCH(visit_wstring(arg.wstring)); - case Arg::POINTER: - return FMT_DISPATCH(visit_pointer(arg.pointer)); - case Arg::CUSTOM: - return FMT_DISPATCH(visit_custom(arg.custom)); - } - return Result(); - } -}; - -enum Alignment -{ - ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ALIGN_NUMERIC -}; - -// Flags. -enum -{ - SIGN_FLAG = 1, PLUS_FLAG = 2, MINUS_FLAG = 4, HASH_FLAG = 8, - CHAR_FLAG = 0x10 // Argument has char type - used in error reporting. -}; - -// An empty format specifier. -struct EmptySpec -{}; - -// A type specifier. -template -struct TypeSpec: EmptySpec -{ - Alignment align() const - { - return ALIGN_DEFAULT; - } - unsigned width() const - { - return 0; - } - int precision() const - { - return -1; - } - bool flag(unsigned) const - { - return false; - } - char type() const - { - return TYPE; - } - char fill() const - { - return ' '; - } -}; - -// A width specifier. -struct WidthSpec -{ - unsigned width_; - // Fill is always wchar_t and cast to char if necessary to avoid having - // two specialization of WidthSpec and its subclasses. - wchar_t fill_; - - WidthSpec(unsigned width, wchar_t fill): width_(width), fill_(fill) - {} - - unsigned width() const - { - return width_; - } - wchar_t fill() const - { - return fill_; - } -}; - -// An alignment specifier. -struct AlignSpec: WidthSpec -{ - Alignment align_; - - AlignSpec(unsigned width, wchar_t fill, Alignment align = ALIGN_DEFAULT) - : WidthSpec(width, fill), align_(align) - {} - - Alignment align() const - { - return align_; - } - - int precision() const - { - return -1; - } -}; - -// An alignment and type specifier. -template -struct AlignTypeSpec: AlignSpec -{ - AlignTypeSpec(unsigned width, wchar_t fill): AlignSpec(width, fill) - {} - - bool flag(unsigned) const - { - return false; - } - char type() const - { - return TYPE; - } -}; - -// A full format specifier. -struct FormatSpec: AlignSpec -{ - unsigned flags_; - int precision_; - char type_; - - FormatSpec( - unsigned width = 0, char type = 0, wchar_t fill = ' ') - : AlignSpec(width, fill), flags_(0), precision_(-1), type_(type) - {} - - bool flag(unsigned f) const - { - return (flags_ & f) != 0; - } - int precision() const - { - return precision_; - } - char type() const - { - return type_; - } -}; - -// An integer format specifier. -template , typename Char = char> -class IntFormatSpec: public SpecT -{ -private: - T value_; - -public: - IntFormatSpec(T val, const SpecT &spec = SpecT()) - : SpecT(spec), value_(val) - {} - - T value() const - { - return value_; - } -}; - -// A string format specifier. -template -class StrFormatSpec: public AlignSpec -{ -private: - const Char *str_; - -public: - template - StrFormatSpec(const Char *str, unsigned width, FillChar fill) - : AlignSpec(width, fill), str_(str) - { - internal::CharTraits::convert(FillChar()); - } - - const Char *str() const - { - return str_; - } -}; - -/** -Returns an integer format specifier to format the value in base 2. -*/ -IntFormatSpec > bin(int value); - -/** -Returns an integer format specifier to format the value in base 8. -*/ -IntFormatSpec > oct(int value); - -/** -Returns an integer format specifier to format the value in base 16 using -lower-case letters for the digits above 9. -*/ -IntFormatSpec > hex(int value); - -/** -Returns an integer formatter format specifier to format in base 16 using -upper-case letters for the digits above 9. -*/ -IntFormatSpec > hexu(int value); - -/** -\rst -Returns an integer format specifier to pad the formatted argument with the -fill character to the specified width using the default (right) numeric -alignment. - -**Example**:: - -MemoryWriter out; -out << pad(hex(0xcafe), 8, '0'); -// out.str() == "0000cafe" - -\endrst -*/ -template -IntFormatSpec, Char> pad( - int value, unsigned width, Char fill = ' '); - -#define FMT_DEFINE_INT_FORMATTERS(TYPE) \ -inline IntFormatSpec > bin(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'b'>()); \ -} \ - \ -inline IntFormatSpec > oct(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'o'>()); \ -} \ - \ -inline IntFormatSpec > hex(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'x'>()); \ -} \ - \ -inline IntFormatSpec > hexu(TYPE value) { \ - return IntFormatSpec >(value, TypeSpec<'X'>()); \ -} \ - \ -template \ -inline IntFormatSpec > pad( \ - IntFormatSpec > f, unsigned width) { \ - return IntFormatSpec >( \ - f.value(), AlignTypeSpec(width, ' ')); \ -} \ - \ -/* For compatibility with older compilers we provide two overloads for pad, */ \ -/* one that takes a fill character and one that doesn't. In the future this */ \ -/* can be replaced with one overload making the template argument Char */ \ -/* default to char (C++11). */ \ -template \ -inline IntFormatSpec, Char> pad( \ - IntFormatSpec, Char> f, \ - unsigned width, Char fill) { \ - return IntFormatSpec, Char>( \ - f.value(), AlignTypeSpec(width, fill)); \ -} \ - \ -inline IntFormatSpec > pad( \ - TYPE value, unsigned width) { \ - return IntFormatSpec >( \ - value, AlignTypeSpec<0>(width, ' ')); \ -} \ - \ -template \ -inline IntFormatSpec, Char> pad( \ - TYPE value, unsigned width, Char fill) { \ - return IntFormatSpec, Char>( \ - value, AlignTypeSpec<0>(width, fill)); \ -} - -FMT_DEFINE_INT_FORMATTERS(int) -FMT_DEFINE_INT_FORMATTERS(long) -FMT_DEFINE_INT_FORMATTERS(unsigned) -FMT_DEFINE_INT_FORMATTERS(unsigned long) -FMT_DEFINE_INT_FORMATTERS(LongLong) -FMT_DEFINE_INT_FORMATTERS(ULongLong) - -/** -\rst -Returns a string formatter that pads the formatted argument with the fill -character to the specified width using the default (left) string alignment. - -**Example**:: - -std::string s = str(MemoryWriter() << pad("abc", 8)); -// s == "abc " - -\endrst -*/ -template -inline StrFormatSpec pad( - const Char *str, unsigned width, Char fill = ' ') -{ - return StrFormatSpec(str, width, fill); -} - -inline StrFormatSpec pad( - const wchar_t *str, unsigned width, char fill = ' ') -{ - return StrFormatSpec(str, width, fill); -} - -namespace internal -{ - -template -class ArgMap -{ -private: - typedef std::vector< - std::pair, internal::Arg> > MapType; - typedef typename MapType::value_type Pair; - - MapType map_; - -public: - FMT_API void init(const ArgList &args); - - const internal::Arg *find(const fmt::BasicStringRef &name) const - { - // The list is unsorted, so just return the first matching name. - for (typename MapType::const_iterator it = map_.begin(), end = map_.end(); - it != end; ++it) - { - if (it->first == name) - return &it->second; - } - return FMT_NULL; - } -}; - -template -class ArgFormatterBase: public ArgVisitor -{ -private: - BasicWriter &writer_; - FormatSpec &spec_; - - FMT_DISALLOW_COPY_AND_ASSIGN(ArgFormatterBase); - - void write_pointer(const void *p) - { - spec_.flags_ = HASH_FLAG; - spec_.type_ = 'x'; - writer_.write_int(reinterpret_cast(p), spec_); - } - -protected: - BasicWriter &writer() - { - return writer_; - } - FormatSpec &spec() - { - return spec_; - } - - void write(bool value) - { - const char *str_value = value ? "true" : "false"; - Arg::StringValue str = { str_value, std::strlen(str_value) }; - writer_.write_str(str, spec_); - } - - void write(const char *value) - { - Arg::StringValue str = { value, value ? std::strlen(value) : 0 }; - writer_.write_str(str, spec_); - } - -public: - ArgFormatterBase(BasicWriter &w, FormatSpec &s) - : writer_(w), spec_(s) - {} - - template - void visit_any_int(T value) - { - writer_.write_int(value, spec_); - } - - template - void visit_any_double(T value) - { - writer_.write_double(value, spec_); - } - - void visit_bool(bool value) - { - if (spec_.type_) - { - visit_any_int(value); - return; - } - write(value); - } - - void visit_char(int value) - { - if (spec_.type_ && spec_.type_ != 'c') - { - spec_.flags_ |= CHAR_FLAG; - writer_.write_int(value, spec_); - return; - } - if (spec_.align_ == ALIGN_NUMERIC || spec_.flags_ != 0) - FMT_THROW(FormatError("invalid format specifier for char")); - typedef typename BasicWriter::CharPtr CharPtr; - Char fill = internal::CharTraits::cast(spec_.fill()); - CharPtr out = CharPtr(); - const unsigned CHAR_SIZE = 1; - if (spec_.width_ > CHAR_SIZE) - { - out = writer_.grow_buffer(spec_.width_); - if (spec_.align_ == ALIGN_RIGHT) - { - std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill); - out += spec_.width_ - CHAR_SIZE; - } - else if (spec_.align_ == ALIGN_CENTER) - { - out = writer_.fill_padding(out, spec_.width_, - internal::const_check(CHAR_SIZE), fill); - } - else - { - std::uninitialized_fill_n(out + CHAR_SIZE, - spec_.width_ - CHAR_SIZE, fill); - } - } - else - { - out = writer_.grow_buffer(CHAR_SIZE); - } - *out = internal::CharTraits::cast(value); - } - - void visit_cstring(const char *value) - { - if (spec_.type_ == 'p') - return write_pointer(value); - write(value); - } - - void visit_string(Arg::StringValue value) - { - writer_.write_str(value, spec_); - } - - using ArgVisitor::visit_wstring; - - void visit_wstring(Arg::StringValue value) - { - writer_.write_str(value, spec_); - } - - void visit_pointer(const void *value) - { - if (spec_.type_ && spec_.type_ != 'p') - report_unknown_type(spec_.type_, "pointer"); - write_pointer(value); - } -}; - -class FormatterBase -{ -private: - ArgList args_; - int next_arg_index_; - - // Returns the argument with specified index. - FMT_API Arg do_get_arg(unsigned arg_index, const char *&error); - -protected: - const ArgList &args() const - { - return args_; - } - - explicit FormatterBase(const ArgList &args) - { - args_ = args; - next_arg_index_ = 0; - } - - // Returns the next argument. - Arg next_arg(const char *&error) - { - if (next_arg_index_ >= 0) - return do_get_arg(internal::to_unsigned(next_arg_index_++), error); - error = "cannot switch from manual to automatic argument indexing"; - return Arg(); - } - - // Checks if manual indexing is used and returns the argument with - // specified index. - Arg get_arg(unsigned arg_index, const char *&error) - { - return check_no_auto_index(error) ? do_get_arg(arg_index, error) : Arg(); - } - - bool check_no_auto_index(const char *&error) - { - if (next_arg_index_ > 0) - { - error = "cannot switch from automatic to manual argument indexing"; - return false; - } - next_arg_index_ = -1; - return true; - } - - template - void write(BasicWriter &w, const Char *start, const Char *end) - { - if (start != end) - w << BasicStringRef(start, internal::to_unsigned(end - start)); - } -}; -} // namespace internal - -/** -\rst -An argument formatter based on the `curiously recurring template pattern -`_. - -To use `~fmt::BasicArgFormatter` define a subclass that implements some or -all of the visit methods with the same signatures as the methods in -`~fmt::ArgVisitor`, for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. When a formatting -function processes an argument, it will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::BasicArgFormatter` or its superclass -will be called. -\endrst -*/ -template -class BasicArgFormatter: public internal::ArgFormatterBase -{ -private: - BasicFormatter &formatter_; - const Char *format_; - -public: - /** - \rst - Constructs an argument formatter object. - *formatter* is a reference to the main formatter object, *spec* contains - format specifier information for standard argument types, and *fmt* points - to the part of the format string being parsed for custom argument types. - \endrst - */ - BasicArgFormatter(BasicFormatter &formatter, - FormatSpec &spec, const Char *fmt) - : internal::ArgFormatterBase(formatter.writer(), spec), - formatter_(formatter), format_(fmt) - {} - - /** Formats an argument of a custom (user-defined) type. */ - void visit_custom(internal::Arg::CustomValue c) - { - c.format(&formatter_, c.value, &format_); - } -}; - -/** The default argument formatter. */ -template -class ArgFormatter: public BasicArgFormatter, Char> -{ -public: - /** Constructs an argument formatter object. */ - ArgFormatter(BasicFormatter &formatter, - FormatSpec &spec, const Char *fmt) - : BasicArgFormatter, Char>(formatter, spec, fmt) - {} -}; - -/** This template formats data and writes the output to a writer. */ -template -class BasicFormatter: private internal::FormatterBase -{ -public: - /** The character type for the output. */ - typedef CharType Char; - -private: - BasicWriter &writer_; - internal::ArgMap map_; - - FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter); - - using internal::FormatterBase::get_arg; - - // Checks if manual indexing is used and returns the argument with - // specified name. - internal::Arg get_arg(BasicStringRef arg_name, const char *&error); - - // Parses argument index and returns corresponding argument. - internal::Arg parse_arg_index(const Char *&s); - - // Parses argument name and returns corresponding argument. - internal::Arg parse_arg_name(const Char *&s); - -public: - /** - \rst - Constructs a ``BasicFormatter`` object. References to the arguments and - the writer are stored in the formatter object so make sure they have - appropriate lifetimes. - \endrst - */ - BasicFormatter(const ArgList &args, BasicWriter &w) - : internal::FormatterBase(args), writer_(w) - {} - - /** Returns a reference to the writer associated with this formatter. */ - BasicWriter &writer() - { - return writer_; - } - - /** Formats stored arguments and writes the output to the writer. */ - void format(BasicCStringRef format_str); - - // Formats a single argument and advances format_str, a format string pointer. - const Char *format(const Char *&format_str, const internal::Arg &arg); -}; - -// Generates a comma-separated list with results of applying f to -// numbers 0..n-1. -# define FMT_GEN(n, f) FMT_GEN##n(f) -# define FMT_GEN1(f) f(0) -# define FMT_GEN2(f) FMT_GEN1(f), f(1) -# define FMT_GEN3(f) FMT_GEN2(f), f(2) -# define FMT_GEN4(f) FMT_GEN3(f), f(3) -# define FMT_GEN5(f) FMT_GEN4(f), f(4) -# define FMT_GEN6(f) FMT_GEN5(f), f(5) -# define FMT_GEN7(f) FMT_GEN6(f), f(6) -# define FMT_GEN8(f) FMT_GEN7(f), f(7) -# define FMT_GEN9(f) FMT_GEN8(f), f(8) -# define FMT_GEN10(f) FMT_GEN9(f), f(9) -# define FMT_GEN11(f) FMT_GEN10(f), f(10) -# define FMT_GEN12(f) FMT_GEN11(f), f(11) -# define FMT_GEN13(f) FMT_GEN12(f), f(12) -# define FMT_GEN14(f) FMT_GEN13(f), f(13) -# define FMT_GEN15(f) FMT_GEN14(f), f(14) - -namespace internal -{ -inline uint64_t make_type() -{ - return 0; -} - -template -inline uint64_t make_type(const T &arg) -{ - return MakeValue< BasicFormatter >::type(arg); -} - -template - struct ArgArray; - -template -struct ArgArray -{ - typedef Value Type[N > 0 ? N : 1]; - -template -static Value make(const T &value) -{ -#ifdef __clang__ - Value result = MakeValue(value); - // Workaround a bug in Apple LLVM version 4.2 (clang-425.0.28) of clang: - // https://github.com/fmtlib/fmt/issues/276 - (void)result.custom.format; - return result; -#else - return MakeValue(value); -#endif -} - }; - -template -struct ArgArray -{ - typedef Arg Type[N + 1]; // +1 for the list end Arg::NONE - - template - static Arg make(const T &value) - { - return MakeArg(value); - } -}; - -#if FMT_USE_VARIADIC_TEMPLATES -template -inline uint64_t make_type(const Arg &first, const Args & ... tail) -{ - return make_type(first) | (make_type(tail...) << 4); -} - -#else - -struct ArgType -{ - uint64_t type; - - ArgType(): type(0) - {} - - template - ArgType(const T &arg) : type(make_type(arg)) - {} -}; - -# define FMT_ARG_TYPE_DEFAULT(n) ArgType t##n = ArgType() - -inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) -{ - return t0.type | (t1.type << 4) | (t2.type << 8) | (t3.type << 12) | - (t4.type << 16) | (t5.type << 20) | (t6.type << 24) | (t7.type << 28) | - (t8.type << 32) | (t9.type << 36) | (t10.type << 40) | (t11.type << 44) | - (t12.type << 48) | (t13.type << 52) | (t14.type << 56); -} -#endif -} // namespace internal - -# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n -# define FMT_MAKE_ARG_TYPE(n) T##n -# define FMT_MAKE_ARG(n) const T##n &v##n -# define FMT_ASSIGN_char(n) \ - arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) -# define FMT_ASSIGN_wchar_t(n) \ - arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) - -#if FMT_USE_VARIADIC_TEMPLATES -// Defines a variadic function returning void. -# define FMT_VARIADIC_VOID(func, arg_type) \ - template \ - void func(arg_type arg0, const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - func(arg0, fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } - -// Defines a variadic constructor. -# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ - template \ - ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } - -#else - -# define FMT_MAKE_REF(n) \ - fmt::internal::MakeValue< fmt::BasicFormatter >(v##n) -# define FMT_MAKE_REF2(n) v##n - -// Defines a wrapper for a function taking one argument of type arg_type -// and n additional arguments of arbitrary types. -# define FMT_WRAP1(func, arg_type, n) \ - template \ - inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::ArgArray::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ - func(arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ - } - -// Emulates a variadic function returning void on a pre-C++11 compiler. -# define FMT_VARIADIC_VOID(func, arg_type) \ - inline void func(arg_type arg) { func(arg, fmt::ArgList()); } \ - FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \ - FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \ - FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \ - FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \ - FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10) - -# define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ - template \ - ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::ArgArray::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ - func(arg0, arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ - } - -// Emulates a variadic constructor on a pre-C++11 compiler. -# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 1) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 2) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 3) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 4) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 5) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 6) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 7) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 8) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 9) \ - FMT_CTOR(ctor, func, arg0_type, arg1_type, 10) -#endif - -// Generates a comma-separated list with results of applying f to pairs -// (argument, index). -#define FMT_FOR_EACH1(f, x0) f(x0, 0) -#define FMT_FOR_EACH2(f, x0, x1) \ - FMT_FOR_EACH1(f, x0), f(x1, 1) -#define FMT_FOR_EACH3(f, x0, x1, x2) \ - FMT_FOR_EACH2(f, x0 ,x1), f(x2, 2) -#define FMT_FOR_EACH4(f, x0, x1, x2, x3) \ - FMT_FOR_EACH3(f, x0, x1, x2), f(x3, 3) -#define FMT_FOR_EACH5(f, x0, x1, x2, x3, x4) \ - FMT_FOR_EACH4(f, x0, x1, x2, x3), f(x4, 4) -#define FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5) \ - FMT_FOR_EACH5(f, x0, x1, x2, x3, x4), f(x5, 5) -#define FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6) \ - FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5), f(x6, 6) -#define FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7) \ - FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6), f(x7, 7) -#define FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8) \ - FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7), f(x8, 8) -#define FMT_FOR_EACH10(f, x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) \ - FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8), f(x9, 9) - -/** -An error returned by an operating system or a language runtime, -for example a file opening error. -*/ -class SystemError: public internal::RuntimeError -{ -private: - void init(int err_code, CStringRef format_str, ArgList args); - -protected: - int error_code_; - - typedef char Char; // For FMT_VARIADIC_CTOR. - - SystemError() - {} - -public: - /** - \rst - Constructs a :class:`fmt::SystemError` object with a description - formatted with `fmt::format_system_error`. *message* and additional - arguments passed into the constructor are formatted similarly to - `fmt::format`. - - **Example**:: - - // This throws a SystemError with the description - // cannot open file 'madeup': No such file or directory - // or similar (system message may vary). - const char *filename = "madeup"; - std::FILE *file = std::fopen(filename, "r"); - if (!file) - throw fmt::SystemError(errno, "cannot open file '{}'", filename); - \endrst - */ - SystemError(int error_code, CStringRef message) - { - init(error_code, message, ArgList()); - } - FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef) - - ~SystemError() FMT_DTOR_NOEXCEPT; - - int error_code() const - { - return error_code_; - } -}; - -/** -\rst -Formats an error returned by an operating system or a language runtime, -for example a file opening error, and writes it to *out* in the following -form: - -.. parsed-literal:: -**: ** - -where ** is the passed message and ** is -the system message corresponding to the error code. -*error_code* is a system error code as given by ``errno``. -If *error_code* is not a valid error code such as -1, the system message -may look like "Unknown error -1" and is platform-dependent. -\endrst -*/ -FMT_API void format_system_error(fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT; - -/** -\rst -This template provides operations for formatting and writing data into -a character stream. The output is stored in a buffer provided by a subclass -such as :class:`fmt::BasicMemoryWriter`. - -You can use one of the following typedefs for common character types: - -+---------+----------------------+ -| Type | Definition | -+=========+======================+ -| Writer | BasicWriter | -+---------+----------------------+ -| WWriter | BasicWriter | -+---------+----------------------+ - -\endrst -*/ -template -class BasicWriter -{ -private: - // Output buffer. - Buffer &buffer_; - - FMT_DISALLOW_COPY_AND_ASSIGN(BasicWriter); - - typedef typename internal::CharTraits::CharPtr CharPtr; - -#if FMT_SECURE_SCL - // Returns pointer value. - static Char *get(CharPtr p) - { - return p.base(); - } -#else - static Char *get(Char *p) - { - return p; - } -#endif - - // Fills the padding around the content and returns the pointer to the - // content area. - static CharPtr fill_padding(CharPtr buffer, - unsigned total_size, std::size_t content_size, wchar_t fill); - - // Grows the buffer by n characters and returns a pointer to the newly - // allocated area. - CharPtr grow_buffer(std::size_t n) - { - std::size_t size = buffer_.size(); - buffer_.resize(size + n); - return internal::make_ptr(&buffer_[size], n); - } - - // Writes an unsigned decimal integer. - template - Char *write_unsigned_decimal(UInt value, unsigned prefix_size = 0) - { - unsigned num_digits = internal::count_digits(value); - Char *ptr = get(grow_buffer(prefix_size + num_digits)); - internal::format_decimal(ptr + prefix_size, value, num_digits); - return ptr; - } - - // Writes a decimal integer. - template - void write_decimal(Int value) - { - typedef typename internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(value); - if (internal::is_negative(value)) - { - abs_value = 0 - abs_value; - *write_unsigned_decimal(abs_value, 1) = '-'; - } - else - { - write_unsigned_decimal(abs_value, 0); - } - } - - // Prepare a buffer for integer formatting. - CharPtr prepare_int_buffer(unsigned num_digits, - const EmptySpec &, const char *prefix, unsigned prefix_size) - { - unsigned size = prefix_size + num_digits; - CharPtr p = grow_buffer(size); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - return p + size - 1; - } - - template - CharPtr prepare_int_buffer(unsigned num_digits, - const Spec &spec, const char *prefix, unsigned prefix_size); - - // Formats an integer. - template - void write_int(T value, Spec spec); - - // Formats a floating-point number (double or long double). - template - void write_double(T value, const FormatSpec &spec); - - // Writes a formatted string. - template - CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec); - - template - void write_str(const internal::Arg::StringValue &str, - const FormatSpec &spec); - - // This following methods are private to disallow writing wide characters - // and strings to a char stream. If you want to print a wide string as a - // pointer as std::ostream does, cast it to const void*. - // Do not implement! - void operator<<(typename internal::WCharHelper::Unsupported); - void operator<<( - typename internal::WCharHelper::Unsupported); - - // Appends floating-point length specifier to the format string. - // The second argument is only used for overload resolution. - void append_float_length(Char *&format_ptr, long double) - { - *format_ptr++ = 'L'; - } - - template - void append_float_length(Char *&, T) - {} - - template - friend class internal::ArgFormatterBase; - - template - friend class BasicPrintfArgFormatter; - -protected: - /** - Constructs a ``BasicWriter`` object. - */ - explicit BasicWriter(Buffer &b): buffer_(b) - {} - -public: - /** - \rst - Destroys a ``BasicWriter`` object. - \endrst - */ - virtual ~BasicWriter() - {} - - /** - Returns the total number of characters written. - */ - std::size_t size() const - { - return buffer_.size(); - } - - /** - Returns a pointer to the output buffer content. No terminating null - character is appended. - */ - const Char *data() const FMT_NOEXCEPT - { - return &buffer_[0]; - } - - /** - Returns a pointer to the output buffer content with terminating null - character appended. - */ - const Char *c_str() const - { - std::size_t size = buffer_.size(); - buffer_.reserve(size + 1); - buffer_[size] = '\0'; - return &buffer_[0]; - } - - /** - \rst - Returns the content of the output buffer as an `std::string`. - \endrst - */ - std::basic_string str() const - { - return std::basic_string(&buffer_[0], buffer_.size()); - } - - /** - \rst - Writes formatted data. - - *args* is an argument list representing arbitrary arguments. - - **Example**:: - - MemoryWriter out; - out.write("Current point:\n"); - out.write("({:+f}, {:+f})", -3.14, 3.14); - - This will write the following output to the ``out`` object: - - .. code-block:: none - - Current point: - (-3.140000, +3.140000) - - The output can be accessed using :func:`data()`, :func:`c_str` or - :func:`str` methods. - - See also :ref:`syntax`. - \endrst - */ - void write(BasicCStringRef format, ArgList args) - { - BasicFormatter(args, *this).format(format); - } - FMT_VARIADIC_VOID(write, BasicCStringRef) - - BasicWriter &operator<<(int value) - { - write_decimal(value); - return *this; - } - BasicWriter &operator<<(unsigned value) - { - return *this << IntFormatSpec(value); - } - BasicWriter &operator<<(long value) - { - write_decimal(value); - return *this; - } - BasicWriter &operator<<(unsigned long value) - { - return *this << IntFormatSpec(value); - } - BasicWriter &operator<<(LongLong value) - { - write_decimal(value); - return *this; - } - - /** - \rst - Formats *value* and writes it to the stream. - \endrst - */ - BasicWriter &operator<<(ULongLong value) - { - return *this << IntFormatSpec(value); - } - - BasicWriter &operator<<(double value) - { - write_double(value, FormatSpec()); - return *this; - } - - /** - \rst - Formats *value* using the general format for floating-point numbers - (``'g'``) and writes it to the stream. - \endrst - */ - BasicWriter &operator<<(long double value) - { - write_double(value, FormatSpec()); - return *this; - } - - /** - Writes a character to the stream. - */ - BasicWriter &operator<<(char value) - { - buffer_.push_back(value); - return *this; - } - - BasicWriter &operator<<( - typename internal::WCharHelper::Supported value) - { - buffer_.push_back(value); - return *this; - } - - /** - \rst - Writes *value* to the stream. - \endrst - */ - BasicWriter &operator<<(fmt::BasicStringRef value) - { - const Char *str = value.data(); - buffer_.append(str, str + value.size()); - return *this; - } - - BasicWriter &operator<<( - typename internal::WCharHelper::Supported value) - { - const char *str = value.data(); - buffer_.append(str, str + value.size()); - return *this; - } - - template - BasicWriter &operator<<(IntFormatSpec spec) - { - internal::CharTraits::convert(FillChar()); - write_int(spec.value(), spec); - return *this; - } - - template - BasicWriter &operator<<(const StrFormatSpec &spec) - { - const StrChar *s = spec.str(); - write_str(s, std::char_traits::length(s), spec); - return *this; - } - - void clear() FMT_NOEXCEPT - { - buffer_.clear(); - } - - Buffer &buffer() FMT_NOEXCEPT - { - return buffer_; - } -}; - -template -template -typename BasicWriter::CharPtr BasicWriter::write_str( - const StrChar *s, std::size_t size, const AlignSpec &spec) -{ - CharPtr out = CharPtr(); - if (spec.width() > size) - { - out = grow_buffer(spec.width()); - Char fill = internal::CharTraits::cast(spec.fill()); - if (spec.align() == ALIGN_RIGHT) - { - std::uninitialized_fill_n(out, spec.width() - size, fill); - out += spec.width() - size; - } - else if (spec.align() == ALIGN_CENTER) - { - out = fill_padding(out, spec.width(), size, fill); - } - else - { - std::uninitialized_fill_n(out + size, spec.width() - size, fill); - } - } - else - { - out = grow_buffer(size); - } - std::uninitialized_copy(s, s + size, out); - return out; -} - -template -template -void BasicWriter::write_str( - const internal::Arg::StringValue &s, const FormatSpec &spec) -{ - // Check if StrChar is convertible to Char. - internal::CharTraits::convert(StrChar()); - if (spec.type_ && spec.type_ != 's') - internal::report_unknown_type(spec.type_, "string"); - const StrChar *str_value = s.value; - std::size_t str_size = s.size; - if (str_size == 0) - { - if (!str_value) - { - FMT_THROW(FormatError("string pointer is null")); - } - } - std::size_t precision = static_cast(spec.precision_); - if (spec.precision_ >= 0 && precision < str_size) - str_size = precision; - write_str(str_value, str_size, spec); -} - -template -typename BasicWriter::CharPtr -BasicWriter::fill_padding( - CharPtr buffer, unsigned total_size, - std::size_t content_size, wchar_t fill) -{ - std::size_t padding = total_size - content_size; - std::size_t left_padding = padding / 2; - Char fill_char = internal::CharTraits::cast(fill); - std::uninitialized_fill_n(buffer, left_padding, fill_char); - buffer += left_padding; - CharPtr content = buffer; - std::uninitialized_fill_n(buffer + content_size, - padding - left_padding, fill_char); - return content; -} - -template -template -typename BasicWriter::CharPtr -BasicWriter::prepare_int_buffer( - unsigned num_digits, const Spec &spec, - const char *prefix, unsigned prefix_size) -{ - unsigned width = spec.width(); - Alignment align = spec.align(); - Char fill = internal::CharTraits::cast(spec.fill()); - if (spec.precision() > static_cast(num_digits)) - { - // Octal prefix '0' is counted as a digit, so ignore it if precision - // is specified. - if (prefix_size > 0 && prefix[prefix_size - 1] == '0') - --prefix_size; - unsigned number_size = - prefix_size + internal::to_unsigned(spec.precision()); - AlignSpec subspec(number_size, '0', ALIGN_NUMERIC); - if (number_size >= width) - return prepare_int_buffer(num_digits, subspec, prefix, prefix_size); - buffer_.reserve(width); - unsigned fill_size = width - number_size; - if (align != ALIGN_LEFT) - { - CharPtr p = grow_buffer(fill_size); - std::uninitialized_fill(p, p + fill_size, fill); - } - CharPtr result = prepare_int_buffer( - num_digits, subspec, prefix, prefix_size); - if (align == ALIGN_LEFT) - { - CharPtr p = grow_buffer(fill_size); - std::uninitialized_fill(p, p + fill_size, fill); - } - return result; - } - unsigned size = prefix_size + num_digits; - if (width <= size) - { - CharPtr p = grow_buffer(size); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - return p + size - 1; - } - CharPtr p = grow_buffer(width); - CharPtr end = p + width; - if (align == ALIGN_LEFT) - { - std::uninitialized_copy(prefix, prefix + prefix_size, p); - p += size; - std::uninitialized_fill(p, end, fill); - } - else if (align == ALIGN_CENTER) - { - p = fill_padding(p, width, size, fill); - std::uninitialized_copy(prefix, prefix + prefix_size, p); - p += size; - } - else - { - if (align == ALIGN_NUMERIC) - { - if (prefix_size != 0) - { - p = std::uninitialized_copy(prefix, prefix + prefix_size, p); - size -= prefix_size; - } - } - else - { - std::uninitialized_copy(prefix, prefix + prefix_size, end - size); - } - std::uninitialized_fill(p, end - size, fill); - p = end; - } - return p - 1; -} - -template -template -void BasicWriter::write_int(T value, Spec spec) -{ - unsigned prefix_size = 0; - typedef typename internal::IntTraits::MainType UnsignedType; - UnsignedType abs_value = static_cast(value); - char prefix[4] = ""; - if (internal::is_negative(value)) - { - prefix[0] = '-'; - ++prefix_size; - abs_value = 0 - abs_value; - } - else if (spec.flag(SIGN_FLAG)) - { - prefix[0] = spec.flag(PLUS_FLAG) ? '+' : ' '; - ++prefix_size; - } - switch (spec.type()) - { - case 0: - case 'd': - { - unsigned num_digits = internal::count_digits(abs_value); - CharPtr p = prepare_int_buffer(num_digits, spec, prefix, prefix_size) + 1; - internal::format_decimal(get(p), abs_value, 0); - break; - } - case 'x': - case 'X': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); - } - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 4) != 0); - Char *p = get(prepare_int_buffer( - num_digits, spec, prefix, prefix_size)); - n = abs_value; - const char *digits = spec.type() == 'x' ? - "0123456789abcdef" : "0123456789ABCDEF"; - do - { - *p-- = digits[n & 0xf]; - } - while ((n >>= 4) != 0); - break; - } - case 'b': - case 'B': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); - } - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 1) != 0); - Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size)); - n = abs_value; - do - { - *p-- = static_cast('0' + (n & 1)); - } - while ((n >>= 1) != 0); - break; - } - case 'o': - { - UnsignedType n = abs_value; - if (spec.flag(HASH_FLAG)) - prefix[prefix_size++] = '0'; - unsigned num_digits = 0; - do - { - ++num_digits; - } - while ((n >>= 3) != 0); - Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size)); - n = abs_value; - do - { - *p-- = static_cast('0' + (n & 7)); - } - while ((n >>= 3) != 0); - break; - } - case 'n': - { - unsigned num_digits = internal::count_digits(abs_value); - fmt::StringRef sep = ""; -#ifndef ANDROID - sep = internal::thousands_sep(std::localeconv()); -#endif - unsigned size = static_cast( - num_digits + sep.size() * ((num_digits - 1) / 3)); - CharPtr p = prepare_int_buffer(size, spec, prefix, prefix_size) + 1; - internal::format_decimal(get(p), abs_value, 0, internal::ThousandsSep(sep)); - break; - } - default: - internal::report_unknown_type( - spec.type(), spec.flag(CHAR_FLAG) ? "char" : "integer"); - break; - } -} - -template -template -void BasicWriter::write_double(T value, const FormatSpec &spec) -{ - // Check type. - char type = spec.type(); - bool upper = false; - switch (type) - { - case 0: - type = 'g'; - break; - case 'e': - case 'f': - case 'g': - case 'a': - break; - case 'F': -#if FMT_MSC_VER - // MSVC's printf doesn't support 'F'. - type = 'f'; -#endif - // Fall through. - case 'E': - case 'G': - case 'A': - upper = true; - break; - default: - internal::report_unknown_type(type, "double"); - break; - } - - char sign = 0; - // Use isnegative instead of value < 0 because the latter is always - // false for NaN. - if (internal::FPUtil::isnegative(static_cast(value))) - { - sign = '-'; - value = -value; - } - else if (spec.flag(SIGN_FLAG)) - { - sign = spec.flag(PLUS_FLAG) ? '+' : ' '; - } - - if (internal::FPUtil::isnotanumber(value)) - { - // Format NaN ourselves because sprintf's output is not consistent - // across platforms. - std::size_t nan_size = 4; - const char *nan = upper ? " NAN" : " nan"; - if (!sign) - { - --nan_size; - ++nan; - } - CharPtr out = write_str(nan, nan_size, spec); - if (sign) - *out = sign; - return; - } - - if (internal::FPUtil::isinfinity(value)) - { - // Format infinity ourselves because sprintf's output is not consistent - // across platforms. - std::size_t inf_size = 4; - const char *inf = upper ? " INF" : " inf"; - if (!sign) - { - --inf_size; - ++inf; - } - CharPtr out = write_str(inf, inf_size, spec); - if (sign) - *out = sign; - return; - } - - std::size_t offset = buffer_.size(); - unsigned width = spec.width(); - if (sign) - { - buffer_.reserve(buffer_.size() + (width > 1u ? width : 1u)); - if (width > 0) - --width; - ++offset; - } - - // Build format string. - enum - { - MAX_FORMAT_SIZE = 10 - }; // longest format: %#-*.*Lg - Char format[MAX_FORMAT_SIZE]; - Char *format_ptr = format; - *format_ptr++ = '%'; - unsigned width_for_sprintf = width; - if (spec.flag(HASH_FLAG)) - *format_ptr++ = '#'; - if (spec.align() == ALIGN_CENTER) - { - width_for_sprintf = 0; - } - else - { - if (spec.align() == ALIGN_LEFT) - *format_ptr++ = '-'; - if (width != 0) - *format_ptr++ = '*'; - } - if (spec.precision() >= 0) - { - *format_ptr++ = '.'; - *format_ptr++ = '*'; - } - - append_float_length(format_ptr, value); - *format_ptr++ = type; - *format_ptr = '\0'; - - // Format using snprintf. - Char fill = internal::CharTraits::cast(spec.fill()); - unsigned n = 0; - Char *start = FMT_NULL; - for (;;) - { - std::size_t buffer_size = buffer_.capacity() - offset; -#if FMT_MSC_VER - // MSVC's vsnprintf_s doesn't work with zero size, so reserve - // space for at least one extra character to make the size non-zero. - // Note that the buffer's capacity will increase by more than 1. - if (buffer_size == 0) - { - buffer_.reserve(offset + 1); - buffer_size = buffer_.capacity() - offset; - } -#endif - start = &buffer_[offset]; - int result = internal::CharTraits::format_float( - start, buffer_size, format, width_for_sprintf, spec.precision(), value); - if (result >= 0) - { - n = internal::to_unsigned(result); - if (offset + n < buffer_.capacity()) - break; // The buffer is large enough - continue with formatting. - buffer_.reserve(offset + n + 1); - } - else - { - // If result is negative we ask to increase the capacity by at least 1, - // but as std::vector, the buffer grows exponentially. - buffer_.reserve(buffer_.capacity() + 1); - } - } - if (sign) - { - if ((spec.align() != ALIGN_RIGHT && spec.align() != ALIGN_DEFAULT) || - *start != ' ') - { - *(start - 1) = sign; - sign = 0; - } - else - { - *(start - 1) = fill; - } - ++n; - } - if (spec.align() == ALIGN_CENTER && spec.width() > n) - { - width = spec.width(); - CharPtr p = grow_buffer(width); - std::memmove(get(p) + (width - n) / 2, get(p), n * sizeof(Char)); - fill_padding(p, spec.width(), n, fill); - return; - } - if (spec.fill() != ' ' || sign) - { - while (*start == ' ') - *start++ = fill; - if (sign) - *(start - 1) = sign; - } - grow_buffer(n); -} - -/** -\rst -This class template provides operations for formatting and writing data -into a character stream. The output is stored in a memory buffer that grows -dynamically. - -You can use one of the following typedefs for common character types -and the standard allocator: - -+---------------+-----------------------------------------------------+ -| Type | Definition | -+===============+=====================================================+ -| MemoryWriter | BasicMemoryWriter> | -+---------------+-----------------------------------------------------+ -| WMemoryWriter | BasicMemoryWriter> | -+---------------+-----------------------------------------------------+ - -**Example**:: - -MemoryWriter out; -out << "The answer is " << 42 << "\n"; -out.write("({:+f}, {:+f})", -3.14, 3.14); - -This will write the following output to the ``out`` object: - -.. code-block:: none - -The answer is 42 -(-3.140000, +3.140000) - -The output can be converted to an ``std::string`` with ``out.str()`` or -accessed as a C string with ``out.c_str()``. -\endrst -*/ -template > -class BasicMemoryWriter: public BasicWriter -{ -private: - internal::MemoryBuffer buffer_; - -public: - explicit BasicMemoryWriter(const Allocator& alloc = Allocator()) - : BasicWriter(buffer_), buffer_(alloc) - {} - -#if FMT_USE_RVALUE_REFERENCES - /** - \rst - Constructs a :class:`fmt::BasicMemoryWriter` object moving the content - of the other object to it. - \endrst - */ - BasicMemoryWriter(BasicMemoryWriter &&other) - : BasicWriter(buffer_), buffer_(std::move(other.buffer_)) - {} - - /** - \rst - Moves the content of the other ``BasicMemoryWriter`` object to this one. - \endrst - */ - BasicMemoryWriter &operator=(BasicMemoryWriter &&other) - { - buffer_ = std::move(other.buffer_); - return *this; - } -#endif -}; - -typedef BasicMemoryWriter MemoryWriter; -typedef BasicMemoryWriter WMemoryWriter; - -/** -\rst -This class template provides operations for formatting and writing data -into a fixed-size array. For writing into a dynamically growing buffer -use :class:`fmt::BasicMemoryWriter`. - -Any write method will throw ``std::runtime_error`` if the output doesn't fit -into the array. - -You can use one of the following typedefs for common character types: - -+--------------+---------------------------+ -| Type | Definition | -+==============+===========================+ -| ArrayWriter | BasicArrayWriter | -+--------------+---------------------------+ -| WArrayWriter | BasicArrayWriter | -+--------------+---------------------------+ -\endrst -*/ -template -class BasicArrayWriter: public BasicWriter -{ -private: - internal::FixedBuffer buffer_; - -public: - /** - \rst - Constructs a :class:`fmt::BasicArrayWriter` object for *array* of the - given size. - \endrst - */ - BasicArrayWriter(Char *array, std::size_t size) - : BasicWriter(buffer_), buffer_(array, size) - {} - - /** - \rst - Constructs a :class:`fmt::BasicArrayWriter` object for *array* of the - size known at compile time. - \endrst - */ - template - explicit BasicArrayWriter(Char(&array)[SIZE]) - : BasicWriter(buffer_), buffer_(array, SIZE) - {} -}; - -typedef BasicArrayWriter ArrayWriter; -typedef BasicArrayWriter WArrayWriter; - -// Reports a system error without throwing an exception. -// Can be used to report errors from destructors. -FMT_API void report_system_error(int error_code, - StringRef message) FMT_NOEXCEPT; - -#if FMT_USE_WINDOWS_H - -/** A Windows error. */ -class WindowsError: public SystemError -{ -private: - FMT_API void init(int error_code, CStringRef format_str, ArgList args); - -public: - /** - \rst - Constructs a :class:`fmt::WindowsError` object with the description - of the form - - .. parsed-literal:: - **: ** - - where ** is the formatted message and ** is the - system message corresponding to the error code. - *error_code* is a Windows error code as given by ``GetLastError``. - If *error_code* is not a valid error code such as -1, the system message - will look like "error -1". - - **Example**:: - - // This throws a WindowsError with the description - // cannot open file 'madeup': The system cannot find the file specified. - // or similar (system message may vary). - const char *filename = "madeup"; - LPOFSTRUCT of = LPOFSTRUCT(); - HFILE file = OpenFile(filename, &of, OF_READ); - if (file == HFILE_ERROR) { - throw fmt::WindowsError(GetLastError(), - "cannot open file '{}'", filename); - } - \endrst - */ - WindowsError(int error_code, CStringRef message) - { - init(error_code, message, ArgList()); - } - FMT_VARIADIC_CTOR(WindowsError, init, int, CStringRef) -}; - -// Reports a Windows error without throwing an exception. -// Can be used to report errors from destructors. -FMT_API void report_windows_error(int error_code, - StringRef message) FMT_NOEXCEPT; - -#endif - -enum Color -{ - BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE -}; - -/** -Formats a string and prints it to stdout using ANSI escape sequences -to specify color (experimental). -Example: -print_colored(fmt::RED, "Elapsed time: {0:.2f} seconds", 1.23); -*/ -FMT_API void print_colored(Color c, CStringRef format, ArgList args); - -/** -\rst -Formats arguments and returns the result as a string. - -**Example**:: - -std::string message = format("The answer is {}", 42); -\endrst -*/ -inline std::string format(CStringRef format_str, ArgList args) -{ - MemoryWriter w; - w.write(format_str, args); - return w.str(); -} - -inline std::wstring format(WCStringRef format_str, ArgList args) -{ - WMemoryWriter w; - w.write(format_str, args); - return w.str(); -} - -/** -\rst -Prints formatted data to the file *f*. - -**Example**:: - -print(stderr, "Don't {}!", "panic"); -\endrst -*/ -FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args); - -/** -\rst -Prints formatted data to ``stdout``. - -**Example**:: - -print("Elapsed time: {0:.2f} seconds", 1.23); -\endrst -*/ -FMT_API void print(CStringRef format_str, ArgList args); - -/** -Fast integer formatter. -*/ -class FormatInt -{ -private: - // Buffer should be large enough to hold all digits (digits10 + 1), - // a sign and a null character. - enum - { - BUFFER_SIZE = std::numeric_limits::digits10 + 3 - }; - mutable char buffer_[BUFFER_SIZE]; - char *str_; - - // Formats value in reverse and returns the number of digits. - char *format_decimal(ULongLong value) - { - char *buffer_end = buffer_ + BUFFER_SIZE - 1; - while (value >= 100) - { - // Integer division is slow so do it for a group of two digits instead - // of for every digit. The idea comes from the talk by Alexandrescu - // "Three Optimization Tips for C++". See speed-test for a comparison. - unsigned index = static_cast((value % 100) * 2); - value /= 100; - *--buffer_end = internal::Data::DIGITS[index + 1]; - *--buffer_end = internal::Data::DIGITS[index]; - } - if (value < 10) - { - *--buffer_end = static_cast('0' + value); - return buffer_end; - } - unsigned index = static_cast(value * 2); - *--buffer_end = internal::Data::DIGITS[index + 1]; - *--buffer_end = internal::Data::DIGITS[index]; - return buffer_end; - } - - void FormatSigned(LongLong value) - { - ULongLong abs_value = static_cast(value); - bool negative = value < 0; - if (negative) - abs_value = 0 - abs_value; - str_ = format_decimal(abs_value); - if (negative) - *--str_ = '-'; - } - -public: - explicit FormatInt(int value) - { - FormatSigned(value); - } - explicit FormatInt(long value) - { - FormatSigned(value); - } - explicit FormatInt(LongLong value) - { - FormatSigned(value); - } - explicit FormatInt(unsigned value): str_(format_decimal(value)) - {} - explicit FormatInt(unsigned long value): str_(format_decimal(value)) - {} - explicit FormatInt(ULongLong value): str_(format_decimal(value)) - {} - - /** Returns the number of characters written to the output buffer. */ - std::size_t size() const - { - return internal::to_unsigned(buffer_ - str_ + BUFFER_SIZE - 1); - } - - /** - Returns a pointer to the output buffer content. No terminating null - character is appended. - */ - const char *data() const - { - return str_; - } - - /** - Returns a pointer to the output buffer content with terminating null - character appended. - */ - const char *c_str() const - { - buffer_[BUFFER_SIZE - 1] = '\0'; - return str_; - } - - /** - \rst - Returns the content of the output buffer as an ``std::string``. - \endrst - */ - std::string str() const - { - return std::string(str_, size()); - } -}; - -// Formats a decimal integer value writing into buffer and returns -// a pointer to the end of the formatted string. This function doesn't -// write a terminating null character. -template -inline void format_decimal(char *&buffer, T value) -{ - typedef typename internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(value); - if (internal::is_negative(value)) - { - *buffer++ = '-'; - abs_value = 0 - abs_value; - } - if (abs_value < 100) - { - if (abs_value < 10) - { - *buffer++ = static_cast('0' + abs_value); - return; - } - unsigned index = static_cast(abs_value * 2); - *buffer++ = internal::Data::DIGITS[index]; - *buffer++ = internal::Data::DIGITS[index + 1]; - return; - } - unsigned num_digits = internal::count_digits(abs_value); - internal::format_decimal(buffer, abs_value, num_digits); - buffer += num_digits; -} - -/** -\rst -Returns a named argument for formatting functions. - -**Example**:: - -print("Elapsed time: {s:.2f} seconds", arg("s", 1.23)); - -\endrst -*/ -template -inline internal::NamedArgWithType arg(StringRef name, const T &arg) -{ - return internal::NamedArgWithType(name, arg); -} - -template -inline internal::NamedArgWithType arg(WStringRef name, const T &arg) -{ - return internal::NamedArgWithType(name, arg); -} - -// The following two functions are deleted intentionally to disable -// nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``. -template -void arg(StringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; -template -void arg(WStringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; -} - -#if FMT_GCC_VERSION -// Use the system_header pragma to suppress warnings about variadic macros -// because suppressing -Wvariadic-macros with the diagnostic pragma doesn't -// work. It is used at the end because we want to suppress as little warnings -// as possible. -# pragma GCC system_header -#endif - -// This is used to work around VC++ bugs in handling variadic macros. -#define FMT_EXPAND(args) args - -// Returns the number of arguments. -// Based on https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s. -#define FMT_NARG(...) FMT_NARG_(__VA_ARGS__, FMT_RSEQ_N()) -#define FMT_NARG_(...) FMT_EXPAND(FMT_ARG_N(__VA_ARGS__)) -#define FMT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define FMT_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - -#define FMT_FOR_EACH_(N, f, ...) \ - FMT_EXPAND(FMT_CONCAT(FMT_FOR_EACH, N)(f, __VA_ARGS__)) -#define FMT_FOR_EACH(f, ...) \ - FMT_EXPAND(FMT_FOR_EACH_(FMT_NARG(__VA_ARGS__), f, __VA_ARGS__)) - -#define FMT_ADD_ARG_NAME(type, index) type arg##index -#define FMT_GET_ARG_NAME(type, index) arg##index - -#if FMT_USE_VARIADIC_TEMPLATES -# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ - template \ - ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ - const Args & ... args) { \ - typedef fmt::internal::ArgArray ArgArray; \ - typename ArgArray::Type array{ \ - ArgArray::template make >(args)...}; \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ - fmt::ArgList(fmt::internal::make_type(args...), array)); \ - } -#else -// Defines a wrapper for a function taking __VA_ARGS__ arguments -// and n additional arguments of arbitrary types. -# define FMT_WRAP(Char, ReturnType, func, call, n, ...) \ - template \ - inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ - FMT_GEN(n, FMT_MAKE_ARG)) { \ - fmt::internal::ArgArray::Type arr; \ - FMT_GEN(n, FMT_ASSIGN_##Char); \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \ - } - -# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ - inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__)) { \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList()); \ - } \ - FMT_WRAP(Char, ReturnType, func, call, 1, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 2, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 3, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 4, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 5, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 6, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 11, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 12, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 13, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 14, __VA_ARGS__) \ - FMT_WRAP(Char, ReturnType, func, call, 15, __VA_ARGS__) -#endif // FMT_USE_VARIADIC_TEMPLATES - -/** -\rst -Defines a variadic function with the specified return type, function name -and argument types passed as variable arguments to this macro. - -**Example**:: - -void print_error(const char *file, int line, const char *format, -fmt::ArgList args) { -fmt::print("{}: {}: ", file, line); -fmt::print(format, args); -} -FMT_VARIADIC(void, print_error, const char *, int, const char *) - -``FMT_VARIADIC`` is used for compatibility with legacy C++ compilers that -don't implement variadic templates. You don't have to use this macro if -you don't need legacy compiler support and can use variadic templates -directly:: - -template -void print_error(const char *file, int line, const char *format, -const Args & ... args) { -fmt::print("{}: {}: ", file, line); -fmt::print(format, args...); -} -\endrst -*/ -#define FMT_VARIADIC(ReturnType, func, ...) \ - FMT_VARIADIC_(char, ReturnType, func, return func, __VA_ARGS__) - -#define FMT_VARIADIC_W(ReturnType, func, ...) \ - FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__) - -#define FMT_CAPTURE_ARG_(id, index) ::fmt::arg(#id, id) - -#define FMT_CAPTURE_ARG_W_(id, index) ::fmt::arg(L###id, id) - -/** -\rst -Convenient macro to capture the arguments' names and values into several -``fmt::arg(name, value)``. - -**Example**:: - -int x = 1, y = 2; -print("point: ({x}, {y})", FMT_CAPTURE(x, y)); -// same as: -// print("point: ({x}, {y})", arg("x", x), arg("y", y)); - -\endrst -*/ -#define FMT_CAPTURE(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_, __VA_ARGS__) - -#define FMT_CAPTURE_W(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_W_, __VA_ARGS__) - -namespace fmt -{ -FMT_VARIADIC(std::string, format, CStringRef) -FMT_VARIADIC_W(std::wstring, format, WCStringRef) -FMT_VARIADIC(void, print, CStringRef) -FMT_VARIADIC(void, print, std::FILE *, CStringRef) -FMT_VARIADIC(void, print_colored, Color, CStringRef) - -namespace internal -{ -template -inline bool is_name_start(Char c) -{ - return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || '_' == c; -} - -// Parses an unsigned integer advancing s to the end of the parsed input. -// This function assumes that the first character of s is a digit. -template -unsigned parse_nonnegative_int(const Char *&s) -{ - assert('0' <= *s && *s <= '9'); - unsigned value = 0; - do - { - unsigned new_value = value * 10 + (*s++ - '0'); - // Check if value wrapped around. - if (new_value < value) - { - value = (std::numeric_limits::max)(); - break; - } - value = new_value; - } - while ('0' <= *s && *s <= '9'); - // Convert to unsigned to prevent a warning. - unsigned max_int = (std::numeric_limits::max)(); - if (value > max_int) - FMT_THROW(FormatError("number is too big")); - return value; -} - -inline void require_numeric_argument(const Arg &arg, char spec) -{ - if (arg.type > Arg::LAST_NUMERIC_TYPE) - { - std::string message = - fmt::format("format specifier '{}' requires numeric argument", spec); - FMT_THROW(fmt::FormatError(message)); - } -} - -template -void check_sign(const Char *&s, const Arg &arg) -{ - char sign = static_cast(*s); - require_numeric_argument(arg, sign); - if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) - { - FMT_THROW(FormatError(fmt::format( - "format specifier '{}' requires signed argument", sign))); - } - ++s; -} -} // namespace internal - -template -inline internal::Arg BasicFormatter::get_arg( - BasicStringRef arg_name, const char *&error) -{ - if (check_no_auto_index(error)) - { - map_.init(args()); - const internal::Arg *arg = map_.find(arg_name); - if (arg) - return *arg; - error = "argument not found"; - } - return internal::Arg(); -} - -template -inline internal::Arg BasicFormatter::parse_arg_index(const Char *&s) -{ - const char *error = FMT_NULL; - internal::Arg arg = *s < '0' || *s > '9' ? - next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error); - if (error) - { - FMT_THROW(FormatError( - *s != '}' && *s != ':' ? "invalid format string" : error)); - } - return arg; -} - -template -inline internal::Arg BasicFormatter::parse_arg_name(const Char *&s) -{ - assert(internal::is_name_start(*s)); - const Char *start = s; - Char c; - do - { - c = *++s; - } - while (internal::is_name_start(c) || ('0' <= c && c <= '9')); - const char *error = FMT_NULL; - internal::Arg arg = get_arg(BasicStringRef(start, s - start), error); - if (error) - FMT_THROW(FormatError(error)); - return arg; -} - -template -const Char *BasicFormatter::format( - const Char *&format_str, const internal::Arg &arg) -{ - using internal::Arg; - const Char *s = format_str; - FormatSpec spec; - if (*s == ':') - { - if (arg.type == Arg::CUSTOM) - { - arg.custom.format(this, arg.custom.value, &s); - return s; - } - ++s; - // Parse fill and alignment. - if (Char c = *s) - { - const Char *p = s + 1; - spec.align_ = ALIGN_DEFAULT; - do - { - switch (*p) - { - case '<': - spec.align_ = ALIGN_LEFT; - break; - case '>': - spec.align_ = ALIGN_RIGHT; - break; - case '=': - spec.align_ = ALIGN_NUMERIC; - break; - case '^': - spec.align_ = ALIGN_CENTER; - break; - } - if (spec.align_ != ALIGN_DEFAULT) - { - if (p != s) - { - if (c == '}') break; - if (c == '{') - FMT_THROW(FormatError("invalid fill character '{'")); - s += 2; - spec.fill_ = c; - } - else ++s; - if (spec.align_ == ALIGN_NUMERIC) - require_numeric_argument(arg, '='); - break; - } - } - while (--p >= s); - } - - // Parse sign. - switch (*s) - { - case '+': - check_sign(s, arg); - spec.flags_ |= SIGN_FLAG | PLUS_FLAG; - break; - case '-': - check_sign(s, arg); - spec.flags_ |= MINUS_FLAG; - break; - case ' ': - check_sign(s, arg); - spec.flags_ |= SIGN_FLAG; - break; - } - - if (*s == '#') - { - require_numeric_argument(arg, '#'); - spec.flags_ |= HASH_FLAG; - ++s; - } - - // Parse zero flag. - if (*s == '0') - { - require_numeric_argument(arg, '0'); - spec.align_ = ALIGN_NUMERIC; - spec.fill_ = '0'; - ++s; - } - - // Parse width. - if ('0' <= *s && *s <= '9') - { - spec.width_ = internal::parse_nonnegative_int(s); - } - else if (*s == '{') - { - ++s; - Arg width_arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - if (*s++ != '}') - FMT_THROW(FormatError("invalid format string")); - ULongLong value = 0; - switch (width_arg.type) - { - case Arg::INT: - if (width_arg.int_value < 0) - FMT_THROW(FormatError("negative width")); - value = width_arg.int_value; - break; - case Arg::UINT: - value = width_arg.uint_value; - break; - case Arg::LONG_LONG: - if (width_arg.long_long_value < 0) - FMT_THROW(FormatError("negative width")); - value = width_arg.long_long_value; - break; - case Arg::ULONG_LONG: - value = width_arg.ulong_long_value; - break; - default: - FMT_THROW(FormatError("width is not integer")); - } - if (value >(std::numeric_limits::max)()) - FMT_THROW(FormatError("number is too big")); - spec.width_ = static_cast(value); - } - - // Parse precision. - if (*s == '.') - { - ++s; - spec.precision_ = 0; - if ('0' <= *s && *s <= '9') - { - spec.precision_ = internal::parse_nonnegative_int(s); - } - else if (*s == '{') - { - ++s; - Arg precision_arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - if (*s++ != '}') - FMT_THROW(FormatError("invalid format string")); - ULongLong value = 0; - switch (precision_arg.type) - { - case Arg::INT: - if (precision_arg.int_value < 0) - FMT_THROW(FormatError("negative precision")); - value = precision_arg.int_value; - break; - case Arg::UINT: - value = precision_arg.uint_value; - break; - case Arg::LONG_LONG: - if (precision_arg.long_long_value < 0) - FMT_THROW(FormatError("negative precision")); - value = precision_arg.long_long_value; - break; - case Arg::ULONG_LONG: - value = precision_arg.ulong_long_value; - break; - default: - FMT_THROW(FormatError("precision is not integer")); - } - if (value >(std::numeric_limits::max)()) - FMT_THROW(FormatError("number is too big")); - spec.precision_ = static_cast(value); - } - else - { - FMT_THROW(FormatError("missing precision specifier")); - } - if (arg.type <= Arg::LAST_INTEGER_TYPE || arg.type == Arg::POINTER) - { - FMT_THROW(FormatError( - fmt::format("precision not allowed in {} format specifier", - arg.type == Arg::POINTER ? "pointer" : "integer"))); - } - } - - // Parse type. - if (*s != '}' && *s) - spec.type_ = static_cast(*s++); - } - - if (*s++ != '}') - FMT_THROW(FormatError("missing '}' in format string")); - - // Format argument. - ArgFormatter(*this, spec, s - 1).visit(arg); - return s; -} - -template -void BasicFormatter::format(BasicCStringRef format_str) -{ - const Char *s = format_str.c_str(); - const Char *start = s; - while (*s) - { - Char c = *s++; - if (c != '{' && c != '}') continue; - if (*s == c) - { - write(writer_, start, s); - start = ++s; - continue; - } - if (c == '}') - FMT_THROW(FormatError("unmatched '}' in format string")); - write(writer_, start, s - 1); - internal::Arg arg = internal::is_name_start(*s) ? - parse_arg_name(s) : parse_arg_index(s); - start = s = format(s, arg); - } - write(writer_, start, s); -} -} // namespace fmt - -#if FMT_USE_USER_DEFINED_LITERALS -namespace fmt -{ -namespace internal -{ - -template -struct UdlFormat -{ - const Char *str; - - template - auto operator()(Args && ... args) const - -> decltype(format(str, std::forward(args)...)) - { - return format(str, std::forward(args)...); - } -}; - -template -struct UdlArg -{ - const Char *str; - - template - NamedArgWithType operator=(T &&value) const - { - return { str, std::forward(value) }; - } -}; - -} // namespace internal - -inline namespace literals -{ - -/** -\rst -C++11 literal equivalent of :func:`fmt::format`. - -**Example**:: - -using namespace fmt::literals; -std::string message = "The answer is {}"_format(42); -\endrst -*/ -inline internal::UdlFormat -operator"" _format(const char *s, std::size_t) -{ - return { s }; -} -inline internal::UdlFormat -operator"" _format(const wchar_t *s, std::size_t) -{ - return { s }; -} - -/** -\rst -C++11 literal equivalent of :func:`fmt::arg`. - -**Example**:: - -using namespace fmt::literals; -print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); -\endrst -*/ -inline internal::UdlArg -operator"" _a(const char *s, std::size_t) -{ - return { s }; -} -inline internal::UdlArg -operator"" _a(const wchar_t *s, std::size_t) -{ - return { s }; -} - -} // inline namespace literals -} // namespace fmt -#endif // FMT_USE_USER_DEFINED_LITERALS - -// Restore warnings. -#if FMT_GCC_VERSION >= 406 -# pragma GCC diagnostic pop -#endif - -#if defined(__clang__) && !defined(FMT_ICC_VERSION) -# pragma clang diagnostic pop -#endif - -#ifdef FMT_HEADER_ONLY -# define FMT_FUNC inline -# include "format.cc" -#else -# define FMT_FUNC -#endif - -#endif // FMT_FORMAT_H_ diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.cc b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.cc deleted file mode 100644 index 2148f3c178d0950b76911d2e693f959af0571283..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* -Formatting library for C++ - std::ostream support - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#include "ostream.h" - -namespace fmt { - - namespace internal { - FMT_FUNC void write(std::ostream &os, Writer &w) - { - const char *data = w.data(); - typedef internal::MakeUnsigned::Type UnsignedStreamSize; - UnsignedStreamSize size = w.size(); - UnsignedStreamSize max_size = - internal::to_unsigned((std::numeric_limits::max)()); - do { - UnsignedStreamSize n = size <= max_size ? size : max_size; - os.write(data, static_cast(n)); - data += n; - size -= n; - } while (size != 0); - } - } - - FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) - { - MemoryWriter w; - w.write(format_str, args); - internal::write(os, w); - } -} // namespace fmt diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.h b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.h deleted file mode 100644 index 3bdb375b20405dcd7e076030f46db7ea6dc32ff7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/ostream.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -Formatting library for C++ - std::ostream support - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#ifndef FMT_OSTREAM_H_ -#define FMT_OSTREAM_H_ - -// commented out by spdlog -// #include "format.h" -#include - -namespace fmt -{ - -namespace internal -{ - -template -class FormatBuf: public std::basic_streambuf -{ -private: - typedef typename std::basic_streambuf::int_type int_type; - typedef typename std::basic_streambuf::traits_type traits_type; - - Buffer &buffer_; - Char *start_; - -public: - FormatBuf(Buffer &buffer): buffer_(buffer), start_(&buffer[0]) - { - this->setp(start_, start_ + buffer_.capacity()); - } - - int_type overflow(int_type ch = traits_type::eof()) - { - if (!traits_type::eq_int_type(ch, traits_type::eof())) - { - size_t buf_size = size(); - buffer_.resize(buf_size); - buffer_.reserve(buf_size * 2); - - start_ = &buffer_[0]; - start_[buf_size] = traits_type::to_char_type(ch); - this->setp(start_ + buf_size + 1, start_ + buf_size * 2); - } - return ch; - } - - size_t size() const - { - return to_unsigned(this->pptr() - start_); - } -}; - -Yes &convert(std::ostream &); - -struct DummyStream: std::ostream -{ - DummyStream(); // Suppress a bogus warning in MSVC. - // Hide all operator<< overloads from std::ostream. - void operator<<(Null<>); -}; - -No &operator<<(std::ostream &, int); - -template -struct ConvertToIntImpl -{ - // Convert to int only if T doesn't have an overloaded operator<<. - enum - { - value = sizeof(convert(get() << get())) == sizeof(No) - }; -}; - -// Write the content of w to os. -void write(std::ostream &os, Writer &w); -} // namespace internal - -// Formats a value. -template -void format_arg(BasicFormatter &f, - const Char *&format_str, const T &value) -{ - internal::MemoryBuffer buffer; - - internal::FormatBuf format_buf(buffer); - std::basic_ostream output(&format_buf); - output << value; - - BasicStringRef str(&buffer[0], format_buf.size()); - typedef internal::MakeArg< BasicFormatter > MakeArg; - format_str = f.format(format_str, MakeArg(str)); -} - -/** -\rst -Prints formatted data to the stream *os*. - -**Example**:: - -print(cerr, "Don't {}!", "panic"); -\endrst -*/ -FMT_API void print(std::ostream &os, CStringRef format_str, ArgList args); -FMT_VARIADIC(void, print, std::ostream &, CStringRef) -} // namespace fmt - -#ifdef FMT_HEADER_ONLY -# include "ostream.cc" -#endif - -#endif // FMT_OSTREAM_H_ diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/printf.h b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/printf.h deleted file mode 100644 index 2b9ddfab0a89176536ae2750ef9f2db07362f558..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/bundled/printf.h +++ /dev/null @@ -1,658 +0,0 @@ -/* -Formatting library for C++ - -Copyright (c) 2012 - 2016, Victor Zverovich -All rights reserved. - -For the license information refer to format.h. -*/ - -#ifndef FMT_PRINTF_H_ -#define FMT_PRINTF_H_ - -#include // std::fill_n -#include // std::numeric_limits - -#include "ostream.h" - -namespace fmt -{ -namespace internal -{ - -// Checks if a value fits in int - used to avoid warnings about comparing -// signed and unsigned integers. -template -struct IntChecker -{ - template - static bool fits_in_int(T value) - { - unsigned max = std::numeric_limits::max(); - return value <= max; - } - static bool fits_in_int(bool) - { - return true; - } -}; - -template <> -struct IntChecker -{ - template - static bool fits_in_int(T value) - { - return value >= std::numeric_limits::min() && - value <= std::numeric_limits::max(); - } - static bool fits_in_int(int) - { - return true; - } -}; - -class PrecisionHandler: public ArgVisitor -{ -public: - void report_unhandled_arg() - { - FMT_THROW(FormatError("precision is not integer")); - } - - template - int visit_any_int(T value) - { - if (!IntChecker::is_signed>::fits_in_int(value)) - FMT_THROW(FormatError("number is too big")); - return static_cast(value); - } -}; - -// IsZeroInt::visit(arg) returns true iff arg is a zero integer. -class IsZeroInt: public ArgVisitor -{ -public: - template - bool visit_any_int(T value) - { - return value == 0; - } -}; - -template -struct is_same -{ - enum - { - value = 0 - }; -}; - -template -struct is_same -{ - enum - { - value = 1 - }; -}; - -// An argument visitor that converts an integer argument to T for printf, -// if T is an integral type. If T is void, the argument is converted to -// corresponding signed or unsigned type depending on the type specifier: -// 'd' and 'i' - signed, other - unsigned) -template -class ArgConverter: public ArgVisitor, void> -{ -private: - internal::Arg &arg_; - wchar_t type_; - - FMT_DISALLOW_COPY_AND_ASSIGN(ArgConverter); - -public: - ArgConverter(internal::Arg &arg, wchar_t type) - : arg_(arg), type_(type) - {} - - void visit_bool(bool value) - { - if (type_ != 's') - visit_any_int(value); - } - - template - void visit_any_int(U value) - { - bool is_signed = type_ == 'd' || type_ == 'i'; - using internal::Arg; - typedef typename internal::Conditional< - is_same::value, U, T>::type TargetType; - if (sizeof(TargetType) <= sizeof(int)) - { - // Extra casts are used to silence warnings. - if (is_signed) - { - arg_.type = Arg::INT; - arg_.int_value = static_cast(static_cast(value)); - } - else - { - arg_.type = Arg::UINT; - typedef typename internal::MakeUnsigned::Type Unsigned; - arg_.uint_value = static_cast(static_cast(value)); - } - } - else - { - if (is_signed) - { - arg_.type = Arg::LONG_LONG; - // glibc's printf doesn't sign extend arguments of smaller types: - // std::printf("%lld", -42); // prints "4294967254" - // but we don't have to do the same because it's a UB. - arg_.long_long_value = static_cast(value); - } - else - { - arg_.type = Arg::ULONG_LONG; - arg_.ulong_long_value = - static_cast::Type>(value); - } - } - } -}; - -// Converts an integer argument to char for printf. -class CharConverter: public ArgVisitor -{ -private: - internal::Arg &arg_; - - FMT_DISALLOW_COPY_AND_ASSIGN(CharConverter); - -public: - explicit CharConverter(internal::Arg &arg): arg_(arg) - {} - - template - void visit_any_int(T value) - { - arg_.type = internal::Arg::CHAR; - arg_.int_value = static_cast(value); - } -}; - -// Checks if an argument is a valid printf width specifier and sets -// left alignment if it is negative. -class WidthHandler: public ArgVisitor -{ -private: - FormatSpec &spec_; - - FMT_DISALLOW_COPY_AND_ASSIGN(WidthHandler); - -public: - explicit WidthHandler(FormatSpec &spec): spec_(spec) - {} - - void report_unhandled_arg() - { - FMT_THROW(FormatError("width is not integer")); - } - - template - unsigned visit_any_int(T value) - { - typedef typename internal::IntTraits::MainType UnsignedType; - UnsignedType width = static_cast(value); - if (internal::is_negative(value)) - { - spec_.align_ = ALIGN_LEFT; - width = 0 - width; - } - unsigned int_max = std::numeric_limits::max(); - if (width > int_max) - FMT_THROW(FormatError("number is too big")); - return static_cast(width); - } -}; -} // namespace internal - -/** -\rst -A ``printf`` argument formatter based on the `curiously recurring template -pattern `_. - -To use `~fmt::BasicPrintfArgFormatter` define a subclass that implements some -or all of the visit methods with the same signatures as the methods in -`~fmt::ArgVisitor`, for example, `~fmt::ArgVisitor::visit_int()`. -Pass the subclass as the *Impl* template parameter. When a formatting -function processes an argument, it will dispatch to a visit method -specific to the argument type. For example, if the argument type is -``double`` then the `~fmt::ArgVisitor::visit_double()` method of a subclass -will be called. If the subclass doesn't contain a method with this signature, -then a corresponding method of `~fmt::BasicPrintfArgFormatter` or its -superclass will be called. -\endrst -*/ -template -class BasicPrintfArgFormatter: public internal::ArgFormatterBase -{ -private: - void write_null_pointer() - { - this->spec().type_ = 0; - this->write("(nil)"); - } - - typedef internal::ArgFormatterBase Base; - -public: - /** - \rst - Constructs an argument formatter object. - *writer* is a reference to the output writer and *spec* contains format - specifier information for standard argument types. - \endrst - */ - BasicPrintfArgFormatter(BasicWriter &w, FormatSpec &s) - : internal::ArgFormatterBase(w, s) - {} - - /** Formats an argument of type ``bool``. */ - void visit_bool(bool value) - { - FormatSpec &fmt_spec = this->spec(); - if (fmt_spec.type_ != 's') - return this->visit_any_int(value); - fmt_spec.type_ = 0; - this->write(value); - } - - /** Formats a character. */ - void visit_char(int value) - { - const FormatSpec &fmt_spec = this->spec(); - BasicWriter &w = this->writer(); - if (fmt_spec.type_ && fmt_spec.type_ != 'c') - w.write_int(value, fmt_spec); - typedef typename BasicWriter::CharPtr CharPtr; - CharPtr out = CharPtr(); - if (fmt_spec.width_ > 1) - { - Char fill = ' '; - out = w.grow_buffer(fmt_spec.width_); - if (fmt_spec.align_ != ALIGN_LEFT) - { - std::fill_n(out, fmt_spec.width_ - 1, fill); - out += fmt_spec.width_ - 1; - } - else - { - std::fill_n(out + 1, fmt_spec.width_ - 1, fill); - } - } - else - { - out = w.grow_buffer(1); - } - *out = static_cast(value); - } - - /** Formats a null-terminated C string. */ - void visit_cstring(const char *value) - { - if (value) - Base::visit_cstring(value); - else if (this->spec().type_ == 'p') - write_null_pointer(); - else - this->write("(null)"); - } - - /** Formats a pointer. */ - void visit_pointer(const void *value) - { - if (value) - return Base::visit_pointer(value); - this->spec().type_ = 0; - write_null_pointer(); - } - - /** Formats an argument of a custom (user-defined) type. */ - void visit_custom(internal::Arg::CustomValue c) - { - BasicFormatter formatter(ArgList(), this->writer()); - const Char format_str[] = { '}', 0 }; - const Char *format = format_str; - c.format(&formatter, c.value, &format); - } -}; - -/** The default printf argument formatter. */ -template -class PrintfArgFormatter - : public BasicPrintfArgFormatter, Char> -{ -public: - /** Constructs an argument formatter object. */ - PrintfArgFormatter(BasicWriter &w, FormatSpec &s) - : BasicPrintfArgFormatter, Char>(w, s) - {} -}; - -/** This template formats data and writes the output to a writer. */ -template > -class PrintfFormatter: private internal::FormatterBase -{ -private: - BasicWriter &writer_; - - void parse_flags(FormatSpec &spec, const Char *&s); - - // Returns the argument with specified index or, if arg_index is equal - // to the maximum unsigned value, the next argument. - internal::Arg get_arg( - const Char *s, - unsigned arg_index = (std::numeric_limits::max)()); - - // Parses argument index, flags and width and returns the argument index. - unsigned parse_header(const Char *&s, FormatSpec &spec); - -public: - /** - \rst - Constructs a ``PrintfFormatter`` object. References to the arguments and - the writer are stored in the formatter object so make sure they have - appropriate lifetimes. - \endrst - */ - explicit PrintfFormatter(const ArgList &al, BasicWriter &w) - : FormatterBase(al), writer_(w) - {} - - /** Formats stored arguments and writes the output to the writer. */ - FMT_API void format(BasicCStringRef format_str); -}; - -template -void PrintfFormatter::parse_flags(FormatSpec &spec, const Char *&s) -{ - for (;;) - { - switch (*s++) - { - case '-': - spec.align_ = ALIGN_LEFT; - break; - case '+': - spec.flags_ |= SIGN_FLAG | PLUS_FLAG; - break; - case '0': - spec.fill_ = '0'; - break; - case ' ': - spec.flags_ |= SIGN_FLAG; - break; - case '#': - spec.flags_ |= HASH_FLAG; - break; - default: - --s; - return; - } - } -} - -template -internal::Arg PrintfFormatter::get_arg(const Char *s, - unsigned arg_index) -{ - (void)s; - const char *error = FMT_NULL; - internal::Arg arg = arg_index == std::numeric_limits::max() ? - next_arg(error) : FormatterBase::get_arg(arg_index - 1, error); - if (error) - FMT_THROW(FormatError(!*s ? "invalid format string" : error)); - return arg; -} - -template -unsigned PrintfFormatter::parse_header( - const Char *&s, FormatSpec &spec) -{ - unsigned arg_index = std::numeric_limits::max(); - Char c = *s; - if (c >= '0' && c <= '9') - { - // Parse an argument index (if followed by '$') or a width possibly - // preceded with '0' flag(s). - unsigned value = internal::parse_nonnegative_int(s); - if (*s == '$') // value is an argument index - { - ++s; - arg_index = value; - } - else - { - if (c == '0') - spec.fill_ = '0'; - if (value != 0) - { - // Nonzero value means that we parsed width and don't need to - // parse it or flags again, so return now. - spec.width_ = value; - return arg_index; - } - } - } - parse_flags(spec, s); - // Parse width. - if (*s >= '0' && *s <= '9') - { - spec.width_ = internal::parse_nonnegative_int(s); - } - else if (*s == '*') - { - ++s; - spec.width_ = internal::WidthHandler(spec).visit(get_arg(s)); - } - return arg_index; -} - -template -void PrintfFormatter::format(BasicCStringRef format_str) -{ - const Char *start = format_str.c_str(); - const Char *s = start; - while (*s) - { - Char c = *s++; - if (c != '%') continue; - if (*s == c) - { - write(writer_, start, s); - start = ++s; - continue; - } - write(writer_, start, s - 1); - - FormatSpec spec; - spec.align_ = ALIGN_RIGHT; - - // Parse argument index, flags and width. - unsigned arg_index = parse_header(s, spec); - - // Parse precision. - if (*s == '.') - { - ++s; - if ('0' <= *s && *s <= '9') - { - spec.precision_ = static_cast(internal::parse_nonnegative_int(s)); - } - else if (*s == '*') - { - ++s; - spec.precision_ = internal::PrecisionHandler().visit(get_arg(s)); - } - } - - using internal::Arg; - Arg arg = get_arg(s, arg_index); - if (spec.flag(HASH_FLAG) && internal::IsZeroInt().visit(arg)) - spec.flags_ &= ~internal::to_unsigned(HASH_FLAG); - if (spec.fill_ == '0') - { - if (arg.type <= Arg::LAST_NUMERIC_TYPE) - spec.align_ = ALIGN_NUMERIC; - else - spec.fill_ = ' '; // Ignore '0' flag for non-numeric types. - } - - // Parse length and convert the argument to the required type. - using internal::ArgConverter; - switch (*s++) - { - case 'h': - if (*s == 'h') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'l': - if (*s == 'l') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'j': - ArgConverter(arg, *s).visit(arg); - break; - case 'z': - ArgConverter(arg, *s).visit(arg); - break; - case 't': - ArgConverter(arg, *s).visit(arg); - break; - case 'L': - // printf produces garbage when 'L' is omitted for long double, no - // need to do the same. - break; - default: - --s; - ArgConverter(arg, *s).visit(arg); - } - - // Parse type. - if (!*s) - FMT_THROW(FormatError("invalid format string")); - spec.type_ = static_cast(*s++); - if (arg.type <= Arg::LAST_INTEGER_TYPE) - { - // Normalize type. - switch (spec.type_) - { - case 'i': - case 'u': - spec.type_ = 'd'; - break; - case 'c': - // TODO: handle wchar_t - internal::CharConverter(arg).visit(arg); - break; - } - } - - start = s; - - // Format argument. - AF(writer_, spec).visit(arg); - } - write(writer_, start, s); -} - -template -void printf(BasicWriter &w, BasicCStringRef format, ArgList args) -{ - PrintfFormatter(args, w).format(format); -} - -/** -\rst -Formats arguments and returns the result as a string. - -**Example**:: - -std::string message = fmt::sprintf("The answer is %d", 42); -\endrst -*/ -inline std::string sprintf(CStringRef format, ArgList args) -{ - MemoryWriter w; - printf(w, format, args); - return w.str(); -} -FMT_VARIADIC(std::string, sprintf, CStringRef) - -inline std::wstring sprintf(WCStringRef format, ArgList args) -{ - WMemoryWriter w; - printf(w, format, args); - return w.str(); -} -FMT_VARIADIC_W(std::wstring, sprintf, WCStringRef) - -/** -\rst -Prints formatted data to the file *f*. - -**Example**:: - -fmt::fprintf(stderr, "Don't %s!", "panic"); -\endrst -*/ -FMT_API int fprintf(std::FILE *f, CStringRef format, ArgList args); -FMT_VARIADIC(int, fprintf, std::FILE *, CStringRef) - -/** -\rst -Prints formatted data to ``stdout``. - -**Example**:: - -fmt::printf("Elapsed time: %.2f seconds", 1.23); -\endrst -*/ -inline int printf(CStringRef format, ArgList args) -{ - return fprintf(stdout, format, args); -} -FMT_VARIADIC(int, printf, CStringRef) - -/** -\rst -Prints formatted data to the stream *os*. - -**Example**:: - -fprintf(cerr, "Don't %s!", "panic"); -\endrst -*/ -inline int fprintf(std::ostream &os, CStringRef format_str, ArgList args) -{ - MemoryWriter w; - printf(w, format_str, args); - internal::write(os, w); - return static_cast(w.size()); -} -FMT_VARIADIC(int, fprintf, std::ostream &, CStringRef) -} // namespace fmt - -#ifdef FMT_HEADER_ONLY -# include "printf.cc" -#endif - -#endif // FMT_PRINTF_H_ diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/fmt.h b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/fmt.h deleted file mode 100644 index 51c53645618f99f94766bd6d286908e8406116bb..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/fmt.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright(c) 2016 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// -// Include a bundled header-only copy of fmtlib or an external one. -// By default spdlog include its own copy. -// - -#if !defined(SPDLOG_FMT_EXTERNAL) - -#ifndef FMT_HEADER_ONLY -#define FMT_HEADER_ONLY -#endif -#ifndef FMT_USE_WINDOWS_H -#define FMT_USE_WINDOWS_H 0 -#endif - -#include - -#else //external fmtlib - -#include - -#endif - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/ostr.h b/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/ostr.h deleted file mode 100644 index 466a711871e620b781b7fd8957e788fbb67a5a4f..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/fmt/ostr.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright(c) 2016 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// include external or bundled copy of fmtlib's ostream support -// -#if !defined(SPDLOG_FMT_EXTERNAL) - -#include -#include -#else -#include -#endif - - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/formatter.h b/archive_old_fs_versions/lfs/include/extern/spdlog/formatter.h deleted file mode 100644 index fd0013414e4d1ec5aed9828fbe771b5bb3063665..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/formatter.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include - -#include -#include -#include - -namespace spdlog -{ -namespace details -{ -class flag_formatter; -} - -class formatter -{ -public: - virtual ~formatter() {} - virtual void format(details::log_msg& msg) = 0; -}; - -class pattern_formatter : public formatter -{ - -public: - explicit pattern_formatter(const std::string& pattern); - pattern_formatter(const pattern_formatter&) = delete; - pattern_formatter& operator=(const pattern_formatter&) = delete; - void format(details::log_msg& msg) override; -private: - const std::string _pattern; - std::vector> _formatters; - void handle_flag(char flag); - void compile_pattern(const std::string& pattern); -}; -} - -#include - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/logger.h b/archive_old_fs_versions/lfs/include/extern/spdlog/logger.h deleted file mode 100644 index 8d75cef1a59d7f280db0b97bcd6a79fabdba2567..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/logger.h +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -// Thread safe logger (except for set_pattern(..), set_formatter(..) and set_error_handler()) -// Has name, log level, vector of std::shared sink pointers and formatter -// Upon each log write the logger: -// 1. Checks if its log level is enough to log the message -// 2. Format the message using the formatter function -// 3. Pass the formatted message to its sinks to performa the actual logging - -#include -#include - -#include -#include -#include - -namespace spdlog -{ - -class logger -{ -public: - logger(const std::string& logger_name, sink_ptr single_sink); - logger(const std::string& name, sinks_init_list); - template - logger(const std::string& name, const It& begin, const It& end); - - virtual ~logger(); - logger(const logger&) = delete; - logger& operator=(const logger&) = delete; - - - template void log(level::level_enum lvl, const char* fmt, const Args&... args); - template void log(level::level_enum lvl, const char* msg); - template void trace(const char* fmt, const Args&... args); - template void debug(const char* fmt, const Args&... args); - template void info(const char* fmt, const Args&... args); - template void warn(const char* fmt, const Args&... args); - template void error(const char* fmt, const Args&... args); - template void critical(const char* fmt, const Args&... args); - - template void log(level::level_enum lvl, const T&); - template void trace(const T&); - template void debug(const T&); - template void info(const T&); - template void warn(const T&); - template void error(const T&); - template void critical(const T&); - - bool should_log(level::level_enum) const; - void set_level(level::level_enum); - level::level_enum level() const; - const std::string& name() const; - void set_pattern(const std::string&); - void set_formatter(formatter_ptr); - - // error handler - void set_error_handler(log_err_handler); - log_err_handler error_handler(); - - // automatically call flush() if message level >= log_level - void flush_on(level::level_enum log_level); - - virtual void flush(); - - const std::vector& sinks() const; - -protected: - virtual void _sink_it(details::log_msg&); - virtual void _set_pattern(const std::string&); - virtual void _set_formatter(formatter_ptr); - - // default error handler: print the error to stderr with the max rate of 1 message/minute - virtual void _default_err_handler(const std::string &msg); - - // return true if the given message level should trigger a flush - bool _should_flush_on(const details::log_msg&); - - const std::string _name; - std::vector _sinks; - formatter_ptr _formatter; - spdlog::level_t _level; - spdlog::level_t _flush_level; - log_err_handler _err_handler; - std::atomic _last_err_time; -}; -} - -#include diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/android_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/android_sink.h deleted file mode 100644 index d8c97e03b31bba2496a10ab1b4b34e44cb7d9c5e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/android_sink.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#if defined(__ANDROID__) - -#include - -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -/* -* Android sink (logging using __android_log_write) -* __android_log_write is thread-safe. No lock is needed. -*/ -class android_sink : public sink -{ -public: - explicit android_sink(const std::string& tag = "spdlog"): _tag(tag) {} - - void log(const details::log_msg& msg) override - { - const android_LogPriority priority = convert_to_android(msg.level); - // See system/core/liblog/logger_write.c for explanation of return value - const int ret = __android_log_write( - priority, _tag.c_str(), msg.formatted.c_str() - ); - if (ret < 0) - { - throw spdlog_ex("__android_log_write() failed", ret); - } - } - - void flush() override - { - } - -private: - static android_LogPriority convert_to_android(spdlog::level::level_enum level) - { - switch(level) - { - case spdlog::level::trace: - return ANDROID_LOG_VERBOSE; - case spdlog::level::debug: - return ANDROID_LOG_DEBUG; - case spdlog::level::info: - return ANDROID_LOG_INFO; - case spdlog::level::warn: - return ANDROID_LOG_WARN; - case spdlog::level::err: - return ANDROID_LOG_ERROR; - case spdlog::level::critical: - return ANDROID_LOG_FATAL; - default: - return ANDROID_LOG_DEFAULT; - } - } - - std::string _tag; -}; - -} -} - -#endif diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ansicolor_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ansicolor_sink.h deleted file mode 100644 index 6982107437d34cdc6c8132fe3fe405679b20e90e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ansicolor_sink.h +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright(c) 2016 Kevin M. Godby (a modified version by spdlog). -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -/** - * @brief The ansi_color_sink is a decorator around another sink and prefixes - * the output with an ANSI escape sequence color code depending on the severity - * of the message. - */ -class ansicolor_sink : public sink -{ -public: - ansicolor_sink(sink_ptr wrapped_sink); - virtual ~ansicolor_sink(); - - ansicolor_sink(const ansicolor_sink& other) = delete; - ansicolor_sink& operator=(const ansicolor_sink& other) = delete; - - virtual void log(const details::log_msg& msg) override; - virtual void flush() override; - - void set_color(level::level_enum color_level, const std::string& color); - - /// Formatting codes - const std::string reset = "\033[00m"; - const std::string bold = "\033[1m"; - const std::string dark = "\033[2m"; - const std::string underline = "\033[4m"; - const std::string blink = "\033[5m"; - const std::string reverse = "\033[7m"; - const std::string concealed = "\033[8m"; - - // Foreground colors - const std::string grey = "\033[30m"; - const std::string red = "\033[31m"; - const std::string green = "\033[32m"; - const std::string yellow = "\033[33m"; - const std::string blue = "\033[34m"; - const std::string magenta = "\033[35m"; - const std::string cyan = "\033[36m"; - const std::string white = "\033[37m"; - - /// Background colors - const std::string on_grey = "\033[40m"; - const std::string on_red = "\033[41m"; - const std::string on_green = "\033[42m"; - const std::string on_yellow = "\033[43m"; - const std::string on_blue = "\033[44m"; - const std::string on_magenta = "\033[45m"; - const std::string on_cyan = "\033[46m"; - const std::string on_white = "\033[47m"; - - -protected: - sink_ptr sink_; - std::map colors_; -}; - -inline ansicolor_sink::ansicolor_sink(sink_ptr wrapped_sink) : sink_(wrapped_sink) -{ - colors_[level::trace] = cyan; - colors_[level::debug] = cyan; - colors_[level::info] = bold; - colors_[level::warn] = yellow + bold; - colors_[level::err] = red + bold; - colors_[level::critical] = bold + on_red; - colors_[level::off] = reset; -} - -inline void ansicolor_sink::log(const details::log_msg& msg) -{ - // Wrap the originally formatted message in color codes - const std::string& prefix = colors_[msg.level]; - const std::string& s = msg.formatted.str(); - const std::string& suffix = reset; - details::log_msg m; - m.level = msg.level; - m.logger_name = msg.logger_name; - m.time = msg.time; - m.thread_id = msg.thread_id; - m.formatted << prefix << s << suffix; - sink_->log(m); -} - -inline void ansicolor_sink::flush() -{ - sink_->flush(); -} - -inline void ansicolor_sink::set_color(level::level_enum color_level, const std::string& color) -{ - colors_[color_level] = color; -} - -inline ansicolor_sink::~ansicolor_sink() -{ - flush(); -} - -} // namespace sinks -} // namespace spdlog - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/base_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/base_sink.h deleted file mode 100644 index c0e483b29d0f218be08b73e85963eaa8129b8c4a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/base_sink.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once -// -// base sink templated over a mutex (either dummy or realy) -// concrete implementation should only overrid the _sink_it method. -// all locking is taken care of here so no locking needed by the implementers.. -// - -#include -#include -#include -#include - -#include - -namespace spdlog -{ -namespace sinks -{ -template -class base_sink:public sink -{ -public: - base_sink():_mutex() {} - virtual ~base_sink() = default; - - base_sink(const base_sink&) = delete; - base_sink& operator=(const base_sink&) = delete; - - void log(const details::log_msg& msg) override - { - std::lock_guard lock(_mutex); - _sink_it(msg); - } - -protected: - virtual void _sink_it(const details::log_msg& msg) = 0; - Mutex _mutex; -}; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/dist_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/dist_sink.h deleted file mode 100644 index 689170cd86e28c7cebf970805d3acdcbfb543ce7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/dist_sink.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) 2015 David Schury, Gabi Melman -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -// Distribution sink (mux). Stores a vector of sinks which get called when log is called - -namespace spdlog -{ -namespace sinks -{ -template -class dist_sink: public base_sink -{ -public: - explicit dist_sink() :_sinks() {} - dist_sink(const dist_sink&) = delete; - dist_sink& operator=(const dist_sink&) = delete; - virtual ~dist_sink() = default; - -protected: - std::vector> _sinks; - - void _sink_it(const details::log_msg& msg) override - { - for (auto &sink : _sinks) - { - if( sink->should_log( msg.level)) - { - sink->log(msg); - } - } - } - -public: - void flush() override - { - std::lock_guard lock(base_sink::_mutex); - for (auto &sink : _sinks) - sink->flush(); - } - - void add_sink(std::shared_ptr sink) - { - std::lock_guard lock(base_sink::_mutex); - _sinks.push_back(sink); - } - - void remove_sink(std::shared_ptr sink) - { - std::lock_guard lock(base_sink::_mutex); - _sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end()); - } -}; - -typedef dist_sink dist_sink_mt; -typedef dist_sink dist_sink_st; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/file_sinks.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/file_sinks.h deleted file mode 100644 index 163805baf0e8178ef5e86ac725a18cda935bb191..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/file_sinks.h +++ /dev/null @@ -1,239 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* - * Trivial file sink with single file as target - */ -template -class simple_file_sink : public base_sink < Mutex > -{ -public: - explicit simple_file_sink(const filename_t &filename, bool truncate = false):_force_flush(false) - { - _file_helper.open(filename, truncate); - } - void flush() override - { - _file_helper.flush(); - } - void set_force_flush(bool force_flush) - { - _force_flush = force_flush; - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - _file_helper.write(msg); - if(_force_flush) - _file_helper.flush(); - } -private: - details::file_helper _file_helper; - bool _force_flush; -}; - -typedef simple_file_sink simple_file_sink_mt; -typedef simple_file_sink simple_file_sink_st; - -/* - * Rotating file sink based on size - */ -template -class rotating_file_sink : public base_sink < Mutex > -{ -public: - rotating_file_sink(const filename_t &base_filename, - std::size_t max_size, std::size_t max_files) : - _base_filename(base_filename), - _max_size(max_size), - _max_files(max_files), - _current_size(0), - _file_helper() - { - _file_helper.open(calc_filename(_base_filename, 0)); - _current_size = _file_helper.size(); //expensive. called only once - } - - void flush() override - { - _file_helper.flush(); - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - _current_size += msg.formatted.size(); - if (_current_size > _max_size) - { - _rotate(); - _current_size = msg.formatted.size(); - } - _file_helper.write(msg); - } - -private: - static filename_t calc_filename(const filename_t& filename, std::size_t index) - { - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - if (index) - w.write(SPDLOG_FILENAME_T("{}.{}"), filename, index); - else - w.write(SPDLOG_FILENAME_T("{}"), filename); - return w.str(); - } - - // Rotate files: - // log.txt -> log.txt.1 - // log.txt.1 -> log.txt.2 - // log.txt.2 -> log.txt.3 - // lo3.txt.3 -> delete - - void _rotate() - { - using details::os::filename_to_str; - _file_helper.close(); - for (auto i = _max_files; i > 0; --i) - { - filename_t src = calc_filename(_base_filename, i - 1); - filename_t target = calc_filename(_base_filename, i); - - if (details::file_helper::file_exists(target)) - { - if (details::os::remove(target) != 0) - { - throw spdlog_ex("rotating_file_sink: failed removing " + filename_to_str(target), errno); - } - } - if (details::file_helper::file_exists(src) && details::os::rename(src, target)) - { - throw spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno); - } - } - _file_helper.reopen(true); - } - filename_t _base_filename; - std::size_t _max_size; - std::size_t _max_files; - std::size_t _current_size; - details::file_helper _file_helper; -}; - -typedef rotating_file_sink rotating_file_sink_mt; -typedef rotating_file_sinkrotating_file_sink_st; - -/* - * Default generator of daily log file names. - */ -struct default_daily_file_name_calculator -{ - // Create filename for the form basename.YYYY-MM-DD_hh-mm - static filename_t calc_filename(const filename_t& basename) - { - std::tm tm = spdlog::details::os::localtime(); - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - w.write(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}"), basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); - return w.str(); - } -}; - -/* - * Generator of daily log file names in format basename.YYYY-MM-DD - */ -struct dateonly_daily_file_name_calculator -{ - // Create filename for the form basename.YYYY-MM-DD - static filename_t calc_filename(const filename_t& basename) - { - std::tm tm = spdlog::details::os::localtime(); - std::conditional::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; - w.write(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}"), basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); - return w.str(); - } -}; - -/* - * Rotating file sink based on date. rotates at midnight - */ -template -class daily_file_sink :public base_sink < Mutex > -{ -public: - //create daily file sink which rotates on given time - daily_file_sink( - const filename_t& base_filename, - int rotation_hour, - int rotation_minute) : _base_filename(base_filename), - _rotation_h(rotation_hour), - _rotation_m(rotation_minute) - { - if (rotation_hour < 0 || rotation_hour > 23 || rotation_minute < 0 || rotation_minute > 59) - throw spdlog_ex("daily_file_sink: Invalid rotation time in ctor"); - _rotation_tp = _next_rotation_tp(); - _file_helper.open(FileNameCalc::calc_filename(_base_filename)); - } - - void flush() override - { - _file_helper.flush(); - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - if (std::chrono::system_clock::now() >= _rotation_tp) - { - _file_helper.open(FileNameCalc::calc_filename(_base_filename)); - _rotation_tp = _next_rotation_tp(); - } - _file_helper.write(msg); - } - -private: - std::chrono::system_clock::time_point _next_rotation_tp() - { - auto now = std::chrono::system_clock::now(); - time_t tnow = std::chrono::system_clock::to_time_t(now); - tm date = spdlog::details::os::localtime(tnow); - date.tm_hour = _rotation_h; - date.tm_min = _rotation_m; - date.tm_sec = 0; - auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date)); - if (rotation_time > now) - return rotation_time; - else - return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24)); - } - - filename_t _base_filename; - int _rotation_h; - int _rotation_m; - std::chrono::system_clock::time_point _rotation_tp; - details::file_helper _file_helper; -}; - -typedef daily_file_sink daily_file_sink_mt; -typedef daily_file_sink daily_file_sink_st; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/msvc_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/msvc_sink.h deleted file mode 100644 index 16342ca26435c8aab8dce40a241995f1ea986762..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/msvc_sink.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright(c) 2016 Alexander Dalshov. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#if defined(_MSC_VER) - -#include -#include - -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* -* MSVC sink (logging using OutputDebugStringA) -*/ -template -class msvc_sink : public base_sink < Mutex > -{ -public: - explicit msvc_sink() - { - } - - void flush() override - { - } - -protected: - void _sink_it(const details::log_msg& msg) override - { - OutputDebugStringA(msg.formatted.c_str()); - } -}; - -typedef msvc_sink msvc_sink_mt; -typedef msvc_sink msvc_sink_st; - -} -} - -#endif diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/null_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/null_sink.h deleted file mode 100644 index 270d1a95c36673e5fb8b3dd345c9f0b6ca706a3c..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/null_sink.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include - -namespace spdlog -{ -namespace sinks -{ - -template -class null_sink : public base_sink < Mutex > -{ -protected: - void _sink_it(const details::log_msg&) override - {} - - void flush() override - {} - -}; -typedef null_sink null_sink_st; -typedef null_sink null_sink_mt; - -} -} - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ostream_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ostream_sink.h deleted file mode 100644 index f5b74cbbf92c552ea6f060554140d28668f859ca..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/ostream_sink.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include - -namespace spdlog -{ -namespace sinks -{ -template -class ostream_sink: public base_sink -{ -public: - explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {} - ostream_sink(const ostream_sink&) = delete; - ostream_sink& operator=(const ostream_sink&) = delete; - virtual ~ostream_sink() = default; - -protected: - void _sink_it(const details::log_msg& msg) override - { - _ostream.write(msg.formatted.data(), msg.formatted.size()); - if (_force_flush) - _ostream.flush(); - } - - void flush() override - { - _ostream.flush(); - } - - std::ostream& _ostream; - bool _force_flush; -}; - -typedef ostream_sink ostream_sink_mt; -typedef ostream_sink ostream_sink_st; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/sink.h deleted file mode 100644 index 316696161f50c1c6d90c1b93682b4976b7effdc1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/sink.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - - -#pragma once - -#include - -namespace spdlog -{ -namespace sinks -{ -class sink -{ -public: - sink() - { - _level = level::trace; - } - - virtual ~sink() {} - virtual void log(const details::log_msg& msg) = 0; - virtual void flush() = 0; - - bool should_log(level::level_enum msg_level) const; - void set_level(level::level_enum log_level); - level::level_enum level() const; - -private: - level_t _level; - -}; - -inline bool sink::should_log(level::level_enum msg_level) const -{ - return msg_level >= _level.load(std::memory_order_relaxed); -} - -inline void sink::set_level(level::level_enum log_level) -{ - _level.store(log_level); -} - -inline level::level_enum sink::level() const -{ - return static_cast(_level.load(std::memory_order_relaxed)); -} - -} -} - diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/stdout_sinks.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/stdout_sinks.h deleted file mode 100644 index d0109078292f207e13d759231abf7680cb1cfbda..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/stdout_sinks.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include - -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ - -template -class stdout_sink: public base_sink -{ - using MyType = stdout_sink; -public: - stdout_sink() - {} - static std::shared_ptr instance() - { - static std::shared_ptr instance = std::make_shared(); - return instance; - } - - void _sink_it(const details::log_msg& msg) override - { - fwrite(msg.formatted.data(), sizeof(char), msg.formatted.size(), stdout); - flush(); - } - - void flush() override - { - fflush(stdout); - } -}; - -typedef stdout_sink stdout_sink_st; -typedef stdout_sink stdout_sink_mt; - - -template -class stderr_sink: public base_sink -{ - using MyType = stderr_sink; -public: - stderr_sink() - {} - static std::shared_ptr instance() - { - static std::shared_ptr instance = std::make_shared(); - return instance; - } - - void _sink_it(const details::log_msg& msg) override - { - fwrite(msg.formatted.data(), sizeof(char), msg.formatted.size(), stderr); - flush(); - } - - void flush() override - { - fflush(stderr); - } -}; - -typedef stderr_sink stderr_sink_mt; -typedef stderr_sink stderr_sink_st; -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/syslog_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/syslog_sink.h deleted file mode 100644 index c2ce07d85411d1c2bd08c3687bbc66a71f213c42..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/syslog_sink.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include - -#ifdef SPDLOG_ENABLE_SYSLOG - -#include -#include - -#include -#include -#include - - -namespace spdlog -{ -namespace sinks -{ -/** - * Sink that write to syslog using the `syscall()` library call. - * - * Locking is not needed, as `syslog()` itself is thread-safe. - */ -class syslog_sink : public sink -{ -public: - // - syslog_sink(const std::string& ident = "", int syslog_option=0, int syslog_facility=LOG_USER): - _ident(ident) - { - _priorities[static_cast(level::trace)] = LOG_DEBUG; - _priorities[static_cast(level::debug)] = LOG_DEBUG; - _priorities[static_cast(level::info)] = LOG_INFO; - _priorities[static_cast(level::warn)] = LOG_WARNING; - _priorities[static_cast(level::err)] = LOG_ERR; - _priorities[static_cast(level::critical)] = LOG_CRIT; - _priorities[static_cast(level::off)] = LOG_INFO; - - //set ident to be program name if empty - ::openlog(_ident.empty()? nullptr:_ident.c_str(), syslog_option, syslog_facility); - } - ~syslog_sink() - { - ::closelog(); - } - - syslog_sink(const syslog_sink&) = delete; - syslog_sink& operator=(const syslog_sink&) = delete; - - void log(const details::log_msg &msg) override - { - ::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str()); - } - - void flush() override - { - } - - -private: - std::array _priorities; - //must store the ident because the man says openlog might use the pointer as is and not a string copy - const std::string _ident; - - // - // Simply maps spdlog's log level to syslog priority level. - // - int syslog_prio_from_level(const details::log_msg &msg) const - { - return _priorities[static_cast(msg.level)]; - } -}; -} -} - -#endif diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/wincolor_sink.h b/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/wincolor_sink.h deleted file mode 100644 index 197e3f65c0b85c4c2f70e6dfd02c47bf2ec9d6a4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/sinks/wincolor_sink.h +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright(c) 2016 spdlog -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* - * Windows color console sink. Uses WriteConsoleA to write to the console with colors - */ -template -class wincolor_sink: public base_sink -{ -public: - const WORD BOLD = FOREGROUND_INTENSITY; - const WORD RED = FOREGROUND_RED; - const WORD CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD WHITE = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD YELLOW = FOREGROUND_RED | FOREGROUND_GREEN; - - wincolor_sink(HANDLE std_handle): out_handle_(std_handle) - { - colors_[level::trace] = CYAN; - colors_[level::debug] = CYAN; - colors_[level::info] = WHITE | BOLD; - colors_[level::warn] = YELLOW | BOLD; - colors_[level::err] = RED | BOLD; // red bold - colors_[level::critical] = BACKGROUND_RED | WHITE | BOLD; // white bold on red background - colors_[level::off] = 0; - } - - virtual ~wincolor_sink() - { - flush(); - } - - wincolor_sink(const wincolor_sink& other) = delete; - wincolor_sink& operator=(const wincolor_sink& other) = delete; - - virtual void _sink_it(const details::log_msg& msg) override - { - auto color = colors_[msg.level]; - auto orig_attribs = set_console_attribs(color); - WriteConsoleA(out_handle_, msg.formatted.data(), static_cast(msg.formatted.size()), nullptr, nullptr); - SetConsoleTextAttribute(out_handle_, orig_attribs); //reset to orig colors - } - - virtual void flush() override - { - // windows console always flushed? - } - - // change the color for the given level - void set_color(level::level_enum level, WORD color) - { - std::lock_guard lock(base_sink::_mutex); - colors_[level] = color; - } - -private: - HANDLE out_handle_; - std::map colors_; - - // set color and return the orig console attributes (for resetting later) - WORD set_console_attribs(WORD attribs) - { - CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info; - GetConsoleScreenBufferInfo(out_handle_, &orig_buffer_info); - SetConsoleTextAttribute(out_handle_, attribs); - return orig_buffer_info.wAttributes; //return orig attribs - } -}; - -// -// windows color console to stdout -// -template -class wincolor_stdout_sink: public wincolor_sink -{ -public: - wincolor_stdout_sink() : wincolor_sink(GetStdHandle(STD_OUTPUT_HANDLE)) - {} -}; - -typedef wincolor_stdout_sink wincolor_stdout_sink_mt; -typedef wincolor_stdout_sink wincolor_stdout_sink_st; - -// -// windows color console to stderr -// -template -class wincolor_stderr_sink: public wincolor_sink -{ -public: - wincolor_stderr_sink() : wincolor_sink(GetStdHandle(STD_ERROR_HANDLE)) - {} -}; - -typedef wincolor_stderr_sink wincolor_stderr_sink_mt; -typedef wincolor_stderr_sink wincolor_stderr_sink_st; - -} -} diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/spdlog.h b/archive_old_fs_versions/lfs/include/extern/spdlog/spdlog.h deleted file mode 100644 index bbf498120137f9f9041e571cca86bbc815175da8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/spdlog.h +++ /dev/null @@ -1,178 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// -// spdlog main header file. -// see example.cpp for usage example - -#pragma once - -#define SPDLOG_VERSION "0.12.0" - -#include -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ - -// -// Return an existing logger or nullptr if a logger with such name doesn't exist. -// example: spdlog::get("my_logger")->info("hello {}", "world"); -// -std::shared_ptr get(const std::string& name); - - -// -// Set global formatting -// example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v"); -// -void set_pattern(const std::string& format_string); -void set_formatter(formatter_ptr f); - -// -// Set global logging level for -// -void set_level(level::level_enum log_level); - -// -// Set global error handler -// -void set_error_handler(log_err_handler); - -// -// Turn on async mode (off by default) and set the queue size for each async_logger. -// effective only for loggers created after this call. -// queue_size: size of queue (must be power of 2): -// Each logger will pre-allocate a dedicated queue with queue_size entries upon construction. -// -// async_overflow_policy (optional, block_retry by default): -// async_overflow_policy::block_retry - if queue is full, block until queue has room for the new log entry. -// async_overflow_policy::discard_log_msg - never block and discard any new messages when queue overflows. -// -// worker_warmup_cb (optional): -// callback function that will be called in worker thread upon start (can be used to init stuff like thread affinity) -// -// worker_teardown_cb (optional): -// callback function that will be called in worker thread upon exit -// -void set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function& worker_teardown_cb = nullptr); - -// Turn off async mode -void set_sync_mode(); - - -// -// Create and register multi/single threaded basic file logger. -// Basic logger simply writes to given file without any limitatons or rotations. -// -std::shared_ptr basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate = false); -std::shared_ptr basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate = false); - -// -// Create and register multi/single threaded rotating file logger -// -std::shared_ptr rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files); -std::shared_ptr rotating_logger_st(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files); - -// -// Create file logger which creates new file on the given time (default in midnight): -// -std::shared_ptr daily_logger_mt(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0); -std::shared_ptr daily_logger_st(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0); - -// -// Create and register stdout/stderr loggers -// -std::shared_ptr stdout_logger_mt(const std::string& logger_name); -std::shared_ptr stdout_logger_st(const std::string& logger_name); -std::shared_ptr stderr_logger_mt(const std::string& logger_name); -std::shared_ptr stderr_logger_st(const std::string& logger_name); -// -// Create and register colored stdout/stderr loggers -// -std::shared_ptr stdout_color_mt(const std::string& logger_name); -std::shared_ptr stdout_color_st(const std::string& logger_name); -std::shared_ptr stderr_color_mt(const std::string& logger_name); -std::shared_ptr stderr_color_st(const std::string& logger_name); - - -// -// Create and register a syslog logger -// -#ifdef SPDLOG_ENABLE_SYSLOG -std::shared_ptr syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0); -#endif - -#if defined(__ANDROID__) -std::shared_ptr android_logger(const std::string& logger_name, const std::string& tag = "spdlog"); -#endif - -// Create and register a logger a single sink -std::shared_ptr create(const std::string& logger_name, const sink_ptr& sink); - -// Create and register a logger with multiple sinks -std::shared_ptr create(const std::string& logger_name, sinks_init_list sinks); -template -std::shared_ptr create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end); - - -// Create and register a logger with templated sink type -// Example: -// spdlog::create("mylog", "dailylog_filename"); -template -std::shared_ptr create(const std::string& logger_name, Args...); - - -// Register the given logger with the given name -void register_logger(std::shared_ptr logger); - -// Apply a user defined function on all registered loggers -// Example: -// spdlog::apply_all([&](std::shared_ptr l) {l->flush();}); -void apply_all(std::function)> fun); - -// Drop the reference to the given logger -void drop(const std::string &name); - -// Drop all references from the registry -void drop_all(); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Trace & Debug can be switched on/off at compile time for zero cost debug statements. -// Uncomment SPDLOG_DEBUG_ON/SPDLOG_TRACE_ON in teakme.h to enable. -// SPDLOG_TRACE(..) will also print current file and line. -// -// Example: -// spdlog::set_level(spdlog::level::trace); -// SPDLOG_TRACE(my_logger, "some trace message"); -// SPDLOG_TRACE(my_logger, "another trace message {} {}", 1, 2); -// SPDLOG_DEBUG(my_logger, "some debug message {} {}", 3, 4); -/////////////////////////////////////////////////////////////////////////////// - -#ifdef SPDLOG_TRACE_ON -#define SPDLOG_STR_H(x) #x -#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x) -#define SPDLOG_TRACE(logger, ...) logger->trace("[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__) -#else -#define SPDLOG_TRACE(logger, ...) -#endif - -#ifdef SPDLOG_DEBUG_ON -#define SPDLOG_DEBUG(logger, ...) logger->debug(__VA_ARGS__) -#else -#define SPDLOG_DEBUG(logger, ...) -#endif - - -} - - -#include diff --git a/archive_old_fs_versions/lfs/include/extern/spdlog/tweakme.h b/archive_old_fs_versions/lfs/include/extern/spdlog/tweakme.h deleted file mode 100644 index 86f66b9e0901cedf9c4c2048135950fa392cd8b2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/include/extern/spdlog/tweakme.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// Copyright(c) 2015 Gabi Melman. -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -/////////////////////////////////////////////////////////////////////////////// -// -// Edit this file to squeeze more performance, and to customize supported features -// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used. -// This clock is less accurate - can be off by dozens of millis - depending on the kernel HZ. -// Uncomment to use it instead of the regular clock. -// -// #define SPDLOG_CLOCK_COARSE -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if date/time logging is not needed and never appear in the log pattern. -// This will prevent spdlog from quering the clock on each log call. -// -// WARNING: If the log pattern contains any date/time while this flag is on, the result is undefined. -// You must set new pattern(spdlog::set_pattern(..") without any date/time in it -// -// #define SPDLOG_NO_DATETIME -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if thread id logging is not needed (i.e. no %t in the log pattern). -// This will prevent spdlog from quering the thread id on each log call. -// -// WARNING: If the log pattern contains thread id (i.e, %t) while this flag is on, the result is undefined. -// -// #define SPDLOG_NO_THREAD_ID -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment if logger name logging is not needed. -// This will prevent spdlog from copying the logger name on each log call. -// -// #define SPDLOG_NO_NAME -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros. -// -// #define SPDLOG_DEBUG_ON -// #define SPDLOG_TRACE_ON -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to avoid locking in the registry operations (spdlog::get(), spdlog::drop() spdlog::register()). -// Use only if your code never modifes concurrently the registry. -// Note that upon creating a logger the registry is modified by spdlog.. -// -// #define SPDLOG_NO_REGISTRY_MUTEX -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to avoid spdlog's usage of atomic log levels -// Use only if your code never modifies a logger's log levels concurrently by different threads. -// -// #define SPDLOG_NO_ATOMIC_LEVELS -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable usage of wchar_t for file names on Windows. -// -// #define SPDLOG_WCHAR_FILENAMES -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to override default eol ("\n" or "\r\n" under Linux/Windows) -// -// #define SPDLOG_EOL ";-)\n" -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to use your own copy of the fmt library instead of spdlog's copy. -// In this case spdlog will try to include so set your -I flag accordingly. -// -// #define SPDLOG_FMT_EXTERNAL -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to enable syslog (disabled by default) -// -// #define SPDLOG_ENABLE_SYSLOG -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// Uncomment to prevent child processes from inheriting log file descriptors -// -// #define SPDLOG_PREVENT_CHILD_FD -/////////////////////////////////////////////////////////////////////////////// diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/access.cpp b/archive_old_fs_versions/lfs/src/adafs_ops/access.cpp deleted file mode 100644 index f74ddcee9bb05b3b4cbf4dcbb5660a9ce51e779a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/access.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// -// Created by evie on 3/28/17. -// - -#include "access.hpp" -#include "mdata_ops.hpp" - -/** - * chk_access wrapper for opendir and open. - * @param req - * @param ino - * @param flags from fuse_file_info - * @return err - */ -int open_chk_access(fuse_req_t& req, fuse_ino_t ino, int flags) { - // XXX error handling - auto md = make_shared(); - - auto err = get_metadata(*md, ino); - - if (err != 0) return err; - - int access = flags & O_ACCMODE; // flags & 3. 0 = R, 1 = W, 2 = RW - - ADAFS_DATA->spdlogger()->debug("access {} flags {}", access, flags); - switch (access) { - case O_RDONLY: - return chk_access(req, *md, R_OK); - case O_WRONLY: - return chk_access(req, *md, W_OK); - case O_RDWR: - return chk_access(req, *md, R_OK | W_OK); - default: - return EACCES; - } - -} - -/** - * Checks access for mask (can be R_OK, W_OK, or X_OK (or combined) AFAIK and not verified) against metadata's mode. - * First the mask is checked agains the 3 bits for the user, then for the 3 bits of the group, and lastly other. - * If all three checks have failed, return EACCESS (no access) - * @param req - * @param md - * @param mask - * @return - */ -int chk_access(const fuse_req_t& req, const Metadata& md, int mask) { - ADAFS_DATA->spdlogger()->debug("chk_access() enter: metadata_uid {} fusecontext_uid {} mask {}", md.uid(), - fuse_req_ctx(req)->uid, mask); - // root user is a god - if (fuse_req_ctx(req)->uid == 0) - return 0; - - //check user leftmost 3 bits for rwx in md->mode - if (md.uid() == fuse_req_ctx(req)->uid) { - // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare - if ((mask & md.mode() >> 6) == static_cast(mask)) - return 0; - else - return EACCES; - } - - //check group middle 3 bits for rwx in md->mode - if (md.gid() == fuse_req_ctx(req)->gid) { - if ((mask & md.mode() >> 3) == static_cast(mask)) - return 0; - else - return EACCES; - } - - //check other rightmost 3 bits for rwx in md->mode. - // Because they are the rightmost bits they don't need to be shifted - if ((mask & md.mode()) == static_cast(mask)) { - return 0; - } - - return EACCES; -} - -/** - * Check if uid from fuse context (i.e., the caller) equals the uid from the object - * @param req - * @param md - * @return - */ -int chk_uid(const fuse_req_t& req, const Metadata& md) { - - // root user is a god - if (fuse_req_ctx(req)->uid == 0) - return 0; - - // if user is the user of md, he/she has access - if (fuse_req_ctx(req)->uid == md.uid()) - return 0; - - // else no permission - return EPERM; -} - -/** - * Changes the mode from an object to a given mode. Permissions are NOT checked here - * @param md - * @param mode - * @return - */ -// XXX error handling -int change_access(Metadata& md, mode_t mode, const bfs::path& path) { - -// auto path_hash = ADAFS_DATA->hashf(path.string()); -// md.mode((mode_t) mode); -// -// write_metadata_field(md.mode(), path_hash, md_field_map.at(Md_fields::mode)); -// -//#ifdef ACMtime -// md.update_ACM_time(true, true, true); -// write_metadata_field(md.atime(), path_hash, md_field_map.at(Md_fields::atime)); -// write_metadata_field(md.ctime(), path_hash, md_field_map.at(Md_fields::ctime)); -// write_metadata_field(md.mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -//#endif - - return 0; -} - -/** - * Changes the uid and gid from an object to a given mode. Only root can actually change gid and uid for now. - * Normal users can't change the uid because they only have one. - * And currently normal users can't change the group either. - * @param md - * @param uid - * @param gid - * @param path - * @return - */ -int change_permissions(Metadata& md, uid_t uid, gid_t gid, const bfs::path& path) { -// auto path_hash = ADAFS_DATA->hashf(path.string()); - -// // XXX Users should be able to change the group to whatever groups they're belonging to. For now group can only -// // XXX be changed to the active group they're belonging to. -// if (fuse_get_context()->gid != gid) -// return -EPERM; -// // if nothing changed, nothing to do -// if (md.uid() == uid && md.gid() == gid) -// return 0; -// -// // root can do anything -// if (fuse_get_context()->uid == 0) { -// md.uid(uid); -// md.gid(gid); -// write_metadata_field(md.gid(), path_hash, md_field_map.at(Md_fields::gid)); -// write_metadata_field(md.uid(), path_hash, md_field_map.at(Md_fields::uid)); -// -//#ifdef ACMtime -// md.update_ACM_time(true, true, true); -// write_metadata_field(md.atime(), path_hash, md_field_map.at(Md_fields::atime)); -// write_metadata_field(md.ctime(), path_hash, md_field_map.at(Md_fields::ctime)); -// write_metadata_field(md.mtime(), path_hash, md_field_map.at(Md_fields::mtime)); -//#endif -// return 0; -// } - // if we get here, users what to change uid or gid to something else which is not permitted - return EPERM; -} - - diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/access.hpp b/archive_old_fs_versions/lfs/src/adafs_ops/access.hpp deleted file mode 100644 index 48c638934ccde5a34274c3ecba03eb4a6cdf548b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/access.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Created by evie on 3/28/17. -// - -#ifndef FS_ACCESS_H -#define FS_ACCESS_H - -#include "../classes/metadata.hpp" - -int open_chk_access(fuse_req_t& req, fuse_ino_t ino, int flags); - -int chk_access(const fuse_req_t& req, const Metadata& md, int mask); - -int chk_uid(const fuse_req_t& req, const Metadata& md); - -int change_access(Metadata& md, mode_t mode, const bfs::path& path); - -int change_permissions(Metadata& md, uid_t uid, gid_t gid, const bfs::path& path); - -#endif //FS_ACCESS_H diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.cpp b/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.cpp deleted file mode 100644 index b97a3230a168f9a5be8b18ef5eefc60e0be4568d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#include "dentry_ops.hpp" -#include "../db/db_ops.hpp" -#include "../db/db_util.hpp" - -using namespace std; - -/** - * Initializes the dentry directory to hold future dentries - * @param inode - * @return err - */ -bool init_dentry_dir(const fuse_ino_t inode) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path()); - d_path /= fmt::FormatInt(inode).c_str(); - bfs::create_directories(d_path); - // XXX This might not be needed as it is another access to the underlying file system -// return bfs::exists(d_path); - return 0; -} - -/** - * Destroys the dentry directory - * @param inode - * @return 0 if successfully deleted - */ -int destroy_dentry_dir(const fuse_ino_t inode) { - auto d_path = bfs::path(ADAFS_DATA->dentry_path()); - d_path /= fmt::FormatInt(inode).c_str(); - - // remove dentry dir - bfs::remove_all(d_path); - - return 0; -} - -/** - * Check if the file name can be found in the directory entries of parent_dir_hash - * @param parent_dir_hash - * @param fname - * @return - */ -bool verify_dentry(const fuse_ino_t inode) { - // XXX do I need this? - return false; -// auto d_path = bfs::path(ADAFS_DATA->dentry_path()); -// if (inode != ADAFS_ROOT_INODE) { // non-root -// d_path /= -// } -// -// -// if (inode.has_parent_path()) { // non-root -// d_path /= fmt::FormatInt(ADAFS_DATA->hashf(inode.parent_path().string())); -// d_path /= inode.filename(); // root -// } else { -// d_path /= fmt::FormatInt(ADAFS_DATA->hashf(inode.string())); -// } -// // if file path exists leaf name is a valid dentry of parent_dir -// return bfs::exists(d_path); -} - - -/** - * Reads all directory entries in a directory with a given @hash. Returns 0 if successful. - * @dir is assumed to be empty - */ -int read_dentries(const fuse_ino_t p_inode, const fuse_ino_t inode) { -// auto path = bfs::path(ADAFS_DATA->dentry_path()); -// path /= fmt::FormatInt(inode); -// if (!bfs::exists(path)) return 1; -// // shortcut if path is empty = no files in directory -// if (bfs::is_empty(path)) return 0; -// -// // Below can be simplified with a C++11 range based loop? But how? :( XXX -// bfs::directory_iterator end_dir_it; -// for (bfs::directory_iterator dir_it(path); dir_it != end_dir_it; ++dir_it) { -// const bfs::path cp = (*dir_it); -// p_inode.push_back(cp.filename().string()); -// } - return 0; -} - -/** - * Reads all directory entries in a directory for the given inode. Returns 0 if successful. The dentries vector is not - * cleared before it is used. - * @param dentries assumed to be empty - * @param dir_inode - */ -void get_dentries(vector& dentries, const fuse_ino_t dir_inode) { - db_get_dentries(dentries, dir_inode); -} - - -/** - * Gets the inode of a directory entry - * @param req - * @param parent_inode - * @param name - * @return pair - */ -pair do_lookup(const fuse_ino_t p_inode, const string& name) { - string val; // will we filled by dentry exist check - if (db_dentry_exists(p_inode, name, val) == 0) { // dentry NOT found - return make_pair(ENOENT, INVALID_INODE); - } - - auto pos = val.find("_"); - auto inode = static_cast(stoul(val.substr(0, pos))); - - return make_pair(0, inode); -} - - -/** - * Creates an empty file in the dentry folder of the parent directory, acting as a dentry for lookup - * @param parent_dir - * @param name - * @return - */ -int create_dentry(const fuse_ino_t p_inode, const fuse_ino_t inode, const string& name, mode_t mode) { - // XXX check later if we need to check if dentry of father already exists - // put dentry for key, value - return db_put_dentry(db_build_dentry_key(p_inode, name), db_build_dentry_value(inode, mode)) ? 0 : EIO; -} - -/** - * Removes a dentry from the parent directory. It is not tested if the parent inode exists. This should have been - * done by do_lookup preceeding this call (impicit or explicit). - * Currently just a wrapper for the db operation - * @param p_inode - * @param name - * @return pair - */ -// XXX errorhandling -pair remove_dentry(const fuse_ino_t p_inode, const string& name) { - return db_delete_dentry_get_inode(p_inode, name); -} - -/** - * Checks if a directory has no dentries, i.e., is empty. Returns zero if empty, or err code. - * @param inode - * @return err - */ -int is_dir_empty(const fuse_ino_t inode) { - return db_is_dir_empty(inode) ? 0 : ENOTEMPTY; -} diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.hpp b/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.hpp deleted file mode 100644 index 171821a0f81249716177c1aa92df3e7409505f31..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/dentry_ops.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#ifndef FS_DENTRY_OPS_H -#define FS_DENTRY_OPS_H - -#include "../main.hpp" -#include "../classes/dentry.hpp" - - -bool init_dentry_dir(const fuse_ino_t inode); - -int destroy_dentry_dir(const fuse_ino_t inode); - -bool verify_dentry(const fuse_ino_t inode); - -int read_dentries(const fuse_ino_t p_inode, const fuse_ino_t inode); - -void get_dentries(std::vector& dentries, const fuse_ino_t dir_inode); - -std::pair do_lookup(const fuse_ino_t p_inode, const std::string& name); - -int create_dentry(const fuse_ino_t p_inode, const fuse_ino_t inode, const std::string& name, mode_t mode); - -std::pair remove_dentry(const fuse_ino_t p_inode, const std::string& name); - -int is_dir_empty(const fuse_ino_t inode); - -#endif //FS_DENTRY_OPS_H diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/io.cpp b/archive_old_fs_versions/lfs/src/adafs_ops/io.cpp deleted file mode 100644 index f036706b15edf991d0718676345a360fc19207e8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/io.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// -// Created by evie on 4/3/17. -// - -#include "io.hpp" -#include "../classes/metadata.hpp" -#include "mdata_ops.hpp" - -using namespace std; - -/** - * Creates the directory in the chunk dir for a file to hold data - * @param inode - * @return - */ -// XXX this might be just a temp function as long as we don't use chunks -// XXX this function creates not only the chunk folder but also a single file which holds the data of the 'real' file -int init_chunk_space(const fuse_ino_t inode) { - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= to_string(inode); - - // create chunk dir - bfs::create_directories(chnk_path); - - // XXX create temp big file. remember also to modify the return value - chnk_path /= "data"s; - bfs::ofstream ofs{chnk_path}; - -// return static_cast(bfs::exists(chnk_path)); - return 0; -} -/** - * Remove the directory in the chunk dir of a file. - * @param inode - * @return - */ -// XXX this might be just a temp function as long as we don't use chunks -int destroy_chunk_space(const fuse_ino_t inode) { - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= to_string(inode); - - // create chunk dir - bfs::remove_all(chnk_path); - -// return static_cast(!bfs::exists(chnk_path)); - return 0; -} - -/** - * pread wrapper - * @param buf - * @param read_size - * @param path - * @param size - * @param off - * @return - */ -int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off) { - int fd = open(path, R_OK); - if (fd < 0) - return EIO; - read_size = static_cast(pread(fd, buf, size, off)); - close(fd); - return 0; -} - -int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, - const bool append) { - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= fmt::FormatInt(inode).c_str(); - chnk_path /= "data"s; - // write to local file - int fd = open(chnk_path.c_str(), W_OK); - if (fd < 0) - return EIO; - write_size = static_cast(pwrite(fd, buf, size, off)); - close(fd); - // Depending on if the file was appended or not metadata sizes need to be modified accordingly - if (append) { - // appending requires to read the old size first so that the new size can be added to it - Metadata md{}; - read_metadata_field_md(inode, Md_fields::size, md); - // truncating file - truncate(chnk_path.c_str(), md.size() + size); - // refresh metadata size field - write_metadata_field(inode, Md_fields::size, md.size() + static_cast(size)); - } else { - truncate(chnk_path.c_str(), size); - write_metadata_field(inode, Md_fields::size, static_cast(size)); - } - - return 0; -} diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/io.hpp b/archive_old_fs_versions/lfs/src/adafs_ops/io.hpp deleted file mode 100644 index 07900277d5ab565d3bbd66960e2df52e87e0908e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/io.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Created by evie on 4/3/17. -// - -#ifndef FS_IO_H -#define FS_IO_H - -#include "../main.hpp" - -int init_chunk_space(const fuse_ino_t inode); - -int destroy_chunk_space(const fuse_ino_t inode); - -int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off); - -int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, - const bool append); - - -#endif //FS_IO_H diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.cpp b/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.cpp deleted file mode 100644 index b00f9f86dc5228007db5f0f0e93eadb43c48a0af..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.cpp +++ /dev/null @@ -1,394 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#include "mdata_ops.hpp" -#include "dentry_ops.hpp" -#include "../rpc/client/c_dentry.hpp" -#include "../rpc/client/c_metadata.hpp" -#include "io.hpp" - -using namespace std; - -/** - * Reads a specific metadata field from the database and puts it into the corresponding metadata object - * @tparam T - * @param inode - * @param field - * @return type, 0 might mean failure - */ -void read_metadata_field_md(const fuse_ino_t inode, const Md_fields field, Metadata& md) { - // XXX I am sure this can be implemented in a better way - switch (field) { - case Md_fields::atime: - md.atime(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::mtime: - md.mtime(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::ctime: - md.ctime(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::uid: - md.uid(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::gid: - md.gid(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::mode: - md.mode(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::inode_no: - md.inode_no(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::link_count: - md.link_count(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::size: - md.size(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - case Md_fields::blocks: - md.blocks(db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map)))); - break; - } -} - -int write_all_metadata(const Metadata& md) { - auto inode_key = fmt::FormatInt(md.inode_no()).str(); - // TODO this should be somewhat a batch operation or similar. this errorhandling is bs - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.atime())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.mtime())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.ctime())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.uid())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.gid())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.mode())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.inode_no())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.link_count())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.size())) - return EIO; - if (!db_put_mdata(db_build_mdata_key( - inode_key, std::get(md_field_map)), md.blocks())) - return EIO; - - return 0; -} - -// TODO error handling. -int read_all_metadata(Metadata& md, const fuse_ino_t inode) { - auto inode_key = fmt::FormatInt(inode).str(); - - md.atime(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.mtime(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.ctime(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.uid(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.gid(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.mode(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.inode_no(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.link_count(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.size(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - md.blocks(db_get_mdata( - db_build_mdata_key(inode_key, std::get(md_field_map)))); - return 0; -} - -/** - * Removes the metadata of a file based on the inode. The function does not check if the inode exists. This should - * be done by the get_metadata() (implicit or explicit) - * @param inode - * @return err - */ -int remove_all_metadata(const fuse_ino_t inode) { - auto inode_key = fmt::FormatInt(inode).str(); - // TODO this should be somewhat a batch operation or similar. this errorhandling is bs - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - if (!db_delete_mdata(db_build_mdata_key(inode_key, std::get(md_field_map)))) - return EIO; - return 0; -} - -/** - * Gets the metadata via its inode and puts it into an Metadata object. - * @param md - * @param inode - * @return err - */ -int get_metadata(Metadata& md, const fuse_ino_t inode) { - ADAFS_DATA->spdlogger()->debug("get_metadata() enter for inode {}", inode); - // Verify that the file's inode exists - if (db_mdata_exists(inode)) { - read_all_metadata(md, inode); - return 0; - } else - return ENOENT; -} - -/** - * Gets the metadata via its inode and puts it into the stat struct. - * - * @param req - * @param attr - * @param inode - * @return err - */ -int get_attr(struct stat& attr, const fuse_ino_t inode) { - - // XXX look in attribute cache first - Metadata md{}; - int err; - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(fmt::FormatInt(inode).str()); - if (ADAFS_DATA->is_local_op(recipient) || inode == ADAFS_ROOT_INODE) { // local, root inode is locally available - err = get_metadata(md, inode); - if (err == 0) - metadata_to_stat(md, attr); - } else { // remote - // attr is filled in here for rpcs - err = rpc_send_get_attr(recipient, inode, attr); - } - } else { // single node operation - err = get_metadata(md, inode); - if (err == 0) - metadata_to_stat(md, attr); - } - if (err != 0) - ADAFS_DATA->spdlogger()->error("Failed to get attributes."); - - return err; -} - -void metadata_to_stat(const Metadata& md, struct stat& attr) { - attr.st_ino = md.inode_no(); - attr.st_mode = md.mode(); - attr.st_nlink = md.link_count(); - attr.st_uid = md.uid(); - attr.st_gid = md.gid(); - attr.st_size = md.size(); - attr.st_blksize = ADAFS_DATA->blocksize(); // globally set blocksize is used - attr.st_blocks = md.blocks(); - attr.st_atim.tv_sec = md.atime(); - attr.st_mtim.tv_sec = md.mtime(); - attr.st_ctim.tv_sec = md.ctime(); -} - -/** - * Initializes the metadata for the given parameters. Return value not returning the state yet. - * Function will additionally return filled fuse_entry_param - * @param inode - * @param uid - * @param gid - * @param mode - * @return always 0 - */ -int init_metadata_fep(struct fuse_entry_param& fep, const fuse_ino_t inode, const uid_t uid, const gid_t gid, - mode_t mode) { - Metadata md{mode, uid, gid, inode}; - if ((mode & S_IFDIR) == S_IFDIR) { - // XXX just visual. size computation of directory should be done properly at some point - md.size(ADAFS_DATA->blocksize()); - } - auto err = write_all_metadata(md); - - // create dentry for Linux - fep.entry_timeout = 1.0; - fep.attr_timeout = 1.0; - fep.ino = md.inode_no(); - //fill fep.attr with the metadata information - metadata_to_stat(md, fep.attr); - return err; -} - -/** - * Initializes the metadata for the given parameters. Return value not returning the state yet. - * @param inode - * @param uid - * @param gid - * @param mode - * @return always 0 - */ -int init_metadata(const fuse_ino_t inode, const uid_t uid, const gid_t gid, mode_t mode) { - Metadata md{mode, uid, gid, inode}; - if ((mode & S_IFDIR) == S_IFDIR) { - // XXX just visual. size computation of directory should be done properly at some point - md.size(ADAFS_DATA->blocksize()); - } - auto err = write_all_metadata(md); - - return err; -} - -/** - * Creates a new node (file or directory) in the file system. Fills given fuse_entry_param. - * @param req - * @param fep - * @param parent - * @param name - * @param mode - * @return err - */ -int create_node(struct fuse_entry_param& fep, fuse_ino_t parent, const char* name, const uid_t uid, const gid_t gid, - mode_t mode) { - int err; - // create new inode number - fuse_ino_t new_inode = Util::generate_inode_no(); - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(RPC_DATA->get_dentry_hashable(parent, name)); - if (ADAFS_DATA->is_local_op(recipient)) { // local dentry create - err = create_dentry(parent, new_inode, name, mode); - } else { // remote dentry create - err = rpc_send_create_dentry(recipient, parent, name, mode, new_inode); - } - if (err != 0) { // failure in dentry creation - ADAFS_DATA->spdlogger()->error("Failed to create a dentry"); - return err; - } - // calculate recipient again for new inode because it could hash somewhere else - recipient = RPC_DATA->get_rpc_node(fmt::FormatInt(new_inode).str()); - if (ADAFS_DATA->is_local_op(recipient)) { // local metadata init - err = init_metadata_fep(fep, new_inode, uid, gid, mode); - if (err == 0) - init_chunk_space(new_inode); - } else { // remote metadata init - err = rpc_send_create_mdata(recipient, uid, gid, mode, new_inode); - if (err == 0) { - // Because we don't want to return the metadata init values through the RPC - // we just set dummy values here with the most important bits - fep.ino = new_inode; - fep.attr.st_ino = new_inode; - fep.attr.st_mode = mode; - fep.attr.st_blocks = 0; - fep.attr.st_gid = gid; - fep.attr.st_uid = uid; - fep.attr.st_nlink = 0; - fep.attr.st_size = 0; - fep.entry_timeout = 1.0; - fep.attr_timeout = 1.0; - } else { - // TODO remove created dentry - } - } - } else { //local single node operation - // XXX check permissions (omittable), should create node be atomic? - // create dentry - err = create_dentry(parent, new_inode, name, mode); - if (err != 0) { // failure in dentry creation - ADAFS_DATA->spdlogger()->error("Failed to create a dentry"); - return err; - } - // create metadata and fill fuse entry param - err = init_metadata_fep(fep, new_inode, uid, gid, mode); - if (err == 0) - init_chunk_space(new_inode); - } - if (err != 0) - ADAFS_DATA->spdlogger()->error("Failed to create metadata"); - // TODO remove created dentry - - return err; -} - -int remove_node(fuse_ino_t parent, const char* name) { - - fuse_ino_t del_inode; - int err; - - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(RPC_DATA->get_dentry_hashable(parent, name)); - if (ADAFS_DATA->is_local_op(recipient)) { // local dentry removal - // Remove denty returns pair - tie(err, del_inode) = remove_dentry(parent, name); - } else { // remote dentry removal - err = rpc_send_remove_dentry(recipient, parent, name, del_inode); - } - if (err != 0) { - ADAFS_DATA->spdlogger()->error("Failed to remove dentry"); - return err; - } - // recalculate recipient for metadata removal - recipient = RPC_DATA->get_rpc_node(fmt::FormatInt(del_inode).str()); - if (ADAFS_DATA->is_local_op(recipient)) { // local metadata removal - err = remove_all_metadata(del_inode); - if (err == 0) - destroy_chunk_space(del_inode); - } else { // remote metadata removal - err = rpc_send_remove_mdata(recipient, del_inode); - } - } else { // single node local operation - // Remove denty returns pair - tie(err, del_inode) = remove_dentry(parent, name); - if (err != 0) { - ADAFS_DATA->spdlogger()->error("Failed to remove dentry"); - return err; - } - // Remove inode - err = remove_all_metadata(del_inode); - if (err == 0) - destroy_chunk_space(del_inode); - } - - if (err != 0) - ADAFS_DATA->spdlogger()->error("Failed to remove metadata"); - - /* TODO really consider if this is even required in a distributed setup, I'd argue: No - * XXX consider the whole lookup count functionality. We need something like a hashtable here, which marks the file - * for removal. If forget is then called, the file should be really removed. (see forget comments) - * Any fuse comments that increment the lookup count will show the file as deleted after unlink and before/after forget. - * symlinks, hardlinks, devices, pipes, etc all work differently with forget and unlink - */ - - return err; -} - - diff --git a/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.hpp b/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.hpp deleted file mode 100644 index f5e7c4de19ce76c6e54b43839a396f10468dda31..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/adafs_ops/mdata_ops.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#ifndef FS_METADATA_OPS_H -#define FS_METADATA_OPS_H - -#include "../main.hpp" -#include "../classes/metadata.hpp" -#include "../db/db_ops.hpp" -#include "../db/db_txn_ops.hpp" -#include "../db/db_util.hpp" - -using namespace std; - -/** - * Reads a specific metadata field from the database and returns it - * @tparam T - * @param inode - * @param field - * @return type, 0 might mean failure - */ -template -decltype(auto) read_metadata_field(const fuse_ino_t inode, const Md_fields field) { - // XXX I am sure this can be implemented in a better way - switch (field) { - case Md_fields::atime: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::mtime: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::ctime: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::uid: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::gid: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::mode: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::inode_no: - return db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::link_count: - return db_get_mdata( - db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::size: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - case Md_fields::blocks: - return db_get_mdata(db_build_mdata_key(inode, std::get(md_field_map))); - } - -} - -void read_metadata_field_md(const fuse_ino_t inode, const Md_fields field, Metadata& md); - -/** - * writes a specific metadata field to the database - * @tparam T - * @param inode - * @param field - * @param md - * @return bool - success - */ -template -bool write_metadata_field(const fuse_ino_t inode, const Md_fields field, const T val) { - // XXX I am sure this can be implemented in a better way - switch (field) { - case Md_fields::atime: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::mtime: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::ctime: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::uid: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::gid: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::mode: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::inode_no: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::link_count: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::size: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - case Md_fields::blocks: - return db_put_mdata(db_build_mdata_key(inode, std::get(md_field_map)), - val); - } - return false; // never reached... compiler complains if left out -} - - -int write_all_metadata(const Metadata& md); - -int read_all_metadata(Metadata& md, const fuse_ino_t inode); - -int remove_all_metadata(const fuse_ino_t inode); - -int get_metadata(Metadata& md, const fuse_ino_t inode); - -int get_attr(struct stat& attr, const fuse_ino_t inode); - -void metadata_to_stat(const Metadata& md, struct stat& attr); - -int init_metadata_fep(struct fuse_entry_param& fep, const fuse_ino_t inode, const uid_t uid, const gid_t gid, - mode_t mode); - -int init_metadata(const fuse_ino_t inode, const uid_t uid, const gid_t gid, mode_t mode); - -int create_node(struct fuse_entry_param& fep, fuse_ino_t parent, const char* name, const uid_t uid, const gid_t gid, - mode_t mode); - -int remove_node(fuse_ino_t parent, const char* name); - -#endif //FS_METADATA_OPS_H diff --git a/archive_old_fs_versions/lfs/src/classes/dentry.cpp b/archive_old_fs_versions/lfs/src/classes/dentry.cpp deleted file mode 100644 index 43202274a54bcd7214f1f315b18835544ea9c347..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/dentry.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// Created by evie on 5/9/17. -// - -#include "dentry.hpp" - -Dentry::Dentry() {} - -Dentry::Dentry(const std::string& name_) : name_(name_) {} - -Dentry::Dentry(const std::string& name_, fuse_ino_t inode_, mode_t mode_) : name_(name_), inode_(inode_), - mode_(mode_) {} - -const std::string& Dentry::name() const { - return name_; -} - -void Dentry::name(const std::string& name_) { - Dentry::name_ = name_; -} - -fuse_ino_t Dentry::inode() const { - return inode_; -} - -void Dentry::inode(fuse_ino_t inode_) { - Dentry::inode_ = inode_; -} - -mode_t Dentry::mode() const { - return mode_; -} - -void Dentry::mode(mode_t mode_) { - Dentry::mode_ = mode_; -} diff --git a/archive_old_fs_versions/lfs/src/classes/dentry.hpp b/archive_old_fs_versions/lfs/src/classes/dentry.hpp deleted file mode 100644 index a246da4c2592cc5822a21a777f23ef3d4dd21a1a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/dentry.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created by evie on 5/9/17. -// - -#ifndef LFS_DEnTRY_H -#define LFS_DEnTRY_H - -#include "../main.hpp" - -class Dentry { - -private: - std::string name_; - fuse_ino_t inode_; - mode_t mode_; // file type code (6 bits) + permission bits (9 bits rwx(user)rwx(group)rwx(others) - -public: - Dentry(); - - Dentry(const std::string& name_); - - Dentry(const std::string& name_, fuse_ino_t inode_, mode_t mode_); - - const std::string& name() const; - - void name(const std::string& name_); - - fuse_ino_t inode() const; - - void inode(fuse_ino_t inode_); - - mode_t mode() const; - - void mode(mode_t mode_); - - -}; - - -#endif //LFS_DEnTRY_H diff --git a/archive_old_fs_versions/lfs/src/classes/fs_data.cpp b/archive_old_fs_versions/lfs/src/classes/fs_data.cpp deleted file mode 100644 index 5b3cd8b660d394316862e570a4ee5f4435af974e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/fs_data.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// -// Created by evie on 4/18/17. -// - -#include "fs_data.hpp" - -// getter/setter - -const std::unordered_map& FsData::hashmap() const { - return hashmap_; -} - -void FsData::hashmap(const std::unordered_map& hashmap_) { - FsData::hashmap_ = hashmap_; -} - -const std::hash& FsData::hashf() const { - return hashf_; -} - -void FsData::hashf(const std::hash& hashf_) { - FsData::hashf_ = hashf_; -} - -blksize_t FsData::blocksize() const { - return blocksize_; -} - -void FsData::blocksize(blksize_t blocksize_) { - FsData::blocksize_ = blocksize_; -} - -const std::shared_ptr& FsData::spdlogger() const { - return spdlogger_; -} - -void FsData::spdlogger(const std::shared_ptr& spdlogger_) { - FsData::spdlogger_ = spdlogger_; -} - -const std::string& FsData::rootdir() const { - return rootdir_; -} - -void FsData::rootdir(const std::string& rootdir_) { - FsData::rootdir_ = rootdir_; -} - -const std::string& FsData::inode_path() const { - return inode_path_; -} - -void FsData::inode_path(const std::string& inode_path_) { - FsData::inode_path_ = inode_path_; -} - -const std::string& FsData::dentry_path() const { - return dentry_path_; -} - -void FsData::dentry_path(const std::string& dentry_path_) { - FsData::dentry_path_ = dentry_path_; -} - -const std::string& FsData::chunk_path() const { - return chunk_path_; -} - -void FsData::chunk_path(const std::string& chunk_path_) { - FsData::chunk_path_ = chunk_path_; -} - -const std::string& FsData::mgmt_path() const { - return mgmt_path_; -} - -void FsData::mgmt_path(const std::string& mgmt_path_) { - FsData::mgmt_path_ = mgmt_path_; -} - -const rocksdb::Options& FsData::rdb_options() const { - return rdb_options_; -} - -void FsData::rdb_options(const rocksdb::Options& rdb_options) { - FsData::rdb_options_ = rdb_options; -} - -const std::string& FsData::rdb_path() const { - return rdb_path_; -} - -void FsData::rdb_path(const std::string& rdb_path) { - FsData::rdb_path_ = rdb_path; -} - -const std::shared_ptr& FsData::rdb() const { - return rdb_; -} - -void FsData::rdb(const std::shared_ptr& rdb) { - FsData::rdb_ = rdb; -} - -const std::shared_ptr& FsData::txn_rdb() const { - return txn_rdb_; -} - -void FsData::txn_rdb(const std::shared_ptr& tx_rdb) { - FsData::txn_rdb_ = tx_rdb; -} - -const std::shared_ptr& FsData::rdb_crt() const { - return rdb_crt_; -} - -void FsData::rdb_crt(const std::shared_ptr& rdb_crt) { - FsData::rdb_crt_ = rdb_crt; -} - -const rocksdb::OptimisticTransactionOptions& FsData::txn_rdb_options() const { - return txn_rdb_options_; -} - -void FsData::txn_rdb_options(const rocksdb::OptimisticTransactionOptions& tx_rdb_options) { - FsData::txn_rdb_options_ = tx_rdb_options; -} - -const rocksdb::WriteOptions& FsData::rdb_write_options() const { - return rdb_write_options_; -} - -void FsData::rdb_write_options(const rocksdb::WriteOptions& rdb_write_options) { - FsData::rdb_write_options_ = rdb_write_options; -} - -fuse_ino_t FsData::inode_count() const { - return inode_count_; -} - -void FsData::inode_count(fuse_ino_t inode_count) { - FsData::inode_count_ = inode_count; -} - -const std::map& FsData::hosts() const { - return hosts_; -} - -void FsData::hosts(const std::map& hosts) { - FsData::hosts_ = hosts; -} - -const uint64_t& FsData::host_id() const { - return host_id_; -} - -void FsData::host_id(const uint64_t& host_id) { - FsData::host_id_ = host_id; -} - -size_t FsData::host_size() const { - return host_size_; -} - -void FsData::host_size(size_t host_size) { - FsData::host_size_ = host_size; -} - -std::string FsData::rpc_port() const { - return rpc_port_; -} - -void FsData::rpc_port(std::string rpc_port) { - FsData::rpc_port_ = rpc_port; -} - -// Utility member functions - -fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { - FsData::inode_count_ += count; - return FsData::inode_count_; -} - -bool FsData::is_local_op(const size_t recipient) { - return recipient == host_id_; -} - - - - - - - diff --git a/archive_old_fs_versions/lfs/src/classes/fs_data.h b/archive_old_fs_versions/lfs/src/classes/fs_data.h deleted file mode 100644 index 5d981155bd89cb59868f0799fedc03ece2b35e62..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/fs_data.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// Created by evie on 4/18/17. -// - -#ifndef LFS_FS_DATA_H -#define LFS_FS_DATA_H - -#include "../main.hpp" - -class FsData { - -private: - FsData() {} - - // Caching - std::unordered_map hashmap_; - std::hash hashf_; - - // inodes - fuse_ino_t inode_count_; - - // Later the blocksize will likely be coupled to the chunks to allow individually big chunk sizes. - blksize_t blocksize_; - - //logger - std::shared_ptr spdlogger_; - - // paths - std::string rootdir_; - std::string inode_path_; - std::string dentry_path_; - std::string chunk_path_; - std::string mgmt_path_; - - // rocksdb - std::shared_ptr rdb_; - std::shared_ptr rdb_crt_; // additional db instance (currently not used) - std::shared_ptr txn_rdb_; - rocksdb::Options rdb_options_; - rocksdb::OptimisticTransactionOptions txn_rdb_options_; // needed for snapshots - rocksdb::WriteOptions rdb_write_options_; - std::string rdb_path_; - -public: - - // mutex has a deleted method to assign an existing mutex. As such it cannot use getter or setters - std::mutex inode_mutex; - - static FsData* getInstance() { - static FsData instance; - return &instance; - } - - FsData(FsData const&) = delete; - - void operator=(FsData const&) = delete; - - // getter/setter - const std::unordered_map& hashmap() const; - - void hashmap(const std::unordered_map& hashmap_); - - const std::hash& hashf() const; - - void hashf(const std::hash& hashf_); - - fuse_ino_t inode_count() const; - - void inode_count(fuse_ino_t inode_count); - - blksize_t blocksize() const; - - void blocksize(blksize_t blocksize_); - - const std::shared_ptr& spdlogger() const; - - void spdlogger(const std::shared_ptr& spdlogger_); - - const std::string& rootdir() const; - - void rootdir(const std::string& rootdir_); - - const std::string& inode_path() const; - - void inode_path(const std::string& inode_path_); - - const std::string& dentry_path() const; - - void dentry_path(const std::string& dentry_path_); - - const std::string& chunk_path() const; - - void chunk_path(const std::string& chunk_path_); - - const std::string& mgmt_path() const; - - void mgmt_path(const std::string& mgmt_path_); - - const std::shared_ptr& rdb() const; - - void rdb(const std::shared_ptr& rdb); - - const rocksdb::Options& rdb_options() const; - - void rdb_options(const rocksdb::Options& rdb_options); - - const std::string& rdb_path() const; - - void rdb_path(const std::string& rdb_path); - - const std::shared_ptr& txn_rdb() const; - - void txn_rdb(const std::shared_ptr& tx_rdb); - - const std::shared_ptr& rdb_crt() const; - - void rdb_crt(const std::shared_ptr& rdb_crt); - - const rocksdb::OptimisticTransactionOptions& txn_rdb_options() const; - - void txn_rdb_options(const rocksdb::OptimisticTransactionOptions& tx_rdb_options); - - const rocksdb::WriteOptions& rdb_write_options() const; - - void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); - - // Utility member functions - - fuse_ino_t raise_inode_count(fuse_ino_t count); -}; - - -#endif //LFS_FS_DATA_H diff --git a/archive_old_fs_versions/lfs/src/classes/fs_data.hpp b/archive_old_fs_versions/lfs/src/classes/fs_data.hpp deleted file mode 100644 index dfcf8d6ba6e3f1c9d1c7f3dab003f6a757ab2af0..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/fs_data.hpp +++ /dev/null @@ -1,160 +0,0 @@ -// -// Created by evie on 4/18/17. -// - -#ifndef LFS_FS_DATA_H -#define LFS_FS_DATA_H - -#include "../main.hpp" -#include - - -class FsData { - -private: - FsData() {} - - // Caching - std::unordered_map hashmap_; - std::hash hashf_; - - // inodes - fuse_ino_t inode_count_; - - // Later the blocksize will likely be coupled to the chunks to allow individually big chunk sizes. - blksize_t blocksize_; - - //logger - std::shared_ptr spdlogger_; - - // paths - std::string rootdir_; - std::string inode_path_; - std::string dentry_path_; - std::string chunk_path_; - std::string mgmt_path_; - - // hosts_ - std::map hosts_; - uint64_t host_id_; // my host number - size_t host_size_; - std::string rpc_port_; - - // rocksdb - std::shared_ptr rdb_; - std::shared_ptr rdb_crt_; // additional db instance (currently not used) - std::shared_ptr txn_rdb_; - rocksdb::Options rdb_options_; - rocksdb::OptimisticTransactionOptions txn_rdb_options_; // needed for snapshots - rocksdb::WriteOptions rdb_write_options_; - std::string rdb_path_; - -public: - - // mutex has a deleted method to assign an existing mutex. As such it cannot use getter or setters - std::mutex inode_mutex; - - - static FsData* getInstance() { - static FsData instance; - return &instance; - } - - FsData(FsData const&) = delete; - - void operator=(FsData const&) = delete; - - // getter/setter - const std::unordered_map& hashmap() const; - - void hashmap(const std::unordered_map& hashmap_); - - const std::hash& hashf() const; - - void hashf(const std::hash& hashf_); - - fuse_ino_t inode_count() const; - - void inode_count(fuse_ino_t inode_count); - - blksize_t blocksize() const; - - void blocksize(blksize_t blocksize_); - - const std::shared_ptr& spdlogger() const; - - void spdlogger(const std::shared_ptr& spdlogger_); - - const std::string& rootdir() const; - - void rootdir(const std::string& rootdir_); - - const std::string& inode_path() const; - - void inode_path(const std::string& inode_path_); - - const std::string& dentry_path() const; - - void dentry_path(const std::string& dentry_path_); - - const std::string& chunk_path() const; - - void chunk_path(const std::string& chunk_path_); - - const std::string& mgmt_path() const; - - void mgmt_path(const std::string& mgmt_path_); - - const std::shared_ptr& rdb() const; - - void rdb(const std::shared_ptr& rdb); - - const rocksdb::Options& rdb_options() const; - - void rdb_options(const rocksdb::Options& rdb_options); - - const std::string& rdb_path() const; - - void rdb_path(const std::string& rdb_path); - - const std::shared_ptr& txn_rdb() const; - - void txn_rdb(const std::shared_ptr& tx_rdb); - - const std::shared_ptr& rdb_crt() const; - - void rdb_crt(const std::shared_ptr& rdb_crt); - - const rocksdb::OptimisticTransactionOptions& txn_rdb_options() const; - - void txn_rdb_options(const rocksdb::OptimisticTransactionOptions& tx_rdb_options); - - const rocksdb::WriteOptions& rdb_write_options() const; - - void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); - - const std::map& hosts() const; - - void hosts(const std::map& hosts); - - const uint64_t& host_id() const; - - void host_id(const uint64_t& host_id); - - size_t host_size() const; - - void host_size(size_t host_size); - - std::string rpc_port() const; - - void rpc_port(std::string rpc_port); - - // Utility member functions - - fuse_ino_t raise_inode_count(fuse_ino_t count); - - bool is_local_op(size_t recipient); -}; - - -#endif //LFS_FS_DATA_H diff --git a/archive_old_fs_versions/lfs/src/classes/metadata.cpp b/archive_old_fs_versions/lfs/src/classes/metadata.cpp deleted file mode 100644 index 5e6b8ab90031e26a8cc8f1ab1539104b9574c917..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/metadata.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// -// Created by draze on 3/5/17. -// - -#include "metadata.hpp" - -time_t Metadata::atime() const { - return atime_; -} - -void Metadata::atime(time_t atime_) { - Metadata::atime_ = atime_; -} - -time_t Metadata::mtime() const { - return mtime_; -} - -void Metadata::mtime(time_t mtime_) { - Metadata::mtime_ = mtime_; -} - -time_t Metadata::ctime() const { - return ctime_; -} - -void Metadata::ctime(time_t ctime_) { - Metadata::ctime_ = ctime_; -} - -uid_t Metadata::uid() const { - return uid_; -} - -void Metadata::uid(uid_t uid_) { - Metadata::uid_ = uid_; -} - -gid_t Metadata::gid() const { - return gid_; -} - -void Metadata::gid(gid_t gid_) { - Metadata::gid_ = gid_; -} - -mode_t Metadata::mode() const { - return mode_; -} - -void Metadata::mode(mode_t mode_) { - Metadata::mode_ = mode_; -} - -fuse_ino_t Metadata::inode_no() const { - return inode_no_; -} - -void Metadata::inode_no(fuse_ino_t inode_no_) { - Metadata::inode_no_ = inode_no_; -} - -nlink_t Metadata::link_count() const { - return link_count_; -} - -void Metadata::link_count(nlink_t link_count_) { - Metadata::link_count_ = link_count_; -} - -off_t Metadata::size() const { - return size_; -} - -void Metadata::size(off_t size_) { - Metadata::size_ = size_; -} - -blkcnt_t Metadata::blocks() const { - return blocks_; -} - -void Metadata::blocks(blkcnt_t blocks_) { - Metadata::blocks_ = blocks_; -} - -//-------------------------------------------- -// By default create an empty metadata object -//Metadata::Metadata() : Metadata(S_IFREG | 0755) {} -Metadata::Metadata() : atime_(), - mtime_(), - ctime_(), - uid_(), - gid_(), - mode_(), - inode_no_(0), - link_count_(0), - size_(0), - blocks_(0) {} - -Metadata::Metadata(mode_t mode, uint32_t uid, uint32_t gid) : - atime_(), - mtime_(), - ctime_(), - uid_(uid), - gid_(gid), - mode_(mode), - inode_no_(0), - link_count_(0), - size_(0), - blocks_(0) { - init_ACM_time(); - inode_no_ = Util::generate_inode_no(); -} - -Metadata::Metadata(mode_t mode, uid_t uid, gid_t gid, fuse_ino_t inode) : - atime_(), - mtime_(), - ctime_(), - uid_(uid), - gid_(gid), - mode_(mode), - inode_no_(inode), - link_count_(0), - size_(0), - blocks_(0) { - init_ACM_time(); -} - -void Metadata::init_ACM_time() { - std::time_t time; - std::time(&time); - atime_ = time; - mtime_ = time; - ctime_ = time; -} - -void Metadata::update_ACM_time(bool a, bool c, bool m) { - std::time_t time; - std::time(&time); - if (a) - atime_ = time; - if (c) - ctime_ = time; - if (m) - mtime_ = time; -} diff --git a/archive_old_fs_versions/lfs/src/classes/metadata.hpp b/archive_old_fs_versions/lfs/src/classes/metadata.hpp deleted file mode 100644 index e585566a43081c38f8f62885865fdff83383c0b4..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/metadata.hpp +++ /dev/null @@ -1,78 +0,0 @@ - -#ifndef FS_METADATA_H -#define FS_METADATA_H - -#include "../main.hpp" - -//TODO we might want to replace this with GOOGLE PROTOBUF -class Metadata { - -private: - time_t atime_; // access time. gets updated on file access unless mounted with noatime - time_t mtime_; // modify time. gets updated when file content is modified. - time_t ctime_; // change time. gets updated when the file attributes are changed AND when file content is modified. - uid_t uid_; - gid_t gid_; - mode_t mode_; - fuse_ino_t inode_no_; - nlink_t link_count_; // number of names for this inode (hardlinks) - off_t size_; // size_ in bytes, might be computed instead of stored - blkcnt_t blocks_; // allocated file system blocks_ - - -public: - Metadata(); - - Metadata(mode_t mode, uint32_t uid, uint32_t gid); - - Metadata(mode_t mode, uid_t uid, gid_t gid, fuse_ino_t inode); - - void init_ACM_time(); - - void update_ACM_time(bool a, bool c, bool m); - - //Getter and Setter - time_t atime() const; - - void atime(time_t atime_); - - time_t mtime() const; - - void mtime(time_t mtime_); - - time_t ctime() const; - - void ctime(time_t ctime_); - - uid_t uid() const; - - void uid(uid_t uid_); - - gid_t gid() const; - - void gid(gid_t gid_); - - mode_t mode() const; - - void mode(mode_t mode_); - - fuse_ino_t inode_no() const; - - void inode_no(fuse_ino_t inode_no_); - - nlink_t link_count() const; - - void link_count(nlink_t link_count_); - - off_t size() const; - - void size(off_t size_); - - blkcnt_t blocks() const; - - void blocks(blkcnt_t blocks_); - -}; - - -#endif //FS_METADATA_H diff --git a/archive_old_fs_versions/lfs/src/classes/rpc_data.cpp b/archive_old_fs_versions/lfs/src/classes/rpc_data.cpp deleted file mode 100644 index be68eb39cd0fd47f238d3d60214729905ea04637..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/rpc_data.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// -// Created by evie on 6/21/17. -// - -#include "rpc_data.hpp" - - -// Utility functions - -bool RPCData::get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) { - - if (address_cache_.tryGet(hostid, svr_addr)) { - ADAFS_DATA->spdlogger()->debug("tryGet successful and put in svr_addr "); - //found - return true; - } else { - ADAFS_DATA->spdlogger()->debug("not found in lrucache"); - // not found, manual lookup and add address mapping to LRU cache -#ifndef RPC_TEST - auto hostname = "cci+tcp://" + ADAFS_DATA->hosts().at(hostid) + ":" + - ADAFS_DATA->rpc_port(); // convert hostid to hostname and port -#else - auto hostname = "cci+tcp://127.0.0.1:" + - ADAFS_DATA->rpc_port(); // convert hostid to hostname and port -// auto hostname = "cci+tcp://134.93.182.11:" + -// ADAFS_DATA->rpc_port(); // convert hostid to hostname and port -#endif - ADAFS_DATA->spdlogger()->debug("generated hostid {}", hostname); - margo_addr_lookup(RPC_DATA->client_mid(), hostname.c_str(), &svr_addr); - if (svr_addr == HG_ADDR_NULL) - return false; - address_cache_.insert(hostid, svr_addr); - return true; - } -} - -size_t RPCData::get_rpc_node(std::string to_hash) { - return ADAFS_DATA->hashf()(to_hash) % ADAFS_DATA->host_size(); -} - -std::string RPCData::get_dentry_hashable(const fuse_ino_t parent, const char* name) { - return fmt::FormatInt(parent).str() + "_" + name; -} - -// Getter/Setter - -hg_class_t* RPCData::server_hg_class() const { - return server_hg_class_; -} - -void RPCData::server_hg_class(hg_class_t* server_hg_class) { - RPCData::server_hg_class_ = server_hg_class; -} - -hg_context_t* RPCData::server_hg_context() const { - return server_hg_context_; -} - -void RPCData::server_hg_context(hg_context_t* server_hg_context) { - RPCData::server_hg_context_ = server_hg_context; -} - -hg_class_t* RPCData::client_hg_class() const { - return client_hg_class_; -} - -void RPCData::client_hg_class(hg_class_t* client_hg_class) { - RPCData::client_hg_class_ = client_hg_class; -} - -hg_context_t* RPCData::client_hg_context() const { - return client_hg_context_; -} - -void RPCData::client_hg_context(hg_context_t* client_hg_context) { - RPCData::client_hg_context_ = client_hg_context; -} - -margo_instance* RPCData::server_mid() { - return server_mid_; -} - -void RPCData::server_mid(margo_instance* server_mid) { - RPCData::server_mid_ = server_mid; -} - -margo_instance* RPCData::client_mid() { - return client_mid_; -} - -void RPCData::client_mid(margo_instance* client_mid) { - RPCData::client_mid_ = client_mid; -} - -hg_id_t RPCData::rpc_minimal_id() const { - return rpc_minimal_id_; -} - -void RPCData::rpc_minimal_id(hg_id_t rpc_minimal_id) { - RPCData::rpc_minimal_id_ = rpc_minimal_id; -} - -lru11::Cache& RPCData::address_cache() { - return address_cache_; -} - -hg_id_t RPCData::rpc_srv_attr_id() const { - return rpc_srv_attr_id_; -} - -void RPCData::rpc_srv_attr_id(hg_id_t rpc_srv_attr_id) { - RPCData::rpc_srv_attr_id_ = rpc_srv_attr_id; -} - -hg_id_t RPCData::rpc_srv_create_dentry_id() const { - return rpc_srv_create_dentry_id_; -} - -void RPCData::rpc_srv_create_dentry_id(hg_id_t rpc_srv_create_dentry_id) { - RPCData::rpc_srv_create_dentry_id_ = rpc_srv_create_dentry_id; -} - -hg_id_t RPCData::rpc_srv_create_mdata_id() const { - return rpc_srv_create_mdata_id_; -} - -void RPCData::rpc_srv_create_mdata_id(hg_id_t rpc_srv_create_mdata_id) { - RPCData::rpc_srv_create_mdata_id_ = rpc_srv_create_mdata_id; -} - -hg_id_t RPCData::rpc_srv_lookup_id() const { - return rpc_srv_lookup_id_; -} - -void RPCData::rpc_srv_lookup_id(hg_id_t rpc_srv_lookup_id) { - RPCData::rpc_srv_lookup_id_ = rpc_srv_lookup_id; -} - -hg_id_t RPCData::rpc_srv_remove_dentry_id() const { - return rpc_srv_remove_dentry_id_; -} - -void RPCData::rpc_srv_remove_dentry_id(hg_id_t rpc_srv_remove_dentry_id) { - RPCData::rpc_srv_remove_dentry_id_ = rpc_srv_remove_dentry_id; -} - -hg_id_t RPCData::rpc_srv_remove_mdata_id() const { - return rpc_srv_remove_mdata_id_; -} - -void RPCData::rpc_srv_remove_mdata_id(hg_id_t rpc_srv_remove_mdata_id) { - RPCData::rpc_srv_remove_mdata_id_ = rpc_srv_remove_mdata_id; -} - -hg_id_t RPCData::rpc_srv_read_data_id() const { - return rpc_srv_read_data_id_; -} - -void RPCData::rpc_srv_read_data_id(hg_id_t rpc_srv_read_data_id) { - RPCData::rpc_srv_read_data_id_ = rpc_srv_read_data_id; -} - -hg_id_t RPCData::rpc_srv_write_data_id() const { - return rpc_srv_write_data_id_; -} - -void RPCData::rpc_srv_write_data_id(hg_id_t rpc_srv_write_data_id) { - RPCData::rpc_srv_write_data_id_ = rpc_srv_write_data_id; -} - - - - - - - - diff --git a/archive_old_fs_versions/lfs/src/classes/rpc_data.hpp b/archive_old_fs_versions/lfs/src/classes/rpc_data.hpp deleted file mode 100644 index 792ca6fb38e3d0ccface3a55ad53cb544700e90f..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/classes/rpc_data.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// -// Created by evie on 6/21/17. -// - -#ifndef LFS_RPC_DATA_HPP -#define LFS_RPC_DATA_HPP - -#include "../main.hpp" -#include "extern/lrucache/LRUCache11.hpp" - -class RPCData { - -private: - RPCData() {} - - // Can't use shared pointers here 'cause the Mercury environment has problems with it, e.g., unable to finalize, - // resulting into a faulty fuse shutdown - // Mercury Server - hg_class_t* server_hg_class_; - hg_context_t* server_hg_context_; - - // Mercury Client - hg_class_t* client_hg_class_; - hg_context_t* client_hg_context_; - - // Margo IDs. They can also be used to retrieve the Mercury classes and contexts that were created at init time - margo_instance_id server_mid_; - margo_instance_id client_mid_; - - lru11::Cache address_cache_{32768, 4096}; // XXX Set values are not based on anything... - - // TODO RPC client IDs - // RPC client IDs - hg_id_t rpc_minimal_id_; - hg_id_t rpc_srv_create_dentry_id_; - hg_id_t rpc_srv_create_mdata_id_; - hg_id_t rpc_srv_attr_id_; - hg_id_t rpc_srv_lookup_id_; - hg_id_t rpc_srv_remove_dentry_id_; - hg_id_t rpc_srv_remove_mdata_id_; - hg_id_t rpc_srv_read_data_id_; - hg_id_t rpc_srv_write_data_id_; - - -public: - static RPCData* getInstance() { - static RPCData instance; - return &instance; - } - - hg_addr_t svr_addr_ = HG_ADDR_NULL; // XXX TEMPORARY! server addresses will be put into a LRU map - - RPCData(RPCData const&) = delete; - - void operator=(RPCData const&) = delete; - - // Utility functions - - bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr); - - size_t get_rpc_node(std::string to_hash); - - std::string get_dentry_hashable(const fuse_ino_t parent, const char* name); - - // Getter/Setter - - hg_class_t* server_hg_class() const; - - void server_hg_class(hg_class_t* server_hg_class); - - hg_context_t* server_hg_context() const; - - void server_hg_context(hg_context_t* server_hg_context); - - hg_class_t* client_hg_class() const; - - void client_hg_class(hg_class_t* client_hg_class); - - hg_context_t* client_hg_context() const; - - void client_hg_context(hg_context_t* client_hg_context); - - margo_instance* server_mid(); - - void server_mid(margo_instance* server_mid); - - margo_instance* client_mid(); - - void client_mid(margo_instance* client_mid); - - hg_id_t rpc_minimal_id() const; - - void rpc_minimal_id(hg_id_t rpc_minimal_id); - - lru11::Cache& address_cache(); - - hg_id_t rpc_srv_attr_id() const; - - void rpc_srv_attr_id(hg_id_t rpc_srv_attr_id); - - hg_id_t rpc_srv_create_dentry_id() const; - - void rpc_srv_create_dentry_id(hg_id_t rpc_srv_create_dentry_id); - - hg_id_t rpc_srv_create_mdata_id() const; - - void rpc_srv_create_mdata_id(hg_id_t rpc_srv_create_mdata_id); - - hg_id_t rpc_srv_lookup_id() const; - - void rpc_srv_lookup_id(hg_id_t rpc_srv_lookup_id); - - hg_id_t rpc_srv_remove_dentry_id() const; - - void rpc_srv_remove_dentry_id(hg_id_t rpc_srv_remove_dentry_id); - - hg_id_t rpc_srv_remove_mdata_id() const; - - void rpc_srv_remove_mdata_id(hg_id_t rpc_srv_remove_mdata_id); - - hg_id_t rpc_srv_read_data_id() const; - - void rpc_srv_read_data_id(hg_id_t rpc_srv_read_data_id); - - hg_id_t rpc_srv_write_data_id() const; - - void rpc_srv_write_data_id(hg_id_t rpc_srv_write_data_id); -}; - - -#endif //LFS_RPC_DATA_HPP diff --git a/archive_old_fs_versions/lfs/src/configure.hpp b/archive_old_fs_versions/lfs/src/configure.hpp deleted file mode 100644 index bf4f3e7cf947fa1c4cbc88c068fb1e09ab5c889b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/configure.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Created by evie on 3/17/17. -// - -#ifndef FS_CONFIGURE_H -#define FS_CONFIGURE_H - -// To enabled logging with info level -#define LOG_INFO -//#define LOG_DEBUG -//#define LOG_TRACE - -// If ACM time should be considered -#define ACMtime - -// If access permissions should be checked while opening a file -//#define CHECK_ACCESS - -// Write-ahead logging of rocksdb -//#define RDB_WOL - -// RPC configuration -#define RPCPORT 4433 -#define RPC_TIMEOUT 15000 - -// Debug configurations -//#define RPC_TEST - -#endif //FS_CONFIGURE_H diff --git a/archive_old_fs_versions/lfs/src/db/db_ops.cpp b/archive_old_fs_versions/lfs/src/db/db_ops.cpp deleted file mode 100644 index 5406e94b02436f5a0b9f1260f9af90e11f333fd5..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_ops.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// Created by evie on 6/6/17. -// - -#include "db_ops.hpp" - -using namespace rocksdb; -using namespace std; - -inline const bool db_get_mdata_helper(const string& key, string& val) { - auto db = ADAFS_DATA->rdb(); - return db->Get(ReadOptions(), key, &val).ok(); -} - -template<> -unsigned long db_get_mdata(const string& key) { - string val; - if (db_get_mdata_helper(key, val)) - return stoul(val); - else - return 0; -} - -template<> -long db_get_mdata(const string& key) { - string val; - if (db_get_mdata_helper(key, val)) - return stol(val); - else - return 0; -} - -template<> -unsigned int db_get_mdata(const string& key) { - string val; - if (db_get_mdata_helper(key, val)) - return static_cast(stoul(val)); - else - return 0; -} - -bool db_delete_mdata(const string& key) { - auto db = ADAFS_DATA->rdb(); - return db->Delete(ADAFS_DATA->rdb_write_options(), key).ok(); -} - -bool db_dentry_exists(const fuse_ino_t p_inode, const string& name, string& val) { - auto db = ADAFS_DATA->rdb(); - auto key = db_build_dentry_key(p_inode, name); - return db->Get(rocksdb::ReadOptions(), key, &val).ok(); -} - -bool db_mdata_exists(const fuse_ino_t inode) { - auto db = ADAFS_DATA->rdb(); - string val_str; - return db->Get(ReadOptions(), - db_build_mdata_key(inode, std::get(md_field_map)), - &val_str).ok(); -} - -bool db_put_dentry(const string& key, const string& val) { - auto db = ADAFS_DATA->rdb(); - return db->Put(ADAFS_DATA->rdb_write_options(), key, val).ok(); -} - -void db_get_dentries(vector& dentries, const fuse_ino_t dir_inode) { - string key; - string val; - size_t pos; - auto delim = "_"s; - auto db = ADAFS_DATA->rdb(); - auto prefix = db_build_dentry_prefix(dir_inode); - // Do RangeScan on parent inode - auto dentry_iter = db->NewIterator(rocksdb::ReadOptions()); - for (dentry_iter->Seek(prefix); - dentry_iter->Valid() && dentry_iter->key().starts_with(prefix); dentry_iter->Next()) { - ADAFS_DATA->spdlogger()->trace("Dentry:"); - key = dentry_iter->key().ToString(); - val = dentry_iter->value().ToString(); - ADAFS_DATA->spdlogger()->trace("key '{}' value '{}'", key, val); - - // Retrieve filename from key - key.erase(0, 2); // Erase prefix - pos = key.find(delim); // Split by _ - key.erase(0, pos + 1); // Erase ParentInode + _ - Dentry dentry{key}; // key holds only filename - - // Retrieve inode and mode from val - pos = val.find(delim); // Split by _ - dentry.inode(static_cast(stoul(val.substr(0, pos)))); // Substring from 0 to pos holds inode - val.erase(0, pos + 1); // Erase inode + delim - dentry.mode(static_cast(stoul(val))); // val holds only mode - // append dentry to dentries vector - ADAFS_DATA->spdlogger()->trace("Formatted: name {} inode {} mode {:o}", dentry.name(), dentry.inode(), - dentry.mode()); - dentries.push_back(dentry); - } -} - -pair db_delete_dentry_get_inode(const fuse_ino_t p_inode, const string& name) { - auto key = db_build_dentry_key(p_inode, name); - auto db = ADAFS_DATA->rdb(); - string val; - db->Get(ReadOptions(), key, &val); - auto pos = val.find("_"); - - return make_pair(db->Delete(ADAFS_DATA->rdb_write_options(), key).ok() ? 0 : EIO, - static_cast(stoul(val.substr(0, pos)))); -} - -/** - * Returns true if no dentries can be found for the prefix - * @param inode - * @return bool - */ -bool db_is_dir_empty(const fuse_ino_t inode) { - auto dir_empty = true; - auto db = ADAFS_DATA->rdb(); - auto prefix = db_build_dentry_prefix(inode); - auto dentry_iter = db->NewIterator(rocksdb::ReadOptions()); - for (dentry_iter->Seek(prefix); - dentry_iter->Valid() && dentry_iter->key().starts_with(prefix); dentry_iter->Next()) { - dir_empty = false; - break; - } - return dir_empty; -} - - - diff --git a/archive_old_fs_versions/lfs/src/db/db_ops.hpp b/archive_old_fs_versions/lfs/src/db/db_ops.hpp deleted file mode 100644 index c9233269340664de2a77ae78c2980850f5d9f624..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_ops.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// Created by evie on 6/6/17. -// - -#ifndef LFS_DB_OPS_HPP -#define LFS_DB_OPS_HPP - -#include "../main.hpp" -#include "../classes/dentry.hpp" -#include "db_util.hpp" - -template -bool db_put_mdata(const std::string& key, const T val) { - auto val_str = fmt::FormatInt(val).c_str(); - auto db = ADAFS_DATA->rdb(); - return db->Put(ADAFS_DATA->rdb_write_options(), key, val_str).ok(); -} - -template -T db_get_mdata(const std::string& key); - -bool db_delete_mdata(const std::string& key); - -bool db_dentry_exists(const fuse_ino_t p_inode, const std::string& name, std::string& val); - -bool db_mdata_exists(const fuse_ino_t inode); - -bool db_put_dentry(const std::string& key, const std::string& val); - -void db_get_dentries(std::vector& dentries, const fuse_ino_t dir_inode); - -std::pair db_delete_dentry_get_inode(const fuse_ino_t p_inode, const std::string& name); - -bool db_is_dir_empty(const fuse_ino_t inode); - -#endif //LFS_DB_OPS_HPP diff --git a/archive_old_fs_versions/lfs/src/db/db_txn_ops.cpp b/archive_old_fs_versions/lfs/src/db/db_txn_ops.cpp deleted file mode 100644 index 4ac473206520c1b02286694904a9aebe39d85ca3..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_txn_ops.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Created by evie on 6/8/17. -// - -#include "db_txn_ops.hpp" - -using namespace rocksdb; -using namespace std; - -inline const string dbtxn_get_mdata_helper(const string& key, rocksdb::Transaction& txn) { - string val_str; - txn.Get(ReadOptions(), key, &val_str); - return val_str; -} - -template<> -unsigned long dbtxn_get_mdata(const string& key, rocksdb::Transaction& txn) { - return stoul(dbtxn_get_mdata_helper(key, txn)); -} - -template<> -long dbtxn_get_mdata(const string& key, rocksdb::Transaction& txn) { - return stol(dbtxn_get_mdata_helper(key, txn)); -} - -template<> -unsigned int dbtxn_get_mdata(const string& key, rocksdb::Transaction& txn) { - return static_cast(stoul(dbtxn_get_mdata_helper(key, txn))); -} - -bool dbtxn_delete_mdata(const string& key, rocksdb::Transaction& txn) { - return txn.Delete(key).ok(); -} - -bool dbtxn_dentry_exists(const fuse_ino_t p_inode, const string& name, string& val, rocksdb::Transaction& txn) { - auto key = db_build_dentry_key(p_inode, name); - return txn.Get(ReadOptions(), key, &val).ok(); -} - -bool dbtxn_mdata_exists(const fuse_ino_t inode, rocksdb::Transaction& txn) { - string val_str; - return txn.Get(ReadOptions(), - db_build_mdata_key(inode, std::get(md_field_map)), - &val_str).ok(); -} - -bool dbtxn_put_dentry(const string& key, const string& val, rocksdb::Transaction& txn) { - return txn.Put(key, val).ok(); -} - - -pair -dbtxn_delete_dentry_get_inode(const fuse_ino_t p_inode, const string& name, rocksdb::Transaction& txn) { - auto key = db_build_dentry_key(p_inode, name); - string val; - txn.Get(ReadOptions(), key, &val); - auto pos = val.find("_"); - - return make_pair(txn.Delete(key).ok() ? 0 : 1, static_cast(stoul(val.substr(0, pos)))); -} diff --git a/archive_old_fs_versions/lfs/src/db/db_txn_ops.hpp b/archive_old_fs_versions/lfs/src/db/db_txn_ops.hpp deleted file mode 100644 index e5800bc509c9f4e9d637bdd2776f74351ab529d2..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_txn_ops.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by evie on 6/8/17. -// - -#ifndef LFS_DB_TXN_OPS_HPP -#define LFS_DB_TXN_OPS_HPP - -#include "../main.hpp" -#include "db_util.hpp" - -template -bool dbtxn_put_mdata(const std::string& key, const T val, rocksdb::Transaction& txn) { - auto val_str = fmt::FormatInt(val).c_str(); - return txn.Put(key, val_str).ok(); -} - -template -T dbtxn_get_mdata(const std::string& key, rocksdb::Transaction& txn); - -bool dbtxn_delete_mdata(const std::string& key, rocksdb::Transaction& txn); - -bool -dbtxn_dentry_exists(const fuse_ino_t p_inode, const std::string& name, std::string& val, rocksdb::Transaction& txn); - -bool dbtxn_mdata_exists(const fuse_ino_t inode, rocksdb::Transaction& txn); - -bool dbtxn_put_dentry(const std::string& key, const std::string& val, rocksdb::Transaction& txn); - -std::pair -dbtxn_delete_dentry_get_inode(const fuse_ino_t p_inode, const std::string& name, rocksdb::Transaction& txn); - -#endif //LFS_DB_TXN_OPS_HPP diff --git a/archive_old_fs_versions/lfs/src/db/db_util.cpp b/archive_old_fs_versions/lfs/src/db/db_util.cpp deleted file mode 100644 index acb907c7c0fb04c6e1d4c0171a2342d3e6f1a44b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_util.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// -// Created by evie on 6/8/17. -// - -#include "db_util.hpp" - -using namespace std; - -bool init_rocksdb() { - rocksdb::DB* db; - ADAFS_DATA->rdb_path(ADAFS_DATA->rootdir() + "/meta/rocksdb"s); - rocksdb::Options options; - // Optimize RocksDB. This is the easiest way to get RocksDB to perform well - options.IncreaseParallelism(); - options.OptimizeLevelStyleCompaction(); - // create the DB if it's not already present - options.create_if_missing = true; - - - optimize_rocksdb(options); - - ADAFS_DATA->rdb_options(options); -// rocksdb::OptimisticTransactionDB* txn_db; -// rocksdb::OptimisticTransactionOptions txn_options{}; -// ADAFS_DATA->txn_rdb_options(txn_options); - ADAFS_DATA->spdlogger()->info("RocksDB options set. About to connect..."); - // open DB -// auto s = rocksdb::OptimisticTransactionDB::Open(ADAFS_DATA->rdb_options(), ADAFS_DATA->rdb_path(), &txn_db); - auto s = rocksdb::DB::Open(ADAFS_DATA->rdb_options(), ADAFS_DATA->rdb_path(), &db); - - if (s.ok()) { -// db = txn_db->GetBaseDB(); // db connection for db operations without transactions - shared_ptr s_db(db); - ADAFS_DATA->rdb(s_db); -// shared_ptr s_txn_db(txn_db); -// ADAFS_DATA->txn_rdb(s_txn_db); - ADAFS_DATA->spdlogger()->info("RocksDB connection established."); - return true; - } else { - ADAFS_DATA->spdlogger()->info("[ERROR] RocksDB connection FAILURE. Exiting..."); - return false; - } -} - -void optimize_rocksdb(rocksdb::Options& options) { - - // rocksdb::BlockBasedTableOptions block_options{}; -// block_options.block_size = 16384 * 2; -// options.table_factory.reset(rocksdb::NewBlockBasedTableFactory(block_options)); - // experimental settings -// options.write_buffer_size = 512; -// options.max_write_buffer_number = 16; -// options.min_write_buffer_number_to_merge = 4; - // These 4 below have the most impact - options.max_bytes_for_level_base = 2048; - options.max_bytes_for_level_multiplier = 10; - options.target_file_size_base = 256; - options.target_file_size_multiplier = 1; - // - options.max_background_flushes = 1; - options.max_background_compactions = 48; - options.level0_file_num_compaction_trigger = 1; - options.level0_slowdown_writes_trigger = 48; - options.level0_stop_writes_trigger = 56; -// options.arena_block_size = 1024 * 8; -// options.compression = rocksdb::kNoCompression; // doesnt do anything - - // Disable Write-Ahead Logging if configured - rocksdb::WriteOptions write_options{}; -#ifndef RDB_WOL - write_options.disableWAL = true; -#endif - ADAFS_DATA->rdb_write_options(write_options); -} - - - - -/** - * Build dentry key of form - * @param inode - * @param name - * @return - */ -string db_build_dentry_key(const fuse_ino_t inode, const string& name) { - return ("d_"s + fmt::FormatInt(inode).str() + "_" + name); -} - -/** - * Build dentry prefix of form - * @param inode - * @param name - * @return - */ -string db_build_dentry_prefix(const fuse_ino_t inode) { - return ("d_"s + fmt::FormatInt(inode).str() + "_"s); -} - -string db_build_dentry_value(const fuse_ino_t inode, const mode_t mode) { - return (fmt::FormatInt(inode).str() + "_"s + fmt::FormatInt(mode).str()); -} - -/** - * Build mdata key of form - * @param inode - * @param name - * @return - */ -string db_build_mdata_key(const fuse_ino_t inode, const string& field) { - return (fmt::FormatInt(inode).str() + field); -} - -string db_build_mdata_key(const string& inode, const string& field) { - return (inode + field); -} - -vector db_build_all_mdata_keys(const fuse_ino_t inode) { - auto inode_key = fmt::FormatInt(inode).str(); - vector mdata_keys{}; - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - mdata_keys.push_back(inode_key + std::get(md_field_map)); - return mdata_keys; -} - - diff --git a/archive_old_fs_versions/lfs/src/db/db_util.hpp b/archive_old_fs_versions/lfs/src/db/db_util.hpp deleted file mode 100644 index 31e9073341500062385a06f35d5719059fd8925e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/db/db_util.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Created by evie on 6/8/17. -// - -#ifndef LFS_DB_UTIL_HPP -#define LFS_DB_UTIL_HPP - -#include "../main.hpp" - -using namespace std; - -template -constexpr typename std::underlying_type::type to_underlying(E e) { - return static_cast::type>(e); -} - -// mapping of enum to string to get the db_keys for metadata -enum class Md_fields { - atime, mtime, ctime, uid, gid, mode, inode_no, link_count, size, blocks -}; - -const std::array md_field_map = { - "_atime"s, "_mtime"s, "_ctime"s, "_uid"s, "_gid"s, "_mode"s, "_inodeno"s, "_lnkcnt"s, "_size"s, "_blkcnt"s -}; - -bool init_rocksdb(); - -void optimize_rocksdb(rocksdb::Options& options); - -std::string db_build_dentry_key(const fuse_ino_t inode, const std::string& name); - -std::string db_build_dentry_prefix(const fuse_ino_t inode); - -std::string db_build_dentry_value(const fuse_ino_t inode, const mode_t mode); - -std::string db_build_mdata_key(const fuse_ino_t inode, const std::string& field); - -string db_build_mdata_key(const string& inode, const string& field); - -std::vector db_build_all_mdata_keys(const fuse_ino_t inode); - -#endif //LFS_DB_UTIL_HPP diff --git a/archive_old_fs_versions/lfs/src/fuse_ops.hpp b/archive_old_fs_versions/lfs/src/fuse_ops.hpp deleted file mode 100644 index 4db438c0eea4610db752ceda7be45698c5b4adba..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// Created by evie on 2/23/17. -// - -#ifndef FS_FUSE_OPS_H -#define FS_FUSE_OPS_H - -#include "main.hpp" - -// file -void adafs_ll_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi); -void adafs_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr, int to_set, struct fuse_file_info *fi); -void adafs_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi); -void adafs_ll_mknod(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev_t rdev); - -void adafs_ll_unlink(fuse_req_t req, fuse_ino_t parent, const char* name); -void adafs_ll_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); -void adafs_ll_release(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); - -// directory -void adafs_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char* name); -void adafs_ll_opendir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi); -void adafs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi); - -void adafs_ll_mkdir(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode); - -void adafs_ll_rmdir(fuse_req_t req, fuse_ino_t parent, const char* name); -void adafs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi); -// I/O -void adafs_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi); - -void adafs_ll_write(fuse_req_t req, fuse_ino_t ino, const char* buf, size_t size, off_t off, struct fuse_file_info* fi); - - -// sync -void adafs_ll_flush(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); - - -// access -void adafs_ll_access(fuse_req_t req, fuse_ino_t ino, int mask); - - -// file system miscellaneous - - -void adafs_ll_init(void* adafs_data, struct fuse_conn_info* conn); -void adafs_ll_destroy(void* adafs_data); - -#endif //FS_FUSE_OPS_H diff --git a/archive_old_fs_versions/lfs/src/fuse_ops/access.cpp b/archive_old_fs_versions/lfs/src/fuse_ops/access.cpp deleted file mode 100644 index 0daef524563e37a8625e82603b13ff805a94cfdb..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops/access.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by evie on 5/12/17. -// - -#include "../main.hpp" -#include "../fuse_ops.hpp" - -/** - * Check file access permissions - * - * This will be called for the access() system call. If the - * 'default_permissions' mount option is given, this method is not - * called. - * - * This method is not called under Linux kernel versions 2.4.x - * - * If this request is answered with an error code of ENOSYS, this is - * treated as a permanent success, i.e. this and all future access() - * requests will succeed without being send to the filesystem process. - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param mask requested access mode - */ -void adafs_ll_access(fuse_req_t req, fuse_ino_t ino, int mask) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_access() enter: ino {} mask {}", ino, mask); - - fuse_reply_err(req, 0); -} \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/fuse_ops/directory.cpp b/archive_old_fs_versions/lfs/src/fuse_ops/directory.cpp deleted file mode 100644 index 3338a9c457941226018ede919ed8676d95581aac..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops/directory.cpp +++ /dev/null @@ -1,279 +0,0 @@ -// -// Created by evie on 4/7/17. -// - -#include "../main.hpp" -#include "../fuse_ops.hpp" -#include "../adafs_ops/mdata_ops.hpp" -#include "../adafs_ops/dentry_ops.hpp" -#include "../adafs_ops/access.hpp" - -#include "../classes/dentry.hpp" -#include "../rpc/client/c_dentry.hpp" - - -using namespace std; - -/** - * Look up a directory entry by name and get its attributes. - * - * Valid replies: - * fuse_reply_entry - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name the name to look up - */ -void adafs_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char* name) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_lookup() enter: parent_inode {} name \"{}\"", parent, name); - int err; - fuse_ino_t inode; - - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(RPC_DATA->get_dentry_hashable(parent, name)); - if (ADAFS_DATA->is_local_op(recipient)) { // local - tie(err, inode) = do_lookup(parent, string(name)); - } else { // remote - err = rpc_send_lookup(recipient, parent, name, inode); - } - } else { // single node operation - //get inode no first (either from cache or disk) with parent inode and name;; returns pair - tie(err, inode) = do_lookup(parent, string(name)); - } - - if (err != 0) { - fuse_reply_err(req, err); - return; - } - - struct fuse_entry_param fep{}; - err = get_attr(fep.attr, inode); - fep.ino = fep.attr.st_ino; - fep.entry_timeout = 1.0; - fep.attr_timeout = 1.0; - - if (err == 0) - fuse_reply_entry(req, &fep); - else - fuse_reply_err(req, err); - - - /* for ENOENTs - * if (err == -ENOENT && f->conf.negative_timeout != 0.0) { - e.ino = 0; - e.entry_timeout = f->conf.negative_timeout; - err = 0; - } - */ - -} - -/** - * Open a directory - * - * Filesystem may store an arbitrary file handle (pointer, index, - * etc) in fi->fh, and use this in other all other directory - * stream operations (readdir, releasedir, fsyncdir). - * - * Filesystem may also implement stateless directory I/O and not - * store anything in fi->fh, though that makes it impossible to - * implement standard conforming directory stream operations in - * case the contents of the directory can change between opendir - * and releasedir. - * - * Valid replies: - * fuse_reply_open - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -void adafs_ll_opendir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_opendir() enter: inode {}", ino); -#ifdef CHECK_ACCESS - auto err = open_chk_access(req, ino, fi->flags); - - if (err != 0) - fuse_reply_err(req, err); - else - fuse_reply_open(req, fi); -#else - // access permitted without checking - fuse_reply_open(req, fi); -#endif -} - -/** - * Read directory - * - * Send a buffer filled using fuse_add_direntry(), with size not - * exceeding the requested size. Send an empty buffer on end of - * stream. - * - * fi->fh will contain the value set by the opendir method, or - * will be undefined if the opendir method didn't set any value. - * - * Returning a directory entry from readdir() does not affect - * its lookup count. - * - * The function does not have to report the '.' and '..' - * entries, but is allowed to do so. - * - * Valid replies: - * fuse_reply_buf - * fuse_reply_data - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param size maximum number of bytes to send - * @param off offset to continue reading the directory stream - * @param fi file information - */ -void adafs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_readdir() enter: inode {} size {} offset {}", ino, size, off); - - // XXX this'll break for large dirs as only the entries are shown that can fit in the buffer TODO later - if (off == 0) { - auto off_cnt = off; - // XXX can this be done in c++11 style? -// auto buf2 = make_unique>(); -// auto p2 = make_shared(); - char* buf = new char[size](); // buffer, holding the dentries - char* p; // pointer pointing on the current buffer entry - size_t remaining_size; // remaining available size - -// p2 = buf2; - p = buf; - remaining_size = size; - size_t entry_size; - - auto dentries = make_shared>(); - - get_dentries(*dentries, ino); - //getdentries here - for (const auto& dentry : *dentries) { - /* - * Generate tiny stat with inode and mode information. - * This information is necessary so that the entry shows up later at all. - * The inode and mode information does not seem to impact correctness since lookup is setting - * the correct inode again. However, it is unclear if the kernel uses this information for optimizations. - */ - auto attr = make_unique(); - attr->st_ino = dentry.inode(); - attr->st_mode = dentry.mode(); // only bits 12-15 are used (i.e., file type) - // add directory entry giving it to fuse and getting the actual entry size information - entry_size = fuse_add_direntry(req, p, remaining_size, dentry.name().c_str(), attr.get(), ++off_cnt); - - if (entry_size > remaining_size) - break; - - p += entry_size; // move pointer - remaining_size -= entry_size; // subtract entry size from remaining size - } - - fuse_reply_buf(req, buf, size - remaining_size); - free(buf); - - } else { - // return no entry, i.e., finished with readdir - char* buf = new char[size](); - size_t remaining_size = size; - fuse_reply_buf(req, buf, size - remaining_size); - free(buf); - } -} - -/** - * Create a directory - * - * Valid replies: - * fuse_reply_entry - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name to create - * @param mode with which to create the new file - */ -void adafs_ll_mkdir(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_mkdir() enter: p_inode {} name {} mode {:o}", parent, name, mode); - - fuse_entry_param fep{}; - auto err = create_node(fep, parent, name, fuse_req_ctx(req)->uid, fuse_req_ctx(req)->gid, S_IFDIR | mode); - - // return new dentry - if (err == 0) { - fuse_reply_entry(req, &fep); - } else { - fuse_reply_err(req, err); - } -} - -/** - * Remove a directory - * - * If the directory's inode's lookup count is non-zero, the - * file system is expected to postpone any removal of the - * inode until the lookup count reaches zero (see description - * of the forget function). - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name to remove - */ -void adafs_ll_rmdir(fuse_req_t req, fuse_ino_t parent, const char* name) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_rmdir() enter: p_inode {} name {}", parent, name); - // XXX consider the whole lookup count functionality. We need something like a hashtable here, which marks the file - // XXX see adafs_ll_unlink - - // Below is checking if the directory that should be removed is actually empty. We omit this here - // and just unlink the directory out of the fs tree. -// fuse_ino_t inode; -// -// // get inode of file -// tie(err, inode) = do_lookup(parent, name); -// if (err != 0) { -// fuse_reply_err(req, err); -// return; -// } -// -// // check if dir is empty -// // TODO THIS IS VEEEEEEEERY SLOW! Doing a RangeScan is not the right approach here! -// err = is_dir_empty(inode); -// if (err != 0) { -// fuse_reply_err(req, err); -// return; -// } - - auto err = remove_node(parent, name); - - fuse_reply_err(req, err); -} - -/** - * Release an open directory - * - * For every opendir call there will be exactly one releasedir - * call. - * - * fi->fh will contain the value set by the opendir method, or - * will be undefined if the opendir method didn't set any value. - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -void adafs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_releasedir() enter: inode {} ", ino); - - fuse_reply_err(req, 0); -} \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/fuse_ops/file.cpp b/archive_old_fs_versions/lfs/src/fuse_ops/file.cpp deleted file mode 100644 index 73625baab19c6231d34ef81623b1b0706b9ed360..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops/file.cpp +++ /dev/null @@ -1,336 +0,0 @@ -// -// Created by evie on 4/6/17. -// - -#include "../main.hpp" -#include "../fuse_ops.hpp" -#include "../adafs_ops/mdata_ops.hpp" -#include "../adafs_ops/dentry_ops.hpp" -#include "../adafs_ops/access.hpp" -#include "../adafs_ops/io.hpp" -#include "../rpc/client/c_metadata.hpp" -#include "../rpc/client/c_dentry.hpp" - -using namespace std; - -/** - * Get file attributes. - * - * If writeback caching is enabled, the kernel may have a - * better idea of a file's length than the FUSE file system - * (eg if there has been a write that extended the file size, - * but that has not yet been passed to the filesystem.n - * - * In this case, the st_size value provided by the file system - * will be ignored. - * - * Valid replies: - * fuse_reply_attr - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi for future use, currently always NULL - */ -void adafs_ll_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_getattr() enter: inode {}", ino); - - struct stat attr{}; - auto err = get_attr(attr, ino); - - if (err == 0) { - // XXX take a look into timeout value later - fuse_reply_attr(req, &attr, 1.0); - } else { - fuse_reply_err(req, err); - } -} - -/** - * Set file attributes - * - * In the 'attr' argument only members indicated by the 'to_set' - * bitmask contain valid values. Other members contain undefined - * values. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits if the file - * size or owner is being changed. - * - * If the setattr was invoked from the ftruncate() system call - * under Linux kernel versions 2.6.15 or later, the fi->fh will - * contain the value set by the open method or will be undefined - * if the open method didn't set any value. Otherwise (not - * ftruncate call, or kernel version earlier than 2.6.15) the fi - * parameter will be NULL. - * - * Valid replies: - * fuse_reply_attr - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param attr the attributes - * @param to_set bit mask of attributes which should be set - * @param fi file information, or NULL - */ -void adafs_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat* attr, int to_set, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_setattr() enter: inode {} to_set {}", ino, to_set); - // TODO to be implemented if required - - // Temporary. Just to know what is already implemented and what is called - if (to_set & FUSE_SET_ATTR_MODE) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_MODE"); - } - if (to_set & FUSE_SET_ATTR_UID) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_UID"); - - } - if (to_set & FUSE_SET_ATTR_GID) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_GID"); - - } - if (to_set & FUSE_SET_ATTR_SIZE) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_SIZE"); - - } - if (to_set & FUSE_SET_ATTR_ATIME) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_ATIME"); - - } - if (to_set & FUSE_SET_ATTR_ATIME_NOW) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_ATIME_NOW"); - - } - if (to_set & FUSE_SET_ATTR_MTIME) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_MTIME"); - - } - if (to_set & FUSE_SET_ATTR_MTIME_NOW) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_MTIME_NOW"s); - - } - if (to_set & FUSE_SET_ATTR_CTIME) { - ADAFS_DATA->spdlogger()->debug("FUSE_SET_ATTR_CTIME"s); - - } - - if (to_set & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) { - // TODO - } - - struct stat buf{}; -// auto err = get_attr(buf, ino); - // TODO I think we need a cache to cache metadata on a node. Otherwise we have to get the metadata remotely all the time - // XXX BELOW ARE DUMMY DATA TO AVOID RPC CALLS! TEMPORARY. SHOULD USE CACHE INSTEAD - int err = 0; - buf.st_ino = ino; - buf.st_size = attr->st_size; - buf.st_nlink = attr->st_nlink; - buf.st_gid = fuse_req_ctx(req)->gid; - buf.st_blocks = attr->st_blocks; - buf.st_blksize = attr->st_blksize; - buf.st_mode = S_IFREG | 477; - buf.st_uid = fuse_req_ctx(req)->gid; - buf.st_atim = attr->st_atim; - buf.st_mtim = attr->st_mtim; - buf.st_ctim = attr->st_ctim; - - if (err == 0) { - fuse_reply_attr(req, &buf, 1.0); - } else { - fuse_reply_err(req, err); - } -} - -/** - * Create and open a file - * - * If the file does not exist, first create it with the specified - * mode, and then open it. - * - * Open flags (with the exception of O_NOCTTY) are available in - * fi->flags. - * - * Filesystem may store an arbitrary file handle (pointer, index, - * etc) in fi->fh, and use this in other all other file operations - * (read, write, flush, release, fsync). - * - * There are also some flags (direct_io, keep_cache) which the - * filesystem may set in fi, to change the way the file is opened. - * See fuse_file_info structure in for more details. - * - * If this method is not implemented or under Linux kernel - * versions earlier than 2.6.15, the mknod() and open() methods - * will be called instead. - * - * If this request is answered with an error code of ENOSYS, the handler - * is treated as not implemented (i.e., for this and future requests the - * mknod() and open() handlers will be called instead). - * - * Valid replies: - * fuse_reply_create - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name to create - * @param mode file type and mode with which to create the new file - * @param fi file information - */ -void adafs_ll_create(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_create() enter: parent_inode {} name {} mode {:o}", parent, name, mode); - - fuse_entry_param fep{}; - // fep is filled inside - auto err = create_node(fep, parent, name, fuse_req_ctx(req)->uid, fuse_req_ctx(req)->gid, S_IFREG | mode); - - if (err == 0) - fuse_reply_create(req, &fep, fi); - else - fuse_reply_err(req, err); -} - - -/** - * Create file node - * - * Create a regular file, character device, block device, fifo or - * socket node. - * - * Valid replies: - * fuse_reply_entry - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name to create - * @param mode file type and mode with which to create the new file - * @param rdev the device number (only valid if created file is a device) - */ -void adafs_ll_mknod(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, dev_t rdev) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_mknod() enter: parent_inode {} name {} mode {:o} dev {}", parent, name, - mode, rdev); - - fuse_entry_param fep{}; - // fep is filled inside - auto err = create_node(fep, parent, name, fuse_req_ctx(req)->uid, fuse_req_ctx(req)->gid, S_IFREG | mode); - - // return new dentry - if (err == 0) { - fuse_reply_entry(req, &fep); - } else { - fuse_reply_err(req, err); - } -} - -/** - * Remove a file - * - * If the file's inode's lookup count is non-zero, the file - * system is expected to postpone any removal of the inode - * until the lookup count reaches zero (see description of the - * forget function). - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name to remove - */ -void adafs_ll_unlink(fuse_req_t req, fuse_ino_t parent, const char* name) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_unlink() enter: parent_inode {} name {}", parent, name); - - auto err = remove_node(parent, name); - - // XXX delete data blocks (asynchronously) for that remove_node needs to me modified to return the file inode - - fuse_reply_err(req, err); -} - -/** - * Open a file - * - * Open flags are available in fi->flags. Creation (O_CREAT, - * O_EXCL, O_NOCTTY) and by default also truncation (O_TRUNC) - * flags will be filtered out. If an application specifies - * O_TRUNC, fuse first calls truncate() and then open(). - * - * If filesystem is able to handle O_TRUNC directly, the - * init() handler should set the `FUSE_CAP_ATOMIC_O_TRUNC` bit - * in ``conn->want``. - * - * Filesystem may store an arbitrary file handle (pointer, - * index, etc) in fi->fh, and use this in other all other file - * operations (read, write, flush, release, fsync). - * - * Filesystem may also implement stateless file I/O and not store - * anything in fi->fh. - * - * There are also some flags (direct_io, keep_cache) which the - * filesystem may set in fi, to change the way the file is opened. - * See fuse_file_info structure in for more details. - * - * If this request is answered with an error code of ENOSYS - * and FUSE_CAP_NO_OPEN_SUPPORT is set in - * `fuse_conn_info.capable`, this is treated as success and - * future calls to open will also succeed without being send - * to the filesystem process. - * - * Valid replies: - * fuse_reply_open - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -void adafs_ll_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_open() enter: inode {}", ino); - -#ifdef CHECK_ACCESS - auto err = open_chk_access(req, ino, fi->flags); - - if (err != 0) - fuse_reply_err(req, err); - else - fuse_reply_open(req, fi); -#else - // access permitted without checking - fuse_reply_open(req, fi); -#endif - - -} - -/** - * Release an open file - * - * Release is called when there are no more references to an open - * file: all file descriptors are closed and all memory mappings - * are unmapped. - * - * For every open call there will be exactly one release call. - * - * The filesystem may reply with an error, but error values are - * not returned to close() or munmap() which triggered the - * release. - * - * fi->fh will contain the value set by the open method, or will - * be undefined if the open method didn't set any value. - * fi->flags will contain the same flags as for open. - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -void adafs_ll_release(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_release() enter: inode {}", ino); - // TODO to be implemented if required - // TODO Update: Not required afaik - fuse_reply_err(req, 0); -} \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/fuse_ops/io.cpp b/archive_old_fs_versions/lfs/src/fuse_ops/io.cpp deleted file mode 100644 index 067f85d138dacf0f9200f3d97cbadf38f48cdd29..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops/io.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// -// Created by evie on 7/12/17. -// - -#include "../main.hpp" -#include "../fuse_ops.hpp" -#include "../db/db_ops.hpp" -#include "../adafs_ops/mdata_ops.hpp" -#include "../rpc/client/c_data.hpp" -#include "../adafs_ops/io.hpp" - -using namespace std; - -/** - * Read data - * - * Read should send exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the file - * has been opened in 'direct_io' mode, in which case the return - * value of the read system call will reflect the return value of - * this operation. - * - * fi->fh will contain the value set by the open method, or will - * be undefined if the open method didn't set any value. - * - * Valid replies: - * fuse_reply_buf - * fuse_reply_iov - * fuse_reply_data - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param size number of bytes to read - * @param off offset to read from - * @param fi file information - */ -void adafs_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi) { - // TODO Check out how splicing works. This uses fuse_reply_data - ADAFS_DATA->spdlogger()->debug("adafs_ll_read() enter: inode {} size {} offset {}", ino, size, off); - size_t read_size; - auto buf = make_unique(size); - int err; - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(fmt::FormatInt(ino).str()); - if (ADAFS_DATA->is_local_op(recipient)) { // local read operation - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= fmt::FormatInt(ino).c_str(); - chnk_path /= "data"s; - err = read_file(buf.get(), read_size, chnk_path.c_str(), size, off); - } else { // remote read operation - err = rpc_send_read(recipient, ino, size, off, buf.get(), read_size); - } - } else { //single node operation - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= fmt::FormatInt(ino).c_str(); - chnk_path /= "data"s; - err = read_file(buf.get(), read_size, chnk_path.c_str(), size, off); - } - if (err != 0) { - fuse_reply_err(req, EIO); - return; - } - - ADAFS_DATA->spdlogger()->trace("Sending buf to Fuse driver: {}", buf.get()); - fuse_reply_buf(req, buf.get(), read_size); -} - - -/** - * Write data - * - * Write should return exactly the number of bytes requested - * except on error. An exception to this is when the file has - * been opened in 'direct_io' mode, in which case the return value - * of the write system call will reflect the return value of this - * operation. - * - * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is - * expected to reset the setuid and setgid bits. - * - * fi->fh will contain the value set by the open method, or will - * be undefined if the open method didn't set any value. - * - * Valid replies: - * fuse_reply_write - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param buf data to write - * @param size number of bytes to write - * @param off offset to write to - * @param fi file information - */ -void -adafs_ll_write(fuse_req_t req, fuse_ino_t ino, const char* buf, size_t size, off_t off, struct fuse_file_info* fi) { - ADAFS_DATA->spdlogger()->debug("adafs_ll_write() enter: inode {} size {} offset {} buf {} O_APPEND {}", ino, size, - off, - buf, fi->flags & O_APPEND); - // TODO Check out how splicing works. This uses the function write_buf then. - int err; - size_t write_size; - if (ADAFS_DATA->host_size() > 1) { // multiple node operation - auto recipient = RPC_DATA->get_rpc_node(fmt::FormatInt(ino).str()); - if (ADAFS_DATA->is_local_op(recipient)) { // local write operation - err = write_file(ino, buf, write_size, size, off, (fi->flags & O_APPEND) != 0); - } else { // remote write operation - err = rpc_send_write(recipient, ino, size, off, buf, write_size, (fi->flags & O_APPEND) != 0); - } - } else { //single node operation - err = write_file(ino, buf, write_size, size, off, (fi->flags & O_APPEND) != 0); - } - if (err != 0) { - fuse_reply_err(req, EIO); - return; - } - - fuse_reply_write(req, size); -} diff --git a/archive_old_fs_versions/lfs/src/fuse_ops/sync.cpp b/archive_old_fs_versions/lfs/src/fuse_ops/sync.cpp deleted file mode 100644 index ab7436d4c0c9a12ed458a3718922f0efdf07ab70..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/fuse_ops/sync.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Created by draze on 5/7/17. -// - -#include "../main.hpp" -#include "../fuse_ops.hpp" - - -/** - * Flush method - * - * This is called on each close() of the opened file. - * - * Since file descriptors can be duplicated (dup, dup2, fork), for - * one open call there may be many flush calls. - * - * Filesystems shouldn't assume that flush will always be called - * after some writes, or that if will be called at all. - * - * fi->fh will contain the value set by the open method, or will - * be undefined if the open method didn't set any value. - * - * NOTE: the name of the method is misleading, since (unlike - * fsync) the filesystem is not forced to flush pending writes. - * One reason to flush data, is if the filesystem wants to return - * write errors. - * - * If the filesystem supports file locking operations (setlk, - * getlk) it should remove all locks belonging to 'fi->owner'. - * - * If this request is answered with an error code of ENOSYS, - * this is treated as success and future calls to flush() will - * succeed automatically without being send to the filesystem - * process. - * - * Valid replies: - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -void adafs_ll_flush(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) { - // TODO to be implemented - ADAFS_DATA->spdlogger()->debug("adafs_ll_flush() enter: inode {}", ino); - fuse_reply_err(req, 0); -} \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/main.cpp b/archive_old_fs_versions/lfs/src/main.cpp deleted file mode 100644 index 43ca7b0e64baaf6853220c7b2da82007f4b8a028..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/main.cpp +++ /dev/null @@ -1,370 +0,0 @@ - -#include "main.hpp" -#include -#include "classes/metadata.hpp" -#include "adafs_ops/mdata_ops.hpp" -#include "adafs_ops/dentry_ops.hpp" -#include "fuse_ops.hpp" -#include "rpc/rpc_util.hpp" - - -static struct fuse_lowlevel_ops adafs_ops; - -using namespace std; -namespace po = boost::program_options; - -struct tmp_fuse_usr { - // Map host nr to host - std::map hosts; - std::string hostfile; - uint64_t host_nr; -}; - -/** - * Initializes the rpc environment: Mercury with Argobots = Margo - * This must be run in a dedicated thread! - */ -void init_rpc_env(promise rpc_promise) { - auto ret = init_argobots(); - if (!ret) { - rpc_promise.set_value(false); - return; - } - ret = init_rpc_server(); - if (!ret) { - rpc_promise.set_value(false); - return; - } - auto mid = RPC_DATA->server_mid(); - ret = init_rpc_client(); - if (!ret) { - rpc_promise.set_value(false); - return; - } - rpc_promise.set_value(true); - margo_wait_for_finalize( - mid); // XXX this consumes 1 logical core. Should put a conditional variable here and wait until shutdown. -} - -/** - * Initialize filesystem - * - * This function is called when libfuse establishes - * communication with the FUSE kernel module. The file system - * should use this module to inspect and/or modify the - * connection parameters provided in the `conn` structure. - * - * Note that some parameters may be overwritten by options - * passed to fuse_session_new() which take precedence over the - * values set in this handler. - * - * There's no reply to this function - * - * @param userdata the user data passed to fuse_session_new() - */ -void adafs_ll_init(void* pdata, struct fuse_conn_info* conn) { - ADAFS_DATA->spdlogger()->info("adafs_ll_init() enter"s); - - // parse additional arguments to adafs - auto fuse_data = static_cast(pdata); - ADAFS_DATA->hosts(fuse_data->hosts); - ADAFS_DATA->host_id(fuse_data->host_nr); - ADAFS_DATA->host_size(fuse_data->hosts.size()); - ADAFS_DATA->rpc_port(fmt::FormatInt(RPCPORT).str()); - - // Make sure directory structure exists - bfs::create_directories(ADAFS_DATA->dentry_path()); - bfs::create_directories(ADAFS_DATA->inode_path()); - bfs::create_directories(ADAFS_DATA->chunk_path()); - bfs::create_directories(ADAFS_DATA->mgmt_path()); - - // Initialize rocksdb - auto err = init_rocksdb(); - assert(err); - // Starting RPC environment - promise rpc_promise; - future rpc_future = rpc_promise.get_future(); - thread t1(init_rpc_env, move(rpc_promise)); - rpc_future.wait(); // wait for RPC environment to be initialized - assert(rpc_future.get()); // get potential error during RPC init and exit if future holds false - ADAFS_DATA->spdlogger()->info("RPC environment successfully started"); - t1.detach(); // detach rpc thread for independent operation. This is mandatory for the Margo framework! - - // Check if fs already has some data and read the inode count - if (bfs::exists(ADAFS_DATA->mgmt_path() + "/inode_count")) - Util::read_inode_cnt(); - else - Util::init_inode_no(); - - //Init file system configuration - ADAFS_DATA->blocksize(4096); - - // Init unordered_map for caching metadata that was already looked up XXX use later - ADAFS_DATA->hashmap(unordered_map()); //unused - ADAFS_DATA->hashf(hash()); - - auto md = make_shared(); - - ADAFS_DATA->spdlogger()->info("Checking root metadata..."); - // Check that root metadata exists. If not initialize it - if (get_metadata(*md, ADAFS_ROOT_INODE) == ENOENT) { - ADAFS_DATA->spdlogger()->info("Root metadata not found. Initializing..."s); - md->init_ACM_time(); - md->mode(S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO); // change_access 777 - md->size(4096); // XXX just visual. size computation of directory should be done properly at some point - // This is because fuse is mounted through root although it was triggered by the user - md->uid(0); // hardcoded root XXX - md->gid(0); // hardcoded root XXX - md->inode_no(ADAFS_ROOT_INODE); - ADAFS_DATA->spdlogger()->info("Writing / metadata to disk..."s); - write_all_metadata(*md); - ADAFS_DATA->spdlogger()->info("Initializing dentry for /"s); - init_dentry_dir(ADAFS_ROOT_INODE); - ADAFS_DATA->spdlogger()->info("Creating Metadata object"s); - } -#ifdef LOG_INFO - else - ADAFS_DATA->spdlogger()->info("Root metadata found"s); -#endif - -} - -/** - * Clean up filesystem - * - * Called on filesystem exit - * - * There's no reply to this function - * - * @param userdata the user data passed to fuse_session_new() - */ -void adafs_ll_destroy(void* pdata) { - ADAFS_DATA->spdlogger()->info("Shutting down..."s); - // Shutting down RPC environment XXX LATER -// margo_finalize(RPC_DATA->client_mid()); -// ADAFS_DATA->spdlogger()->info("Margo client finalized"); -// margo_finalize(RPC_DATA->server_mid()); -// ADAFS_DATA->spdlogger()->info("Margo server finalized"); -// destroy_argobots(); -// ADAFS_DATA->spdlogger()->info("Argobots shut down"s); -// destroy_rpc_client(); -// ADAFS_DATA->spdlogger()->info("Client shut down"s); -// destroy_rpc_server(); -// ADAFS_DATA->spdlogger()->info("Server shut down"s); - Util::write_inode_cnt(); -} - -static void init_adafs_ops(fuse_lowlevel_ops* ops) { - // file - ops->getattr = adafs_ll_getattr; - ops->setattr = adafs_ll_setattr; - ops->create = adafs_ll_create; - ops->mknod = adafs_ll_mknod; - ops->unlink = adafs_ll_unlink; - ops->open = adafs_ll_open; - ops->release = adafs_ll_release; - - // directory - ops->lookup = adafs_ll_lookup; - ops->opendir = adafs_ll_opendir; - ops->readdir = adafs_ll_readdir; - ops->mkdir = adafs_ll_mkdir; - ops->rmdir = adafs_ll_rmdir; - ops->releasedir = adafs_ll_releasedir; - - // I/O - ops->write = adafs_ll_write; - ops->read = adafs_ll_read; - - // sync - ops->flush = adafs_ll_flush; - - // permission - ops->access = adafs_ll_access; - - ops->init = adafs_ll_init; - ops->destroy = adafs_ll_destroy; -} - -void err_cleanup1(fuse_cmdline_opts opts, fuse_args& args) { - free(opts.mountpoint); - fuse_opt_free_args(&args); - cout << "# Resources released" << endl; -} - -void err_cleanup2(fuse_session& se) { - fuse_session_destroy(&se); - cout << "# Fuse session destroyed" << endl; -} - -void err_cleanup3(fuse_session& se) { - fuse_remove_signal_handlers(&se); - cout << "# Signal handlers removed" << endl; -} - -/** - * First some adafs configurations, e.g., userdata in fuse is set, then fuse is initialized with the remaining argv - * @param argc - * @param argv - * @return - */ -int main(int argc, const char* argv[]) { - - //Initialize the mapping of Fuse functions - init_adafs_ops(&adafs_ops); - -// //set the spdlogger and initialize it with spdlog - ADAFS_DATA->spdlogger(spdlog::basic_logger_mt("basic_logger", "adafs.log")); -#if defined(LOG_TRACE) - spdlog::set_level(spdlog::level::trace); - ADAFS_DATA->spdlogger()->flush_on(spdlog::level::trace); -#elif defined(LOG_DEBUG) - spdlog::set_level(spdlog::level::debug); - ADAFS_DATA->spdlogger()->flush_on(spdlog::level::debug); -#elif defined(LOG_INFO) - spdlog::set_level(spdlog::level::info); - ADAFS_DATA->spdlogger()->flush_on(spdlog::level::info); -#else - spdlog::set_level(spdlog::level::off); -#endif - - // Parse input - auto fuse_argc = 1; - vector fuse_argv; - fuse_argv.push_back(move(argv[0])); - auto fuse_struct = make_unique(); - - po::options_description desc("Allowed options"); - desc.add_options() - ("help,h", "Help message") - ("foreground,f", "Run Fuse instance in foreground. (Fuse parameter)") - ("mountdir,m", po::value(), "User Fuse mountdir. (Fuse parameter)") - ("rootdir,r", po::value(), "ADA-FS data directory") - ("hostsfile", po::value(), "Path to the hosts_ file for all fs participants") - ("hosts,h", po::value(), "Comma separated list of hosts_ for all fs participants"); - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - if (vm.count("help")) { - cout << desc << "\n"; - return 1; - } - - if (vm.count("foreground")) { - fuse_argc++; - fuse_argv.push_back("-f"s); - } - if (vm.count("mountdir")) { - fuse_argc++; - fuse_argv.push_back(vm["mountdir"].as()); - } - if (vm.count("rootdir")) { - ADAFS_DATA->rootdir(vm["rootdir"].as()); - } - - // TODO Hostfile parsing here... - if (vm.count("hosts")) { - auto hosts = vm["hosts"].as(); - uint64_t i = 0; - auto found_hostname = false; - auto hostname = Util::get_my_hostname(); - if (hostname.size() == 0) { - cerr << "Unable to read the machine's hostname" << endl; - assert(hostname.size() != 0); - } - // split comma separated host string - boost::char_separator sep(","); - boost::tokenizer> tok(hosts, sep); - for (auto&& s : tok) { - fuse_struct->hosts[i] = s; - if (hostname == s) { - fuse_struct->host_nr = i; - found_hostname = true; - } - i++; - } - if (!found_hostname) { - cerr << "Hostname was not found in given parameters. Exiting ..." << endl; - assert(found_hostname); - } - } - - // convert fuse_argv into char* [] - char* fuse_argv_c[10] = {0}; - for (unsigned int i = 0; i < fuse_argv.size(); ++i) { - char* tmp_c = new char[fuse_argv[i].size() + 1]; - std::strcpy(tmp_c, fuse_argv[i].c_str()); - fuse_argv_c[i] = tmp_c; - } - - //set all paths - ADAFS_DATA->inode_path(ADAFS_DATA->rootdir() + "/meta/inodes"s); - ADAFS_DATA->dentry_path(ADAFS_DATA->rootdir() + "/meta/dentries"s); - ADAFS_DATA->chunk_path(ADAFS_DATA->rootdir() + "/data/chunks"s); - ADAFS_DATA->mgmt_path(ADAFS_DATA->rootdir() + "/mgmt"s); - - // Fuse stuff starts here in C style... ######################################################################## - struct fuse_args args = FUSE_ARGS_INIT(fuse_argc, fuse_argv_c); - struct fuse_session* se; - struct fuse_cmdline_opts opts; - int err = -1; - - if (fuse_parse_cmdline(&args, &opts) != 0) - return 1; - if (opts.show_help) { - cout << "usage: " << argv[0] << "[option] \n\n" << endl; - fuse_cmdline_help(); - fuse_lowlevel_help(); - err_cleanup1(opts, args); - return 0; - } else if (opts.show_version) { - cout << "FUSE library version " << fuse_pkgversion() << "\n" << endl; - fuse_lowlevel_version(); - err_cleanup1(opts, args); - return 0; - } - - // creating a low level session - se = fuse_session_new(&args, &adafs_ops, sizeof(adafs_ops), fuse_struct.get()); - - if (se == NULL) { - err_cleanup1(opts, args); - return 0; - } - cout << "# Fuse session created" << endl; - // setup the signal handlers so that fuse exits the session properly - if (fuse_set_signal_handlers(se) != 0) { - err_cleanup2(*se); - err_cleanup1(opts, args); - return 0; - } - cout << "# Signal handlers set" << endl; - // mount the file system at the mountpoint - if (fuse_session_mount(se, opts.mountpoint) != 0) { - err_cleanup3(*se); - err_cleanup2(*se); - err_cleanup1(opts, args); - return 0; - } - cout << "# Fuse file system mounted at \"" << opts.mountpoint << "\"" << endl; - fuse_daemonize(opts.foreground); - cout << "# Fuse daemonized - About to dive into event loop" << endl; - - // Block until ctrl+c or fusermount -u - if (opts.singlethread) - err = fuse_session_loop(se); - else - err = fuse_session_loop_mt(se, opts.clone_fd); - - cout << "\n# Interrupt detected \n# Destroying file system..." << endl; - - // Cleanup - fuse_session_unmount(se); - cout << "# Fuse file system unmounted" << endl; - err_cleanup3(*se); - err_cleanup2(*se); - err_cleanup1(opts, args); - - return err ? 1 : 0; -} diff --git a/archive_old_fs_versions/lfs/src/main.hpp b/archive_old_fs_versions/lfs/src/main.hpp deleted file mode 100644 index 98c395d0315cc15363cd200490c1df7223711774..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/main.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// Created by lefthy on 1/24/17. -// - -#ifndef MAIN_H -#define MAIN_H - -#define FUSE_USE_VERSION 30 - -extern "C" { - #include -} -// std libs -#include -#include -#include -#include -#include - -// boost libs -#include -#include -#include -#include -// adafs -#include "configure.hpp" -// third party libs -#include "extern/spdlog/spdlog.h" -#include "extern/spdlog/fmt/fmt.h" -// rocksdb -#include -#include -#include -#include -#include -// margo -extern "C" { -#include -#include -//#include -//#include -#include -#include -#include -} - -// classes -#include "classes/fs_data.hpp" -#include "classes/rpc_data.hpp" - -namespace bfs = boost::filesystem; - -#define ADAFS_ROOT_INODE static_cast(1) -#define INVALID_INODE static_cast(0) -#define ADAFS_DATA (static_cast(FsData::getInstance())) -#define RPC_DATA (static_cast(RPCData::getInstance())) - -namespace Util { - int init_inode_no(); - - fuse_ino_t generate_inode_no(); - - int read_inode_cnt(); - - int write_inode_cnt(); - - std::string get_my_hostname(); -} - -#endif //MAIN_H diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_data.cpp b/archive_old_fs_versions/lfs/src/rpc/client/c_data.cpp deleted file mode 100644 index 816dd24e9b8ab5d9e4e49266b41e097ea0fb73e7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_data.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Created by evie on 7/13/17. -// - -#include "c_data.hpp" - -using namespace std; - - -int rpc_send_write(const size_t recipient, const fuse_ino_t inode, const size_t in_size, const off_t in_offset, - const char *buf, size_t &write_size, const bool append) { - - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_write_data_in_t in; - rpc_data_out_t out; - int err; - // fill in - in.inode = inode; - in.size = in_size; - in.offset = in_offset; - if (append) - in.append = HG_TRUE; - else - in.append = HG_FALSE; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_write_data_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - auto hgi = HG_Get_info(handle); - /* register local target buffer for bulk access */ - // this is stupid. Fuse gives us a const char* but Bulk_creat expects a non-const char*. - // The only way of getting const away from buf is to memcpy the content to a new buffer. - // TODO better solution - auto non_const_buf = make_unique(in_size); - memcpy(non_const_buf.get(), buf, in_size); - auto b_buf = static_cast(non_const_buf.get()); - ret = HG_Bulk_create(hgi->hg_class, 1, &b_buf, &in_size, HG_BULK_READ_ONLY, &in.bulk_handle); - if (ret != 0) - ADAFS_DATA->spdlogger()->error("failed to create bulkd on client"); - - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - - /* decode response */ - ret = HG_Get_output(handle, &out); - err = out.res; - write_size = static_cast(out.io_size); - ADAFS_DATA->spdlogger()->debug("Got response {}", out.res); - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC rpc_send_read (timed out)"); - err = EAGAIN; - } - - HG_Bulk_free(in.bulk_handle); - HG_Free_input(handle, &in); - HG_Destroy(handle); - - return err; -} \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_data.hpp b/archive_old_fs_versions/lfs/src/rpc/client/c_data.hpp deleted file mode 100644 index 7b26b4cfa121d5bc3d8b9fdd41078dee19d35501..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_data.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Created by evie on 7/13/17. -// - -#ifndef LFS_C_DATA_HPP -#define LFS_C_DATA_HPP - -#include "../../main.hpp" -#include "../rpc_types.hpp" - -static int max_retries = 3; - -template -int rpc_send_read(const size_t recipient, const fuse_ino_t inode, const size_t in_size, const off_t in_offset, - T* tar_buf, size_t& read_size) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_read_data_in_t in; - rpc_data_out_t out; - int err; - // fill in - in.inode = inode; - in.size = in_size; - in.offset = in_offset; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_read_data_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - - auto b_buf = static_cast(tar_buf); - /* register local target buffer for bulk access */ - auto hgi = HG_Get_info(handle); - ret = HG_Bulk_create(hgi->hg_class, 1, &b_buf, &in_size, HG_BULK_WRITE_ONLY, &in.bulk_handle); - if (ret != 0) - ADAFS_DATA->spdlogger()->error("failed to create bulkd on client"); - - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - tar_buf = static_cast(b_buf); - read_size = static_cast(out.io_size); - err = out.res; - ADAFS_DATA->spdlogger()->debug("Got response {}", out.res); - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC rpc_send_read (timed out)"); - err = EAGAIN; - } - - HG_Bulk_free(in.bulk_handle); - HG_Free_input(handle, &in); - HG_Destroy(handle); - - return err; -} - -int rpc_send_write(const size_t recipient, const fuse_ino_t inode, const size_t in_size, const off_t in_offset, - const char *buf, size_t &write_size, const bool append); - -#endif //LFS_C_DATA_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.cpp b/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.cpp deleted file mode 100644 index f07c19bb81e51c8bcd4e15e11743cbae0d1e09ce..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// -// Created by evie on 7/7/17. -// - -#include "c_dentry.hpp" -#include "../rpc_types.hpp" - -using namespace std; - -static int max_retries = 3; - -int rpc_send_lookup(const size_t recipient, const fuse_ino_t parent, const char* name, fuse_ino_t& inode) { - - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_lookup_in_t in; - rpc_lookup_out_t out; - auto err = 0; - // fill in - in.parent_inode = static_cast(parent); - in.filename = name; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_lookup_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response inode: {}", out.inode); - inode = static_cast(out.inode); - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_lookup(timed out)"); - } - - in.filename = nullptr; - HG_Free_input(handle, &in); - HG_Destroy(handle); - - if (inode == INVALID_INODE) - err = ENOENT; - return err; -} - -int rpc_send_create_dentry(const size_t recipient, const fuse_ino_t parent, const string& name, - const mode_t mode, fuse_ino_t& new_inode) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_create_dentry_in_t in; - rpc_create_dentry_out_t out; - auto err = 0; - // fill in - in.parent_inode = static_cast(parent); - in.filename = name.c_str(); - in.mode = static_cast(mode); - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_create_dentry_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response inode: {}", out.inode); - new_inode = static_cast(out.inode); - - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_create_dentry (timed out)"); - } - - in.filename = nullptr; // XXX temporary. If this is not done free input crashes because of invalid pointer?! - HG_Free_input(handle, &in); - HG_Destroy(handle); - if (new_inode == INVALID_INODE) - err = 1; - - return err; -} - -int rpc_send_remove_dentry(const size_t recipient, const fuse_ino_t parent, const string& name, fuse_ino_t& del_inode) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_remove_dentry_in_t in; - rpc_remove_dentry_out_t out; - auto err = 0; - // fill in - in.parent_inode = static_cast(parent); - in.filename = name.c_str(); - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_remove_dentry_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response deleted inode: {}", out.del_inode); - del_inode = static_cast(out.del_inode); - - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_remove_dentry (timed out)"); - } - - in.filename = nullptr; // XXX temporary. If this is not done free input crashes because of invalid pointer?! - HG_Free_input(handle, &in); - HG_Destroy(handle); - if (del_inode == INVALID_INODE) - err = 1; - - return err; -} - - diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.hpp b/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.hpp deleted file mode 100644 index bb78e6be938cce6da8a8b79253d634b9c37fb3c6..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_dentry.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by evie on 7/7/17. -// - -#ifndef LFS_C_DENTRY_HPP -#define LFS_C_DENTRY_HPP - -#include "../../main.hpp" - -int rpc_send_lookup(const size_t recipient, const fuse_ino_t parent, const char* name, fuse_ino_t& inode); - -int rpc_send_create_dentry(const size_t recipient, const fuse_ino_t parent, const std::string& name, - const mode_t mode, fuse_ino_t& new_inode); - -int -rpc_send_remove_dentry(const size_t recipient, const fuse_ino_t parent, const std::string& name, fuse_ino_t& del_inode); - - -#endif //LFS_C_DENTRY_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.cpp b/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.cpp deleted file mode 100644 index 240496947985c0c0cc3506f5f167cfb35dcb46e6..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// -// Created by evie on 6/22/17. -// - -#include "c_metadata.hpp" -#include "../rpc_types.hpp" - -using namespace std; - -static int max_retries = 3; - -//void send_minimal_rpc() { -//void send_minimal_rpc(void* arg) { -// -// hg_handle_t handle; -// rpc_minimal_in_t in; -// rpc_minimal_out_t out; -//// hg_addr_t svr_addr = HG_ADDR_NULL; -//// hg_addr_t* svr_addr = static_cast(arg); -// -// hg_addr_t svr_addr = RPC_DATA->svr_addr_; -// -//// mada_addr_lookup("cci+tcp://localhost:1234"s, &svr_addr); -//// margo_addr_lookup(RPC_DATA->client_mid(), "cci+tcp://localhost:1234"s.c_str(), &svr_addr); -// -// ADAFS_DATA->spdlogger()->debug("minimal RPC is running..."); -// -// -// /* create handle */ -// auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_minimal_id(), &handle); -// if(ret != HG_SUCCESS) { -// printf("Creating handle FAILED\n"); -// return; -// } -// -// /* Send rpc. Note that we are also transmitting the bulk handle in the -// * input struct. It was set above. -// */ -// in.input = 42; -// ADAFS_DATA->spdlogger()->debug("About to call RPC ..."); -// mada_forward(handle, &in); -// -// /* decode response */ -// ret = HG_Get_output(handle, &out); -// -// ADAFS_DATA->spdlogger()->debug("Got response ret: {}", out.output); -// -//// HG_Addr_free(RPC_DATA->client_hg_class(), svr_addr); -// /* clean up resources consumed by this rpc */ -// HG_Free_output(handle, &out); -// HG_Destroy(handle); -// -// ADAFS_DATA->spdlogger()->debug("minimal RPC is done."); -//} - -void send_minimal_rpc(void* arg) { - - hg_handle_t handle; - rpc_minimal_in_t in; - rpc_minimal_out_t out; - hg_addr_t svr_addr = HG_ADDR_NULL; -// hg_addr_t* svr_addr = static_cast(arg); - - ADAFS_DATA->spdlogger()->debug("Looking up address"); - - margo_addr_lookup(RPC_DATA->client_mid(), "cci+tcp://134.93.182.11:1234"s.c_str(), &svr_addr); - - ADAFS_DATA->spdlogger()->debug("minimal RPC is running..."); - - - /* create handle */ - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_minimal_id(), &handle); - if (ret != HG_SUCCESS) { - printf("Creating handle FAILED\n"); - return; - } - - /* Send rpc. Note that we are also transmitting the bulk handle in the - * input struct. It was set above. - */ - in.input = 42; - ADAFS_DATA->spdlogger()->debug("About to call RPC ..."); - int send_ret = HG_FALSE; - for (int i = 1; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, 5); - if (send_ret == HG_SUCCESS) { - break; - } - } - - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response ret: {}", out.output); - - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->info("RPC NOT send (timed out)"); - } - HG_Addr_free(margo_get_class(RPC_DATA->client_mid()), svr_addr); - HG_Free_input(handle, &in); - HG_Destroy(handle); - - ADAFS_DATA->spdlogger()->debug("minimal RPC is done."); -} - -int rpc_send_create_mdata(const size_t recipient, const uid_t uid, const gid_t gid, - const mode_t mode, const fuse_ino_t inode) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_create_mdata_in_t in; - rpc_create_mdata_out_t out; - // fill in - in.inode = inode; - in.mode = mode; - in.uid = uid; - in.gid = gid; - hg_bool_t success = HG_FALSE; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_create_mdata_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response success: {}", out.success); - success = out.success; - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_create_mdata(timed out)"); - } - - - HG_Free_input(handle, &in); - HG_Destroy(handle); - return success == HG_TRUE ? 0 : 1; -} - -int rpc_send_get_attr(const size_t recipient, const fuse_ino_t inode, struct stat& attr) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_get_attr_in_t in; - rpc_get_attr_out_t out; - // fill in - in.inode = inode; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_attr_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response mode {}", out.mode); - attr.st_ino = static_cast(inode); - attr.st_atim.tv_sec = static_cast(out.atime); - attr.st_mtim.tv_sec = static_cast(out.mtime); - attr.st_ctim.tv_sec = static_cast(out.ctime); - attr.st_mode = static_cast(out.mode); - attr.st_uid = static_cast(out.uid); - attr.st_gid = static_cast(out.gid); - attr.st_nlink = static_cast(out.nlink); - attr.st_size = static_cast(out.size); - attr.st_blksize = ADAFS_DATA->blocksize(); // globally set blocksize is used - attr.st_blocks = static_cast(out.blocks); - - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_get_attr (timed out)"); - } - - HG_Free_input(handle, &in); - HG_Destroy(handle); - - return 0; -} - -int rpc_send_remove_mdata(const size_t recipient, const fuse_ino_t del_inode) { - hg_handle_t handle; - hg_addr_t svr_addr = HG_ADDR_NULL; - rpc_remove_mdata_in_t in; - rpc_remove_mdata_out_t out; - // fill in - in.del_inode = static_cast(del_inode); - hg_bool_t success = HG_FALSE; - // TODO HG_ADDR_T is never freed atm. Need to change LRUCache - if (!RPC_DATA->get_addr_by_hostid(recipient, svr_addr)) { - ADAFS_DATA->spdlogger()->error("server address not resolvable for host id {}", recipient); - return 1; - } - auto ret = HG_Create(RPC_DATA->client_hg_context(), svr_addr, RPC_DATA->rpc_srv_remove_mdata_id(), &handle); - if (ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("creating handle FAILED"); - return 1; - } - int send_ret = HG_FALSE; - for (int i = 0; i < max_retries; ++i) { - send_ret = margo_forward_timed(RPC_DATA->client_mid(), handle, &in, RPC_TIMEOUT); - if (send_ret == HG_SUCCESS) { - break; - } - } - if (send_ret == HG_SUCCESS) { - /* decode response */ - ret = HG_Get_output(handle, &out); - - ADAFS_DATA->spdlogger()->debug("Got response remove mdata success: {}", out.success); - success = out.success; - /* clean up resources consumed by this rpc */ - HG_Free_output(handle, &out); - } else { - ADAFS_DATA->spdlogger()->error("RPC send_remove_mdata(timed out)"); - } - - HG_Free_input(handle, &in); - HG_Destroy(handle); - return success == HG_TRUE ? 0 : 1; -} diff --git a/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.hpp b/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.hpp deleted file mode 100644 index 80480e43ed5fd19c21780030aedfc596c0f2b160..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/client/c_metadata.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Created by evie on 6/22/17. -// - -#ifndef LFS_C_METADATA_HPP -#define LFS_C_METADATA_HPP - -#include "../../main.hpp" -#include "../rpc_types.hpp" - -void send_minimal_rpc(void* arg); - -int rpc_send_create_mdata(const size_t recipient, const uid_t uid, const gid_t gid, - const mode_t mode, const fuse_ino_t inode); - -int rpc_send_create(const size_t recipient, const fuse_ino_t parent, const std::string& name, - const uid_t uid, const gid_t gid, const mode_t mode, fuse_ino_t& new_inode); - -int rpc_send_get_attr(const size_t recipient, const fuse_ino_t inode, struct stat& attr); - -int rpc_send_remove_mdata(const size_t recipient, const fuse_ino_t del_inode); - -#endif //LFS_C_METADATA_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/rpc_defs.hpp b/archive_old_fs_versions/lfs/src/rpc/rpc_defs.hpp deleted file mode 100644 index ffec52dc91a7bbd684a13c9332e52f3d0db845ce..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/rpc_defs.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// Created by evie on 6/22/17. -// - -#ifndef LFS_RPC_DEFS_HPP -#define LFS_RPC_DEFS_HPP - -#include "../main.hpp" - -/* visible API for RPC operations */ - -DECLARE_MARGO_RPC_HANDLER(rpc_minimal) - -// mdata ops -DECLARE_MARGO_RPC_HANDLER(rpc_srv_create_mdata) -DECLARE_MARGO_RPC_HANDLER(rpc_srv_attr) -DECLARE_MARGO_RPC_HANDLER(rpc_srv_remove_mdata) - -// dentry ops -DECLARE_MARGO_RPC_HANDLER(rpc_srv_lookup) -DECLARE_MARGO_RPC_HANDLER(rpc_srv_create_dentry) -DECLARE_MARGO_RPC_HANDLER(rpc_srv_remove_dentry) - -// data -DECLARE_MARGO_RPC_HANDLER(rpc_srv_read_data) - -DECLARE_MARGO_RPC_HANDLER(rpc_srv_write_data) - - - -#endif //LFS_RPC_DEFS_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/rpc_types.hpp b/archive_old_fs_versions/lfs/src/rpc/rpc_types.hpp deleted file mode 100644 index 37c50c00a34247a870745a3d21f302ae85fd70c7..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/rpc_types.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// Created by evie on 6/22/17. -// - -#ifndef LFS_RPC_TYPES_HPP -#define LFS_RPC_TYPES_HPP - - -#include "../main.hpp" - -/* visible API for RPC data types used in RPCS */ - -MERCURY_GEN_PROC(rpc_minimal_in_t, ((int32_t) (input))) - -MERCURY_GEN_PROC(rpc_minimal_out_t, ((int32_t) (output))) -// misc generic rpc types -MERCURY_GEN_PROC(rpc_res_out_t, ((hg_bool_t) (res))) - -// create dentry -MERCURY_GEN_PROC(rpc_create_dentry_in_t, - ((uint64_t) (parent_inode))\ -((hg_const_string_t) (filename))\ -((uint32_t) (mode))) - -MERCURY_GEN_PROC(rpc_create_dentry_out_t, ((uint64_t) (inode))) -// create mdata -MERCURY_GEN_PROC(rpc_create_mdata_in_t, - ((uint64_t) (inode))\ -((uint32_t) (gid))\ -((uint32_t) (uid))\ -((uint32_t) (mode))) - -MERCURY_GEN_PROC(rpc_create_mdata_out_t, ((hg_bool_t) (success))) -// get_attr -MERCURY_GEN_PROC(rpc_get_attr_in_t, ((uint64_t) (inode))) - -MERCURY_GEN_PROC(rpc_get_attr_out_t, - ((uint64_t) (nlink))\ -((uint32_t) (mode))\ -((uint32_t) (uid))\ -((uint32_t) (gid))\ -((int64_t) (size))\ -((int64_t) (blocks))\ -((int64_t) (atime))\ -((int64_t) (mtime))\ -((int64_t) (ctime))) -// lookup -MERCURY_GEN_PROC(rpc_lookup_in_t, - ((uint64_t) (parent_inode))\ -((hg_const_string_t) (filename))) - -MERCURY_GEN_PROC(rpc_lookup_out_t, ((uint64_t) (inode))) -// remove dentry -MERCURY_GEN_PROC(rpc_remove_dentry_in_t, - ((uint64_t) (parent_inode))\ -((hg_const_string_t) (filename))) - -MERCURY_GEN_PROC(rpc_remove_dentry_out_t, ((uint64_t) (del_inode))) -// remove mdata -MERCURY_GEN_PROC(rpc_remove_mdata_in_t, ((uint64_t) (del_inode))) - -MERCURY_GEN_PROC(rpc_remove_mdata_out_t, ((hg_bool_t) (success))) -// data -MERCURY_GEN_PROC(rpc_read_data_in_t, - ((uint64_t) (inode))\ -((hg_size_t) (size))\ -((int64_t) (offset))\ -((hg_bulk_t) (bulk_handle))) - -MERCURY_GEN_PROC(rpc_data_out_t, - ((int32_t) (res))\ - ((hg_size_t) (io_size))) - -MERCURY_GEN_PROC(rpc_write_data_in_t, - ((uint64_t) (inode))\ -((hg_size_t) (size))\ -((int64_t) (offset))\ -((hg_bool_t) (append))\ -((hg_bulk_t) (bulk_handle))) - -#endif //LFS_RPC_TYPES_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/rpc_util.cpp b/archive_old_fs_versions/lfs/src/rpc/rpc_util.cpp deleted file mode 100644 index d3bd5e3da05b4d931afb8d491c9b0ff34c2019e1..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/rpc_util.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// -// Created by evie on 6/21/17. -// - -#include "rpc_util.hpp" -#include "rpc_types.hpp" -#include "rpc_defs.hpp" -#include "client/c_metadata.hpp" - -using namespace std; - -/** - * Initializes the Argobots environment - * @return - */ -bool init_argobots() { - ADAFS_DATA->spdlogger()->info("Initializing Argobots ..."); - - // We need no arguments to init - auto argo_err = ABT_init(0, nullptr); - if (argo_err != 0) { - ADAFS_DATA->spdlogger()->error("ABT_init() Failed to init Argobots (client)"); - return false; - } - // Set primary execution stream to idle without polling. Normally xstreams cannot sleep. This is what ABT_snoozer does - argo_err = ABT_snoozer_xstream_self_set(); - if (argo_err != 0) { - ADAFS_DATA->spdlogger()->error("ABT_snoozer_xstream_self_set() (client)"); - return false; - } - ADAFS_DATA->spdlogger()->info("Success."); - return true; -} - -/** - * Shuts down Argobots - */ -void destroy_argobots() { - ADAFS_DATA->spdlogger()->info("About to shut Argobots down"s); - auto ret = ABT_finalize(); - if (ret == ABT_SUCCESS) { - ADAFS_DATA->spdlogger()->info("Argobots successfully shutdown."); - } else { - ADAFS_DATA->spdlogger()->error("Argobots shutdown FAILED with err code {}", ret); - } -} - - -/** - * Initializes the Mercury and Margo server - * @return - */ -bool init_rpc_server() { - auto protocol_port = "cci+tcp://localhost:" + to_string(RPCPORT); - - hg_addr_t addr_self; - hg_size_t addr_self_cstring_sz = 128; - char addr_self_cstring[128]; - - // Mercury class and context pointer that go into RPC_data class - hg_class_t* hg_class; - hg_context_t* hg_context; - - ADAFS_DATA->spdlogger()->info("Initializing Mercury server ..."); - /* MERCURY PART */ - // Init Mercury layer (must be finalized when finished) - hg_class = HG_Init(protocol_port.c_str(), HG_TRUE); - if (hg_class == nullptr) { - ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury server layer"); - return false; - } - // Create a new Mercury context (must be destroyed when finished) - hg_context = HG_Context_create(hg_class); - if (hg_context == nullptr) { - ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury server context"); - HG_Finalize(hg_class); - return false; - } - // Below is just for logging purposes - // Figure out what address this server is listening on (must be freed when finished) - auto hg_ret = HG_Addr_self(hg_class, &addr_self); - if (hg_ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("HG_Addr_self() Failed to retrieve server address"); - HG_Context_destroy(hg_context); - HG_Finalize(hg_class); - return false; - } - // Convert the address to a cstring (with \0 terminator). - hg_ret = HG_Addr_to_string(hg_class, addr_self_cstring, &addr_self_cstring_sz, addr_self); - if (hg_ret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("HG_Addr_to_string Failed to convert address to cstring"); - HG_Context_destroy(hg_context); - HG_Finalize(hg_class); - HG_Addr_free(hg_class, addr_self); - return false; - } - HG_Addr_free(hg_class, addr_self); - - ADAFS_DATA->spdlogger()->info("Success. Accepting RPCs on address {}", addr_self_cstring); - - /* MARGO PART */ - ADAFS_DATA->spdlogger()->info("Initializing Margo server..."); - // Start Margo - auto mid = margo_init(1, 16, hg_context); - if (mid == MARGO_INSTANCE_NULL) { - ADAFS_DATA->spdlogger()->error("margo_init failed to initialize the Margo server"); - HG_Context_destroy(hg_context); - HG_Finalize(hg_class); - return false; - } - ADAFS_DATA->spdlogger()->info("Success."); - - // Put context and class into RPC_data object - RPC_DATA->server_hg_class(hg_class); - RPC_DATA->server_hg_context(hg_context); - RPC_DATA->server_mid(mid); - - // register RPCs - register_server_rpcs(); - - return true; -} - -/** - * Register the rpcs for the server. There is no need to store rpc ids for the server - * @param hg_class - */ -void register_server_rpcs() { - auto hg_class = RPC_DATA->server_hg_class(); - MERCURY_REGISTER(hg_class, "rpc_minimal", rpc_minimal_in_t, rpc_minimal_out_t, rpc_minimal_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_create_dentry", rpc_create_dentry_in_t, rpc_create_dentry_out_t, - rpc_srv_create_dentry_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_remove_dentry", rpc_remove_dentry_in_t, rpc_remove_dentry_out_t, - rpc_srv_remove_dentry_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_create_mdata", rpc_create_mdata_in_t, rpc_create_mdata_out_t, - rpc_srv_create_mdata_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_remove_mdata", rpc_remove_mdata_in_t, rpc_remove_mdata_out_t, - rpc_srv_remove_mdata_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_attr", rpc_get_attr_in_t, rpc_get_attr_out_t, rpc_srv_attr_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_lookup", rpc_lookup_in_t, rpc_lookup_out_t, rpc_srv_lookup_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_read_data", rpc_read_data_in_t, rpc_data_out_t, rpc_srv_read_data_handler); - MERCURY_REGISTER(hg_class, "rpc_srv_write_data", rpc_write_data_in_t, rpc_data_out_t, rpc_srv_write_data_handler); -} - -void destroy_rpc_server() { - HG_Context_destroy(RPC_DATA->server_hg_context()); - HG_Finalize(RPC_DATA->server_hg_class()); -} - -/** - * Initializes the Mercury and Margo clients - * @return - */ -bool init_rpc_client() { - auto protocol_port = "cci+tcp"s; - ADAFS_DATA->spdlogger()->info("Initializing Mercury client ..."); - /* MERCURY PART */ - // Init Mercury layer (must be finalized when finished) - hg_class_t* hg_class; - hg_context_t* hg_context; - hg_class = HG_Init(protocol_port.c_str(), HG_FALSE); - if (hg_class == nullptr) { - ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury client layer"); - return false; - } - // Create a new Mercury context (must be destroyed when finished) - hg_context = HG_Context_create(hg_class); - if (hg_context == nullptr) { - ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury client context"); - HG_Finalize(hg_class); - return false; - } - ADAFS_DATA->spdlogger()->info("Success."); - - /* MARGO PART */ - ADAFS_DATA->spdlogger()->info("Initializing Margo client ..."); - // Start Margo - auto mid = margo_init(0, 0, - hg_context); // TODO if the progress thread is set to 1, we do not consume 100% of one core. INVESTIGATE LATER - if (mid == MARGO_INSTANCE_NULL) { - ADAFS_DATA->spdlogger()->info("[ERR]: margo_init failed to initialize the Margo client"); - HG_Context_destroy(hg_context); - HG_Finalize(hg_class); - return false; - } - ADAFS_DATA->spdlogger()->info("Success."); - - // Put context and class into RPC_data object - RPC_DATA->client_hg_class(hg_class); - RPC_DATA->client_hg_context(hg_context); - RPC_DATA->client_mid(mid); - - register_client_rpcs(); - - return true; -} - -/** - * Register rpcs for the client and add the rpc id to rpc_data - * @param hg_class - */ -void register_client_rpcs() { - auto hg_class = RPC_DATA->client_hg_class(); - RPC_DATA->rpc_minimal_id(MERCURY_REGISTER(hg_class, "rpc_minimal", rpc_minimal_in_t, rpc_minimal_out_t, nullptr)); - RPC_DATA->rpc_srv_create_dentry_id( - MERCURY_REGISTER(hg_class, "rpc_srv_create_dentry", rpc_create_dentry_in_t, rpc_create_dentry_out_t, - nullptr)); - RPC_DATA->rpc_srv_remove_dentry_id( - MERCURY_REGISTER(hg_class, "rpc_srv_remove_dentry", rpc_remove_dentry_in_t, rpc_remove_dentry_out_t, - nullptr)); - RPC_DATA->rpc_srv_create_mdata_id( - MERCURY_REGISTER(hg_class, "rpc_srv_create_mdata", rpc_create_mdata_in_t, rpc_create_mdata_out_t, nullptr)); - RPC_DATA->rpc_srv_remove_mdata_id( - MERCURY_REGISTER(hg_class, "rpc_srv_remove_mdata", rpc_remove_mdata_in_t, rpc_remove_mdata_out_t, nullptr)); - RPC_DATA->rpc_srv_attr_id( - MERCURY_REGISTER(hg_class, "rpc_srv_attr", rpc_get_attr_in_t, rpc_get_attr_out_t, nullptr)); - RPC_DATA->rpc_srv_lookup_id( - MERCURY_REGISTER(hg_class, "rpc_srv_lookup", rpc_lookup_in_t, rpc_lookup_out_t, nullptr)); - RPC_DATA->rpc_srv_read_data_id( - MERCURY_REGISTER(hg_class, "rpc_srv_read_data", rpc_read_data_in_t, rpc_data_out_t, nullptr)); - RPC_DATA->rpc_srv_write_data_id( - MERCURY_REGISTER(hg_class, "rpc_srv_write_data", rpc_write_data_in_t, rpc_data_out_t, nullptr)); -} - -void destroy_rpc_client() { - HG_Context_destroy(RPC_DATA->client_hg_context()); - HG_Finalize(RPC_DATA->client_hg_class()); -} diff --git a/archive_old_fs_versions/lfs/src/rpc/rpc_util.hpp b/archive_old_fs_versions/lfs/src/rpc/rpc_util.hpp deleted file mode 100644 index 50a56042cda243f7946d8a02fb6c95bb58a6f0c8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/rpc_util.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by evie on 6/21/17. -// - -#ifndef LFS_RPC_UTIL_HPP -#define LFS_RPC_UTIL_HPP - -#include "../main.hpp" - -bool init_argobots(); - -void destroy_argobots(); - -bool init_rpc_server(); - -void register_server_rpcs(); - -void destroy_rpc_server(); - -bool init_rpc_client(); - -void register_client_rpcs(); - -void destroy_rpc_client(); - -#endif //LFS_RPC_UTIL_HPP diff --git a/archive_old_fs_versions/lfs/src/rpc/server/s_data.cpp b/archive_old_fs_versions/lfs/src/rpc/server/s_data.cpp deleted file mode 100644 index 7d35b8cd80ec9192ee0d36a43486b3a7e26ea9db..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/server/s_data.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// -// Created by evie on 7/13/17. -// -#include "../rpc_types.hpp" -#include "../rpc_defs.hpp" -#include "../../adafs_ops/io.hpp" - -using namespace std; - -static hg_return_t rpc_srv_read_data(hg_handle_t handle) { - rpc_read_data_in_t in; - rpc_data_out_t out; - void* b_buf; - int err; - hg_bulk_t bulk_handle; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got read RPC with inode {} size {} offset {}", in.inode, in.size, in.offset); - - auto hgi = HG_Get_info(handle); - auto mid = margo_hg_class_to_instance(hgi->hg_class); - - // set up buffer to read - auto buf = make_unique(in.size); - - // do read operation - auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); - chnk_path /= fmt::FormatInt(in.inode).c_str(); - chnk_path /= "data"s; - - err = read_file(buf.get(), out.io_size, chnk_path.c_str(), in.size, in.offset); - - if (err != 0) { - ADAFS_DATA->spdlogger()->error("Could not open file with inode: {}", in.inode); - out.res = err; - ADAFS_DATA->spdlogger()->debug("Sending output response {}", out.res); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to read request"); - } - } else { - // set up buffer for bulk transfer - b_buf = (void*) buf.get(); - - ret = HG_Bulk_create(hgi->hg_class, 1, &b_buf, &in.size, HG_BULK_READ_ONLY, &bulk_handle); - - // push data to client - if (ret == HG_SUCCESS) - margo_bulk_transfer(mid, HG_BULK_PUSH, hgi->addr, in.bulk_handle, 0, bulk_handle, 0, in.size); - else { - ADAFS_DATA->spdlogger()->error("Failed to send data to client in read operation"); - out.res = EIO; - out.io_size = 0; - } - ADAFS_DATA->spdlogger()->debug("Sending output response {}", out.res); - // respond rpc - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to read request"); - } - HG_Bulk_free(bulk_handle); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_read_data) - -static hg_return_t rpc_srv_write_data(hg_handle_t handle) { - rpc_write_data_in_t in; - rpc_data_out_t out; - void *b_buf; - hg_bulk_t bulk_handle; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got write RPC with inode {} size {} offset {}", in.inode, in.size, in.offset); - - auto hgi = HG_Get_info(handle); - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // register local buffer to fill for bulk pull - auto b_buf_wrap = make_unique(in.size); - b_buf = static_cast(b_buf_wrap.get()); - ret = HG_Bulk_create(hgi->hg_class, 1, &b_buf, &in.size, HG_BULK_WRITE_ONLY, &bulk_handle); - // push data to client - if (ret == HG_SUCCESS) { - // pull data from client here - margo_bulk_transfer(mid, HG_BULK_PULL, hgi->addr, in.bulk_handle, 0, bulk_handle, 0, in.size); - // do write operation - auto buf = static_cast(b_buf); - out.res = write_file(in.inode, buf, out.io_size, in.size, in.offset, (in.append == HG_TRUE)); - if (out.res != 0) { - ADAFS_DATA->spdlogger()->error("Failed to write data to local disk."); - out.io_size = 0; - } - HG_Bulk_free(bulk_handle); - } else { - ADAFS_DATA->spdlogger()->error("Failed to pull data from client in write operation"); - out.res = EIO; - out.io_size = 0; - } - ADAFS_DATA->spdlogger()->debug("Sending output response {}", out.res); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to write request"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_write_data) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/rpc/server/s_dentry.cpp b/archive_old_fs_versions/lfs/src/rpc/server/s_dentry.cpp deleted file mode 100644 index 3361067469f1d2c74ba8c32482d745b8a885e74d..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/server/s_dentry.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// -// Created by evie on 7/7/17. -// -#include "../rpc_types.hpp" -#include "../rpc_defs.hpp" -#include "../../adafs_ops/dentry_ops.hpp" - -using namespace std; - -static hg_return_t rpc_srv_lookup(hg_handle_t handle) { - rpc_lookup_in_t in; - rpc_lookup_out_t out; - fuse_ino_t inode; - int err; - const struct hg_info* hgi; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got lookup RPC with filename {}", in.filename); - - hgi = HG_Get_info(handle); - - auto mid = margo_hg_class_to_instance(hgi->hg_class); - tie(err, inode) = do_lookup(in.parent_inode, in.filename); - - if (err != 0) { - inode = INVALID_INODE; - } - - out.inode = static_cast(inode); - ADAFS_DATA->spdlogger()->debug("Sending output inode {}", out.inode); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to lookup"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_lookup) - -static hg_return_t rpc_srv_create_dentry(hg_handle_t handle) { - rpc_create_dentry_in_t in; - rpc_create_dentry_out_t out; - const struct hg_info* hgi; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got create dentry RPC with filename {}", in.filename); - - hgi = HG_Get_info(handle); - - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // create new inode number and then the dentry - auto new_inode = Util::generate_inode_no(); - if (create_dentry(in.parent_inode, new_inode, in.filename, in.mode) != 0) { - // if putting dentry failed, return invalid inode to indicate failure - new_inode = INVALID_INODE; - } - out.inode = new_inode; - ADAFS_DATA->spdlogger()->debug("Sending output {}", out.inode); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to create dentry rpc"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_create_dentry) - -static hg_return_t rpc_srv_remove_dentry(hg_handle_t handle) { - rpc_remove_dentry_in_t in; - rpc_remove_dentry_out_t out; - const struct hg_info* hgi; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got remove dentry RPC with filename {}", in.filename); - - hgi = HG_Get_info(handle); - - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // remove dentry - fuse_ino_t del_inode; - int err; - tie(err, del_inode) = remove_dentry(in.parent_inode, in.filename); - if (err != 0) - del_inode = INVALID_INODE; - out.del_inode = del_inode; - ADAFS_DATA->spdlogger()->debug("Sending output {}", out.del_inode); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to remove dentry rpc"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_remove_dentry) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/rpc/server/s_metadata.cpp b/archive_old_fs_versions/lfs/src/rpc/server/s_metadata.cpp deleted file mode 100644 index 3cc8c7870ed0ada41efb5652c5152983d306453a..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/rpc/server/s_metadata.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// -// Created by evie on 6/22/17. -// -#include "../rpc_types.hpp" -#include "../rpc_defs.hpp" -#include "../../adafs_ops/mdata_ops.hpp" -#include "../../adafs_ops/io.hpp" - -static hg_return_t rpc_minimal(hg_handle_t handle) { - rpc_minimal_in_t in; - rpc_minimal_out_t out; - const struct hg_info* hgi; - // Get input - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - - ADAFS_DATA->spdlogger()->debug("Got simple RPC with input {}", in.input); - // Get hg_info handle - hgi = HG_Get_info(handle); - // extract margo id from hg_info (needed to know where to send response) - auto mid = margo_hg_class_to_instance(hgi->hg_class); - - // Create output and send it - out.output = in.input * 2; - ADAFS_DATA->spdlogger()->debug("Sending output {}", out.output); - auto hret = margo_respond(mid, handle, &out); - assert(hret == HG_SUCCESS); - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} -DEFINE_MARGO_RPC_HANDLER(rpc_minimal) - - -static hg_return_t rpc_srv_create_mdata(hg_handle_t handle) { - rpc_create_mdata_in_t in; - rpc_create_mdata_out_t out; - - const struct hg_info* hgi; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got create mdata RPC with inode {}", in.inode); - - hgi = HG_Get_info(handle); - - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // create metadata - auto err = init_metadata(in.inode, in.uid, in.gid, in.mode); - if (err == 0) { - out.success = HG_TRUE; - init_chunk_space(static_cast(in.inode)); - - } - ADAFS_DATA->spdlogger()->debug("Sending output {}", out.success); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to create mdata rpc"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_create_mdata) - - -static hg_return_t rpc_srv_attr(hg_handle_t handle) { - rpc_get_attr_in_t in; - rpc_get_attr_out_t out; - const struct hg_info* hgi; - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got get attr RPC with inode {}", in.inode); - hgi = HG_Get_info(handle); - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // get the metadata - Metadata md{}; - get_metadata(md, in.inode); - out.atime = static_cast(md.atime()); - out.mtime = static_cast(md.mtime()); - out.ctime = static_cast(md.ctime()); - out.mode = static_cast(md.mode()); - out.uid = static_cast(md.uid()); - out.gid = static_cast(md.gid()); - out.nlink = static_cast(md.link_count()); - out.size = static_cast(md.size()); - out.blocks = static_cast(md.blocks()); - - ADAFS_DATA->spdlogger()->debug("Sending output mode {}", out.mode); - auto hret = margo_respond(mid, handle, &out); - assert(hret == HG_SUCCESS); - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_attr) - -static hg_return_t rpc_srv_remove_mdata(hg_handle_t handle) { - rpc_remove_mdata_in_t in; - rpc_remove_mdata_out_t out; - - const struct hg_info* hgi; - - auto ret = HG_Get_input(handle, &in); - assert(ret == HG_SUCCESS); - ADAFS_DATA->spdlogger()->debug("Got remove mdata RPC with inode {}", in.del_inode); - - hgi = HG_Get_info(handle); - - auto mid = margo_hg_class_to_instance(hgi->hg_class); - // delete metadata - auto err = remove_all_metadata(static_cast(in.del_inode)); - if (err == 0) { - out.success = HG_TRUE; - destroy_chunk_space(static_cast(in.del_inode)); - } else { - out.success = HG_FALSE; - } - ADAFS_DATA->spdlogger()->debug("Sending output {}", out.success); - auto hret = margo_respond(mid, handle, &out); - if (hret != HG_SUCCESS) { - ADAFS_DATA->spdlogger()->error("Failed to respond to remove mdata rpc"); - } - - // Destroy handle when finished - HG_Free_input(handle, &in); - HG_Free_output(handle, &out); - HG_Destroy(handle); - return HG_SUCCESS; -} - -DEFINE_MARGO_RPC_HANDLER(rpc_srv_remove_mdata) \ No newline at end of file diff --git a/archive_old_fs_versions/lfs/src/util.cpp b/archive_old_fs_versions/lfs/src/util.cpp deleted file mode 100644 index 64fd8328c26e5be2911e8ef28fef1ba00b0c402b..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/lfs/src/util.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -#include -#include -#include "main.hpp" - -using namespace std; - -namespace Util { - - int init_inode_no() { - auto n_hosts = ADAFS_DATA->hosts().size(); - // We are working locally. Start with inode 1 - if (n_hosts == 0) { - ADAFS_DATA->inode_count(1); - return 0; - } - // hostname was found in given hostlist TODO doublecheck calculation - auto inode_max_chunk = std::numeric_limits::max(); - auto first_inode = static_cast(((inode_max_chunk / n_hosts) * ADAFS_DATA->host_id()) + 1); - ADAFS_DATA->inode_count(first_inode); - return 0; - } - - fuse_ino_t generate_inode_no() { - std::lock_guard inode_lock(ADAFS_DATA->inode_mutex); - // TODO check that our inode counter is within boundaries of inode numbers in the given node - return ADAFS_DATA->raise_inode_count(1); - } - - // XXX error handling - int read_inode_cnt() { - auto i_path = bfs::path(ADAFS_DATA->mgmt_path() + "/inode_count"); - bfs::ifstream ifs{i_path}; - boost::archive::binary_iarchive ba(ifs); - fuse_ino_t inode_count; - ba >> inode_count; - ADAFS_DATA->inode_count(inode_count); - - return 0; - } - - // XXX error handling - int write_inode_cnt() { - auto i_path = bfs::path(ADAFS_DATA->mgmt_path() + "/inode_count"); - bfs::ofstream ofs{i_path}; - boost::archive::binary_oarchive ba(ofs); - auto inode = ADAFS_DATA->inode_count(); - ba << inode; - - return 0; - } - - /** - * Returns the machine's hostname - * @return - */ - string get_my_hostname() { - char hostname[1024]; - auto ret = gethostname(hostname, 1024); - return ret == 0 ? string(hostname) : ""s; - } - -} \ No newline at end of file diff --git a/archive_old_fs_versions/stackfs_lowlevel/.gitignore b/archive_old_fs_versions/stackfs_lowlevel/.gitignore deleted file mode 100644 index 0647a8677245e3d740d54d8b153644bfb3fde48e..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/stackfs_lowlevel/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ - - -# IDEA FILES # -##################### -.idea/ - -# BUILD # -######### - -build/ - -# DEBUG # -######### - -cmake-build-debug/ -cmake-build-release/ -playground/ diff --git a/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE.cmake b/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE.cmake deleted file mode 100644 index bd178e26a6e28d63df43a43181df9b6279e224d8..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Find the FUSE includes and library -# -# FUSE_INCLUDE_DIR - where to find fuse.h, etc. -# FUSE_LIBRARIES - List of libraries when using FUSE. -# FUSE_FOUND - True if FUSE lib is found. - -# check if already in cache, be silent -IF (FUSE_INCLUDE_DIR) - SET (FUSE_FIND_QUIETLY TRUE) -ENDIF (FUSE_INCLUDE_DIR) - -# find includes -FIND_PATH (FUSE_INCLUDE_DIR fuse.h - /usr/local/include/osxfuse - /usr/local/include - /usr/include - ) - -# find lib -if (APPLE) - SET(FUSE_NAMES libosxfuse.dylib fuse) -else (APPLE) - SET(FUSE_NAMES fuse) -endif (APPLE) -FIND_LIBRARY(FUSE_LIBRARIES - NAMES ${FUSE_NAMES} - PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu - ) - -include ("FindPackageHandleStandardArgs") -find_package_handle_standard_args ("FUSE" DEFAULT_MSG - FUSE_INCLUDE_DIR FUSE_LIBRARIES) - -mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES) \ No newline at end of file diff --git a/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE3.cmake b/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE3.cmake deleted file mode 100644 index ab2e822f143d3911d52aca98c793d6a5f4daf562..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/stackfs_lowlevel/CMake/FindFUSE3.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Try to find fuse (devel) -# Once done, this will define -# -# FUSE3_FOUND - system has fuse -# FUSE3_INCLUDE_DIRS - the fuse include directories -# FUSE3_LIBRARIES - fuse libraries directories - -if(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - set(FUSE3_FIND_QUIETLY TRUE) -endif(FUSE3_INCLUDE_DIRS AND FUSE3_LIBRARIES) - -find_path( FUSE3_INCLUDE_DIR fuse3/fuse_lowlevel.h - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES include ) - -find_library( FUSE3_LIBRARY fuse3 - HINTS - /usr - /usr/local - ${FUSE3_DIR} - PATH_SUFFIXES lib ) - -set(FUSE3_INCLUDE_DIRS ${FUSE3_INCLUDE_DIR}) -set(FUSE3_LIBRARIES ${FUSE3_LIBRARY}) - -# handle the QUIETLY and REQUIRED arguments and set FUSE3_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(fuse3 DEFAULT_MSG FUSE3_INCLUDE_DIR FUSE3_LIBRARY) - -mark_as_advanced(FUSE3_INCLUDE_DIR FUSE3_LIBRARY) \ No newline at end of file diff --git a/archive_old_fs_versions/stackfs_lowlevel/CMakeLists.txt b/archive_old_fs_versions/stackfs_lowlevel/CMakeLists.txt deleted file mode 100644 index 86684d20d40807276c4111f12a61279844cde1c6..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/stackfs_lowlevel/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(stackfs_lowlevel LANGUAGES C) - -set(CMAKE_C_STANDARD 99) -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -D_FILE_OFFSET_BITS=64") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64") -#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall --pedantic -g") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -g -pg") -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) - -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -find_package(FUSE REQUIRED) - -include_directories(${FUSE_INCLUDE_DIR}) -set(SOURCE_FILES main.c) -add_executable(stackfs_lowlevel ${SOURCE_FILES}) -target_link_libraries(stackfs_lowlevel ${FUSE_LIBRARIES} -lpthread) \ No newline at end of file diff --git a/archive_old_fs_versions/stackfs_lowlevel/main.c b/archive_old_fs_versions/stackfs_lowlevel/main.c deleted file mode 100644 index 02e0bdc72ba8ba900da97a13e5c0c309fcebd400..0000000000000000000000000000000000000000 --- a/archive_old_fs_versions/stackfs_lowlevel/main.c +++ /dev/null @@ -1,1483 +0,0 @@ -#define FUSE_USE_VERSION 30 -#define _XOPEN_SOURCE 500 -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* Definition of AT_* constants */ -#include -#include -#include -#include -#include -#include - -FILE *logfile; -#define TESTING_XATTR 0 -#define USE_SPLICE 0 - -#define TRACE_FILE "/trace_stackfs.log" -#define TRACE_FILE_LEN 18 -pthread_spinlock_t spinlock; /* Protecting the above spin lock */ -char banner[4096]; - -void print_usage(void) -{ - printf("USAGE : ./StackFS_ll -r |-rootdir= "); - printf("[--attrval=] [--statsdir=] "); - printf(" [FUSE options]\n"); /* For checkPatch.pl */ - printf(" : Root Directory containg the Low Level F/S\n"); - printf(" : Time in secs to let kernel know how muh time "); - printf("the attributes are valid\n"); /* For checkPatch.pl */ - printf(" : Path for copying any statistics details\n"); - printf(" : Mount Directory on to which the F/S should be "); - printf("mounted\n"); /* For checkPatch.pl */ - printf("Example : ./StackFS_ll -r rootDir/ mountDir/\n"); -} - -int log_open(char *statsDir) -{ - char *trace_path = NULL; - - if (statsDir) { - trace_path = (char *)malloc(strlen(statsDir) + - TRACE_FILE_LEN + 1); - memset(trace_path, 0, strlen(statsDir) + TRACE_FILE_LEN + 1); - strncpy(trace_path, statsDir, strlen(statsDir)); - strncat(trace_path, TRACE_FILE, TRACE_FILE_LEN); - } else { - trace_path = (char *)malloc(TRACE_FILE_LEN); - memset(trace_path, 0, TRACE_FILE_LEN); - strncpy(trace_path, TRACE_FILE + 1, TRACE_FILE_LEN-1); - } - printf("Trace file location : %s\n", trace_path); - logfile = fopen(trace_path, "w"); - if (logfile == NULL) { - perror("logfile"); - free(trace_path); - return -1; - } - free(trace_path); - setvbuf(logfile, NULL, _IOLBF, 0); - return 0; -} - -void log_close(void) -{ - - if (logfile) - fclose(logfile); -} - - -int64_t print_timer(void) -{ - struct timespec tms; - - if (clock_gettime(CLOCK_REALTIME, &tms)) { - printf("ERROR\n"); - return 0; - } - int64_t micros = tms.tv_sec * 1000000; - - micros += tms.tv_nsec/1000; - if (tms.tv_nsec % 1000 >= 500) - ++micros; - return micros; -} - -/* called with file lock */ -int print_banner(void) -{ - int len; - int64_t time; - int pid; - unsigned long tid; - - banner[0] = '\0'; - time = print_timer(); - pid = getpid(); - tid = syscall(SYS_gettid); - if (time == 0) - return -1; - len = sprintf(banner, "Time : %"PRId64" Pid : %d Tid : %lu ", - time, pid, tid); - (void) len; - fputs(banner, logfile); - return 0; -} - -void StackFS_trace(const char *format, ...) -{ - va_list ap; - int ret = 0; - - /*lock*/ - pthread_spin_lock(&spinlock); - if (logfile) { - /*Banner : time + pid + tid*/ - ret = print_banner(); - if (ret) - goto trace_out; - /*Done with banner*/ - va_start(ap, format); - vfprintf(logfile, format, ap); - /*Done with trace*/ - fprintf(logfile, "\n"); - } - trace_out: - /*unlock*/ - pthread_spin_unlock(&spinlock); -} - -/*=============Hash Table implementation==========================*/ - -/* The node structure that we maintain as our local cache which maps - * the ino numbers to their full path, this address is stored as part - * of the value of the hash table */ -struct lo_inode { - struct lo_inode *next; - struct lo_inode *prev; -/* Full path of the underlying ext4 path - * correspoding to its ino (easy way to extract back) */ - char *name; -/* Inode numbers and dev no's of - * underlying EXT4 F/s for the above path */ - ino_t ino; - dev_t dev; -/* inode number sent to lower F/S */ - ino_t lo_ino; -/* Lookup count of this node */ - uint64_t nlookup; -}; - -#define HASH_TABLE_MIN_SIZE 8192 - -/* The structure is used for maintaining the hash table - * 1. array --> Buckets to store the key and values - * 2. use --> Current size of the hash table - * 3. size --> Max size of the hash table - * (we start with NODE_TABLE_MIN_SIZE) - * 4. split --> used to resize the table - * (this is how fuse-lib does) */ -struct node_table { - struct lo_inode **array; - size_t use; - size_t size; - size_t split; -}; - -static int hash_table_init(struct node_table *t) -{ - t->size = HASH_TABLE_MIN_SIZE; - t->array = (struct lo_inode **) calloc(1, - sizeof(struct lo_inode *) * t->size); - if (t->array == NULL) { - fprintf(stderr, "fuse: memory allocation failed\n"); - return -1; - } - t->use = 0; - t->split = 0; - - return 0; -} - -void hash_table_destroy(struct node_table *t) -{ - free(t->array); -} - -static int hash_table_resize(struct node_table *t) -{ - size_t newsize = t->size * 2; - void *newarray = NULL; - - newarray = realloc(t->array, sizeof(struct lo_inode *) * newsize); - if (newarray == NULL) { - fprintf(stderr, "fuse: memory allocation failed\n"); - return -1; - } - - t->array = newarray; - /* zero the newly allocated space */ - memset(t->array + t->size, 0, t->size * sizeof(struct lo_inode *)); - t->size = newsize; - t->split = 0; - - return 0; -} - -/* The structure which is used to store the hash table - * and it is always comes as part of the req structure */ -struct lo_data { -/* hash table mapping key (inode no + complete path) --> - * value (linked list of node's - open chaining) */ - struct node_table hash_table; - /* protecting the above hash table */ - pthread_spinlock_t spinlock; -/* put the root Inode '/' here itself for faster - * access and some other useful raesons */ - struct lo_inode root; - /* do we still need this ? let's see*/ - double attr_valid; -}; - -struct lo_dirptr { - DIR *dp; - struct dirent *entry; - off_t offset; -}; - -static struct lo_dirptr *lo_dirptr(struct fuse_file_info *fi) -{ - return ((struct lo_dirptr *) ((uintptr_t) fi->fh)); -} - - -static struct lo_data *get_lo_data(fuse_req_t req) -{ - return (struct lo_data *) fuse_req_userdata(req); -} - -static struct lo_inode *lo_inode(fuse_req_t req, fuse_ino_t ino) -{ - if (ino == FUSE_ROOT_ID) - return &get_lo_data(req)->root; - else - return (struct lo_inode *) (uintptr_t) ino; -} - -static char *lo_name(fuse_req_t req, fuse_ino_t ino) -{ - return lo_inode(req, ino)->name; -} - -/* This is what given to the kernel FUSE F/S */ -static ino_t get_lower_fuse_inode_no(fuse_req_t req, fuse_ino_t ino) { - return lo_inode(req, ino)->lo_ino; -} - -/* This is what given to the user FUSE F/S */ -//static ino_t get_higher_fuse_inode_no(fuse_req_t req, fuse_ino_t ino) { -// return lo_inode(req, ino)->ino; -//} - - -static double lo_attr_valid_time(fuse_req_t req) -{ - return ((struct lo_data *) fuse_req_userdata(req))->attr_valid; -} - -static void construct_full_path(fuse_req_t req, fuse_ino_t ino, - char *fpath, const char *path) -{ - strcpy(fpath, lo_name(req, ino)); - strncat(fpath, "/", 1); - strncat(fpath, path, PATH_MAX); -} - -/*======================End=======================================*/ - -/* Function which generates the hash depending on the ino number - * and full path */ -static size_t name_hash(struct lo_data *lo_data, fuse_ino_t ino, - const char *fullpath) -{ - uint64_t hash = ino; - uint64_t oldhash; - const char *name; - - name = fullpath; - - for (; *name; name++) - hash = hash * 31 + (unsigned char) *name; - - hash %= lo_data->hash_table.size; - oldhash = hash % (lo_data->hash_table.size / 2); - if (oldhash >= lo_data->hash_table.split) - return oldhash; - else - return hash; -} - -static void remap_hash_table(struct lo_data *lo_data) -{ - struct node_table *t = &lo_data->hash_table; - struct lo_inode **nodep; - struct lo_inode **next; - struct lo_inode *prev; - size_t hash; - - if (t->split == t->size / 2) - return; - -/* split this bucket by recalculating the hash */ - hash = t->split; - t->split++; - - for (nodep = &t->array[hash]; *nodep != NULL; nodep = next) { - struct lo_inode *node = *nodep; - size_t newhash = name_hash(lo_data, node->ino, node->name); - - if (newhash != hash) { - prev = node->prev; - *nodep = node->next; - if (*nodep) - (*nodep)->prev = prev; - - node->prev = NULL; - node->next = t->array[newhash]; - if (t->array[newhash]) - (t->array[newhash])->prev = node; - t->array[newhash] = node; - next = nodep; - } else { - next = &node->next; - } - } - -/* If we have reached the splitting to half of the size - * then double the size of hash table */ - if (t->split == t->size / 2) - hash_table_resize(t); -} - -static int insert_to_hash_table(struct lo_data *lo_data, - struct lo_inode *lo_inode) -{ - size_t hash = name_hash(lo_data, lo_inode->ino, lo_inode->name); - - lo_inode->next = lo_data->hash_table.array[hash]; - if (lo_data->hash_table.array[hash]) - (lo_data->hash_table.array[hash])->prev = lo_inode; - lo_data->hash_table.array[hash] = lo_inode; - lo_data->hash_table.use++; - - if (lo_data->hash_table.use >= lo_data->hash_table.size / 2) - remap_hash_table(lo_data); - - return 0; -} - -static void hash_table_reduce(struct node_table *t) -{ - size_t newsize = t->size / 2; - void *newarray; - - if (newsize < HASH_TABLE_MIN_SIZE) - return; - - newarray = realloc(t->array, sizeof(struct node *) * newsize); - if (newarray != NULL) - t->array = newarray; - - t->size = newsize; - t->split = t->size / 2; -} - -static void remerge_hash_table(struct lo_data *lo_data) -{ - struct node_table *t = &lo_data->hash_table; - int iter; - -/* This means all the hashes would be under the half size - * of table (so simply make it half) */ - if (t->split == 0) - hash_table_reduce(t); - - for (iter = 8; t->split > 0 && iter; iter--) { - struct lo_inode **upper; - - t->split--; - upper = &t->array[t->split + t->size / 2]; - if (*upper) { - struct lo_inode **nodep; - struct lo_inode *prev = NULL; - - for (nodep = &t->array[t->split]; - *nodep; nodep = &(*nodep)->next) - prev = *nodep; - - *nodep = *upper; - (*upper)->prev = prev; - *upper = NULL; - break; - } - } -} - -static int delete_from_hash_table(struct lo_data *lo_data, - struct lo_inode *lo_inode) -{ - struct lo_inode *prev, *next; - - prev = next = NULL; - size_t hash = 0; - - pthread_spin_lock(&lo_data->spinlock); - - prev = lo_inode->prev; - next = lo_inode->next; - - if (prev) { - prev->next = next; - if (next) - next->prev = prev; - goto del_out; - } else { - hash = name_hash(lo_data, lo_inode->ino, lo_inode->name); - - if (next) - next->prev = NULL; - - lo_data->hash_table.array[hash] = next; - } - - del_out: - /* free the lo_inode */ - lo_inode->prev = lo_inode->next = NULL; - free(lo_inode->name); - free(lo_inode); - - lo_data->hash_table.use--; - if (lo_data->hash_table.use < lo_data->hash_table.size / 4) - remerge_hash_table(lo_data); - - pthread_spin_unlock(&lo_data->spinlock); - return 0; -} - -/* Function which checks the inode in the hash table - * by calculating the hash from ino and full path */ -static struct lo_inode *lookup_lo_inode(struct lo_data *lo_data, - struct stat *st, const char *fullpath) -{ - size_t hash = name_hash(lo_data, st->st_ino, fullpath); - struct lo_inode *node; - - for (node = lo_data->hash_table.array[hash]; node != NULL; - node = node->next) { - if ((node->ino == st->st_ino) && (node->dev == st->st_dev) && - (strcmp(node->name, fullpath) == 0)) - return node; - } - - return NULL; -} - -void free_hash_table(struct lo_data *lo_data) -{ - struct lo_inode *node, *next; - int i; - - for (i = 0; i < lo_data->hash_table.size; i++) { - node = lo_data->hash_table.array[i]; - while (node) { - next = node->next; - /* free up the node */ - free(node->name); - free(node); - node = next; - } - } -} - -/* A function which checks the hash table and returns the lo_inode - * otherwise a new lo_inode is created and inserted into the hashtable - * req --> for the hash_table reference - * st --> to check against the ino and dev_id - * when navigating the bucket chain - * fullpath --> full path is used to construct the key */ -struct lo_inode *find_lo_inode(fuse_req_t req, struct stat *st, char *fullpath) -{ - struct lo_data *lo_data; - struct lo_inode *lo_inode; - int res; - - lo_data = get_lo_data(req); - - pthread_spin_lock(&lo_data->spinlock); - - lo_inode = lookup_lo_inode(lo_data, st, fullpath); - - if (lo_inode == NULL) { - /* create the node and insert into hash_table */ - lo_inode = calloc(1, sizeof(struct lo_inode)); - if (!lo_inode) - goto find_out; - lo_inode->ino = st->st_ino; - lo_inode->dev = st->st_dev; - lo_inode->name = strdup(fullpath); - /* store this for mapping (debugging) */ - lo_inode->lo_ino = (uintptr_t) lo_inode; - lo_inode->next = lo_inode->prev = NULL; - - /* insert into hash table */ - res = insert_to_hash_table(lo_data, lo_inode); - if (res == -1) { - free(lo_inode->name); - free(lo_inode); - lo_inode = NULL; - goto find_out; - } - } - lo_inode->nlookup++; - find_out: - pthread_spin_unlock(&lo_data->spinlock); - return lo_inode; -} - -static void stackfs_ll_lookup(fuse_req_t req, fuse_ino_t parent, - const char *name) -{ - struct fuse_entry_param e; - int res; - char *fullPath = NULL; - double attr_val; - -// StackFS_trace("Lookup called on name : %s, parent ino : %llu", -// name, parent); - fullPath = (char *)malloc(PATH_MAX); - construct_full_path(req, parent, fullPath, name); - - attr_val = lo_attr_valid_time(req); - memset(&e, 0, sizeof(e)); - - e.attr_timeout = attr_val; - e.entry_timeout = 1.0; /* dentry timeout */ - - //generate_start_time(req); - res = stat(fullPath, &e.attr); - //generate_end_time(req); - //populate_time(req); - - if (res == 0) { - struct lo_inode *inode; - - inode = find_lo_inode(req, &e.attr, fullPath); - - if (fullPath) - free(fullPath); - - if (!inode) - fuse_reply_err(req, ENOMEM); - else { - /* store this address for faster path conversations */ - e.ino = inode->lo_ino; - fuse_reply_entry(req, &e); - } - } else { - if (fullPath) - free(fullPath); - fuse_reply_err(req, ENOENT); - } -} - -static void stackfs_ll_getattr(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - int res; - struct stat buf; - (void) fi; - double attr_val; - - //StackFS_trace("Getattr called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - attr_val = lo_attr_valid_time(req); - //generate_start_time(req); - res = stat(lo_name(req, ino), &buf); - //generate_end_time(req); - //populate_time(req); - if (res == -1) - return (void) fuse_reply_err(req, errno); - - fuse_reply_attr(req, &buf, attr_val); -} - -static void stackfs_ll_setattr(fuse_req_t req, fuse_ino_t ino, - struct stat *attr, int to_set, struct fuse_file_info *fi) -{ - int res; - (void) fi; - struct stat buf; - double attr_val; - - //StackFS_trace("Setattr called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - attr_val = lo_attr_valid_time(req); - //generate_start_time(req); - if (to_set & FUSE_SET_ATTR_SIZE) { - /*Truncate*/ - res = truncate(lo_name(req, ino), attr->st_size); - if (res != 0) { - //generate_end_time(req); - //populate_time(req); - return (void) fuse_reply_err(req, errno); - } - } - - if (to_set & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) { - /* Update Time */ - struct utimbuf tv; - - tv.actime = attr->st_atime; - tv.modtime = attr->st_mtime; - res = utime(lo_name(req, ino), &tv); - if (res != 0) { - //generate_end_time(req); - //populate_time(req); - return (void) fuse_reply_err(req, errno); - } - } - - memset(&buf, 0, sizeof(buf)); - res = stat(lo_name(req, ino), &buf); - //generate_end_time(req); - //populate_time(req); - if (res != 0) - return (void) fuse_reply_err(req, errno); - - fuse_reply_attr(req, &buf, attr_val); -} - -static void stackfs_ll_create(fuse_req_t req, fuse_ino_t parent, - const char *name, mode_t mode, struct fuse_file_info *fi) -{ - int fd, res; - struct fuse_entry_param e; - char *fullPath = NULL; - double attr_val; - - //StackFS_trace("Create called on %s and parent ino : %llu", - // name, lo_inode(req, parent)->ino); - - fullPath = (char *)malloc(PATH_MAX); - construct_full_path(req, parent, fullPath, name); - attr_val = lo_attr_valid_time(req); - - //generate_start_time(req); - - fd = creat(fullPath, mode); - - if (fd == -1) { - if (fullPath) - free(fullPath); - //generate_end_time(req); - //populate_time(req); - return (void)fuse_reply_err(req, errno); - } - - memset(&e, 0, sizeof(e)); - - e.attr_timeout = attr_val; - e.entry_timeout = 1.0; - - res = stat(fullPath, &e.attr); - //generate_end_time(req); - //populate_time(req); - - if (res == 0) { - /* insert lo_inode into the hash table */ - struct lo_data *lo_data; - struct lo_inode *lo_inode; - - lo_inode = calloc(1, sizeof(struct lo_inode)); - if (!lo_inode) { - if (fullPath) - free(fullPath); - - return (void) fuse_reply_err(req, errno); - } - - lo_inode->ino = e.attr.st_ino; - lo_inode->dev = e.attr.st_dev; - lo_inode->name = strdup(fullPath); - /* store this for mapping (debugging) */ - lo_inode->lo_ino = (uintptr_t) lo_inode; - lo_inode->next = lo_inode->prev = NULL; - free(fullPath); - - lo_data = get_lo_data(req); - pthread_spin_lock(&lo_data->spinlock); - - res = insert_to_hash_table(lo_data, lo_inode); - - pthread_spin_unlock(&lo_data->spinlock); - - if (res == -1) { - free(lo_inode->name); - free(lo_inode); - fuse_reply_err(req, EBUSY); - } else { - lo_inode->nlookup++; - e.ino = lo_inode->lo_ino; - //StackFS_trace("Create called, e.ino : %llu", e.ino); - fi->fh = fd; - fuse_reply_create(req, &e, fi); - } - } else { - if (fullPath) - free(fullPath); - fuse_reply_err(req, errno); - } -} - -static void stackfs_ll_mkdir(fuse_req_t req, fuse_ino_t parent, - const char *name, mode_t mode) -{ - int res; - struct fuse_entry_param e; - char *fullPath = NULL; - double attr_val; - - //StackFS_trace("Mkdir called with name : %s, parent ino : %llu", - // name, lo_inode(req, parent)->ino); - - fullPath = (char *)malloc(PATH_MAX); - construct_full_path(req, parent, fullPath, name); - attr_val = lo_attr_valid_time(req); - - //generate_start_time(req); - res = mkdir(fullPath, mode); - - if (res == -1) { - /* Error occurred while creating the directory */ - if (fullPath) - free(fullPath); - - //generate_end_time(req); - //populate_time(req); - - return (void)fuse_reply_err(req, errno); - } - - /* Assign the stats of the newly created directory */ - memset(&e, 0, sizeof(e)); - e.attr_timeout = attr_val; - e.entry_timeout = 1.0; /* may be attr_val */ - res = stat(fullPath, &e.attr); - //generate_end_time(req); - //populate_time(req); - - if (res == 0) { - /* insert lo_inode into the hash table */ - struct lo_data *lo_data; - struct lo_inode *lo_inode; - - lo_inode = calloc(1, sizeof(struct lo_inode)); - if (!lo_inode) { - if (fullPath) - free(fullPath); - - return (void) fuse_reply_err(req, errno); - } - - lo_inode->ino = e.attr.st_ino; - lo_inode->dev = e.attr.st_dev; - lo_inode->name = strdup(fullPath); - /* store this for mapping (debugging) */ - lo_inode->lo_ino = (uintptr_t) lo_inode; - lo_inode->next = lo_inode->prev = NULL; - free(fullPath); - - lo_data = get_lo_data(req); - - pthread_spin_lock(&lo_data->spinlock); - - res = insert_to_hash_table(lo_data, lo_inode); - - pthread_spin_unlock(&lo_data->spinlock); - - if (res == -1) { - free(lo_inode->name); - free(lo_inode); - fuse_reply_err(req, EBUSY); - } else { - lo_inode->nlookup++; - e.ino = lo_inode->lo_ino; - fuse_reply_entry(req, &e); - } - } else { - if (fullPath) - free(fullPath); - fuse_reply_err(req, errno); - } -} - -static void stackfs_ll_open(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - int fd; - - //generate_start_time(req); - fd = open(lo_name(req, ino), fi->flags); - //generate_end_time(req); - //populate_time(req); - - //StackFS_trace("Open called on name : %s and fuse inode : %llu kernel inode : %llu fd : %d", - // lo_name(req, ino), get_higher_fuse_inode_no(req, ino), get_lower_fuse_inode_no(req, ino), fd); - //StackFS_trace("Open name : %s and inode : %llu", lo_name(req, ino), get_lower_fuse_inode_no(req, ino)); - - if (fd == -1) - return (void) fuse_reply_err(req, errno); - - fi->fh = fd; - - fuse_reply_open(req, fi); -} - -static void stackfs_ll_opendir(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - DIR *dp; - struct lo_dirptr *d; - - //StackFS_trace("Opendir called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - - //generate_start_time(req); - dp = opendir(lo_name(req, ino)); - //generate_end_time(req); - //populate_time(req); - - if (dp == NULL) - return (void) fuse_reply_err(req, errno); - - d = malloc(sizeof(struct lo_dirptr)); - d->dp = dp; - d->offset = 0; - d->entry = NULL; - - fi->fh = (uintptr_t) d; - - fuse_reply_open(req, fi); -} - -static void stackfs_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t offset, struct fuse_file_info *fi) -{ - int res; - (void) ino; - //struct timespec start, end; - //long time; - //long time_sec; - - StackFS_trace("StackFS Read start on inode : %llu", get_lower_fuse_inode_no(req, ino)); - if (USE_SPLICE) { - struct fuse_bufvec buf = FUSE_BUFVEC_INIT(size); - - //StackFS_trace("Splice Read name : %s, off : %lu, size : %zu", - // lo_name(req, ino), offset, size); - - //generate_start_time(req); - buf.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK; - buf.buf[0].fd = fi->fh; - buf.buf[0].pos = offset; - //generate_end_time(req); - //populate_time(req); - fuse_reply_data(req, &buf, FUSE_BUF_SPLICE_MOVE); - } else { - char *buf; - - //StackFS_trace("Read on name : %s, Kernel inode : %llu, fuse inode : %llu, off : %lu, size : %zu", - // lo_name(req, ino), get_lower_fuse_inode_no(req, ino), get_higher_fuse_inode_no(req, ino), offset, size); - buf = (char *)malloc(size); - //generate_start_time(req); - //clock_gettime(CLOCK_MONOTONIC, &start); - res = pread(fi->fh, buf, size, offset); - //clock_gettime(CLOCK_MONOTONIC, &end); - //generate_end_time(req); - //populate_time(req); - //time_sec = end.tv_sec - start.tv_sec; - //time = end.tv_nsec - start.tv_nsec; - //time_sec *= 1000000000; - //time += time_sec; - //StackFS_trace("Read inode : %llu off : %lu size : %zu diff : %llu", get_lower_fuse_inode_no(req, ino), offset, size, time); - if (res == -1) - return (void) fuse_reply_err(req, errno); - res = fuse_reply_buf(req, buf, res); - free(buf); - } - StackFS_trace("StackFS Read end on inode : %llu", get_lower_fuse_inode_no(req, ino)); -} - -static void stackfs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, - off_t off, struct fuse_file_info *fi) -{ - struct lo_dirptr *d; - char *buf = NULL; - char *p = NULL; - size_t rem; - int err; - (void) ino; - - //StackFS_trace("Readdir called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - d = lo_dirptr(fi); - buf = malloc(size*sizeof(char)); - if (!buf) - return (void) fuse_reply_err(req, ENOMEM); - - //generate_start_time(req); - /* If offset is not same, need to seek it */ - if (off != d->offset) { - seekdir(d->dp, off); - d->entry = NULL; - d->offset = off; - } - p = buf; - rem = size; - while (1) { - size_t entsize; - off_t nextoff; - - if (!d->entry) { - errno = 0; - d->entry = readdir(d->dp); - if (!d->entry) { - if (errno && rem == size) { - err = errno; - goto error; - } - break; - } - } - nextoff = telldir(d->dp); - - struct stat st = { - .st_ino = d->entry->d_ino, - .st_mode = d->entry->d_type << 12, - }; - entsize = fuse_add_direntry(req, p, rem, - d->entry->d_name, &st, nextoff); - /* The above function returns the size of the entry size even though - * the copy failed due to smaller buf size, so I'm checking after this - * function and breaking out incase we exceed the size. - */ - if (entsize > rem) - break; - - p += entsize; - rem -= entsize; - - d->entry = NULL; - d->offset = nextoff; - } - - //generate_end_time(req); - //populate_time(req); - fuse_reply_buf(req, buf, size - rem); - free(buf); - - return; - - error: - //generate_end_time(req); - //populate_time(req); - free(buf); - - fuse_reply_err(req, err); -} - -static void stackfs_ll_release(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - (void) ino; - - //StackFS_trace("Release called on name : %s and inode : %llu fd : %d ", - // lo_name(req, ino), lo_inode(req, ino)->ino, fi->fh); - //generate_start_time(req); - close(fi->fh); - //generate_end_time(req); - //populate_time(req); - - fuse_reply_err(req, 0); -} - -static void stackfs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - struct lo_dirptr *d; - (void) ino; - - //StackFS_trace("Releasedir called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - d = lo_dirptr(fi); - //generate_start_time(req); - closedir(d->dp); - //generate_end_time(req); - //populate_time(req); - free(d); - fuse_reply_err(req, 0); -} - -static void stackfs_ll_write(fuse_req_t req, fuse_ino_t ino, const char *buf, - size_t size, off_t off, struct fuse_file_info *fi) -{ - int res; - (void) ino; - - //StackFS_trace("Write name : %s, inode : %llu, off : %lu, size : %zu", - // lo_name(req, ino), lo_inode(req, ino)->ino, off, size); - //generate_start_time(req); - res = pwrite(fi->fh, buf, size, off); - //generate_end_time(req); - //populate_time(req); - - if (res == -1) - return (void) fuse_reply_err(req, errno); - - fuse_reply_write(req, res); -} - -#if USE_SPLICE -static void stackfs_ll_write_buf(fuse_req_t req, fuse_ino_t ino, - struct fuse_bufvec *buf, off_t off, struct fuse_file_info *fi) -{ - int res; - (void) ino; - - struct fuse_bufvec dst = FUSE_BUFVEC_INIT(fuse_buf_size(buf)); - - //StackFS_trace("Splice Write_buf on name : %s, off : %lu, size : %zu", - // lo_name(req, ino), off, buf->buf[0].size); - - //generate_start_time(req); - dst.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK; - dst.buf[0].fd = fi->fh; - dst.buf[0].pos = off; - res = fuse_buf_copy(&dst, buf, FUSE_BUF_SPLICE_NONBLOCK); - //generate_end_time(req); - //populate_time(req); - if (res >= 0) - fuse_reply_write(req, res); - else - fuse_reply_err(req, res); -} -#endif - -static void stackfs_ll_unlink(fuse_req_t req, fuse_ino_t parent, - const char *name) -{ - int res; - char *fullPath = NULL; - - //StackFS_trace("Unlink called on name : %s, parent inode : %llu", - // name, lo_inode(req, parent)->ino); - fullPath = (char *)malloc(PATH_MAX); - construct_full_path(req, parent, fullPath, name); - //generate_start_time(req); - res = unlink(fullPath); - //generate_end_time(req); - //populate_time(req); - if (res == -1) - fuse_reply_err(req, errno); - else - fuse_reply_err(req, res); - - if (fullPath) - free(fullPath); -} - -static void stackfs_ll_rmdir(fuse_req_t req, fuse_ino_t parent, - const char *name) -{ - int res; - char *fullPath = NULL; - - //StackFS_trace("rmdir called with name : %s, parent inode : %llu", - // name, lo_inode(req, parent)->ino); - fullPath = (char *)malloc(PATH_MAX); - construct_full_path(req, parent, fullPath, name); - //generate_start_time(req); - res = rmdir(fullPath); - //generate_end_time(req); - //populate_time(req); - - if (res == -1) - fuse_reply_err(req, errno); - else - fuse_reply_err(req, res); - - if (fullPath) - free(fullPath); -} - -static void forget_inode(fuse_req_t req, struct lo_inode *inode, - uint64_t nlookup) -{ - int res; - - assert(inode->nlookup >= nlookup); - inode->nlookup -= nlookup; - - if (!inode->nlookup) - res = delete_from_hash_table(get_lo_data(req), inode); - - (void) res; -} - -static void stackfs_ll_forget(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup) -{ - struct lo_inode *inode = lo_inode(req, ino); - - //generate_start_time(req); - //StackFS_trace("Forget name : %s, inode : %llu and lookup count : %llu", - // inode->name, inode->ino, nlookup); - forget_inode(req, inode, nlookup); - //generate_end_time(req); - //populate_time(req); - - fuse_reply_none(req); -} - -static void stackfs_ll_forget_multi(fuse_req_t req, size_t count, - struct fuse_forget_data *forgets) -{ - size_t i; - struct lo_inode *inode; - fuse_ino_t ino; - uint64_t nlookup; - - //generate_start_time(req); - //StackFS_trace("Batch Forget count : %zu", count); - for (i = 0; i < count; i++) { - ino = forgets[i].ino; - nlookup = forgets[i].nlookup; - inode = lo_inode(req, ino); - - //StackFS_trace("Forget %zu name : %s, lookup count : %llu", - // i, inode->name, nlookup); - forget_inode(req, inode, nlookup); - } - //generate_end_time(req); - //populate_time(req); - - fuse_reply_none(req); -} - -static void stackfs_ll_flush(fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi) -{ - int err; - - //StackFS_trace("Flush called on name : %s and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - //generate_start_time(req); - err = 0; - //generate_end_time(req); - //populate_time(req); - fuse_reply_err(req, err); -} - -static void stackfs_ll_statfs(fuse_req_t req, fuse_ino_t ino) -{ - int res; - struct statvfs buf; - - if (ino) { - //StackFS_trace("Statfs called with name : %s, and inode : %llu", - // lo_name(req, ino), lo_inode(req, ino)->ino); - memset(&buf, 0, sizeof(buf)); - //generate_start_time(req); - res = statvfs(lo_name(req, ino), &buf); - //generate_end_time(req); - //populate_time(req); - } - - if (!res) - fuse_reply_statfs(req, &buf); - else - fuse_reply_err(req, res); -} - -static void stackfs_ll_fsync(fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info *fi) -{ - int res; - - //StackFS_trace("Fsync on name : %s, inode : %llu, datasync : %d", - // lo_name(req, ino), lo_inode(req, ino)->ino, datasync); - //generate_start_time(req); - if (datasync) - res = fdatasync(fi->fh); - else - res = fsync(fi->fh); - //generate_end_time(req); - //populate_time(req); - - fuse_reply_err(req, res); -} - -#if TESTING_XATTR -static void stackfs_ll_getxattr(fuse_req_t req, fuse_ino_t ino, - const char *name, size_t size) -{ - int res; - - //StackFS_trace("Function Trace : Getxattr"); - if (size) { - char *value = (char *) malloc(size); - - //generate_start_time(req); - res = lgetxattr(lo_name(req, ino), name, value, size); - //generate_end_time(req); - //populate_time(req); - if (res > 0) - fuse_reply_buf(req, value, res); - else - fuse_reply_err(req, errno); - - free(value); - } else { - //generate_start_time(req); - res = lgetxattr(lo_name(req, ino), name, NULL, 0); - //generate_end_time(req); - //populate_time(req); - if (res >= 0) - fuse_reply_xattr(req, res); - else - fuse_reply_err(req, errno); - } -} -#endif - -static struct fuse_lowlevel_ops hello_ll_oper = { - .lookup = stackfs_ll_lookup, - .getattr = stackfs_ll_getattr, - .statfs = stackfs_ll_statfs, - .setattr = stackfs_ll_setattr, - .flush = stackfs_ll_flush, - .fsync = stackfs_ll_fsync, -#if TESTING_XATTR - .getxattr = stackfs_ll_getxattr, -#endif - .forget = stackfs_ll_forget, - .forget_multi = stackfs_ll_forget_multi, - .create = stackfs_ll_create, - .open = stackfs_ll_open, - .read = stackfs_ll_read, - .write = stackfs_ll_write, -#if USE_SPLICE - .write_buf = stackfs_ll_write_buf, -#endif - .release = stackfs_ll_release, - .unlink = stackfs_ll_unlink, - .mkdir = stackfs_ll_mkdir, - .rmdir = stackfs_ll_rmdir, - .opendir = stackfs_ll_opendir, - .readdir = stackfs_ll_readdir, - .releasedir = stackfs_ll_releasedir -}; - -struct stackFS_info { - char *rootDir; - char *statsDir;/* Path to copy any statistics details */ - double attr_valid;/* Time in secs for attribute validation */ - int is_help; - int tracing; -}; - -#define STACKFS_OPT(t, p) { t, offsetof(struct stackFS_info, p), 1 } - -static const struct fuse_opt stackfs_opts[] = { - STACKFS_OPT("-r %s", rootDir), - STACKFS_OPT("--rootdir=%s", rootDir), - STACKFS_OPT("--statsdir=%s", statsDir), - STACKFS_OPT("--attrval=%lf", attr_valid), - FUSE_OPT_KEY("--tracing", 1), - FUSE_OPT_KEY("-h", 0), - FUSE_OPT_KEY("--help", 0), - FUSE_OPT_END -}; - -static int stackfs_process_arg(void *data, const char *arg, - int key, struct fuse_args *outargs) -{ - struct stackFS_info *s_info = data; - - (void)outargs; - (void)arg; - - switch (key) { - case 0: - s_info->is_help = 1; - return 0; - case 1: - s_info->tracing = 1; - return 0; - default: - return 1; - } -} - -int main(int argc, char **argv) -{ - int res = 0, err = 0; - char *rootDir = NULL; - char *statsDir = NULL; - char *resolved_statsDir = NULL; - char *resolved_rootdir_path = NULL; - int multithreaded; - - struct fuse_args args = FUSE_ARGS_INIT(argc, argv); - /*Default attr valid time is 1 sec*/ - struct stackFS_info s_info = {NULL, NULL, 1.0, 0, 0}; - - res = fuse_opt_parse(&args, &s_info, stackfs_opts, stackfs_process_arg); - - if (res) { - printf("Failed to parse arguments\n"); - return -1; - } - - if (s_info.is_help) { - print_usage(); - return 0; - } - - if (!s_info.rootDir) { - printf("Root Directory is mandatory\n"); - print_usage(); - return -1; - } - - if (s_info.statsDir) { - statsDir = s_info.statsDir; - resolved_statsDir = realpath(statsDir, NULL); - if (resolved_statsDir == NULL) { - printf("There is a problem in resolving the stats "); - printf("Directory passed %s\n", statsDir); - perror("Error"); - res = -1; - goto out1; - } - } - - rootDir = s_info.rootDir; - struct lo_data *lo = NULL; - - if (rootDir) { - lo = (struct lo_data *) calloc(1, sizeof(struct lo_data)); - if (!lo) { - fprintf(stderr, "fuse: memory allocation failed\n"); - res = -1; - goto out2; /* free the resolved_statsDir */ - } - resolved_rootdir_path = realpath(rootDir, NULL); - if (!resolved_rootdir_path) { - printf("There is a problem in resolving the root "); - printf("Directory Passed %s\n", rootDir); - perror("Error"); - res = -1; - goto out3; /* free both resolved_statsDir, lo */ - } - if (res == 0) { - (lo->root).name = resolved_rootdir_path; - (lo->root).ino = FUSE_ROOT_ID; - (lo->root).nlookup = 2; - (lo->root).next = (lo->root).prev = NULL; - lo->attr_valid = s_info.attr_valid; - /* Initialise the hash table and assign */ - res = hash_table_init(&lo->hash_table); - if (res == -1) - goto out4; - /* Initialise the spin lock for table */ - pthread_spin_init(&(lo->spinlock), 0); - } - } else { - res = -1; - goto out2; - } - - struct fuse_chan *ch; - char *mountpoint; - - res = fuse_parse_cmdline(&args, &mountpoint, &multithreaded, NULL); - - /* Initialise the spinlock before the logfile creation */ - pthread_spin_init(&spinlock, 0); - - if (s_info.tracing) { - err = log_open(resolved_statsDir); - if (err) - printf("No log file created(but not a fatle error, "); - printf("so proceeding)\n"); - } else - printf("No tracing\n"); - - printf("Multi Threaded : %d\n", multithreaded); - - if (res != -1) { - ch = fuse_mount(mountpoint, &args); - if (ch) { - struct fuse_session *se; - - printf("Mounted Successfully\n"); - se = fuse_lowlevel_new(&args, &hello_ll_oper, - sizeof(hello_ll_oper), lo); - if (se) { - if (fuse_set_signal_handlers(se) != -1) { - fuse_session_add_chan(se, ch); - // if (resolved_statsDir) - // fuse_session_add_statsDir(se, - // resolved_statsDir); - if (multithreaded) - err = fuse_session_loop_mt(se); - else - err = fuse_session_loop(se); - (void) err; - - fuse_remove_signal_handlers(se); - // fuse_session_remove_statsDir(se); - fuse_session_remove_chan(ch); - } - fuse_session_destroy(se); - } - StackFS_trace("Function Trace : Unmount"); - fuse_unmount(mountpoint, ch); - } - } - - /* free the arguments */ - fuse_opt_free_args(&args); - - /* destroy the lock protecting the hash table */ - pthread_spin_destroy(&(lo->spinlock)); - - /* free up the hash table */ - free_hash_table(lo); - - /* destroy the hash table */ - hash_table_destroy(&lo->hash_table); - - /* destroy the lock protecting the log file */ - pthread_spin_destroy(&spinlock); - - /* close the log file (if any) */ - log_close(); - - out4: - if (resolved_rootdir_path) - free(resolved_rootdir_path); - out3: - if (lo) - free(lo); - out2: - if (resolved_statsDir) - free(resolved_statsDir); - out1: - return res; -} diff --git a/benchmarks/mdtest-1.9.3-modified/.gitignore b/benchmarks/mdtest-1.9.3-modified/.gitignore deleted file mode 100644 index 93a580b5fcacde1f64f315397fd6160e81bbeda0..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mdtest diff --git a/benchmarks/mdtest-1.9.3-modified/COPYRIGHT b/benchmarks/mdtest-1.9.3-modified/COPYRIGHT deleted file mode 100644 index a316065092a508d67d94fb566f5b0dc78b268f8b..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/COPYRIGHT +++ /dev/null @@ -1,300 +0,0 @@ -Copyright (c) 2009, Los Alamos National Security, LLC All rights reserved. -Copyright 2009. Los Alamos National Security, LLC. This software was produced -under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National -Laboratory (LANL), which is operated by Los Alamos National Security, LLC for -the U.S. Department of Energy. The U.S. Government has rights to use, -reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS -ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR -ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is -modified to produce derivative works, such modified software should be -clearly marked, so as not to confuse it with the version available from -LANL. - -Additionally, redistribution and use in source and binary forms, with or -without modification, are permitted provided that the following conditions are -met: - -• Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -• Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -• Neither the name of Los Alamos National Security, LLC, Los Alamos National -Laboratory, LANL, the U.S. Government, nor the names of its contributors may be -used to endorse or promote products derived from this software without specific -prior written permission. - -THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. - -LANL Contributions by Alfred Torrez (atorrez@lanl.gov) and Brett Kettering -(brettk@lanl.gov). - - -Copyright (c) 2003, The Regents of the University of California. -Produced at the Lawrence Livermore National Laboratory. -Written by Christopher Morrone , Bill Loewe , -and Tyce McLarty . -UCRL-CODE-155800 -All rights reserved. - -This file is part of mdtest. - -Please also read Our Notice and GNU General Public License. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License (as published by the Free Software -Foundation) version 2, dated June 1991. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the terms and conditions of the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - - -OUR NOTICE AND TERMS AND CONDITIONS OF THE GNU GENERAL PUBLIC LICENSE - -Our Preamble Notice - -A. This notice is required to be provided under our contract with the U.S. -Department of Energy (DOE). This work was produced at the University of -California, Lawrence Livermore National Laboratory under Contract No. -W-7405-ENG-48 with the DOE. - -B. Neither the United States Government nor the University of California nor -any of their employees, makes any warranty, express or implied, or assumes any -liability or responsibility for the accuracy, completeness, or usefulness of -any information, apparatus, product, or process disclosed, or represents that -its use would not infringe privately-owned rights. - -C. Also, reference herein to any specific commercial products, process, or -services by trade name, trademark, manufacturer or otherwise does not -necessarily constitute or imply its endorsement, recommendation, or favoring -by the United States Government or the University of California. The views and -opinions of authors expressed herein do not necessarily state or reflect those -of the United States Government or the University of California, and shall not -be used for advertising or product endorsement purposes. - -The precise terms and conditions for copying, distribution and modification -follows. - -GNU Terms and Conditions for Copying, Distribution, and Modification - -0. This License applies to any program or other work which contains a notice -placed by the copyright holder saying it may be distributed under the terms of -this General Public License. The "Program," below, refers to any such program -or work, and a "work based on the Program" means either the Program or any -derivative work under copyright law: that is to say, a work containing the -Program or a portion of it, either verbatim or with modifications and/or -translated into another language. (Hereinafter, translation is included -without limitation in the term "modification".) Each licensee is addressed as -"you." - -Activities other than copying, distribution and modification are not covered by -this License; they are outside its scope. The act of running the Program is -not restricted, and the output from the Program is covered only if its contents -constitute a work based on the Program (independent of having been made by -running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as -you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this License -and to the absence of any warranty; and give any other recipients of the -Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may -at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, -thus forming a work based on the Program, and copy and distribute such -modifications or work under the terms of Section 1 above, provided that you -also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices stating - that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole - or in part contains or is derived from the Program or any part thereof, - to be licensed as a whole at no charge to all third parties under the terms - of this License. - - c) If the modified program normally reads commands interactively when run, - you must cause it, when started running for such interactive use in the - most ordinary way, to print or display an announcement including an - appropriate copyright notice and a notice that there is no warranty (or - else, saying that you provide a warranty) and that users may redistribute - the program under these conditions, and telling the user how to view a copy - of this License. (Exception: if the Program itself is interactive but does - not normally print such an announcement, your work based on the Program is - not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable -sections of that work are not derived from the Program, and can be reasonably -considered independent and separate works in themselves, then this License, and -its terms, do not apply to those sections when you distribute them as separate -work. But when you distribute the same section as part of a whole which is a -work based on the Program, the distribution of the whole must be on the terms -of this License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your -rights to work written entirely by you; rather, the intent is to exercise the -right to control the distribution of derivative or collective works based on -the Program. - -In addition, mere aggregation of another work not based on the Program with the -Program (or with a work based on the Program) on a volume of a storage or -distribution medium does not bring the other work under the scope of this -License. - -3. You may copy and distribute the Program (or a work based on it, under -Section 2) in object code or executable form under the terms of Sections 1 and -2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source - code, which must be distributed under the terms of Sections 1 and 2 above - on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to - give any third party, for a charge no more than your cost of physically - performing source distribution, a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed only - for noncommercial distribution and only if you received the program in - object code or executable form with such an offer, in accord with - Subsection b above.) - -The source code for a work means the preferred form the work for making -modifications to it. For an executable work, complete source code means all -the source code for all modules it contains, plus any associated interface -definition files, plus the scripts used to control compilation and installation -of the executable. However, as a special exception, the source code -distributed need not include anything that is normally distributed (in either -source or binary form) with the major components (compiler, kernel, and so on) -of the operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the source -code from the same place counts as distribution of the source code, even though -third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as -expressly provided under this License. Any attempt otherwise to copy, modify, -sublicense or distribute the Program is void, and will automatically terminate -your rights under this License. However, parties who have received copies, or -rights, from you under this License will not have their licenses terminated so -long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. -However, nothing else grants you permission to modify or distribute the Program -or its derivative works. These actions are prohibited by law if you do not -accept this License. Therefore, by modifying or distributing the Program (or -any work based on the Program), you indicate your acceptance of this License to -do so, and all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), -the recipient automatically receives a license from the original licensor to -copy, distribute or modify the Program subject to these terms and conditions. -You may not impose any further restrictions on the recipients' exercise of the -rights granted herein. You are not responsible for enforcing compliance by -third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), conditions -are imposed on you (whether by court order, agreement or otherwise) that -contradict the conditions of this License, they do not excuse you from the -conditions of this License. If you cannot distribute so as to satisfy -simultaneously your obligations under this License and any other pertinent -obligations, then as a consequence you may not distribute the Program at all. -For example, if a patent license would not permit royalty-free redistribution -of the Program by all those who receive copies directly or indirectly through -you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply and -the section as a whole is intended to apply in other circumstances. - -It is not the purpose to this section to induce you to infringe any patents or -other property right claims or to contest validity of any such claims; this -section has the sole purpose of protecting the integrity of the free software -distribution system, which is implemented by public license practices. Many -people have made generous contributions to the wide range of software -distributed through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing to -distribute software through any other system and a licensee cannot impose that -choice. - -This section is intended to make thoroughly clear what is believed to be a -consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain -countries either by patents or by copyrighted interfaces, the original -copyright holder who places the Program under this License may add an explicit -geographical distribution limitation excluding those countries, so that -distribution is permitted only in or among countries not thus excluded. In -such case, this License incorporates the limitation as if written in the body -of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any later -version," you have the option of following the terms and conditions either of -that version of any later version published by the Free Software Foundation. -If the Program does not specify a version number of this License, you may -choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs -whose distribution conditions are different, write to the author to ask for -permission. For software which is copyrighted by the Free Software Foundation, -write to the Free Software Foundation; we sometimes make exceptions for this. -Our decision to grant permission will be guided by the two goals of preserving -the free status of all derivatives of our free software and or promoting the -sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE -STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE -PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE -PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR -INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER -OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS diff --git a/benchmarks/mdtest-1.9.3-modified/Makefile b/benchmarks/mdtest-1.9.3-modified/Makefile deleted file mode 100644 index be19a98b2a46a78430d106d06741e81c01671df9..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -#/*****************************************************************************\ -#* * -#* Copyright (c) 2003, The Regents of the University of California * -#* See the file COPYRIGHT for a complete copyright notice and license. * -#* * -#******************************************************************************* -#* -#* CVS info: -#* $RCSfile: Makefile,v $ -#* $Revision: 1.2 $ -#* $Date: 2013/04/16 16:43:51 $ -#* $Author: brettkettering $ -#* -#* Purpose: -#* Make mdtest executable. -#* -#* make [mdtest] -- mdtest -#* make clean -- remove executable -#* -#\*****************************************************************************/ - -CC.AIX = mpcc_r -bmaxdata:0x80000000 -CC.Linux = mpicc -Wall -# -# For Cray systems -#CC.Linux = ${MPI_CC} -CC.Darwin = mpicc -Wall - -# Requires GNU Make -OS=$(shell uname) - -# Flags for compiling on 64-bit machines -LARGE_FILE = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D__USE_LARGEFILE64=1 - -CC = $(CC.$(OS)) - -# -# One needs someting like the following code snippet in one's cshrc file is one -# plans to use PLFS with mdtest. -# -# -# If we're not going to use PLFS with mdtest, we don't need to define this variable. -# -# setenv MDTEST_FLAGS "" -# -# If we're going to use PLFS with mdtest, we need to define this variable based on -# whether we are loading a PLFS module or using the system default PLFS installation. -# -# if ( $?PLFS_CFLAGS ) then -# setenv MDTEST_FLAGS "-D_HAS_PLFS ${PLFS_CFLAGS} ${PLFS_LDFLAGS}" -# else -# setenv MDTEST_FLAGS "-D_HAS_PLFS -I${MPICH_DIR}/include -lplfs" -# endif - - -all: mdtest - -mdtest: mdtest.c - $(CC) -D$(OS) $(LARGE_FILE) $(MDTEST_FLAGS) -g -o mdtest mdtest.c `pkg-config --cflags --libs glib-2.0` -lm - -clean: - rm -f mdtest mdtest.o diff --git a/benchmarks/mdtest-1.9.3-modified/README b/benchmarks/mdtest-1.9.3-modified/README deleted file mode 100644 index e6ce3cfb6b7a28d37e9183796f5c8a893048d69a..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/README +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************\ -* * -* Copyright (c) 2003, The Regents of the University of California * -* See the file COPYRIGHT for a complete copyright notice and license. * -* * -\******************************************************************************/ - -Usage: mdtest [-b #] [-B] [-c] [-C] [-d testdir] [-D] [-e] [-E] [-f first] [-F] - [-h] [-i iterations] [-I #] [-l last] [-L] [-n #] [-N #] [-p seconds] - [-r] [-R[#]] [-s #] [-S] [-t] [-T] [-u] [-v] [-V #] [-w #] [-y] - [-z #] - - -b: branching factor of hierarchical directory structure - -B: no barriers between phases (create/stat/remove) - -c: collective creates: task 0 does all creates and deletes - -C: only create files/dirs - -d: the directory in which the tests will run - -D: perform test on directories only (no files) - -e: number of bytes to read from each file - -E: only read files - -f: first number of tasks on which the test will run - -F: perform test on files only (no directories) - -h: prints help message - -i: number of iterations the test will run - -I: number of items per tree node - -l: last number of tasks on which the test will run - -L: files/dirs created only at leaf level - -n: every task will create/stat/remove # files/dirs per tree - -N: stride # between neighbor tasks for file/dir stat (local=0) - -p: pre-iteration delay (in seconds) - -r: only remove files/dirs - -R: randomly stat files/dirs (optional seed can be provided) - -s: stride between the number of tasks for each test - -S: shared file access (file only, no directories) - -t: time unique working directory overhead - -T: only stat files/dirs - -u: unique working directory for each task - -v: verbosity (each instance of option increments by one) - -V: verbosity value - -w: number of bytes to write to each file - -y: sync file after write completion - -z: depth of hierarchical directory structure - -NOTES: - * -N allows a "read-your-neighbor" approach by setting stride to - tasks-per-node. Do not use it with -B, as it creates race conditions. - * -d allows multiple paths for the form '-d fullpath1@fullpath2@fullpath3' - * -B allows each task to time itself. The aggregate results reflect this - change. - * -n and -I cannot be used together. -I specifies the number of files/dirs - created per tree node, whereas the -n specifies the total number of - files/dirs created over an entire tree. When using -n, integer division is - used to determine the number of files/dirs per tree node. (E.g. if -n is - 10 and there are 4 tree nodes (z=1 and b=3), there will be 2 files/dirs per - tree node.) - * -R and -T can be used separately. -R merely indicates that if files/dirs - are going to be stat'ed, then they will be stat'ed randomly. - - -Illustration of terminology: - - Hierarchical directory structure (tree) - - ======= - | | (tree node) - ======= - / | \ - ------ | ------ - / | \ - ======= ======= ======= - | | | | | | (leaf level) - ======= ======= ======= - - In this example, the tree has a depth of one (z=1) and branching factor of - three (b=3). The node at the top of the tree is the root node. The level - of nodes furthest from the root is the leaf level. All trees created by - mdtest are balanced. - - To see how mdtest operates, do a simple run like the following: - - mdtest -z 1 -b 3 -I 10 -C -i 3 - - This command will create a tree like the one above, then each task will - create 10 files/dirs per tree node. Three of these trees will be created - (one for each iteration). - - -Example usages: - -mdtest -I 10 -z 5 -b 2 - - A directory tree is created in the current working directory that has a - depth of 5 and a branching factor of 2. Each task operates on 10 - files/dirs in each tree node. - -mdtest -I 10 -z 5 -b 2 -R - - This example is the same as the previous one except that the files/dirs are - stat'ed randomly. - -mdtest -I 10 -z 5 -b 2 -R4 - - Again, this example is the same as the previous except a seed of 4 is - passed to the random number generator. - -mdtest -I 10 -z 5 -b 2 -L - - A directory tree is created as described above, but in this example - files/dirs exist only at the leaf level of the tree. - -mdtest -n 100 -i 3 -d /users/me/testing - - Each task creates 100 files/dirs in a root node (there are no branches - out of the root node) within the path /users/me/testing. This is done - three times. Aggregate values are calculated over the iterations. - -mdtest -n 100 -F -C - - Each task only creates 100 files in the current directory. - Directories are not created. The files are neither stat'ed nor - removed. - -mdtest -I 5 -z 3 -b 5 -u -d /users/me/testing - - Each task creates a directory tree in the /users/me/testing - directory. Each tree has a depth of 3 and a branching factor of - 5. Five files/dirs are operated upon in each node of each tree. - -mdtest -I 5 -z 3 -b 5 -u -d /users/me/testing@/some/other/location - - This run is the same as the previous except that each task creates - its tree in a different directory. Task 0 will create a tree in - /users/me/testing. Task 1 will create a tree in /some/other/location. - After all of the directories are used, the remaining tasks round- - robin over the directories supplied. (I.e. Task 2 will create a - tree in /users/me/testing, etc.) diff --git a/benchmarks/mdtest-1.9.3-modified/RELEASE_LOG b/benchmarks/mdtest-1.9.3-modified/RELEASE_LOG deleted file mode 100644 index 573227ccf6fd631a56d28678481d03c61bb6e5fb..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/RELEASE_LOG +++ /dev/null @@ -1,146 +0,0 @@ -Changes in mdtest-1.9.3 - * Checked for -B used with -N. This creates possible race conditions where - a process may try to stat or delete a file it did not create and the - process responsible did not yet create it or another process already - deleted it (in the case of stat). - -Changes in mdtest-1.9.2 - * Updated PLFS support to PLFS 2.5 API calls that return plfs_error_t. This - means that mdtest 1.9.2 is not compatible with PLFS versions prior to 2.5. - -Changes in mdtest-1.9.1 - * Removed duplicate . files from directories. - * Fixed shared file (-S) output to state 1 file not file count based on - process count. - -Changes in mdtest-1.9 - * Added use of PLFS library calls. So, a target of I/O testing can be a - PLFS file system. - - To control whether or not mdtest is built with PLFS, one needs something - like the following cshrc code segment: - -# -# If we're not going to use PLFS with mdtest, we don't need to define this variable. -# -# setenv MDTEST_FLAGS "" -# -# If we're going to use PLFS with mdtest, we need to define this variable based on -# whether we are loading a PLFS module or using the system default PLFS installation. -# - if ( $?PLFS_CFLAGS ) then - setenv MDTEST_FLAGS "-D_HAS_PLFS ${PLFS_CFLAGS} ${PLFS_LDFLAGS}" - else - setenv MDTEST_FLAGS "-D_HAS_PLFS -I${MPICH_DIR}/include -lplfs" - endif - - * Changed the item count variables to be unsigned long long so that a - test can be run with more than 2^31-1 (max value of int) items. - - * Fixed the remove process so that all of the directories that mdtest - creates get deleted if the remove flag is set. Before the #test.0 - class of directories remained with no files in them. - -Changes in mdtest-1.8.4 - * Added read option to extend create (write) capability. New feature will: - -E: Only perform the read phase of the tests. - -e #: Set the number of Bytes to read from each file. - -Fixes in mdtest-1.8.3 - * Prepared for release on sourceforge.net - -Fixes in mdtest-1.8.2 - * With the new changes issued in mdtest-1.8.0, all files and directories - were operated upon by using the full path to each file/dir. Full paths - are no longer used. Now a relative path is used from the root dir of - each directory tree. - * fixed bug in collective creates and unique directory per task mode - -Fixes in mdtest-1.8.1 - * A new test directory is created for each iteration. Then for each - iteration the directory structure is created/removed. This allowed - multiple iterations of the create-only mode. The name of the test - directories has changed as a result of this fix. Also, aggregate - creation/removal times are computed now over the number of iterations. - -Changes in mdtest-1.8.0 - * added option to create files/dirs in tree-like directory structure: - Previously, all files/dirs were created in one test directory. Now the - root directories of the tree(s) are created in that test directory. - Files/dirs are then created within those root directories or their children. - If the -u flag is specified, then unique trees are created per proc. - Otherwise, one tree is created. This coincides with the previous - functionality. The following flags were added/changed to incorporate this - new feature: - -z #: Indicates the depth of the leaves of the tree. If this flag is not - specified, the depth defaults to 0 (i.e. files/dirs are created in - the top-level directories). - -b #: Indicates the branching factor of the tree. If this flag is not - specified, the branching factor defaults to 1. Branching factor - indicates the number of children that each non-leaf node has. - -L: Indicates that files/dirs should only be created at the leaf level - of the tree. - -I #: Indicates the number of files/dirs that should be created within - each directory of the tree. - -n #: This flag still indicates the total number of files/dirs that should - be created. However, with the new tree structure some calculations - are done to determine the number of files that should be created per - directory in the tree. Due to rounding the actual total number of - files may differ slightly from what is specified. - - * added option to choose which phases to run: - The create, stat, and remove phases of mdtest have been separated. There - are flags now that allow the user to choose which phases they want to - perform. If none of these flags is specified, then the default usage is - to do all of the phases. The user is trusted to be intelligent about their - choice of phases. As a result of the separation of the phases, the naming - convention of the files/dirs had to be altered slightly. - - * added option to not barrier between each phase (create/stat/remove): - A major change in mdtest is the ability to time each proc that is running - the different phases of mdtest. The default functionality is the same as - the previous version - barriers are taken between phases (create/stat/ - remove). Also, in the default case, the resultant times reflect the - slowest rates for each phase. If the -B flag is specified, then no barriers - are taken between the phases. There is a race condition when specifying - this flag, but it is rarely met. The race condition is that one proc might - be trying to remove a file in the shared file case before someone else has - a chance to stat the file. Also, when the -B flag is specified, the - resultant rates are aggregates over the number of iterations and the number - of procs used. The default case, as mentioned above, calculates aggregates - only over the number of iterations where the time for each phase of an - iteration is the time of the slowest proc for that particular phase. - - * added option to stat files/dirs in a random order: - The default usage of mdtest will stat files in sequential order. Now, - however, items can be stat'ed in a random order by specifying the -R flag. - Even though the stat order is random with this usage, items are still only - stat'ed once each. This is achieved by randomly sorting a list of unique - item IDs before running the different tests. A seed for the random number - generator can optionally be provided with the following syntax: -R#. - -Fixes in mdtest-1.7.5 - * changed bug in how test directory was created (race condition) - * added multipath option for test directories ('-d path1@path2@path3') - * added man page and correct malloc error-checking (patches from Jim Garlick) - -Fixes in mdtest-1.7.4: - * folded b_remove_0 branch into main HEAD branch - -Fixes in mdtest-b_remove_0: - * added remove option to only remove files from previous run - -Fixes in mdtest-pre_b_remove_0: - * simple clean up for preparing for branch - -Fixes in mdtest-1.7.3: - * added statfs() to get file system data block and inode usage, replacing - system() call - -Fixes in mdtest-1.7.2: - * initialized declared variables - * modified df disk usage call - * added error-checking for chdir() - -Fixes in mdtest-1.7.1: - * added '-y' option to sync file after write diff --git a/benchmarks/mdtest-1.9.3-modified/mdtest.1 b/benchmarks/mdtest-1.9.3-modified/mdtest.1 deleted file mode 100644 index ba82d88a966948be99ddf9672c63bf72911968c3..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/mdtest.1 +++ /dev/null @@ -1,188 +0,0 @@ -.TH mdtest 1 "2010-05-05" "mdtest-1.8.3" "mdtest" -.SH NAME -mdtest \- test file system metadata performance -.SH SYNOPSIS -.B mdtest -.I "[-options]" -.SH DESCRIPTION -.B mdtest -is a file system metadata performance test designed to run -in a cluster MPI environment against parallel file systems. -.PP -In each iteration of the test, each MPI task creates, stats, and removes -the specified number of directories and/or files and measures the performance -in ops/second. After all the iterations complete, the maximum, minimum, -mean ops/sec and the std. deviation are reported for each operation. -.SH OPTIONS -.TP -.I "-b" branching_factor -The branching factor of the hierarchical directory structure [default: 1]. -.TP -.I "-B" -No barriers will be taken between the phases (create/stat/remove) of the tests. -.TP -.I "-c" -Use ``collective creates'', meaning task 0 does all the creates. -.TP -.I "-C" -Only perform the create phase of the tests. -.TP -.I "-d" testdir[@testdir2] -The directory in which the tests will run. For multiple pathes, must use fully-qualified pathnames. -[default: working directory of mdtest]. -.TP -.I "-D" -Perform test on directories only (no files). -.TP -.I "-e" bytes -Set the number of Bytes to read from each file [default: 0]. -.TP -.I "-E" -Only perform the read phase of the tests. -.TP -.I "-f" first -The first number of tasks on which the test will run -[default: 0]. -.TP -.I "-F" -Perform test on files only (no directories). -.TP -.I "-h" -Display help message. -.TP -.I "-i" iterations -The number of iterations the test will run -[default: 1]. -.TP -.I "-I" items_per_directory -The number of items per directory in the tree [default: 0]. -.TP -.I "-l" last -The last number of tasks on which the test will run -[default: 0]. -.TP -.I "-L" -Files/directories only created at the leaf level of the tree. -.TP -.I "-n" number_of_items -Every process will creat/stat/remove # directories and files -[default: 0]. -.TP -.I "-N" stride -Stride # between neighbor tasks for file/dir stat, 0 = local -[default: 0]. -.TP -.I "-p" seconds -Pre-iteration delay (in seconds). -.TP -.I "-r" -Only perform the remove phase of the tests. -.TP -.I "-R[seed]" -Randomly stat files. There is an optional argument that provides a seed -to the random number generator. (Note: There is no space between the -.I "-R" - and -the seed if one is provided.) -.TP -.I "-s" stride -Stride between the number of tasks for each test -[default: 1]. -.TP -.I "-S" -Shared file access (file only, no directories). -.TP -.I "-t" -Include unique working directory management overhead in the results -(presumes -.I "-u" -option). -.TP -.I "-T" -Only perform the stat phase of the tests. -.TP -.I "-u" -Create a unique working directory for each task -(presumes -.I "-d" -option). -.TP -.I "-v" -Increase verbosity (each instance of option increments by one). -.TP -.I "-V" value -Set verbosity value -[default: 0]. -.TP -.I "-w" bytes -Set the number of Bytes to write to each file after it is created -[default: 0]. -.TP -.I "-z" tree_depth -The depth of the hierarchical directory tree [default: 0]. -.SH EXAMPLES -.SS "Example 1" -.nf -$ mpirun -n 2 ./mdtest -d /tmp/z -n 100 -i 2 - --- started at 11/23/2009 09:05:29 -- - -mdtest-1.8.1 was launched with 2 total task(s) on 1 nodes -Command line used: ./mdtest -d /tmp/z -n 100 -i 2 -Path: /tmp -FS: 28.8 GiB Used FS: 8.6% 8.6%Inodes: 1.8 Mi Used Inodes: 5.1% - -time to create tree: 0.000078 sec -tree creation rate: 12826.617737 ops/sec - -2 tasks, 200 files/directories - -SUMMARY: (of 2 iterations) - Operation Max Min Mean Std Dev - --------- --- --- ---- ------- - Directory creation: 21489.415 17447.551 19468.483 2020.932 - Directory stat : 154657.227 28731.061 91694.144 62963.083 - Directory removal : 146756.613 21489.415 84123.014 62633.599 - File creation : 42024.989 28731.061 35378.025 6646.964 - File stat : 146756.613 17447.551 82102.082 64654.531 - File removal : 156884.384 42024.989 99454.686 57429.698 - -time to remove tree: 0.001031 sec -tree removal rate: 970.005550 ops/sec - --- finished at 11/23/2009 09:05:29 -- -.fi -.SS "Example 2" -.nf -$ mpirun -np 2 -H pc6 ./mdtest -d /tmp/z -b 2 -z 3 -I 10 - --- started at 11/23/2009 09:09:23 -- - -mdtest-1.8.1 was launched with 2 total task(s) on 1 nodes -Command line used: ./mdtest -d /tmp/z -b 2 -z 3 -I 10 -Path: /tmp -FS: 28.8 GiB Used FS: 8.6% 8.6%Inodes: 1.8 Mi Used Inodes: 5.1% - -time to create tree: 0.000765 sec -tree creation rate: 19605.659084 ops/sec - -2 tasks, 300 files/directories - -SUMMARY: (of 1 iterations) - Operation Max Min Mean Std Dev - --------- --- --- ---- ------- - Directory creation: 29365.707 29365.707 29365.707 0.000 - Directory stat : 123701.455 123701.455 123701.455 0.000 - Directory removal : 25623.459 25623.459 25623.459 0.000 - File creation : 38704.743 38704.743 38704.743 0.000 - File stat : 125477.782 125477.782 125477.782 0.000 - File removal : 51911.845 51911.845 51911.845 0.000 - -time to remove tree: 0.000940 sec -tree removal rate: 15960.060883 ops/sec - --- finished at 11/23/2009 09:09:23 -- -.fi - -.SH "SEE ALSO" -\fBhttp://sourceforge.net/projects/mdtest\fR diff --git a/benchmarks/mdtest-1.9.3-modified/mdtest.c b/benchmarks/mdtest-1.9.3-modified/mdtest.c deleted file mode 100644 index df07c11505686533d3c3895efa8ec5b03b011682..0000000000000000000000000000000000000000 --- a/benchmarks/mdtest-1.9.3-modified/mdtest.c +++ /dev/null @@ -1,3397 +0,0 @@ -/* - * Copyright (C) 2003, The Regents of the University of California. - * Produced at the Lawrence Livermore National Laboratory. - * Written by Christopher J. Morrone , - * Bill Loewe , Tyce McLarty , - * and Ryan Kroiss . - * All rights reserved. - * UCRL-CODE-155800 - * - * Please read the COPYRIGHT file. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (as published by - * the Free Software Foundation) version 2, dated June 1991. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * terms and conditions of the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * CVS info: - * $RCSfile: mdtest.c,v $ - * $Revision: 1.4 $ - * $Date: 2013/11/27 17:05:31 $ - * $Author: brettkettering $ - */ - -#include "mpi.h" -#include -#include -#include -#include -#include -#include -#include - -#ifdef Darwin -#include -#include -#else - -#include - -#endif -#ifdef _HAS_PLFS -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH -#define DIRMODE S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH -/* - * Try using the system's PATH_MAX, which is what realpath and such use. - */ -#define MAX_LEN PATH_MAX -/* -#define MAX_LEN 1024 -*/ -#define RELEASE_VERS "1.9.3" -#define TEST_DIR "#test-dir" -#define ITEM_COUNT 25000 - -//FILE CREATION ONLY. print periodic output. disable with value 0 -//One has to be 0. Both cannot be active. if both are enabled, steps are used -#define PERI_ITEM_STEPS 0 -//in seconds -//DONT CHANGE THE STEPS. CURRENTLY IN DEVELOPMENT STAGE AND 5 IS HARDCODED IN PYTHON SCRIPT -#define PERI_TIME_STEPS 5 -//if periodic output should be printed + file output. 0 disable, 1 output only all, 2 output all with local output -#define PERI_PRINT 0 - -typedef struct { - double entry[10]; -} table_t; - -int rank; -int size; -int nodeCount; -char processor_name[MPI_MAX_PROCESSOR_NAME]; -unsigned long long *rand_array; -char testdir[MAX_LEN]; -char testdirpath[MAX_LEN]; -char top_dir[MAX_LEN]; -char base_tree_name[MAX_LEN]; -char **filenames = NULL; -//periodic output -char filename_buffer_periodic[MAX_LEN]; -char filename_buffer_periodic_all[MAX_LEN]; -char hostname[MAX_LEN]; -char unique_dir[MAX_LEN]; -char mk_name[MAX_LEN]; -char stat_name[MAX_LEN]; -char read_name[MAX_LEN]; -char rm_name[MAX_LEN]; -char unique_mk_dir[MAX_LEN]; -char unique_chdir_dir[MAX_LEN]; -char unique_stat_dir[MAX_LEN]; -char unique_read_dir[MAX_LEN]; -char unique_rm_dir[MAX_LEN]; -char unique_rm_uni_dir[MAX_LEN]; -char *write_buffer = NULL; -char *read_buffer = NULL; -int barriers = 1; -int create_only = 0; -int stat_only = 0; -int read_only = 0; -int remove_only = 0; -int leaf_only = 0; -int branch_factor = 1; -int depth = 0; -/* - * This is likely a small value, but it's sometimes computed by - * branch_factor^(depth+1), so we'll make it a larger variable, - * just in case. - */ -unsigned long long num_dirs_in_tree = 0; -/* - * As we start moving towards Exascale, we could have billions - * of files in a directory. Make room for that possibility with - * a larger variable. - */ -unsigned long long items_per_dir = 0; -int random_seed = 0; -int shared_file = 0; -int files_only = 0; -int dirs_only = 0; -int pre_delay = 0; -int unique_dir_per_task = 0; -int time_unique_dir_overhead = 0; -int verbose = 0; -int throttle = 1; -unsigned long long items = 0; -int collective_creates = 0; -size_t write_bytes = 0; -size_t read_bytes = 0; -int sync_file = 0; -int path_count = 0; -int nstride = 0; -/* neighbor stride */ -MPI_Comm testcomm; -table_t *summary_table; -#ifdef _HAS_PLFS -char using_plfs_path = 0; -pid_t pid; -uid_t uid; -Plfs_fd *wpfd = NULL; -Plfs_fd *rpfd = NULL; -Plfs_fd *cpfd = NULL; -#endif - -/* for making/removing unique directory && stating/deleting subdirectory */ -enum { - MK_UNI_DIR, STAT_SUB_DIR, READ_SUB_DIR, RM_SUB_DIR, RM_UNI_DIR -}; - -#ifdef __linux__ -#define FAIL(msg) do { \ - fprintf(stdout, "%s: Process %d(%s): FAILED in %s, %s: %s\n",\ - timestamp(), rank, hostname, __func__, \ - msg, strerror(errno)); \ - fflush(stdout);\ - MPI_Abort(MPI_COMM_WORLD, 1); \ -} while(0) -#else -#define FAIL(msg) do { \ - fprintf(stdout, "%s: Process %d(%s): FAILED at %d, %s: %s\n",\ - timestamp(), rank, hostname, __LINE__, \ - msg, strerror(errno)); \ - fflush(stdout);\ - MPI_Abort(MPI_COMM_WORLD, 1); \ -} while(0) -#endif - -void set_periodic_entry(double *t_tmp, double *t_start, double *t_prev, int *i_btwn_prev, - unsigned long long *items_per_dir, unsigned long long *i, int *ai, - int *endi, GArray *ops_sec_total, GArray *ops_sec_since_prev, GArray *files_created) { - //calc total ops/sec since beginning PER PROCESS - gdouble tmp = (gdouble)(*i / (*t_tmp - *t_start)); - g_array_append_val(ops_sec_total, tmp); - //calc ops/sec since previous step PER PROCESS - tmp = (gdouble)(*i_btwn_prev / (*t_tmp - *t_prev)); - g_array_append_val(ops_sec_since_prev, tmp); - //store items created at that point in time - gint tmp2 = (gint) *i; - g_array_append_val(files_created, tmp2); - //some verbosity to see how long file creation will last - if (rank == 0) { - printf("File creation with %d total task(s) on %d node(s) %2.2f%%/100%% completed... Time left: ~%10.2f seconds\n", - size, nodeCount, (*i * 1.0) / *items_per_dir * 100, - (((*items_per_dir - *i) / (*i_btwn_prev * 1.0)) * (*t_tmp - *t_prev))); - fflush(stdout); - } - //set prev time to current time - *t_prev = *t_tmp; - //needed for last output after for loop - *endi = *i; - -} - -char *timestamp() { - static char datestring[80]; - time_t timestamp; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering timestamp...\n"); - } - - fflush(stdout); - timestamp = time(NULL); - strftime(datestring, 80, "%m/%d/%Y %T", localtime(×tamp)); - - return datestring; -} - -int count_tasks_per_node(void) { - char localhost[MAX_LEN], - hostname[MAX_LEN]; - int count = 1, - i; - MPI_Status status; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering count_tasks_per_node...\n"); - fflush(stdout); - } - - if (gethostname(localhost, MAX_LEN) != 0) { - FAIL("gethostname()"); - } - if (rank == 0) { - /* MPI_receive all hostnames, and compare to local hostname */ - for (i = 0; i < size - 1; i++) { - MPI_Recv(hostname, MAX_LEN, MPI_CHAR, MPI_ANY_SOURCE, - MPI_ANY_TAG, MPI_COMM_WORLD, &status); - if (strcmp(hostname, localhost) == 0) { - count++; - } - } - } else { - /* MPI_send hostname to root node */ - MPI_Send(localhost, MAX_LEN, MPI_CHAR, 0, 0, MPI_COMM_WORLD); - } - MPI_Bcast(&count, 1, MPI_INT, 0, MPI_COMM_WORLD); - - return (count); -} - -void delay_secs(int delay) { - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering delay_secs...\n"); - fflush(stdout); - } - - if (rank == 0 && delay > 0) { - if (verbose >= 1) { - fprintf(stdout, "delaying %d seconds . . .\n", delay); - fflush(stdout); - } - sleep(delay); - } - MPI_Barrier(testcomm); -} - -void offset_timers(double *t, int tcount) { - double toffset; - int i; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering offset_timers...\n"); - fflush(stdout); - } - - toffset = MPI_Wtime() - t[tcount]; - for (i = 0; i < tcount + 1; i++) { - t[i] += toffset; - } -} - -void parse_dirpath(char *dirpath_arg) { - char *tmp, *token; - char delimiter_string[3] = {'@', '\n', '\0'}; - int i = 0; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering parse_dirpath...\n"); - fflush(stdout); - } - - tmp = dirpath_arg; - - if (*tmp != '\0') path_count++; - while (*tmp != '\0') { - if (*tmp == '@') { - path_count++; - } - tmp++; - } - filenames = (char **) malloc(path_count * sizeof(char **)); - if (filenames == NULL) { - FAIL("out of memory"); - } - - token = strtok(dirpath_arg, delimiter_string); - while (token != NULL) { - filenames[i] = token; - token = strtok(NULL, delimiter_string); - i++; - } -} - -/* - * This function copies the unique directory name for a given option to - * the "to" parameter. Some memory must be allocated to the "to" parameter. - */ - -void unique_dir_access(int opt, char *to) { - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering unique_dir_access...\n"); - fflush(stdout); - } - - if (opt == MK_UNI_DIR) { - MPI_Barrier(testcomm); - strcpy(to, unique_chdir_dir); - } else if (opt == STAT_SUB_DIR) { - strcpy(to, unique_stat_dir); - } else if (opt == READ_SUB_DIR) { - strcpy(to, unique_read_dir); - } else if (opt == RM_SUB_DIR) { - strcpy(to, unique_rm_dir); - } else if (opt == RM_UNI_DIR) { - strcpy(to, unique_rm_uni_dir); - } -} - -/* helper for creating/removing items */ -void create_remove_items_helper(int dirs, - int create, char *path, unsigned long long itemNum) { - - unsigned long long i; - char curr_item[MAX_LEN]; - //values for periodic output for steps ONLY for file creation - GArray *ops_sec_total, *ops_sec_since_prev, *files_created; - int steps = 0; - int a_length = 0; - if (PERI_ITEM_STEPS) { - steps = PERI_ITEM_STEPS / size; - a_length = (items_per_dir / steps) + 0; - ops_sec_total = g_array_sized_new(FALSE, FALSE, sizeof(gdouble), a_length); - ops_sec_since_prev = g_array_sized_new(FALSE, FALSE, sizeof(gdouble), a_length); - files_created = g_array_sized_new(FALSE, FALSE, sizeof(gint), a_length); - } else { - ops_sec_total = g_array_new(FALSE, FALSE, sizeof(gdouble)); - ops_sec_since_prev = g_array_new(FALSE, FALSE, sizeof(gdouble)); - files_created = g_array_new(FALSE, FALSE, sizeof(gint)); - } - int ai = 0; - int endi = 0; - double t_start = MPI_Wtime(); - double t_prev = t_start; - double t_tmp; - -#ifdef _HAS_PLFS - int open_flags; - plfs_error_t plfs_ret; - ssize_t bytes_written; - int num_ref; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering create_remove_items_helper...\n"); - fflush(stdout); - } - - for (i = 0; i < items_per_dir; i++) { - if (dirs) { - if (create) { - if ((rank == 0) && - (verbose >= 3) && - ((itemNum + i) % ITEM_COUNT == 0 && (itemNum + i != 0))) { - - printf("V-3: create dir: %010llu\n", itemNum + i); - fflush(stdout); - } - - //create dirs - sprintf(curr_item, "%s/dir.%s%010llu", path, mk_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (dirs create): curr_item is \"%s\"\n", curr_item); - fflush(stdout); - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_mkdir( curr_item, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir directory"); - } - } else { - if ( mkdir( curr_item, DIRMODE ) == -1 ) { - FAIL("unable to create directory"); - } - } -#else - if (mkdir(curr_item, DIRMODE) == -1) { - FAIL("unable to create directory"); - } -#endif - /* - * !create - */ - } else { - if ((rank == 0) && - (verbose >= 3) && - ((itemNum + i) % ITEM_COUNT == 0 && (itemNum + i != 0))) { - - printf("V-3: remove dir: %010llu\n", itemNum + i); - fflush(stdout); - } - - //remove dirs - sprintf(curr_item, "%s/dir.%s%010llu", path, rm_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (dirs remove): curr_item is \"%s\"\n", curr_item); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_rmdir( curr_item ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_rmdir directory"); - } - } else { - if (rmdir(curr_item) == -1) { - FAIL("unable to remove directory"); - } - } -#else - if (rmdir(curr_item) == -1) { - FAIL("unable to remove directory"); - } -#endif - } - /* - * !dirs - */ - } else { - int fd; - - if (create) { - if ((rank == 0) && - (verbose >= 3) && - ((itemNum + i) % ITEM_COUNT == 0 && (itemNum + i != 0))) { - - printf("V-3: create file: %010llu\n", itemNum + i); - fflush(stdout); - } - - //create files - sprintf(curr_item, "%s/file.%s%010llu", path, mk_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (non-dirs create): curr_item is \"%s\"\n", curr_item); - fflush(stdout); - } - - if (collective_creates) { -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (collective): plfs_open...\n" ); - fflush( stdout ); - } -/* - * If PLFS opens a file as O_RDWR, it suffers a bad performance hit. Looking through the - * code that follows up to the close, this file only gets one write, so we'll open it as - * write-only. - */ - open_flags = O_WRONLY; - wpfd = NULL; - - plfs_ret = plfs_open( &wpfd, curr_item, open_flags, rank, FILEMODE, NULL ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_open file" ); - } - } else { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (collective): open...\n" ); - fflush( stdout ); - } - - if ((fd = open(curr_item, O_RDWR)) == -1) { - FAIL("unable to open file"); - } - } -#else - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (collective): open...\n"); - fflush(stdout); - } - - if ((fd = open(curr_item, O_RDWR)) == -1) { - FAIL("unable to open file"); - } -#endif - /* - * !collective_creates - */ - } else { - if (shared_file) { -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (non-collective, shared): plfs_open...\n" ); - fflush( stdout ); - } -/* - * If PLFS opens a file as O_RDWR, it suffers a bad performance hit. Looking through the - * code that follows up to the close, this file only gets one write, so we'll open it as - * write-only. - */ - open_flags = O_CREAT | O_WRONLY; - wpfd = NULL; - - plfs_ret = plfs_open( &wpfd, curr_item, open_flags, rank, FILEMODE, NULL ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_open for create file" ); - } - } else { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (non-collective, shared): open...\n" ); - fflush( stdout ); - } - - if ((fd = open(curr_item, O_CREAT|O_RDWR, FILEMODE)) == -1) { - FAIL("unable to create file"); - } - } -#else - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (non-collective, shared): open...\n"); - fflush(stdout); - } - - if ((fd = open(curr_item, O_CREAT | O_RDWR, FILEMODE)) == -1) { - FAIL("unable to create file"); - } -#endif - /* - * !shared_file - */ - } else { -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (non-collective, non-shared): plfs_open...\n" ); - fflush( stdout ); - } -/* - * If PLFS opens a file as O_RDWR, it suffers a bad performance hit. Looking through the - * code that follows up to the close, this file only gets one write, so we'll open it as - * write-only. - */ - open_flags = O_CREAT | O_WRONLY; - wpfd = NULL; - - plfs_ret = plfs_open( &wpfd, curr_item, open_flags, rank, FILEMODE, NULL ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_open for create file" ); - } - } else { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper (non-collective, non-shared): open...\n" ); - fflush( stdout ); - } - - if ((fd = creat(curr_item, FILEMODE)) == -1) { - FAIL("unable to create file"); - } - } -#else - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (non-collective, non-shared): open...\n"); - fflush(stdout); - } - - /* MY STUFF STARTS HERE*/ - //at a given steps value save current ops/sec total and since prev step - if (PERI_ITEM_STEPS | PERI_TIME_STEPS) { - if (PERI_ITEM_STEPS && i != 0 && i % steps == 0) { - //get current time - t_tmp = MPI_Wtime(); - set_periodic_entry(&t_tmp, &t_start, &t_prev, &steps, &items_per_dir, &i, &ai, &endi, - ops_sec_total, ops_sec_since_prev, files_created); - //increase index of the two arrays where ops_sec are stored - ai++; - } else if (PERI_TIME_STEPS) { - t_tmp = MPI_Wtime(); - if (t_tmp - t_prev > PERI_TIME_STEPS) { - int steps_since_prev = i - endi; - set_periodic_entry(&t_tmp, &t_start, &t_prev, &steps_since_prev, &items_per_dir, &i, - &ai, &endi, ops_sec_total, ops_sec_since_prev, files_created); - //increase index of the two arrays where ops_sec are stored - ai++; - } - } - } - if ((fd = creat(curr_item, FILEMODE)) == -1) { - FAIL("unable to create file"); - } -#endif - } - } - - if (write_bytes > 0) { -#ifdef _HAS_PLFS -/* - * According to Bill Loewe, writes are only done one time, so they are always at - * offset 0 (zero). - */ - if ( using_plfs_path ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: plfs_write...\n" ); - fflush( stdout ); - } - - plfs_ret = plfs_write( wpfd, write_buffer, write_bytes, 0, pid, &bytes_written ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_write file" ); - } - if ( bytes_written != write_bytes ) { - FAIL( "Did not plfs_write the correct number of bytes to the file" ); - } - } else { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: write...\n" ); - fflush( stdout ); - } - - if (write(fd, write_buffer, write_bytes) != write_bytes) { - FAIL("unable to write file"); - } - } -#else - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper: write...\n"); - fflush(stdout); - } - - if (write(fd, write_buffer, write_bytes) != write_bytes) { - FAIL("unable to write file"); - } -#endif - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if ( sync_file ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: plfs_sync...\n" ); - fflush( stdout ); - } - - plfs_ret = plfs_sync( wpfd ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_sync file" ); - } - } - } else { - if ( sync_file ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: fsync...\n" ); - fflush( stdout ); - } - - if ( fsync(fd) == -1 ) { - FAIL("unable to sync file"); - } - } - } -#else - if (sync_file) { - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper: fsync...\n"); - fflush(stdout); - } - - if (fsync(fd) == -1) { - FAIL("unable to sync file"); - } - } -#endif - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: plfs_close...\n" ); - fflush( stdout ); - } - - plfs_ret = plfs_close( wpfd, rank, uid, open_flags, NULL, &num_ref ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_close file" ); - } - } else { - if (rank == 0 && verbose >= 3) { - printf( "V-3: create_remove_items_helper: close...\n" ); - fflush( stdout ); - } - - if (close(fd) == -1) { - FAIL("unable to close file"); - } - } -#else - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper: close...\n"); - fflush(stdout); - } - - if (close(fd) == -1) { - FAIL("unable to close file"); - } -#endif - /* - * !create - */ - } else { - if ((rank == 0) && - (verbose >= 3) && - ((itemNum + i) % ITEM_COUNT == 0 && (itemNum + i != 0))) { - - printf("V-3: remove file: %010llu\n", itemNum + i); - fflush(stdout); - } - - //remove files - sprintf(curr_item, "%s/file.%s%010llu", path, rm_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items_helper (non-dirs remove): curr_item is \"%s\"\n", curr_item); - fflush(stdout); - } - - if (!(shared_file && rank != 0)) { -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_unlink( curr_item ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_unlink file" ); - } - } else { - if (unlink(curr_item) == -1) { - FAIL("unable to unlink file"); - } - } -#else - if (unlink(curr_item) == -1) { - FAIL("unable to unlink file"); - } -#endif - } - } - } - } - if ((PERI_ITEM_STEPS | PERI_TIME_STEPS) && dirs == 0 && create && collective_creates == 0 && shared_file == 0) { - //last value for periodic step output - t_tmp = MPI_Wtime(); - gdouble tmp = (gdouble)(items_per_dir / (t_tmp - t_start)); - g_array_append_val(ops_sec_total, tmp); - tmp = (gdouble)((items_per_dir - endi) / (t_tmp - t_prev)); - g_array_append_val(ops_sec_since_prev, tmp); - g_array_append_val(files_created, items_per_dir); - if (PERI_TIME_STEPS) { - //depending on how fast the proc ran, one proc could have one entry more in the array. - //for next MPI calls we want to have the max length - a_length = ai + 1; - int g_ai; - MPI_Allreduce(&a_length, &g_ai, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - a_length = g_ai; - } - //Allocates global arrays to sum up all ops_sec from all processes - if (a_length == 0) { - a_length = ai + 1; - } - double *g_ops_sec_total, *g_ops_sec_since_prev, *l_ops_sec_total, *l_ops_sec_since_prev; - int *g_files_created, *l_files_created; - g_ops_sec_since_prev = (double *) malloc(sizeof(double) * a_length); - g_ops_sec_total = (double *) malloc(sizeof(double) * a_length); - g_files_created = (int *) malloc(sizeof(int) * a_length); - l_ops_sec_since_prev = (double *) malloc(sizeof(double) * a_length); - l_ops_sec_total = (double *) malloc(sizeof(double) * a_length); - l_files_created = (int *) malloc(sizeof(int) * a_length); - //convert glib arrays to regular arrays for MPI... - double t_interval_last = 0; - for (i = 0; i < a_length; i++) { - //this branch will be used when one proc created files faster than other proc. He obviously hasn't created more files and thus he has also fewer array entries. - //further total operations per second will be calculated down since he has to wait while doing nothing, decreasing the total ops/sec each time he has to wait - if (PERI_TIME_STEPS && i > ai) { - if (i == a_length - 1) { - t_interval_last = PERI_TIME_STEPS - (t_tmp - t_prev); - } - //decrease his operations per second depending on the total time of all proc after he is finished - double idle_ops_sec = ( (double) g_array_index(ops_sec_total, gdouble, ai) ) / ( (i + 1) * PERI_TIME_STEPS - t_interval_last) * ( (ai + 1) * PERI_TIME_STEPS); - l_ops_sec_since_prev[i] = 0.0; - l_ops_sec_total[i] = idle_ops_sec; - l_files_created[i] = (int) g_array_index(files_created, gint, ai); - } else { - l_ops_sec_since_prev[i] = (double) g_array_index(ops_sec_since_prev, gdouble, i); - l_ops_sec_total[i] = (double) g_array_index(ops_sec_total, gdouble, i); - l_files_created[i] = (int) g_array_index(files_created, gint, i); - } - } - - //get the sum up values from each process and save it in global arrays owned by rank 0 - MPI_Reduce(l_ops_sec_total, g_ops_sec_total, a_length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); - MPI_Reduce(l_ops_sec_since_prev, g_ops_sec_since_prev, a_length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); - MPI_Reduce(l_files_created, g_files_created, a_length, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); - //every proc prints his own output - FILE *f = fopen(filename_buffer_periodic, "a"); - if (f == NULL) { - FAIL("Error opening file for periodic output!\n"); - } - if (PERI_ITEM_STEPS) { - for (i = 0; i < a_length; i++) { - fprintf(f, - " ; Rank %d from node %s ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Time_since_prev: %7.3f ; %10.3f ops/sec_since_prev\n", - rank, processor_name, l_files_created[i], l_files_created[i] / l_ops_sec_total[i], - l_ops_sec_total[i], - PERI_ITEM_STEPS / l_ops_sec_since_prev[i], l_ops_sec_since_prev[i]); - if (PERI_PRINT == 2) { - printf(" ; Rank %d from node %s ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Time_since_prev: %7.3f ; %10.3f ops/sec_since_prev\n", - rank, processor_name, l_files_created[i], l_files_created[i] / l_ops_sec_total[i], - l_ops_sec_total[i], - PERI_ITEM_STEPS / l_ops_sec_since_prev[i], l_ops_sec_since_prev[i]); - } - } - } else { - t_interval_last = 0; - for (i = 0; i < a_length; i++) { - if (i == a_length - 1) { - t_interval_last = PERI_TIME_STEPS - (t_tmp - t_prev); - } - fprintf(f, - " ; Rank %d from node %s ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Created_files_since_prev: %10d ; %10.3f ops/sec_since_prev\n", - rank, processor_name, l_files_created[i], - (double) (i + 1) * PERI_TIME_STEPS - t_interval_last, - l_ops_sec_total[i], (int) (l_ops_sec_since_prev[i] * (PERI_TIME_STEPS - t_interval_last)), - l_ops_sec_since_prev[i]); - if (PERI_PRINT == 2) { - printf(" ; Rank %d from node %s ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Created_files_since_prev: %10d ; %10.3f ops/sec_since_prev\n", - rank, processor_name, l_files_created[i], - (double) (i + 1) * PERI_TIME_STEPS - t_interval_last, - l_ops_sec_total[i], (int) (l_ops_sec_since_prev[i] * (PERI_TIME_STEPS - t_interval_last)), - l_ops_sec_since_prev[i]); - } - } - } - fprintf(f, "\n"); - fclose(f); - //rank 0 outputs periodic values - if (rank == 0) { - FILE *f = fopen(filename_buffer_periodic_all, "a"); - if (f == NULL) { - FAIL("Error opening file for periodic output!\n"); - } - if (PERI_ITEM_STEPS) { - for (i = 0; i < a_length; i++) { - fprintf(f, - " ; All ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Time_since_prev: %14.3f ; %10.3f ops/sec_since_prev\n", - g_files_created[i], g_files_created[i] / g_ops_sec_total[i], g_ops_sec_total[i], - PERI_ITEM_STEPS / g_ops_sec_since_prev[i], g_ops_sec_since_prev[i]); - if (PERI_PRINT) { - printf(" ; All ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Time_since_prev: %14.3f ; %10.3f ops/sec_since_prev\n", - g_files_created[i], g_files_created[i] / g_ops_sec_total[i], g_ops_sec_total[i], - PERI_ITEM_STEPS / g_ops_sec_since_prev[i], g_ops_sec_since_prev[i]); - } - } - } else { - t_interval_last = 0; - for (i = 0; i < a_length; i++) { - if (i == a_length - 1) { - t_interval_last = PERI_TIME_STEPS - (t_tmp - t_prev); - } - fprintf(f, - " ; All ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Created_files_since_prev: %10d ; %10.3f ops/sec_since_prev\n", - g_files_created[i], (double) (i + 1) * PERI_TIME_STEPS - t_interval_last, - g_ops_sec_total[i], (int) (g_ops_sec_since_prev[i] * (PERI_TIME_STEPS - t_interval_last)), - g_ops_sec_since_prev[i]); - if (PERI_PRINT) { - printf(" ; All ; Created_files: %10d ; Time_elapsed: %10.3f ; %14.3f ops/sec ; Created_files_since_prev: %10d ; %10.3f ops/sec_since_prev\n", - g_files_created[i], (double) (i + 1) * PERI_TIME_STEPS - t_interval_last, - g_ops_sec_total[i], - (int) (g_ops_sec_since_prev[i] * (PERI_TIME_STEPS - t_interval_last)), - g_ops_sec_since_prev[i]); - } - } - } - printf("File creates finished ... \n"); - fflush(stdout); - fprintf(f, - "FINISHED ITERATION---------------------------------------------------------------------------------\n\n\n"); - fclose(f); - } - //free global arrays - free(g_ops_sec_since_prev); - free(g_ops_sec_total); - //free local arrays - free(l_ops_sec_total); - free(l_ops_sec_since_prev); - } - g_array_free(ops_sec_since_prev, TRUE); - g_array_free(ops_sec_total, TRUE); -} - -/* helper function to do collective operations */ -void collective_helper(int dirs, int create, char *path, unsigned long long itemNum) { - - unsigned long long i; - char curr_item[MAX_LEN]; -#ifdef _HAS_PLFS - int open_flags; - plfs_error_t plfs_ret; - int num_ref; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering collective_helper...\n"); - fflush(stdout); - } - - - for (i = 0; i < items_per_dir; i++) { - if (dirs) { - if (create) { - - //create dirs - sprintf(curr_item, "%s/dir.%s%010llu", path, mk_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create dir : %s\n", curr_item); - fflush(stdout); - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_mkdir( curr_item, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir directory"); - } - } else { - if (mkdir(curr_item, DIRMODE) == -1) { - FAIL("unable to create directory"); - } - } -#else - if (mkdir(curr_item, DIRMODE) == -1) { - FAIL("unable to create directory"); - } -#endif - } else { - - //remove dirs - sprintf(curr_item, "%s/dir.%s%010llu", path, rm_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: remove dir : %s\n", curr_item); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_rmdir( curr_item ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_rmdir directory"); - } - } else { - if (rmdir(curr_item) == -1) { - FAIL("unable to remove directory"); - } - } -#else - if (rmdir(curr_item) == -1) { - FAIL("unable to remove directory"); - } -#endif - } - - } else { - - int fd; - if (create) { - - //create files - sprintf(curr_item, "%s/file.%s%010llu", path, mk_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: create file: %s\n", curr_item); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - open_flags = O_CREAT | O_WRONLY; - cpfd = NULL; - - plfs_ret = plfs_open( &cpfd, curr_item, open_flags, rank, FILEMODE, NULL ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_open for create file" ); - } - } else { - if ((fd = creat(curr_item, FILEMODE)) == -1) { - FAIL("unable to create file"); - } - } -#else - if ((fd = creat(curr_item, FILEMODE)) == -1) { - FAIL("unable to create file"); - } -#endif -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_close( cpfd, rank, uid, open_flags, NULL, &num_ref ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_close file" ); - } - } else { - if (close(fd) == -1) { - FAIL("unable to close file"); - } - } -#else - if (close(fd) == -1) { - FAIL("unable to close file"); - } -#endif - - } else { - - //remove files - sprintf(curr_item, "%s/file.%s%010llu", path, rm_name, itemNum + i); - if (rank == 0 && verbose >= 3) { - printf("V-3: remove file: curr_item is \"%s\"\n", curr_item); - fflush(stdout); - } - if (!(shared_file && rank != 0)) { -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_unlink( curr_item ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_unlink file" ); - } - } else { - if (unlink(curr_item) == -1) { - FAIL("unable to unlink file"); - } - } -#else - if (unlink(curr_item) == -1) { - FAIL("unable to unlink file"); - } -#endif - } - } - } - } -} - -/* recusive function to create and remove files/directories from the - directory tree */ -void create_remove_items(int currDepth, int dirs, int create, int collective, - char *path, unsigned long long dirNum) { - - int i; - char dir[MAX_LEN]; - char temp_path[MAX_LEN]; - unsigned long long currDir = dirNum; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering create_remove_items, currDepth = %d...\n", currDepth); - fflush(stdout); - } - - - memset(dir, 0, MAX_LEN); - strcpy(temp_path, path); - - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items (start): temp_path is \"%s\"\n", temp_path); - fflush(stdout); - } - - if (currDepth == 0) { - /* create items at this depth */ - if (!leaf_only || (depth == 0 && leaf_only)) { - if (collective) { - collective_helper(dirs, create, temp_path, 0); - } else { - create_remove_items_helper(dirs, create, temp_path, 0); - } - } - - if (depth > 0) { - create_remove_items(++currDepth, dirs, create, - collective, temp_path, ++dirNum); - } - - } else if (currDepth <= depth) { - /* iterate through the branches */ - for (i = 0; i < branch_factor; i++) { - - /* determine the current branch and append it to the path */ - sprintf(dir, "%s.%llu/", base_tree_name, currDir); - strcat(temp_path, "/"); - strcat(temp_path, dir); - - if (rank == 0 && verbose >= 3) { - printf("V-3: create_remove_items (for loop): temp_path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* create the items in this branch */ - if (!leaf_only || (leaf_only && currDepth == depth)) { - if (collective) { - collective_helper(dirs, create, temp_path, currDir * items_per_dir); - } else { - create_remove_items_helper(dirs, create, temp_path, currDir * items_per_dir); - } - } - - /* make the recursive call for the next level below this branch */ - create_remove_items( - ++currDepth, - dirs, - create, - collective, - temp_path, - (currDir * (unsigned long long) branch_factor) + 1); - currDepth--; - - /* reset the path */ - strcpy(temp_path, path); - currDir++; - } - } -} - -/* stats all of the items created as specified by the input parameters */ -void mdtest_stat(int random, int dirs, char *path) { - - struct stat buf; - unsigned long long i, parent_dir, item_num = 0; - char item[MAX_LEN], temp[MAX_LEN]; -#ifdef _HAS_PLFS - plfs_error_t plfs_ret; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering mdtest_stat...\n"); - fflush(stdout); - } - - /* determine the number of items to stat*/ - unsigned long long stop = 0; - if (leaf_only) { - stop = items_per_dir * (unsigned long long) pow(branch_factor, depth); - } else { - stop = items; - } - - /* iterate over all of the item IDs */ - for (i = 0; i < stop; i++) { - - /* - * It doesn't make sense to pass the address of the array because that would - * be like passing char **. Tested it on a Cray and it seems to work either - * way, but it seems that it is correct without the "&". - * - memset(&item, 0, MAX_LEN); - */ - memset(item, 0, MAX_LEN); - memset(temp, 0, MAX_LEN); - - /* determine the item number to stat */ - if (random) { - item_num = rand_array[i]; - } else { - item_num = i; - } - - /* make adjustments if in leaf only mode*/ - if (leaf_only) { - item_num += items_per_dir * - (num_dirs_in_tree - (unsigned long long) pow(branch_factor, depth)); - } - - /* create name of file/dir to stat */ - if (dirs) { - if (rank == 0 && verbose >= 3 && (i % ITEM_COUNT == 0) && (i != 0)) { - printf("V-3: stat dir: %010llu\n", i); - fflush(stdout); - } - sprintf(item, "dir.%s%010llu", stat_name, item_num); - } else { - if (rank == 0 && verbose >= 3 && (i % ITEM_COUNT == 0) && (i != 0)) { - printf("V-3: stat file: %010llu\n", i); - fflush(stdout); - } - sprintf(item, "file.%s%010llu", stat_name, item_num); - } - - /* determine the path to the file/dir to be stat'ed */ - parent_dir = item_num / items_per_dir; - - if (parent_dir > 0) { //item is not in tree's root directory - - /* prepend parent directory to item's path */ - sprintf(temp, "%s.%llu/%s", base_tree_name, parent_dir, item); - strcpy(item, temp); - - //still not at the tree's root dir - while (parent_dir > branch_factor) { - parent_dir = (unsigned long long) ((parent_dir - 1) / branch_factor); - sprintf(temp, "%s.%llu/%s", base_tree_name, parent_dir, item); - strcpy(item, temp); - } - } - - /* Now get item to have the full path */ - sprintf(temp, "%s/%s", path, item); - strcpy(item, temp); - - /* below temp used to be hiername */ - if (rank == 0 && verbose >= 3) { - if (dirs) { - printf("V-3: mdtest_stat dir : %s\n", item); - } else { - printf("V-3: mdtest_stat file: %s\n", item); - } - fflush(stdout); - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_getattr( NULL, item, &buf, 0 ); - if ( plfs_ret != PLFS_SUCCESS ) { - if (dirs) { - if ( verbose >= 3 ) { - fprintf( stdout, "V-3: Stat'ing directory \"%s\"\n", item ); - fflush( stdout ); - } - FAIL( "Unable to plfs_getattr directory" ); - } else { - if ( verbose >= 3 ) { - fprintf( stdout, "V-3: Stat'ing file \"%s\"\n", item ); - fflush( stdout ); - } - FAIL( "Unable to plfs_getattr file" ); - } - } - } else { - if (stat(item, &buf) == -1) { - if (dirs) { - if ( verbose >= 3 ) { - fprintf( stdout, "V-3: Stat'ing directory \"%s\"\n", item ); - fflush( stdout ); - } - FAIL("unable to stat directory"); - } else { - if ( verbose >= 3 ) { - fprintf( stdout, "V-3: Stat'ing file \"%s\"\n", item ); - fflush( stdout ); - } - FAIL("unable to stat file"); - } - } - } -#else - if (stat(item, &buf) == -1) { - if (dirs) { - if (verbose >= 3) { - fprintf(stdout, "V-3: Stat'ing directory \"%s\"\n", item); - fflush(stdout); - } - FAIL("unable to stat directory"); - } else { - if (verbose >= 3) { - fprintf(stdout, "V-3: Stat'ing file \"%s\"\n", item); - fflush(stdout); - } - FAIL("unable to stat file"); - } - } -#endif - } -} - - -/* reads all of the items created as specified by the input parameters */ -void mdtest_read(int random, int dirs, char *path) { - - unsigned long long i, parent_dir, item_num = 0; - int fd; - char item[MAX_LEN], temp[MAX_LEN]; -#ifdef _HAS_PLFS - plfs_error_t plfs_ret; - ssize_t bytes_read; - int num_ref; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering mdtest_read...\n"); - fflush(stdout); - } - - /* allocate read buffer */ - if (read_bytes > 0) { - read_buffer = (char *) malloc(read_bytes); - if (read_buffer == NULL) { - FAIL("out of memory"); - } - } - - /* determine the number of items to read */ - unsigned long long stop = 0; - if (leaf_only) { - stop = items_per_dir * (unsigned long long) pow(branch_factor, depth); - } else { - stop = items; - } - - /* iterate over all of the item IDs */ - for (i = 0; i < stop; i++) { - - /* - * It doesn't make sense to pass the address of the array because that would - * be like passing char **. Tested it on a Cray and it seems to work either - * way, but it seems that it is correct without the "&". - * - memset(&item, 0, MAX_LEN); - */ - memset(item, 0, MAX_LEN); - memset(temp, 0, MAX_LEN); - - /* determine the item number to read */ - if (random) { - item_num = rand_array[i]; - } else { - item_num = i; - } - - /* make adjustments if in leaf only mode*/ - if (leaf_only) { - item_num += items_per_dir * - (num_dirs_in_tree - (unsigned long long) pow(branch_factor, depth)); - } - - /* create name of file to read */ - if (dirs) { ; /* N/A */ - } else { - if (rank == 0 && verbose >= 3 && (i % ITEM_COUNT == 0) && (i != 0)) { - printf("V-3: read file: %010llu\n", i); - fflush(stdout); - } - sprintf(item, "file.%s%010llu", read_name, item_num); - } - - /* determine the path to the file/dir to be read'ed */ - parent_dir = item_num / items_per_dir; - - if (parent_dir > 0) { //item is not in tree's root directory - - /* prepend parent directory to item's path */ - sprintf(temp, "%s.%llu/%s", base_tree_name, parent_dir, item); - strcpy(item, temp); - - /* still not at the tree's root dir */ - while (parent_dir > branch_factor) { - parent_dir = (unsigned long long) ((parent_dir - 1) / branch_factor); - sprintf(temp, "%s.%llu/%s", base_tree_name, parent_dir, item); - strcpy(item, temp); - } - } - - /* Now get item to have the full path */ - sprintf(temp, "%s/%s", path, item); - strcpy(item, temp); - - /* below temp used to be hiername */ - if (rank == 0 && verbose >= 3) { - if (dirs) { ; - } else { - printf("V-3: mdtest_read file: %s\n", item); - } - fflush(stdout); - } - - /* open file for reading */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - /* - * If PLFS opens a file as O_RDWR, it suffers a bad performance hit. Looking through the - * code that follows up to the close, this file only gets one read, so we'll open it as - * read-only. - */ - rpfd = NULL; - plfs_ret = plfs_open( &rpfd, item, O_RDONLY, rank, FILEMODE, NULL ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_open for read file" ); - } - } else { - if ((fd = open(item, O_RDWR, FILEMODE)) == -1) { - FAIL("unable to open file"); - } - } -#else - if ((fd = open(item, O_RDWR, FILEMODE)) == -1) { - FAIL("unable to open file"); - } -#endif - - /* read file */ - if (read_bytes > 0) { -#ifdef _HAS_PLFS - /* - * According to Bill Loewe, reads are only done one time, so they are always at - * offset 0 (zero). - */ - if ( using_plfs_path ) { - plfs_ret = plfs_read( rpfd, read_buffer, read_bytes, 0, &bytes_read ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_read file" ); - } - if ( bytes_read != read_bytes ) { - FAIL( "Did not plfs_read the correct number of bytes from the file" ); - } - } else { - if (read(fd, read_buffer, read_bytes) != read_bytes) { - FAIL("unable to read file"); - } - } -#else - if (read(fd, read_buffer, read_bytes) != read_bytes) { - FAIL("unable to read file"); - } -#endif - } - - /* close file */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_close( rpfd, rank, uid, O_RDONLY, NULL, &num_ref ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "Unable to plfs_close file" ); - } - } else { - if (close(fd) == -1) { - FAIL("unable to close file"); - } - } -#else - if (close(fd) == -1) { - FAIL("unable to close file"); - } -#endif - } -} - -/* This method should be called by rank 0. It subsequently does all of - the creates and removes for the other ranks */ -void collective_create_remove(int create, int dirs, int ntasks, char *path) { - - int i; - char temp[MAX_LEN]; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering collective_create_remove...\n"); - fflush(stdout); - } - - /* rank 0 does all of the creates and removes for all of the ranks */ - for (i = 0; i < ntasks; i++) { - - memset(temp, 0, MAX_LEN); - - strcpy(temp, testdir); - strcat(temp, "/"); - - /* set the base tree name appropriately */ - if (unique_dir_per_task) { - sprintf(base_tree_name, "mdtest_tree.%d", i); - } else { - sprintf(base_tree_name, "mdtest_tree"); - } - - /* Setup to do I/O to the appropriate test dir */ - strcat(temp, base_tree_name); - strcat(temp, ".0"); - - /* set all item names appropriately */ - if (!shared_file) { - sprintf(mk_name, "mdtest.%07d.", (i + (0 * nstride)) % ntasks); - sprintf(stat_name, "mdtest.%07d.", (i + (1 * nstride)) % ntasks); - sprintf(read_name, "mdtest.%07d.", (i + (2 * nstride)) % ntasks); - sprintf(rm_name, "mdtest.%07d.", (i + (3 * nstride)) % ntasks); - } - if (unique_dir_per_task) { - sprintf(unique_mk_dir, "%s/mdtest_tree.%d.0", testdir, - (i + (0 * nstride)) % ntasks); - sprintf(unique_chdir_dir, "%s/mdtest_tree.%d.0", testdir, - (i + (1 * nstride)) % ntasks); - sprintf(unique_stat_dir, "%s/mdtest_tree.%d.0", testdir, - (i + (2 * nstride)) % ntasks); - sprintf(unique_read_dir, "%s/mdtest_tree.%d.0", testdir, - (i + (3 * nstride)) % ntasks); - sprintf(unique_rm_dir, "%s/mdtest_tree.%d.0", testdir, - (i + (4 * nstride)) % ntasks); - sprintf(unique_rm_uni_dir, "%s", testdir); - } - - /* Now that everything is set up as it should be, do the create or remove */ - if (rank == 0 && verbose >= 3) { - printf("V-3: collective_create_remove (create_remove_items): temp is \"%s\"\n", temp); - fflush(stdout); - } - - create_remove_items(0, dirs, create, 1, temp, 0); - } - - /* reset all of the item names */ - if (unique_dir_per_task) { - sprintf(base_tree_name, "mdtest_tree.0"); - } else { - sprintf(base_tree_name, "mdtest_tree"); - } - if (!shared_file) { - sprintf(mk_name, "mdtest.%07d.", (0 + (0 * nstride)) % ntasks); - sprintf(stat_name, "mdtest.%07d.", (0 + (1 * nstride)) % ntasks); - sprintf(read_name, "mdtest.%07d.", (0 + (2 * nstride)) % ntasks); - sprintf(rm_name, "mdtest.%07d.", (0 + (3 * nstride)) % ntasks); - } - if (unique_dir_per_task) { - sprintf(unique_mk_dir, "%s/mdtest_tree.%d.0", testdir, - (0 + (0 * nstride)) % ntasks); - sprintf(unique_chdir_dir, "%s/mdtest_tree.%d.0", testdir, - (0 + (1 * nstride)) % ntasks); - sprintf(unique_stat_dir, "%s/mdtest_tree.%d.0", testdir, - (0 + (2 * nstride)) % ntasks); - sprintf(unique_read_dir, "%s/mdtest_tree.%d.0", testdir, - (0 + (3 * nstride)) % ntasks); - sprintf(unique_rm_dir, "%s/mdtest_tree.%d.0", testdir, - (0 + (4 * nstride)) % ntasks); - sprintf(unique_rm_uni_dir, "%s", testdir); - } -} - -void directory_test(int iteration, int ntasks, char *path) { - - int size; - double t[5] = {0}; - char temp_path[MAX_LEN]; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering directory_test...\n"); - fflush(stdout); - } - - MPI_Barrier(testcomm); - t[0] = MPI_Wtime(); - - /* create phase */ - if (create_only) { - if (unique_dir_per_task) { - unique_dir_access(MK_UNI_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 0); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: directory_test: create path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* "touch" the files */ - if (collective_creates) { - if (rank == 0) { - collective_create_remove(1, 1, ntasks, temp_path); - } - } else { - /* create directories */ - create_remove_items(0, 1, 1, 0, temp_path, 0); - } - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[1] = MPI_Wtime(); - - /* stat phase */ - if (stat_only) { - - if (unique_dir_per_task) { - unique_dir_access(STAT_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 1); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: directory_test: stat path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* stat directories */ - if (random_seed > 0) { - mdtest_stat(1, 1, temp_path); - } else { - mdtest_stat(0, 1, temp_path); - } - - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[2] = MPI_Wtime(); - - /* read phase */ - if (read_only) { - - if (unique_dir_per_task) { - unique_dir_access(READ_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 2); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: directory_test: read path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* read directories */ - if (random_seed > 0) { ; /* N/A */ - } else { ; /* N/A */ - } - - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[3] = MPI_Wtime(); - - if (remove_only) { - if (unique_dir_per_task) { - unique_dir_access(RM_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 3); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: directory_test: remove directories path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* remove directories */ - if (collective_creates) { - if (rank == 0) { - collective_create_remove(0, 1, ntasks, temp_path); - } - } else { - create_remove_items(0, 1, 0, 0, temp_path, 0); - } - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[4] = MPI_Wtime(); - - if (remove_only) { - if (unique_dir_per_task) { - unique_dir_access(RM_UNI_DIR, temp_path); - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: directory_test: remove unique directories path is \"%s\"\n", temp_path); - fflush(stdout); - } - } - - if (unique_dir_per_task && !time_unique_dir_overhead) { - offset_timers(t, 4); - } - - MPI_Comm_size(testcomm, &size); - - /* calculate times */ - if (create_only) { - summary_table[iteration].entry[0] = items * size / (t[1] - t[0]); - } else { - summary_table[iteration].entry[0] = 0; - } - if (stat_only) { - summary_table[iteration].entry[1] = items * size / (t[2] - t[1]); - } else { - summary_table[iteration].entry[1] = 0; - } - if (read_only) { - summary_table[iteration].entry[2] = items * size / (t[3] - t[2]); - } else { - summary_table[iteration].entry[2] = 0; - } - if (remove_only) { - summary_table[iteration].entry[3] = items * size / (t[4] - t[3]); - } else { - summary_table[iteration].entry[3] = 0; - } - - if (verbose >= 1 && rank == 0) { - printf("V-1: Directory creation: %14.3f sec, %14.3f ops/sec\n", - t[1] - t[0], summary_table[iteration].entry[0]); - printf("V-1: Directory stat : %14.3f sec, %14.3f ops/sec\n", - t[2] - t[1], summary_table[iteration].entry[1]); -/* N/A - printf("V-1: Directory read : %14.3f sec, %14.3f ops/sec\n", - t[3] - t[2], summary_table[iteration].entry[2]); -*/ - printf("V-1: Directory removal : %14.3f sec, %14.3f ops/sec\n", - t[4] - t[3], summary_table[iteration].entry[3]); - fflush(stdout); - } -} - -void file_test(int iteration, int ntasks, char *path) { - int size; - double t[5] = {0}; - char temp_path[MAX_LEN]; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering file_test...\n"); - fflush(stdout); - } - - MPI_Barrier(testcomm); - t[0] = MPI_Wtime(); - - /* create phase */ - if (create_only) { - if (unique_dir_per_task) { - unique_dir_access(MK_UNI_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 0); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: file_test: create path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* "touch" the files */ - if (collective_creates) { - if (rank == 0) { - collective_create_remove(1, 0, ntasks, temp_path); - } - MPI_Barrier(testcomm); - } - - /* create files */ - create_remove_items(0, 0, 1, 0, temp_path, 0); - - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[1] = MPI_Wtime(); - - /* stat phase */ - if (stat_only) { - - if (unique_dir_per_task) { - unique_dir_access(STAT_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 1); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: file_test: stat path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* stat files */ - if (random_seed > 0) { - mdtest_stat(1, 0, temp_path); - } else { - mdtest_stat(0, 0, temp_path); - } - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[2] = MPI_Wtime(); - - /* read phase */ - if (read_only) { - - if (unique_dir_per_task) { - unique_dir_access(READ_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 2); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: file_test: read path is \"%s\"\n", temp_path); - fflush(stdout); - } - - /* read files */ - if (random_seed > 0) { - mdtest_read(1, 0, temp_path); - } else { - mdtest_read(0, 0, temp_path); - } - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[3] = MPI_Wtime(); - - if (remove_only) { - if (unique_dir_per_task) { - unique_dir_access(RM_SUB_DIR, temp_path); - if (!time_unique_dir_overhead) { - offset_timers(t, 3); - } - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: file_test: rm directories path is \"%s\"\n", temp_path); - fflush(stdout); - } - - if (collective_creates) { - if (rank == 0) { - collective_create_remove(0, 0, ntasks, temp_path); - } - } else { - create_remove_items(0, 0, 0, 0, temp_path, 0); - } - } - - if (barriers) { - MPI_Barrier(testcomm); - } - t[4] = MPI_Wtime(); - - if (remove_only) { - if (unique_dir_per_task) { - unique_dir_access(RM_UNI_DIR, temp_path); - } else { - strcpy(temp_path, path); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: file_test: rm unique directories path is \"%s\"\n", temp_path); - fflush(stdout); - } - } - - if (unique_dir_per_task && !time_unique_dir_overhead) { - offset_timers(t, 4); - } - - MPI_Comm_size(testcomm, &size); - - /* calculate times */ - if (create_only) { - summary_table[iteration].entry[4] = items * size / (t[1] - t[0]); - } else { - summary_table[iteration].entry[4] = 0; - } - if (stat_only) { - summary_table[iteration].entry[5] = items * size / (t[2] - t[1]); - } else { - summary_table[iteration].entry[5] = 0; - } - if (read_only) { - summary_table[iteration].entry[6] = items * size / (t[3] - t[2]); - } else { - summary_table[iteration].entry[6] = 0; - } - if (remove_only) { - summary_table[iteration].entry[7] = items * size / (t[4] - t[3]); - } else { - summary_table[iteration].entry[7] = 0; - } - - if (verbose >= 1 && rank == 0) { - printf("V-1: File creation : %14.3f sec, %14.3f ops/sec\n", - t[1] - t[0], summary_table[iteration].entry[4]); - printf("V-1: File stat : %14.3f sec, %14.3f ops/sec\n", - t[2] - t[1], summary_table[iteration].entry[5]); - printf("V-1: File read : %14.3f sec, %14.3f ops/sec\n", - t[3] - t[2], summary_table[iteration].entry[6]); - printf("V-1: File removal : %14.3f sec, %14.3f ops/sec\n", - t[4] - t[3], summary_table[iteration].entry[7]); - fflush(stdout); - } -} - -void print_help() { - char *opts[] = { - "Usage: mdtest [-b branching_factor] [-B] [-c] [-C] [-d testdir] [-D] [-e number_of_bytes_to_read]", - " [-E] [-f first] [-F] [-h] [-i iterations] [-I items_per_dir] [-l last] [-L]", - " [-n number_of_items] [-N stride_length] [-p seconds] [-r]", - " [-R[seed]] [-s stride] [-S] [-t] [-T] [-u] [-v]", - " [-V verbosity_value] [-w number_of_bytes_to_write] [-y] [-z depth]", - "\t-b: branching factor of hierarchical directory structure", - "\t-B: no barriers between phases", - "\t-c: collective creates: task 0 does all creates", - "\t-C: only create files/dirs", - "\t-d: the directory in which the tests will run", - "\t-D: perform test on directories only (no files)", - "\t-e: bytes to read from each file", - "\t-E: only read files/dir", - "\t-f: first number of tasks on which the test will run", - "\t-F: perform test on files only (no directories)", - "\t-h: prints this help message", - "\t-i: number of iterations the test will run", - "\t-I: number of items per directory in tree", - "\t-l: last number of tasks on which the test will run", - "\t-L: files only at leaf level of tree", - "\t-n: every process will creat/stat/read/remove # directories and files", - "\t-N: stride # between neighbor tasks for file/dir operation (local=0)", - "\t-p: pre-iteration delay (in seconds)", - "\t-r: only remove files or directories left behind by previous runs", - "\t-R: randomly stat files (optional argument for random seed)", - "\t-s: stride between the number of tasks for each test", - "\t-S: shared file access (file only, no directories)", - "\t-t: time unique working directory overhead", - "\t-T: only stat files/dirs", - "\t-u: unique working directory for each task", - "\t-v: verbosity (each instance of option increments by one)", - "\t-V: verbosity value", - "\t-w: bytes to write to each file after it is created", - "\t-y: sync file after writing", - "\t-z: depth of hierarchical directory structure", - "" - }; - int i, j; - - for (i = 0; strlen(opts[i]) > 0; i++) - printf("%s\n", opts[i]); - fflush(stdout); - - MPI_Initialized(&j); - if (j) { - MPI_Finalize(); - } - exit(0); -} - -void summarize_results(int iterations) { - char access[MAX_LEN]; - int i, j, k; - int start, stop, tableSize = 10; - double min, max, mean, sd, sum = 0, var = 0, curr = 0; - - double all[iterations * size * tableSize]; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering summarize_results...\n"); - fflush(stdout); - } - - MPI_Barrier(MPI_COMM_WORLD); - MPI_Gather(&summary_table->entry[0], tableSize * iterations, - MPI_DOUBLE, all, tableSize * iterations, MPI_DOUBLE, - 0, MPI_COMM_WORLD); - - if (rank == 0) { - - printf("\nSUMMARY: (of %d iterations)\n", iterations); - printf( - " Operation Max Min Mean Std Dev\n"); - printf( - " --------- --- --- ---- -------\n"); - fflush(stdout); - - /* if files only access, skip entries 0-3 (the dir tests) */ - if (files_only && !dirs_only) { - start = 4; - } else { - start = 0; - } - - /* if directories only access, skip entries 4-7 (the file tests) */ - if (dirs_only && !files_only) { - stop = 4; - } else { - stop = 8; - } - - /* special case: if no directory or file tests, skip all */ - if (!dirs_only && !files_only) { - start = stop = 0; - } - - /* calculate aggregates */ - if (barriers) { - double maxes[iterations]; - - - /* Because each proc times itself, in the case of barriers we - * have to backwards calculate the time to simulate the use - * of barriers. - */ - for (i = start; i < stop; i++) { - for (j = 0; j < iterations; j++) { - maxes[j] = all[j * tableSize + i]; - for (k = 0; k < size; k++) { - curr = all[(k * tableSize * iterations) - + (j * tableSize) + i]; - if (maxes[j] < curr) { - maxes[j] = curr; - } - } - } - - min = max = maxes[0]; - for (j = 0; j < iterations; j++) { - if (min > maxes[j]) { - min = maxes[j]; - } - if (max < maxes[j]) { - max = maxes[j]; - } - sum += maxes[j]; - } - mean = sum / iterations; - for (j = 0; j < iterations; j++) { - var += pow((mean - maxes[j]), 2); - } - var = var / iterations; - sd = sqrt(var); - switch (i) { - case 0: - strcpy(access, "Directory creation:"); - break; - case 1: - strcpy(access, "Directory stat :"); - break; - /* case 2: strcpy(access, "Directory read :"); break; */ - case 2:; - break; /* N/A */ - case 3: - strcpy(access, "Directory removal :"); - break; - case 4: - strcpy(access, "File creation :"); - break; - case 5: - strcpy(access, "File stat :"); - break; - case 6: - strcpy(access, "File read :"); - break; - case 7: - strcpy(access, "File removal :"); - break; - default: - strcpy(access, "ERR"); - break; - } - if (i != 2) { - printf(" %s ", access); - printf("%14.3f ", max); - printf("%14.3f ", min); - printf("%14.3f ", mean); - printf("%14.3f\n", sd); - fflush(stdout); - } - sum = var = 0; - - } - - } else { - for (i = start; i < stop; i++) { - min = max = all[i]; - for (k = 0; k < size; k++) { - for (j = 0; j < iterations; j++) { - curr = all[(k * tableSize * iterations) - + (j * tableSize) + i]; - if (min > curr) { - min = curr; - } - if (max < curr) { - max = curr; - } - sum += curr; - } - } - mean = sum / (iterations * size); - for (k = 0; k < size; k++) { - for (j = 0; j < iterations; j++) { - var += pow((mean - all[(k * tableSize * iterations) - + (j * tableSize) + i]), 2); - } - } - var = var / (iterations * size); - sd = sqrt(var); - switch (i) { - case 0: - strcpy(access, "Directory creation:"); - break; - case 1: - strcpy(access, "Directory stat :"); - break; - /* case 2: strcpy(access, "Directory read :"); break; */ - case 2:; - break; /* N/A */ - case 3: - strcpy(access, "Directory removal :"); - break; - case 4: - strcpy(access, "File creation :"); - break; - case 5: - strcpy(access, "File stat :"); - break; - case 6: - strcpy(access, "File read :"); - break; - case 7: - strcpy(access, "File removal :"); - break; - default: - strcpy(access, "ERR"); - break; - } - if (i != 2) { - printf(" %s ", access); - printf("%14.3f ", max); - printf("%14.3f ", min); - printf("%14.3f ", mean); - printf("%14.3f\n", sd); - fflush(stdout); - } - sum = var = 0; - - } - } - - /* calculate tree create/remove rates */ - for (i = 8; i < tableSize; i++) { - min = max = all[i]; - for (j = 0; j < iterations; j++) { - curr = summary_table[j].entry[i]; - if (min > curr) { - min = curr; - } - if (max < curr) { - max = curr; - } - sum += curr; - } - mean = sum / (iterations); - for (j = 0; j < iterations; j++) { - var += pow((mean - summary_table[j].entry[i]), 2); - } - var = var / (iterations); - sd = sqrt(var); - switch (i) { - case 8: - strcpy(access, "Tree creation :"); - break; - case 9: - strcpy(access, "Tree removal :"); - break; - default: - strcpy(access, "ERR"); - break; - } - printf(" %s ", access); - printf("%14.3f ", max); - printf("%14.3f ", min); - printf("%14.3f ", mean); - printf("%14.3f\n", sd); - fflush(stdout); - sum = var = 0; - } - } -} - -/* Checks to see if the test setup is valid. If it isn't, fail. */ -void valid_tests() { - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering valid_tests...\n"); - fflush(stdout); - } - - /* if dirs_only and files_only were both left unset, set both now */ - if (!dirs_only && !files_only) { - dirs_only = files_only = 1; - } - - /* if shared file 'S' access, no directory tests */ - if (shared_file) { - dirs_only = 0; - } - - /* check for no barriers with shifting processes for different phases. - that is, one may not specify both -B and -N as it will introduce - race conditions that may cause errors stat'ing or deleting after - creates. - */ - if ((barriers == 0) && (nstride != 0) && (rank == 0)) { - FAIL("Possible race conditions will occur: -B not compatible with -N"); - } - - /* check for collective_creates incompatibilities */ - if (shared_file && collective_creates && rank == 0) { - FAIL("-c not compatible with -S"); - } - if (path_count > 1 && collective_creates && rank == 0) { - FAIL("-c not compatible with multiple test directories"); - } - if (collective_creates && !barriers) { - FAIL("-c not compatible with -B"); - } - - /* check for shared file incompatibilities */ - if (unique_dir_per_task && shared_file && rank == 0) { - FAIL("-u not compatible with -S"); - } - - /* check multiple directory paths and strided option */ - if (path_count > 1 && nstride > 0) { - FAIL("cannot have multiple directory paths with -N strides between neighbor tasks"); - } - - /* check for shared directory and multiple directories incompatibility */ - if (path_count > 1 && unique_dir_per_task != 1) { - FAIL("shared directory mode is not compatible with multiple directory paths"); - } - - /* check if more directory paths than ranks */ - if (path_count > size) { - FAIL("cannot have more directory paths than MPI tasks"); - } - - /* check depth */ - if (depth < 0) { - FAIL("depth must be greater than or equal to zero"); - } - /* check branch_factor */ - if (branch_factor < 1 && depth > 0) { - FAIL("branch factor must be greater than or equal to zero"); - } - /* check for valid number of items */ - if ((items > 0) && (items_per_dir > 0)) { - FAIL("only specify the number of items or the number of items per directory"); - } - -} - -void show_file_system_size(char *file_system) { - char real_path[MAX_LEN]; - char file_system_unit_str[MAX_LEN] = "GiB"; - char inode_unit_str[MAX_LEN] = "Mi"; - long long int file_system_unit_val = 1024 * 1024 * 1024; - long long int inode_unit_val = 1024 * 1024; - long long int total_file_system_size, - free_file_system_size, - total_inodes, - free_inodes; - double total_file_system_size_hr, - used_file_system_percentage, - used_inode_percentage; - struct statfs status_buffer; -#ifdef _HAS_PLFS - struct statvfs stbuf; - plfs_error_t plfs_ret; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering show_file_system_size...\n"); - fflush(stdout); - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - /* - printf( "Detected that file system, \"%s\" is a PLFS file system.\n", file_system ); - */ - - plfs_ret = plfs_statvfs( file_system, &stbuf ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL( "unable to plfs_statvfs() file system" ); - } - } else { - /* - printf( "Detected that file system, \"%s\" is a regular file system.\n", file_system ); - */ - if ( statfs( file_system, &status_buffer ) != 0 ) { - FAIL("unable to statfs() file system"); - } - } -#else - if (statfs(file_system, &status_buffer) != 0) { - FAIL("unable to statfs() file system"); - } -#endif - - /* data blocks */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - total_file_system_size = stbuf.f_blocks * stbuf.f_bsize; - free_file_system_size = stbuf.f_bfree * stbuf.f_bsize; - } else { - total_file_system_size = status_buffer.f_blocks * status_buffer.f_bsize; - free_file_system_size = status_buffer.f_bfree * status_buffer.f_bsize; - } -#else - total_file_system_size = status_buffer.f_blocks * status_buffer.f_bsize; - free_file_system_size = status_buffer.f_bfree * status_buffer.f_bsize; -#endif - used_file_system_percentage = (1 - ((double) free_file_system_size - / (double) total_file_system_size)) * 100; - total_file_system_size_hr = (double) total_file_system_size - / (double) file_system_unit_val; - if (total_file_system_size_hr > 1024) { - total_file_system_size_hr = total_file_system_size_hr / 1024; - strcpy(file_system_unit_str, "TiB"); - } - - /* inodes */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - total_inodes = stbuf.f_files; - free_inodes = stbuf.f_ffree; - } else { - total_inodes = status_buffer.f_files; - free_inodes = status_buffer.f_ffree; - } -#else - total_inodes = status_buffer.f_files; - free_inodes = status_buffer.f_ffree; -#endif - used_inode_percentage = (1 - ((double) free_inodes / (double) total_inodes)) - * 100; - - /* show results */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - strcpy( real_path, file_system ); - } else { - if (realpath(file_system, real_path) == NULL) { - FAIL("unable to use realpath()"); - } - } -#else - if (realpath(file_system, real_path) == NULL) { - FAIL("unable to use realpath()"); - } -#endif - fprintf(stdout, "Path: %s\n", real_path); - fprintf(stdout, "FS: %.1f %s Used FS: %2.1f%% ", - total_file_system_size_hr, file_system_unit_str, - used_file_system_percentage); - fprintf(stdout, "Inodes: %.1f %s Used Inodes: %2.1f%%\n", - (double) total_inodes / (double) inode_unit_val, - inode_unit_str, used_inode_percentage); - fflush(stdout); - - return; -} - -void display_freespace(char *testdirpath) { - char dirpath[MAX_LEN] = {0}; - int i; - int directoryFound = 0; - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering display_freespace...\n"); - fflush(stdout); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: testdirpath is \"%s\"\n", testdirpath); - fflush(stdout); - } - - strcpy(dirpath, testdirpath); - - /* get directory for outfile */ - i = strlen(dirpath); - while (i-- > 0) { - if (dirpath[i] == '/') { - dirpath[i] = '\0'; - directoryFound = 1; - break; - } - } - - /* if no directory/, use '.' */ - if (directoryFound == 0) { - strcpy(dirpath, "."); - } - - if (verbose >= 3 && rank == 0) { - printf("V-3: Before show_file_system_size, dirpath is \"%s\"\n", dirpath); - fflush(stdout); - } - - show_file_system_size(dirpath); - - if (verbose >= 3 && rank == 0) { - printf("V-3: After show_file_system_size, dirpath is \"%s\"\n", dirpath); - fflush(stdout); - } - - return; -} - -void create_remove_directory_tree(int create, - int currDepth, char *path, int dirNum) { - - int i; - char dir[MAX_LEN]; -#ifdef _HAS_PLFS - plfs_error_t plfs_ret; -#endif - - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: Entering create_remove_directory_tree, currDepth = %d...\n", currDepth); - fflush(stdout); - } - - if (currDepth == 0) { - sprintf(dir, "%s/%s.%d/", path, base_tree_name, dirNum); - - if (create) { - if (rank == 0 && verbose >= 2) { - printf("V-2: Making directory \"%s\"\n", dir); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_mkdir( dir, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir directory"); - } - } else { - if (mkdir(dir, DIRMODE) == -1) { - FAIL("Unable to create directory"); - } - } -#else - if (mkdir(dir, DIRMODE) == -1) { - FAIL("Unable to create directory"); - } -#endif - } - - create_remove_directory_tree(create, ++currDepth, dir, ++dirNum); - - if (!create) { - if (rank == 0 && verbose >= 2) { - printf("V-2: Remove directory \"%s\"\n", dir); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_rmdir( dir ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_rmdir directory"); - } - } else { - if (rmdir(dir) == -1) { - FAIL("Unable to remove directory"); - } - } -#else - if (rmdir(dir) == -1) { - FAIL("Unable to remove directory"); - } -#endif - } - } else if (currDepth <= depth) { - - char temp_path[MAX_LEN]; - strcpy(temp_path, path); - int currDir = dirNum; - - for (i = 0; i < branch_factor; i++) { - sprintf(dir, "%s.%d/", base_tree_name, currDir); - strcat(temp_path, dir); - - if (create) { - if (rank == 0 && verbose >= 2) { - printf("V-2: Making directory \"%s\"\n", temp_path); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_mkdir( temp_path, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir directory"); - } - } else { - if (mkdir(temp_path, DIRMODE) == -1) { - FAIL("Unable to create directory"); - } - } -#else - if (mkdir(temp_path, DIRMODE) == -1) { - FAIL("Unable to create directory"); - } -#endif - } - - create_remove_directory_tree(create, ++currDepth, - temp_path, (branch_factor * currDir) + 1); - currDepth--; - - if (!create) { - if (rank == 0 && verbose >= 2) { - printf("V-2: Remove directory \"%s\"\n", temp_path); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - plfs_ret = plfs_rmdir( temp_path ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_rmdir directory"); - } - } else { - if (rmdir(temp_path) == -1) { - FAIL("Unable to remove directory"); - } - } -#else - if (rmdir(temp_path) == -1) { - FAIL("Unable to remove directory"); - } -#endif - } - - strcpy(temp_path, path); - currDir++; - } - } -} - -int main(int argc, char **argv) { - int i, j, k, c; - MPI_Group worldgroup, testgroup; - struct { - int first; - int last; - int stride; - } range = {0, 0, 1}; - int first = 1; - int last = 0; - int stride = 1; - int iterations = 1; - - /* Check for -h parameter before MPI_Init so the mdtest binary can be - called directly, without, for instance, mpirun. */ - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { - print_help(); - } - } - - MPI_Init(&argc, &argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - int name_len; - MPI_Get_processor_name(processor_name, &name_len); - - -#ifdef _HAS_PLFS - pid = getpid(); - uid = getuid(); - plfs_error_t plfs_ret; -#endif - - nodeCount = size / count_tasks_per_node(); - - if (rank == 0) { - printf("-- started at %s --\n\n", timestamp()); - printf("mdtest-%s was launched with %d total task(s) on %d node(s)\n", - RELEASE_VERS, size, nodeCount); - fflush(stdout); - } - - if (rank == 0) { - fprintf(stdout, "Command line used:"); - for (i = 0; i < argc; i++) { - fprintf(stdout, " %s", argv[i]); - } - fprintf(stdout, "\n"); - fflush(stdout); - } - - /* Parse command line options */ - while (1) { - c = getopt(argc, argv, "b:BcCd:De:Ef:Fhi:I:l:Ln:N:p:rR::s:StTuvV:w:yz:"); - if (c == -1) { - break; - } - - switch (c) { - case 'b': - branch_factor = atoi(optarg); - break; - case 'B': - barriers = 0; - break; - case 'c': - collective_creates = 1; - break; - case 'C': - create_only = 1; - break; - case 'd': - parse_dirpath(optarg); - break; - case 'D': - dirs_only = 1; - break; - case 'e': - read_bytes = (size_t) strtoul(optarg, (char **) NULL, 10); - break; - //read_bytes = atoi(optarg); break; - case 'E': - read_only = 1; - break; - case 'f': - first = atoi(optarg); - break; - case 'F': - files_only = 1; - break; - case 'h': - print_help(); - break; - case 'i': - iterations = atoi(optarg); - break; - case 'I': - items_per_dir = (unsigned long long) strtoul(optarg, (char **) NULL, 10); - break; - //items_per_dir = atoi(optarg); break; - case 'l': - last = atoi(optarg); - break; - case 'L': - leaf_only = 1; - break; - case 'n': - items = (unsigned long long) strtoul(optarg, (char **) NULL, 10); - break; - //items = atoi(optarg); break; - case 'N': - nstride = atoi(optarg); - break; - case 'p': - pre_delay = atoi(optarg); - break; - case 'r': - remove_only = 1; - break; - case 'R': - if (optarg == NULL) { - random_seed = time(NULL); - MPI_Barrier(MPI_COMM_WORLD); - MPI_Bcast(&random_seed, 1, MPI_INT, 0, MPI_COMM_WORLD); - random_seed += rank; - } else { - random_seed = atoi(optarg) + rank; - } - break; - case 's': - stride = atoi(optarg); - break; - case 'S': - shared_file = 1; - break; - case 't': - time_unique_dir_overhead = 1; - break; - case 'T': - stat_only = 1; - break; - case 'u': - unique_dir_per_task = 1; - break; - case 'v': - verbose += 1; - break; - case 'V': - verbose = atoi(optarg); - break; - case 'w': - write_bytes = (size_t) strtoul(optarg, (char **) NULL, 10); - break; - //write_bytes = atoi(optarg); break; - case 'y': - sync_file = 1; - break; - case 'z': - depth = atoi(optarg); - break; - } - } - - if (!create_only && !stat_only && !read_only && !remove_only) { - create_only = stat_only = read_only = remove_only = 1; - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "V-1: main: Setting create/stat/read/remove_only to True\n"); - fflush(stdout); - } - } - - valid_tests(); - - if ((rank == 0) && (verbose >= 1)) { - fprintf(stdout, "barriers : %s\n", (barriers ? "True" : "False")); - fprintf(stdout, "collective_creates : %s\n", (collective_creates ? "True" : "False")); - fprintf(stdout, "create_only : %s\n", (create_only ? "True" : "False")); - fprintf(stdout, "dirpath(s):\n"); - for (i = 0; i < path_count; i++) { - fprintf(stdout, "\t%s\n", filenames[i]); - } - fprintf(stdout, "dirs_only : %s\n", (dirs_only ? "True" : "False")); - fprintf(stdout, "read_bytes : %zu\n", read_bytes); - fprintf(stdout, "read_only : %s\n", (read_only ? "True" : "False")); - fprintf(stdout, "first : %d\n", first); - fprintf(stdout, "files_only : %s\n", (files_only ? "True" : "False")); - fprintf(stdout, "iterations : %d\n", iterations); - fprintf(stdout, "items_per_dir : %llu\n", items_per_dir); - fprintf(stdout, "last : %d\n", last); - fprintf(stdout, "leaf_only : %s\n", (leaf_only ? "True" : "False")); - fprintf(stdout, "items : %llu\n", items); - fprintf(stdout, "nstride : %d\n", nstride); - fprintf(stdout, "pre_delay : %d\n", pre_delay); - fprintf(stdout, "remove_only : %s\n", (leaf_only ? "True" : "False")); - fprintf(stdout, "random_seed : %d\n", random_seed); - fprintf(stdout, "stride : %d\n", stride); - fprintf(stdout, "shared_file : %s\n", (shared_file ? "True" : "False")); - fprintf(stdout, "time_unique_dir_overhead: %s\n", (time_unique_dir_overhead ? "True" : "False")); - fprintf(stdout, "stat_only : %s\n", (stat_only ? "True" : "False")); - fprintf(stdout, "unique_dir_per_task : %s\n", (unique_dir_per_task ? "True" : "False")); - fprintf(stdout, "write_bytes : %zu\n", write_bytes); - fprintf(stdout, "sync_file : %s\n", (sync_file ? "True" : "False")); - fprintf(stdout, "depth : %d\n", depth); - fflush(stdout); - } - - /* setup total number of items and number of items per dir */ - if (depth <= 0) { - num_dirs_in_tree = 1; - } else { - if (branch_factor < 1) { - num_dirs_in_tree = 1; - } else if (branch_factor == 1) { - num_dirs_in_tree = depth + 1; - } else { - num_dirs_in_tree = - (1 - pow(branch_factor, depth + 1)) / (1 - branch_factor); - } - } - if (items_per_dir > 0) { - items = items_per_dir * num_dirs_in_tree; - } else { - if (leaf_only) { - if (branch_factor <= 1) { - items_per_dir = items; - } else { - items_per_dir = items / pow(branch_factor, depth); - items = items_per_dir * pow(branch_factor, depth); - } - } else { - items_per_dir = items / num_dirs_in_tree; - items = items_per_dir * num_dirs_in_tree; - } - } - - /* initialize rand_array */ - if (random_seed > 0) { - srand(random_seed); - - unsigned long long stop = 0; - unsigned long long s; - - if (leaf_only) { - stop = items_per_dir * (unsigned long long) pow(branch_factor, depth); - } else { - stop = items; - } - rand_array = (unsigned long long *) malloc(stop * sizeof(unsigned long long)); - - for (s = 0; s < stop; s++) { - rand_array[s] = s; - } - - /* shuffle list randomly */ - unsigned long long n = stop; - while (n > 1) { - n--; - - /* - * Generate a random number in the range 0 .. n - * - * rand() returns a number from 0 .. RAND_MAX. Divide that - * by RAND_MAX and you get a floating point number in the - * range 0 .. 1. Multiply that by n and you get a number in - * the range 0 .. n. - */ - - unsigned long long k = - (unsigned long long) (((double) rand() / (double) RAND_MAX) * (double) n); - - /* - * Now move the nth element to the kth (randomly chosen) - * element, and the kth element to the nth element. - */ - - unsigned long long tmp = rand_array[k]; - rand_array[k] = rand_array[n]; - rand_array[n] = tmp; - } - } - - /* allocate and initialize write buffer with # */ - if (write_bytes > 0) { - write_buffer = (char *) malloc(write_bytes); - if (write_buffer == NULL) { - FAIL("out of memory"); - } - memset(write_buffer, 0x23, write_bytes); - } - - /* setup directory path to work in */ - if (path_count == 0) { /* special case where no directory path provided with '-d' option */ - char *cwd = getcwd(testdirpath, MAX_LEN); - if (cwd == NULL) { - FAIL("unexspected error by getting current working directory"); - } - path_count = 1; - } else { - strcpy(testdirpath, filenames[rank % path_count]); - } - -#ifdef _HAS_PLFS - using_plfs_path = is_plfs_path( testdirpath ); -#endif - - /* if directory does not exist, create it */ -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if ( rank < path_count ) { - plfs_ret = plfs_access( testdirpath, F_OK ); - if ( plfs_ret != PLFS_SUCCESS ) { - plfs_ret = plfs_mkdir( testdirpath, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir test directory path"); - } - } - } - } else { - if ((rank < path_count) && access(testdirpath, F_OK) != 0) { - if (mkdir(testdirpath, DIRMODE) != 0) { - FAIL("Unable to create test directory path"); - } - } - } -#else - if ((rank < path_count) && access(testdirpath, F_OK) != 0) { - if (mkdir(testdirpath, DIRMODE) != 0) { - FAIL("Unable to create test directory path"); - } - } -#endif - - /* display disk usage */ - if (verbose >= 3 && rank == 0) { - printf("V-3: main (before display_freespace): testdirpath is \"%s\"\n", testdirpath); - fflush(stdout); - } - - //if (rank == 0) display_freespace(testdirpath); - - if (verbose >= 3 && rank == 0) { - printf("V-3: main (after display_freespace): testdirpath is \"%s\"\n", testdirpath); - fflush(stdout); - } - - if (rank == 0) { - if (random_seed > 0) { - printf("random seed: %d\n", random_seed); - } - } - - if (gethostname(hostname, MAX_LEN) == -1) { - perror("gethostname"); - MPI_Abort(MPI_COMM_WORLD, 2); - } - - if (last == 0) { - first = size; - last = size; - } - - /* setup summary table for recording results */ - summary_table = (table_t *) malloc(iterations * sizeof(table_t)); - if (summary_table == NULL) { - FAIL("out of memory"); - } - - if (unique_dir_per_task) { - sprintf(base_tree_name, "mdtest_tree.%d", rank); - } else { - sprintf(base_tree_name, "mdtest_tree"); - } - - /* start and end times of directory tree create/remove */ - double startCreate, endCreate; - - /* default use shared directory */ - strcpy(mk_name, "mdtest.shared."); - strcpy(stat_name, "mdtest.shared."); - strcpy(read_name, "mdtest.shared."); - strcpy(rm_name, "mdtest.shared."); - - /* periodic output set filenames in a new directory */ - if (create_only & (PERI_ITEM_STEPS || PERI_TIME_STEPS)) { - char periodic_out_path[MAX_LEN]; - sprintf(periodic_out_path, "/tmp/mdtest_periodic_out"); - struct stat st = {0}; - if (stat(periodic_out_path, &st) == -1) { - mkdir(periodic_out_path, DIRMODE); - } else { - //if it already exists, delete contents inside - DIR *tmpfolder = opendir(periodic_out_path); - struct dirent *next_file; - char filepath[MAX_LEN]; - while ( (next_file = readdir(tmpfolder)) != NULL ) - { - // build the path for each file in the folder - sprintf(filepath, "%s/%s", periodic_out_path, next_file->d_name); - remove(filepath); - } - } - snprintf(filename_buffer_periodic, sizeof(char) * MAX_LEN, "%s/rank_%d_%s_periodic.out", periodic_out_path, - rank, processor_name); - snprintf(filename_buffer_periodic_all, sizeof(char) * MAX_LEN, "%s/rank_all_%s_periodic.out", periodic_out_path, - processor_name); - FILE *f = fopen(filename_buffer_periodic, "w"); - if (f == NULL) { - FAIL("Error creating file for periodic output!\n"); - } - fclose(f); - if (rank == 0) { - FILE *f = fopen(filename_buffer_periodic_all, "w"); - if (f == NULL) { - FAIL("Error creating file for periodic output rank 0!\n"); - } - fclose(f); - } - } - - MPI_Comm_group(MPI_COMM_WORLD, &worldgroup); - /* Run the tests */ - for (i = first; i <= last && i <= size; i += stride) { - range.last = i - 1; - MPI_Group_range_incl(worldgroup, 1, (void *) &range, &testgroup); - MPI_Comm_create(MPI_COMM_WORLD, testgroup, &testcomm); - if (rank == 0) { - if (files_only && dirs_only) { - printf("\n%d tasks, %llu files/directories\n", i, i * items); - } else if (files_only) { - if (!shared_file) { - printf("\n%d tasks, %llu files\n", i, i * items); - } - else { - printf("\n%d tasks, 1 file\n", i); - } - } else if (dirs_only) { - printf("\n%d tasks, %llu directories\n", i, i * items); - } - } - if (rank == 0 && verbose >= 1) { - printf("\n"); - printf(" Operation Duration Rate\n"); - printf(" --------- -------- ----\n"); - } - for (j = 0; j < iterations; j++) { - if (rank == 0 && verbose >= 1) { - printf("V-1: main: * iteration %d *\n", j + 1); - fflush(stdout); - } - //printf("1: Testdir: %s , Testdirpath: %s , TEST_DIR: %s \n", testdir, testdirpath, TEST_DIR); - strcpy(testdir, testdirpath); - if (testdir[strlen(testdir) - 1] != '/') { - strcat(testdir, "/"); - } - //printf("2: Testdir: %s , Testdirpath: %s \n", testdir, testdirpath); - strcat(testdir, TEST_DIR); - //printf("3: Testdir: %s , Testdirpath: %s \n", testdir, testdirpath); - char testdir2[MAX_LEN]; - sprintf(testdir2, "%s.%d", testdir, j); - //sprintf(testdir, "%s.%d", testdir, j); - //printf("4: Testdir: %s , Testdir2: %s \n", testdir, testdir2); - strcpy(testdir, testdir2); - if (verbose >= 2 && rank == 0) { - printf("V-2: main (for j loop): making testdir, \"%s\"\n", testdir); - fflush(stdout); - } -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if ( rank < path_count ) { - plfs_ret = plfs_access( testdir, F_OK ); - if ( plfs_ret != PLFS_SUCCESS ) { - plfs_ret = plfs_mkdir( testdir, DIRMODE ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_mkdir test directory"); - } - } - } - } else { - if ((rank < path_count) && access(testdir, F_OK) != 0) { - if (mkdir(testdir, DIRMODE) != 0) { - FAIL("Unable to create test directory"); - } - } - } -#else - if ((rank < path_count) && access(testdir, F_OK) != 0) { - if (mkdir(testdir, DIRMODE) != 0) { - FAIL("Unable to create test directory"); - } - } -#endif - MPI_Barrier(MPI_COMM_WORLD); - //print iteration into periodic file output - if (create_only & (PERI_ITEM_STEPS || PERI_TIME_STEPS)) { - FILE *f = fopen(filename_buffer_periodic, "a"); - if (f == NULL) { - FAIL("Error creating file for periodic output!\n"); - } - fprintf(f, "\n\n", j); - fclose(f); - if (rank == 0) { - FILE *f = fopen(filename_buffer_periodic_all, "a"); - if (f == NULL) { - FAIL("Error creating file for periodic output rank 0!\n"); - } - fprintf(f, "\n\n", j); - fclose(f); - } - } - /* create hierarchical directory structure */ - MPI_Barrier(MPI_COMM_WORLD); - if (create_only) { - startCreate = MPI_Wtime(); - if (unique_dir_per_task) { - if (collective_creates && (rank == 0)) { - /* - * This is inside two loops, one of which already uses "i" and the other uses "j". - * I don't know how this ever worked. I'm changing this loop to use "k". - */ - for (k = 0; k < size; k++) { - sprintf(base_tree_name, "mdtest_tree.%d", k); - - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (create hierarchical directory loop-collective): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(1, 0, testdir, 0); - } - } else if (!collective_creates) { - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (create hierarchical directory loop-!collective_creates): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(1, 0, testdir, 0); - } - } else { - if (rank == 0) { - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (create hierarchical directory loop-!unque_dir_per_task): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(1, 0, testdir, 0); - } - } - MPI_Barrier(MPI_COMM_WORLD); - endCreate = MPI_Wtime(); - summary_table[j].entry[8] = - num_dirs_in_tree / (endCreate - startCreate); - if (verbose >= 1 && rank == 0) { - printf("V-1: main: Tree creation : %14.3f sec, %14.3f ops/sec\n", - (endCreate - startCreate), summary_table[j].entry[8]); - fflush(stdout); - } - } else { - summary_table[j].entry[8] = 0; - } - sprintf(unique_mk_dir, "%s/%s.0", testdir, base_tree_name); - sprintf(unique_chdir_dir, "%s/%s.0", testdir, base_tree_name); - sprintf(unique_stat_dir, "%s/%s.0", testdir, base_tree_name); - sprintf(unique_read_dir, "%s/%s.0", testdir, base_tree_name); - sprintf(unique_rm_dir, "%s/%s.0", testdir, base_tree_name); - sprintf(unique_rm_uni_dir, "%s", testdir); - - if (!unique_dir_per_task) { - if (verbose >= 3 && rank == 0) { - printf("V-3: main: Using unique_mk_dir, \"%s\"\n", unique_mk_dir); - fflush(stdout); - } - } - - if (rank < i) { - if (!shared_file) { - sprintf(mk_name, "mdtest.%07d.", (rank + (0 * nstride)) % i); - sprintf(stat_name, "mdtest.%07d.", (rank + (1 * nstride)) % i); - sprintf(read_name, "mdtest.%07d.", (rank + (2 * nstride)) % i); - sprintf(rm_name, "mdtest.%07d.", (rank + (3 * nstride)) % i); - } - if (unique_dir_per_task) { - sprintf(unique_mk_dir, "%s/mdtest_tree.%d.0", testdir, - (rank + (0 * nstride)) % i); - sprintf(unique_chdir_dir, "%s/mdtest_tree.%d.0", testdir, - (rank + (1 * nstride)) % i); - sprintf(unique_stat_dir, "%s/mdtest_tree.%d.0", testdir, - (rank + (2 * nstride)) % i); - sprintf(unique_read_dir, "%s/mdtest_tree.%d.0", testdir, - (rank + (3 * nstride)) % i); - sprintf(unique_rm_dir, "%s/mdtest_tree.%d.0", testdir, - (rank + (4 * nstride)) % i); - sprintf(unique_rm_uni_dir, "%s", testdir); - } - strcpy(top_dir, unique_mk_dir); - - if (verbose >= 3 && rank == 0) { - printf("V-3: main: Copied unique_mk_dir, \"%s\", to topdir\n", unique_mk_dir); - fflush(stdout); - } - - if (dirs_only && !shared_file) { - if (pre_delay) { - delay_secs(pre_delay); - } - directory_test(j, i, unique_mk_dir); - } - if (files_only) { - if (pre_delay) { - delay_secs(pre_delay); - } - file_test(j, i, unique_mk_dir); - } - } - - /* remove directory structure */ - if (!unique_dir_per_task) { - if (verbose >= 3 && rank == 0) { - printf("V-3: main: Using testdir, \"%s\"\n", testdir); - fflush(stdout); - } - } - - MPI_Barrier(MPI_COMM_WORLD); - if (remove_only) { - startCreate = MPI_Wtime(); - if (unique_dir_per_task) { - if (collective_creates && (rank == 0)) { - /* - * This is inside two loops, one of which already uses "i" and the other uses "j". - * I don't know how this ever worked. I'm changing this loop to use "k". - */ - for (k = 0; k < size; k++) { - sprintf(base_tree_name, "mdtest_tree.%d", k); - - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (remove hierarchical directory loop-collective): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(0, 0, testdir, 0); - } - } else if (!collective_creates) { - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (remove hierarchical directory loop-!collective): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(0, 0, testdir, 0); - } - } else { - if (rank == 0) { - if (verbose >= 3 && rank == 0) { - printf( - "V-3: main (remove hierarchical directory loop-!unique_dir_per_task): Calling create_remove_directory_tree with \"%s\"\n", - testdir); - fflush(stdout); - } - - /* - * Let's pass in the path to the directory we most recently made so that we can use - * full paths in the other calls. - */ - create_remove_directory_tree(0, 0, testdir, 0); - } - } - - MPI_Barrier(MPI_COMM_WORLD); - endCreate = MPI_Wtime(); - summary_table[j].entry[9] = num_dirs_in_tree - / (endCreate - startCreate); - if (verbose >= 1 && rank == 0) { - printf("V-1: main Tree removal : %14.3f sec, %14.3f ops/sec\n", - (endCreate - startCreate), summary_table[j].entry[9]); - fflush(stdout); - } - - if ((rank == 0) && (verbose >= 2)) { - fprintf(stdout, "V-2: main (at end of for j loop): Removing testdir of \"%s\"\n", testdir); - fflush(stdout); - } - -#ifdef _HAS_PLFS - if ( using_plfs_path ) { - if ( rank < path_count ) { - plfs_ret = plfs_access( testdir, F_OK ); - if ( plfs_ret == PLFS_SUCCESS ) { - plfs_ret = plfs_rmdir( testdir ); - if ( plfs_ret != PLFS_SUCCESS ) { - FAIL("Unable to plfs_rmdir directory"); - } - } - } - } else { - if ((rank < path_count) && access(testdir, F_OK) == 0) { - //if (( rank == 0 ) && access(testdir, F_OK) == 0) { - if (rmdir(testdir) == -1) { - FAIL("unable to remove directory"); - } - } - } -#else - if ((rank < path_count) && access(testdir, F_OK) == 0) { - //if (( rank == 0 ) && access(testdir, F_OK) == 0) { - if (rmdir(testdir) == -1) { - FAIL("unable to remove directory"); - } - } -#endif - } else { - summary_table[j].entry[9] = 0; - } - //get 1 process per node for cache flushing -// int valid_for_sync = 0; -// if (nodeCount == 1 && rank == 0) { -// //rank 0 syncs if only one host is running -// valid_for_sync = 1; -// } else if (nodeCount > 1) { -// int relative_node_rank = rank % (nodeCount * size); -// if (relative_node_rank == 0) { -// valid_for_sync = 1; -// } -// } -// //acquired process above will sync -// if (valid_for_sync == 1) { -// if (verbose >= 1) { -// fprintf(stdout, "V-1: main: Node %s will now be synced...\n", processor_name); -// fflush(stdout); -// } -//// printf("Hi, I am rank %d from processor %s and I will now sync...\n", rank, processor_name); -// sync(); -// if (verbose >= 1) { -// fprintf(stdout, "V-1: main: Node %s sync completed...\n", processor_name); -// } -//// printf("Rank %d from processor %s completed sync operation...\n", rank, processor_name); -// } - } - - summarize_results(iterations); - if (i == 1 && stride > 1) { - i = 0; - } - } - - if (rank == 0) { - printf("\n-- finished at %s --\n", timestamp()); - fflush(stdout); - } - - if (random_seed > 0) { - free(rand_array); - } - - MPI_Finalize(); - exit(0); -} diff --git a/ifs/scripts/eval/ior_to_csv.py b/ifs/scripts/eval/ior_to_csv.py deleted file mode 100644 index cf86d598660b933bed73561c524aa30e4939e383..0000000000000000000000000000000000000000 --- a/ifs/scripts/eval/ior_to_csv.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import argparse - -import numpy as np -import os - -__author__ = "Marc-Andre Vef" -__email__ = "vef@uni-mainz.de" - -node_n = list() -results_n = list() - - -def mebi_to_mega(size): - return (float(size) * 1024 * 1024) / 1000 / 1000 - - -def transfer_to_mb(transfer_size_unit): - # size in gigabytes - if transfer_size_unit[-1] == 'g': - transfersize_kb = float(transfer_size_unit[:-1]) * 1024 - # size in megabytes - elif transfer_size_unit[-1] == 'm': - return float(transfer_size_unit[:-1]) - # size in kilobytes - elif transfer_size_unit[-1] == 'k': - return float(transfer_size_unit[:-1]) / 1024 - # size in bytes - else: - return float(transfer_size_unit[:-1]) / 1024 / 1024 - - -def parse_file(filepath): - write_tmp = [] - read_tmp = [] - write_avg = [] - write_std = [] - read_avg = [] - read_std = [] - transfersizes = [] - write_iops_avg = [] - read_iops_avg = [] - iter_n_tmp = 0 - iter_n = [] - n = 0 - set_n = 0 - curr_transfer_size_unit = '' - with open(filepath, 'r') as rf: - for line_idx, line in enumerate(rf.readlines()): - if 'Startup successful. Daemon is ready.' in line: - n += 1 - if line_idx == 1: # Second line has slurm set nodes information - set_n = int(line.strip()) - if '' in line: - curr_transfer_size_unit = line.strip().split(';')[1] - write_tmp = [] - read_tmp = [] - iter_n_tmp = 0 - if '' in line: - transfersizes.append(curr_transfer_size_unit) - # calc average throughput - write_avg.append(np.mean(write_tmp)) - write_std.append(np.std(write_tmp)) - # calc average standard deviation over all iterations - read_avg.append(np.mean(read_tmp)) - read_std.append(np.std(read_tmp)) - # calc write and read operations per second (i.e. IOPS) - transfer_norm = transfer_to_mb(curr_transfer_size_unit) - write_avg_mb = mebi_to_mega(write_avg[-1]) - write_iops_avg.append(write_avg_mb / transfer_norm) - read_avg_mb = mebi_to_mega(read_avg[-1]) - read_iops_avg.append(read_avg_mb / transfer_norm) - iter_n.append(iter_n_tmp) - curr_transfer_size_unit = '' - if 'Max Write' in line: - write_tmp.append(float(line.split(' ')[2])) - iter_n_tmp += 1 - if 'Max Read' in line: - read_tmp.append(float(line.split(' ')[3])) - if 'DAEMON STOP' in line: - break - if len(write_avg) == 0 or len(read_avg) == 0: - # something is wrong. discard this file - print 'File %s does not contain results' % filepath - return - if set_n != n: - # Something was wrong during test daemon startup - print 'MISMATCH: Set number of hosts (%d) and number of successful host daemon startup hosts (%d)' % (set_n, n) - # put create stat and remove into dict index 0: avg, index 1 std - node_n.append(n) - tmp_d = dict() - tmp_d['transfersizes'] = transfersizes - tmp_d['write_avg'] = write_avg - tmp_d['read_avg'] = read_avg - tmp_d['write_std'] = write_std - tmp_d['read_std'] = read_std - tmp_d['write_iops_avg'] = write_iops_avg - tmp_d['read_iops_avg'] = read_iops_avg - tmp_d['node_n'] = n - tmp_d['iter_n'] = iter_n - results_n.append(tmp_d) - - -def parse_ior_out(inpath, outpath='', printshell=False, printonly=True, calc_iops=True, calc_std=False): - if not os.path.exists(inpath) or not os.path.isdir(inpath): - print "Input path does not exist or is not a directory. Exiting." - exit(1) - # parse input - in_depth = inpath.count(os.path.sep) - for root, dirs, files in os.walk(inpath): - curr_depth = root.count(os.path.sep) - if curr_depth > in_depth: - break - for file in files: - filepath = '%s/%s' % (root, file) - parse_file(filepath) - - # create csv output - csv_write_avg_l = list() - csv_read_avg_l = list() - csv_write_std_l = list() - csv_read_std_l = list() - csv_write_iops_avg_l = list() - csv_read_iops_avg_l = list() - csv_iteration_n_l = list() - header_string = '# nodes,%s' % ','.join([x for x in results_n[0]['transfersizes']]) - for i in range(len(node_n)): - csv_write_avg = '%s,%s' % (node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['write_avg']])) - csv_write_avg_l.append([node_n[i], csv_write_avg]) - csv_read_avg = '%s,%s' % (node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['read_avg']])) - csv_read_avg_l.append([node_n[i], csv_read_avg]) - csv_write_std = '%s,%s' % (node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['write_std']])) - csv_write_std_l.append([node_n[i], csv_write_std]) - csv_read_std = '%s,%s' % (node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['read_std']])) - csv_read_std_l.append([node_n[i], csv_read_std]) - csv_write_iops_avg = '%s,%s' % ( - node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['write_iops_avg']])) - csv_write_iops_avg_l.append([node_n[i], csv_write_iops_avg]) - csv_read_iops_avg = '%s,%s' % (node_n[i], ','.join(["{:.2f}".format(x) for x in results_n[i]['read_iops_avg']])) - csv_read_iops_avg_l.append([node_n[i], csv_read_iops_avg]) - csv_iteration_n = '%s,%s' % (node_n[i], ','.join([str(x) for x in results_n[i]['iter_n']])) - csv_iteration_n_l.append([node_n[i], csv_iteration_n]) - # sort by number of nodes and create csvs - csv_write_avg_l.sort(key=lambda x: x[0]) - csv_write_avg = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_write_avg_l])) - csv_read_avg_l.sort(key=lambda x: x[0]) - csv_read_avg = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_read_avg_l])) - csv_write_std_l.sort(key=lambda x: x[0]) - csv_write_std = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_write_std_l])) - csv_read_std_l.sort(key=lambda x: x[0]) - csv_read_std = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_read_std_l])) - csv_write_iops_avg_l.sort(key=lambda x: x[0]) - csv_write_iops_avg = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_write_iops_avg_l])) - csv_read_iops_avg_l.sort(key=lambda x: x[0]) - csv_read_iops_avg = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_read_iops_avg_l])) - csv_iteration_n_l.sort(key=lambda x: x[0]) - csv_iteration_n = '%s\n%s' % (header_string, '\n'.join([x[1] for x in csv_iteration_n_l])) - # print output - if printshell: - print '\nWrite_avg:' - print csv_write_avg - print '\nRead_avg:' - print csv_read_avg - if calc_std: - print '\nWrite_std:' - print csv_write_std - print '\nRead_std:' - print csv_read_std - if calc_iops: - print '\nWrite_IOPS_avg:' - print csv_write_iops_avg - print '\nRead_IOPS_avg:' - print csv_read_iops_avg - # print iterations - print '\niteration_n:' - print csv_iteration_n - - if not printonly and outpath != '': - # write output - with open(outpath, 'w') as wf: - wf.write('Write_avg:') - wf.write(csv_write_avg) - wf.write('Read_avg:') - wf.write(csv_read_avg) - if calc_std: - wf.write('Write_std:') - wf.write(csv_write_std) - wf.write('Read_std:') - wf.write(csv_read_std) - if calc_iops: - wf.write('Write_IOPS_avg:') - wf.write(csv_write_iops_avg) - wf.write('Read_IOPS_avg:') - wf.write(csv_read_iops_avg) - - -if __name__ == "__main__": - # Init parser - parser = argparse.ArgumentParser(description='This script converts an ior output file into a csv. ' - 'If only input path is given, csv is printed on shell', - formatter_class=argparse.RawTextHelpFormatter) - # positional arguments - parser.add_argument('ior_in_path', type=str, - help='path to the ior out input file. If its a directory it will process all files in it.') - parser.add_argument('-o', '--output', metavar='', type=str, default='', - help='path to the csv output file location') - parser.add_argument('-p', '--printshell', action='store_true', - help='Output csv on shell') - parser.add_argument('--printonly', action='store_true', - help='Only output csv on shell') - parser.add_argument('-s', '--std', action='store_true', - help='Set to output standard deviation') - parser.add_argument('-i', '--iops', action='store_true', - help='Enable calculating write and read oprations per second') - - args = parser.parse_args() - calc_std = True if args.std else False - calc_iops = True if args.iops else False - print_shell = False - print_only = False - out_path = '' - if args.printshell and args.output != '' and not args.printonly: - print_shell = True - print_only = False - out_path = args.output - elif args.output != '' and not args.printonly: - print_shell = False - print_only = False - out_path = args.output - else: - print_shell = True - print_only = True - - parse_ior_out(args.ior_in_path, out_path, print_shell, print_only, calc_iops, calc_std) - - print '\nNothing left to do; exiting. :)' diff --git a/ifs/scripts/eval/mdtest_to_csv.py b/ifs/scripts/eval/mdtest_to_csv.py deleted file mode 100644 index 16daff017100a56c221ee84b75b5576facbb526a..0000000000000000000000000000000000000000 --- a/ifs/scripts/eval/mdtest_to_csv.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import argparse - -import numpy as np -import os - -__author__ = "Marc-Andre Vef" -__email__ = "vef@uni-mainz.de" - -node_n = list() -mdtest_d = dict(create_avg=list(), stat_avg=list(), remove_avg=list(), create_std=list(), stat_std=list(), - remove_std=list(), iter_n=list()) - - -def parse_file(filepath): - flag = False - # extraxt relevant info from file and put it into mdtest_out list - mdtest_out = [] - create_tmp = [] - stat_tmp = [] - remove_tmp = [] - n = 0 - set_n = 0 - with open(filepath, 'r') as rf: - for line_idx, line in enumerate(rf.readlines()): - if 'Startup successful. Daemon is ready.' in line: - n += 1 - if line_idx == 2: # Third line has slurm set nodes information - set_n = int(line.strip()) - if 'SUMMARY: (of' in line: - flag = True - if '-- finished at ' in line or 'V-1: Entering timestamp...' in line: - flag = False - # Filter for relevant stuff - mdtest_out = mdtest_out[3:-2] - # put values for iteration in tmp lists - create_tmp.append(float([x for x in mdtest_out[0].strip().split(' ') if x][-2:-1][0])) - stat_tmp.append(float([x for x in mdtest_out[1].strip().split(' ') if x][-2:-1][0])) - remove_tmp.append(float([x for x in mdtest_out[3].strip().split(' ') if x][-2:-1][0])) - mdtest_out = [] - if flag: - mdtest_out.append(line.strip()) - if 'DAEMON STOP' in line: - break - if len(create_tmp) == 0: - # something is wrong. discard this file - print 'File %s does not contain mdtest results' % filepath - return - if set_n != n: - # Something was wrong during test daemon startup - print 'MISMATCH: Set number of hosts (%d) and number of successful host daemon startup hosts (%d)' % (set_n, n) - node_n.append(n) - # calc mean and standard deviation - iter_n = len(create_tmp) - mdtest_d['create_avg'].append("{:.2f}".format(np.mean(create_tmp))) - mdtest_d['create_std'].append("{:.2f}".format(np.std(create_tmp))) - mdtest_d['stat_avg'].append("{:.2f}".format(np.mean(stat_tmp))) - mdtest_d['stat_std'].append("{:.2f}".format(np.std(stat_tmp))) - mdtest_d['remove_avg'].append("{:.2f}".format(np.mean(remove_tmp))) - mdtest_d['remove_std'].append("{:.2f}".format(np.std(remove_tmp))) - mdtest_d['iter_n'].append(iter_n) - - -def parse_mdtest_out(inpath, outpath='', printshell=False, printonly=True): - if not os.path.exists(inpath) or not os.path.isdir(inpath): - print "Input path does not exist or is not a directory. Exiting." - exit(1) - # parse input - in_depth = inpath.count(os.path.sep) - for root, dirs, files in os.walk(inpath): - curr_depth = root.count(os.path.sep) - if curr_depth > in_depth: - break - for file in files: - filepath = '%s/%s' % (root, file) - parse_file(filepath) - - # create output - # first put node number and their mdtest numbers in list and sort them - csv_l = list() - for i in range(len(node_n)): - csv_line = '' - csv_line += '%s,' % mdtest_d['create_avg'][i] - csv_line += '%s,' % mdtest_d['stat_avg'][i] - csv_line += '%s,' % mdtest_d['remove_avg'][i] - csv_line += '%s,' % mdtest_d['create_std'][i] - csv_line += '%s,' % mdtest_d['stat_std'][i] - csv_line += '%s,' % mdtest_d['remove_std'][i] - csv_line += '%s\n' % mdtest_d['iter_n'][i] - csv_l.append([node_n[i], csv_line]) - csv_l.sort(key=lambda x: x[0]) - # convert sorted list into csv text file - csv = '\nn,creates_avg/sec,stats_avg/sec,remove_avg/sec,create_std,stat_std,remove_std,#_iterations\n' - for i in csv_l: - csv += '%d,%s' % (i[0], i[1]) - # print output - if printshell: - print csv - if not printonly and outpath != '': - # write output - with open(outpath, 'w') as wf: - wf.write(csv) - - -if __name__ == "__main__": - # Init parser - parser = argparse.ArgumentParser(description='This script converts an mdtest output file into a csv. ' - 'If only input path is given, csv is printed on shell', - formatter_class=argparse.RawTextHelpFormatter) - # positional arguments - parser.add_argument('mdtest_in_path', type=str, - help='path to the mdtest out input file. If its a directory it will process all files in it.') - parser.add_argument('-o', '--output', metavar='', type=str, default='', - help='path to the csv output file location') - parser.add_argument('-p', '--printshell', action='store_true', - help='Output csv on shell') - parser.add_argument('--printonly', action='store_true', - help='Only output csv on shell') - args = parser.parse_args() - if args.printshell and args.output != '' and not args.printonly: - parse_mdtest_out(args.mdtest_in_path, args.output, True, False) - elif args.output != '' and not args.printonly: - parse_mdtest_out(args.mdtest_in_path, args.output, False, False) - else: - parse_mdtest_out(args.mdtest_in_path, '', True, True) - - print '\nNothing left to do; exiting. :)' diff --git a/ifs/scripts/eval/tmp/ior_used_nodes.py b/ifs/scripts/eval/tmp/ior_used_nodes.py deleted file mode 100644 index fdb060e89604a6ad08eae7e8ad227961201ca3a5..0000000000000000000000000000000000000000 --- a/ifs/scripts/eval/tmp/ior_used_nodes.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import argparse - -import os - -__author__ = "Marc-Andre Vef" -__email__ = "vef@uni-mainz.de" - -nodes = list() - - -def parse_file(filepath): - n = 0 - nodes_tmp = list() - with open(filepath, 'r') as rf: - for line in rf.readlines(): - if 'Startup successful. Daemon is ready.' in line: - n += 1 - if '[SUCCESS]' in line: - nodes_tmp.append(int(line.strip().split()[-1][1:])) - if 'DAEMON STOP' in line: - break - # put create stat and remove into dict index 0: avg, index 1 std - nodes_tmp.sort(key=lambda x: x) - nodes.append(nodes_tmp) - - -def parse_ior_out(inpath, faulty_node_set): - if not os.path.exists(inpath) or not os.path.isdir(inpath): - print "Input path does not exist or is not a directory. Exiting." - exit(1) - # parse input - in_depth = inpath.count(os.path.sep) - for root, dirs, files in os.walk(inpath): - curr_depth = root.count(os.path.sep) - if curr_depth > in_depth: - break - for file in files: - filepath = '%s/%s' % (root, file) - parse_file(filepath) - nodes.sort(key=lambda x: len(x)) - faulty_index = -1 - for i, n in enumerate(nodes): - if len(n) == faulty_node_set: - faulty_index = i - tmp_set = set(nodes[faulty_index]) - for i, n in enumerate(nodes): - if i == faulty_index: - continue - tmp_set = tmp_set.difference(set(n)) - tmp_set = list(tmp_set) - tmp_set.sort() - print ','.join(map(str, tmp_set)) - - -if __name__ == "__main__": - # Init parser - parser = argparse.ArgumentParser(description='This scripts returns a sorted number of nodes used in IOR ', - formatter_class=argparse.RawTextHelpFormatter) - # positional arguments - parser.add_argument('ior_in_path', type=str, - help='path to the ior out input file. If its a directory it will process all files in it.') - parser.add_argument('nodes_number_to_intersect', type=int, - help='nodes_number_to_intersect') - - args = parser.parse_args() - - parse_ior_out(args.ior_in_path, args.nodes_number_to_intersect) - - print '\nNothing left to do; exiting. :)' diff --git a/ifs/scripts/eval/tmp/playground.py b/ifs/scripts/eval/tmp/playground.py deleted file mode 100644 index 5e64ca4460dc62c5cc2cd1f7b12661d92c938fdd..0000000000000000000000000000000000000000 --- a/ifs/scripts/eval/tmp/playground.py +++ /dev/null @@ -1,33 +0,0 @@ -# #cache 4m -# a = [7,12,13,16,18,28,40,41,67,68,76,77,78,79,80,81,94,95,96,101,102,103,104,110,111,112,125,170,171,172,173,212,213,214,257,258,259,293,294,295,311,312,313,315,320,325,326,331,336,346,354,355,356,357,466,467,468,481,502,503,504,552,553,554] -# -# #cache 512k -# b1 = [181,182,428,429,437,438,439,440,441,442,443,444,447,448,456,457] -# b2 = [7,11,12,13,40,41,67,68,76,77,78,80,81,94,95,101,102,103,104,110,122,123,124,125,170,171,172,212,213,257,259,294,295,313,324,325,466,467,468,479,480,481,482,502,504] -# b3 = [7,24,27,38,40,41,57,65,67,68,71,73,76,77,78,80,81,83,94,98,99,101,102,103,104,108,110,116,119,125,130,135,136,138,139,144,147,150,152,153,161,163,165,170,171,172,176,177,181,182,187,190,194,200,206,208,213,216,224,226,227,253,257,259,267,268,269,283,294,295,297,300,305,313,325,347,420,421,427,428,429,456,457,466,467,468,502,504] -# -# #cache 16m -# c1 = [7,11,12,13,14,40,41,67,68,78,79,95,96,98,99,101,102,103,104,116,117,121,122,152,153,156,157,158,170,171,172,173,176,177,189,190,202,203,205,206,212,213,214,223,224,289,290,297,298,299,300,311,312,313,324,325,326,466,467,468,502,503,504] -# c2 = [7,11,12,13,40,41,67,68,76,77,78,79,80,94,95,96,98,99,101,102,103,104,110,111,112,116,117,150,152,153,157,158,161,163,165,170,171,172,173,176,177,187,189,190,194,198,200,202,203,205,206,208,210,212,213,214,216,218,223,224,229,241,247,257,258,259,261,274,276,278,283,289,293,297,299,300,311,312,313,325,326,356,357,466,467,468,479,480,481,482,502,503,504,552,553,554] -# -# final_set = set(a).intersection(set(b2)) -# # final_set = final_set.intersection(set(b2)) -# final_set = final_set.intersection(set(b3)) -# final_set = final_set.intersection(set(c1)) -# final_set = final_set.intersection(set(c2)) -# print sorted(final_set) - -suspects = [7, 40, 41, 67, 68, 78, 101, 102, 103, 104, 170, 171, 172, 213, 313, 325, 466, 467, 468, 502, 504] -d = [11, 12, 13, 14, 101, 102, 103, 104, 110, 111, 112, 121, 122, 123, 124, 125, 156, 157, 158, 170, 171, 172, 173, 212, - 213, 214, 223, 224, 225, 226, 227, 257, 258, 259, 289, 290, 291, 297, 298, 299, 300, 311, 312, 313, 324, 325, 326, - 354, 355, 356, 357, 466, 467, 468, 479, 480, 481, 482, 502, 503, 504, 552, 553, 554] -e = [57, 58, 59, 60, 95, 96, 101, 102, 103, 104, 110, 111, 112, 122, 123, 124, 130, 135, 136, 138, 139, 144, 156, 157, - 158, 159, 160, 165, 166, 167, 170, 171, 172, 176, 177, 181, 182, 183, 202, 203, 216, 217, 218, 223, 224, 225, 226, - 227, 231, 232, 253, 254, 257, 258, 259, 269, 270, 276, 289, 290, 291, 294, 295, 297, 298, 299, 300, 301, 302, 305, - 306, 307, 308, 309, 311, 312, 313, 319, 322, 324, 325, 326, 328, 334, 342, 346, 354, 355, 356, 357, 386, 396, 397, - 398, 399, 403, 405, 406, 408, 420, 421, 425, 426, 427, 456, 457, 467, 468, 479, 480, 481, 482, 494, 495, 496, 497, - 498, 499, 502, 503, 504, 510, 519, 520, 537, 552, 553, 554] - -final_set = set(suspects).intersection(set(d)) -final_set = final_set.intersection(set(d)) -print sorted(final_set) diff --git a/ifs/scripts/slurm/mogon1_ior_ramdisk.sh b/ifs/scripts/slurm/mogon1_ior_ramdisk.sh deleted file mode 100755 index 79025fd8b95d2dfedce501e4c087c4dc3dfaf05e..0000000000000000000000000000000000000000 --- a/ifs/scripts/slurm/mogon1_ior_ramdisk.sh +++ /dev/null @@ -1,266 +0,0 @@ -#!/bin/bash -# Slurm stuff - -#SBATCH -J adafs_ior -#SBATCH -p nodeshort -#SBATCH -t 300 -#SBATCH -A zdvresearch -#SBATCH --gres=ramdisk:16G - -usage_short() { - echo " -usage: mogon1_ior_ramdisk.sh [-h] [-n ] [-b ] [-i ] [-Y] [-p] - [-t ] [-s] [-r] [-v] - benchmark_dir+file_prefix adafs_daemon_path ld_preload_path - " -} - -help_msg() { - - usage_short - echo " -This slurm batch script is for IOR testing adafs - -positional arguments: - benchmark_dir - benchmark workdir - adafs_daemon_path - adafs_daemon path - ld_preload_path - ld_preload path - - - -optional arguments: - -h, --help - shows this help message and exits - - -n , --nodes - number of processes per node - defaults to '16' - -i , --iterations - number of iterations done around IOR - defaults to '1' - -b , --blocksize - total number of data written and read (use 1k, 1m, 1g, etc...) - defaults to '16m' - -t , --transfersizes - Sets the transfer sizes for the block sizes. Set a space separated list. - Each transfer size must be a multiple of the block size - Example: \"64m 32m 16m 8m 4m 2m 1m 512k 256k 128k 4k 1k\" - Defaults to example - -s, --striping - Enable random striping for readback. A random seed of 42 is used. - -r, --random - Enable random offsets for I/O - -Y, --fsync - enable fsync after writes - defaults to 'false' - -v, --verbose - enable ior verbosity - -p, --pretend - Pretend operation. Does not execute commands benchmark commands - This does start and stop the adafs daemon - " -} -# Set default values -PROC_PER_NODE=16 -ITER=1 -BLOCKSIZE="64m" -FSYNC=false -PRETEND=false -STRIPING=false -RANDOM=false -VERBOSE="" -TRANSFERSIZES="64m 32m 16m 8m 4m 2m 1m 512k 256k 128k 4k 1k" -START_TIME="$(date -u +%s)" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do -key="$1" - -case ${key} in - -n|--nodes) - PROC_PER_NODE="$2" - shift # past argument - shift # past value - ;; - -b|--blocksize) - BLOCKSIZE="$2" - shift # past argument - shift # past value - ;; - -i|--iterations) - ITER="$2" - shift # past argument - shift # past value - ;; - -t|--transfersizes) - TRANSFERSIZES="$2" - shift # past argument - shift # past value - ;; - -Y|--fsync) - FSYNC=true - shift # past argument - ;; - -r|--random) - RANDOM=true - shift # past argument - ;; - -s|--striping) - STRIPING=true - shift # past argument - ;; - -p|--pretend) - PRETEND=true - shift # past argument - ;; - -v|--verbose) - VERBOSE="-vv" - shift # past argument - ;; - -h|--help) - help_msg - exit - #shift # past argument - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; -esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -# positional arguments -if [[ ( -z ${1+x} ) || ( -z ${2+x} ) || ( -z ${3+x} ) ]]; then - echo "Positional arguments missing." - usage_short - exit -fi - -VEF_HOME="/home/vef" -HOSTFILE="${VEF_HOME}/jobdir/hostfile_${SLURM_JOB_ID}" -WORKDIR=$1 -DAEMONPATH=$2 -LIBPATH=$3 -ROOTDIR="/localscratch/${SLURM_JOB_ID}/ramdisk" - -# Load modules and set environment variables -PATH=$PATH:/home/vef/adafs/install/bin:/home/vef/.local/bin -C_INCLUDE_PATH=$C_INCLUDE_PATH:/home/vef/adafs/install/include -CPATH=$CPATH:/home/vef/adafs/install/include -CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/vef/adafs/install/include -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vef/adafs/install/lib -LIBRARY_PATH=$LIBRARY_PATH:/home/vef/adafs/install/lib -export PATH -export CPATH -export C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH -export LD_LIBRARY_PATH -export LIBRARY_PATH -export LDFLAGS='-L/home/vef/adafs/install/lib/' -export CPPFLAGS='-I/home/vef/adafs/install/include/' -module load devel/CMake/3.8.0 -module load mpi/OpenMPI/2.0.2-GCC-6.3.0 -module load devel/Boost/1.63.0-foss-2017a -export CC=$(which gcc) -export CXX=$(which g++) - -# create a proper hostfile to run -srun -n ${SLURM_NNODES} hostname -s | sort -u > ${HOSTFILE} && sed -e 's/$/ max_slots=64/' -i ${HOSTFILE} - -echo "Generated hostfile no of nodes:" -cat ${HOSTFILE} | wc -l - -NONODES=$(cat ${HOSTFILE} | wc -l) -let IOR_PROC_N=${NONODES}*${PROC_PER_NODE} - -echo " -############################################################################ -############################### DAEMON START ############################### ############################################################################ -" -# start adafs daemon on the nodes -python2 ${VEF_HOME}/ifs/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0,1 --membind=0,1" ${DAEMONPATH} ${ROOTDIR} ${WORKDIR} ${HOSTFILE} - -# pssh to get logfiles. hostfile is created by startup script -${VEF_HOME}/.local/bin/pssh -O StrictHostKeyChecking=no -i -h /tmp/hostfile_pssh_${SLURM_JOB_ID} "tail /tmp/adafs_daemon.log" - -echo " -############################################################################ -############################ RUNNING BENCHMARK ############################# -############################################################################ -" -# Run benchmark - -BENCH_TMPL="mpiexec -np ${IOR_PROC_N} --map-by node --hostfile ${HOSTFILE} -x LD_PRELOAD=${LIBPATH} numactl --cpunodebind=2,3,4,5,6,7 --membind=2,3,4,5,6,7 /gpfs/fs1/home/vef/benchmarks/mogon1/ior/build/src/ior -a POSIX -i 1 -o ${WORKDIR} -b ${BLOCKSIZE} ${VERBOSE} -x -F -w -r -W" - -echo "##########################" -echo "< 1. WARMUP >" -echo "##########################" -for ((i=1;i<=3;i+=1)) -do - CMD="${BENCH_TMPL} -t 16m" - echo "## Command ${CMD}" - if [ "${PRETEND}" = false ] ; then - eval ${CMD} - fi -done -# Run experiments -echo "##########################" -echo "< 2. RUNNING EXPERIMENTS >" -echo "##########################" -# Some info output -if [ "${RANDOM}" = true ] ; then - echo "## RANDOM I/O on" -fi -if [ "${STRIPING}" = true ] ; then - echo "## STRIPING on" -fi -if [ "${FSYNC}" = true ] ; then - echo "## FSYNC on" -fi -for TRANSFER in ${TRANSFERSIZES} -do - echo ";${TRANSFER}" - for ((i=1;i<=${ITER};i+=1)) - do - echo ";$i" - # build command from template and then execute it - CMD="${BENCH_TMPL} -t ${TRANSFER}" - echo "## iteration $i/${ITER} transfer size ${TRANSFER}" - if [ "${RANDOM}" = true ] ; then - CMD="${CMD} -z" - fi - if [ "${STRIPING}" = true ] ; then - CMD="${CMD} -Z -X 42" - fi - if [ "${FSYNC}" = true ] ; then - CMD="${CMD} -Y" - fi - echo "## Command ${CMD}" - if [ "${PRETEND}" = false ] ; then - eval ${CMD} - fi - echo ";$i" - echo "### iteration $i/${ITER} done" - done - echo ";${TRANSFER}" - echo "## new transfer size #################################" -done - -echo " -############################################################################ -############################### DAEMON STOP ############################### ############################################################################ -" -END_TIME="$(date -u +%s)" -ELAPSED="$((${END_TIME}-${START_TIME}))" -MINUTES=$((${ELAPSED} / 60)) -echo "##Elapsed time: ${MINUTES} minutes or ${ELAPSED} seconds elapsed for test set." -# shut down adafs daemon on the nodes -python2 ${VEF_HOME}/ifs/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs/build/bin/adafs_daemon ${HOSTFILE} - -# cleanup -rm ${HOSTFILE} diff --git a/ifs/scripts/slurm/mogon1_mdtest_ramdisk.sh b/ifs/scripts/slurm/mogon1_mdtest_ramdisk.sh deleted file mode 100755 index a33fd87e9ba92d2b62b92d9e400e625bfbcb8f47..0000000000000000000000000000000000000000 --- a/ifs/scripts/slurm/mogon1_mdtest_ramdisk.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash -# Slurm stuff - -#SBATCH -J adafs_ior -#SBATCH -p nodeshort -#SBATCH -t 300 -#SBATCH -A zdvresearch -#SBATCH --gres=ramdisk:16G - -usage_short() { - echo " -usage: adafs_mdtest.sh [-h] [-n ] [-i ] [-I ] [-u] - benchmark_dir - " -} - -help_msg() { - - usage_short - echo " -This slurm batch script is for mdtesting adafs - -positional arguments: - benchmark_dir path where the dependency downloads are put - - -optional arguments: - -h, --help - shows this help message and exits - -n - number of processes used in mdtest - defaults to '1' - -i - number of iterations done in mdtest - defaults to '1' - -I - number of files per process in mdtest - defaults to '500000' - -u, --unique - use if files should be placed in a unique directory per-process in mdtest - " -} - -MD_PROC_N=16 -MD_ITER=1 -MD_ITEMS="500000" -MD_UNIQUE="" -START_TIME="$(date -u +%s)" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do -key="$1" - -case ${key} in - -n) - MD_PROC_N="$2" - shift # past argument - shift # past value - ;; - -i) - MD_ITER="$2" - shift # past argument - shift # past value - ;; - -I) - MD_ITEMS="$2" - shift # past argument - shift # past value - ;; - -u|--unique) - MD_UNIQUE="-u" - shift # past argument - ;; - -h|--help) - help_msg - exit - #shift # past argument - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; -esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -# positional arguments -if [[ -z ${1+x} ]]; then - echo "Positional arguments missing." - usage_short - exit -fi - -VEF_HOME="/home/vef" -HOSTFILE="${VEF_HOME}/jobdir/hostfile_${SLURM_JOB_ID}" -MD_DIR=$1 -ROOTDIR="/localscratch/${SLURM_JOB_ID}/ramdisk" - -# Load modules and set environment variables -PATH=$PATH:/home/vef/adafs/install/bin:/home/vef/.local/bin -C_INCLUDE_PATH=$C_INCLUDE_PATH:/home/vef/adafs/install/include -CPATH=$CPATH:/home/vef/adafs/install/include -CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/vef/adafs/install/include -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vef/adafs/install/lib -LIBRARY_PATH=$LIBRARY_PATH:/home/vef/adafs/install/lib -export PATH -export CPATH -export C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH -export LD_LIBRARY_PATH -export LIBRARY_PATH -export LDFLAGS='-L/home/vef/adafs/install/lib/' -export CPPFLAGS='-I/home/vef/adafs/install/include/' -module load devel/CMake/3.8.0 -module load mpi/OpenMPI/2.0.2-GCC-6.3.0 -module load devel/Boost/1.63.0-foss-2017a -export CC=$(which gcc) -export CXX=$(which g++) - -# printing stuff -echo "files per process: ${MD_ITEMS}" - -# create a proper hostfile to run -srun -n ${SLURM_NNODES} hostname -s | sort -u > ${HOSTFILE} && sed -e 's/$/ max_slots=64/' -i ${HOSTFILE} - -echo "Generated hostfile no of nodes:" -cat ${HOSTFILE} | wc -l - -NONODES=$(cat ${HOSTFILE} | wc -l) -let MD_PROC_N=${NONODES}*16 - -echo " -############################################################################ -############################### DAEMON START ############################### ############################################################################ -" -# start adafs daemon on the nodes -python2 ${VEF_HOME}/ifs/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0,1 --membind=0,1" ${VEF_HOME}/ifs/build/bin/adafs_daemon ${ROOTDIR} ${MD_DIR} ${HOSTFILE} - -#echo "logfiles:" -#cat /tmp/adafs_daemon.log -# pssh to get logfiles. hostfile is created by startup script -${VEF_HOME}/.local/bin/pssh -O StrictHostKeyChecking=no -i -h /tmp/hostfile_pssh_${SLURM_JOB_ID} "tail /tmp/adafs_daemon.log" - -echo " -############################################################################ -############################ RUNNING BENCHMARK ############################# -############################################################################ -" -# Run benchmark -BENCHCMD="mpiexec -np ${MD_PROC_N} --map-by node --hostfile ${HOSTFILE} -x LD_PRELOAD=/gpfs/fs2/project/zdvresearch/vef/fs/ifs/build/lib/libadafs_preload_client.so --cpunodebind=2,3,4,5,6,7 --membind=2,3,4,5,6,7 /gpfs/fs1/home/vef/benchmarks/mogon1/ior/build/src/mdtest -z 0 -b 1 -i ${MD_ITER} -d ${MD_DIR} -F -I ${MD_ITEMS} -C -r -T -v 1 ${MD_UNIQUE}" - -eval ${BENCHCMD} - -echo " -############################################################################ -############################### DAEMON STOP ############################### ############################################################################ -" -END_TIME="$(date -u +%s)" -ELAPSED="$((${END_TIME}-${START_TIME}))" -MINUTES=$((${ELAPSED} / 60)) -echo "##Elapsed time: ${MINUTES} minutes or ${ELAPSED} seconds elapsed for test set." -# shut down adafs daemon on the nodes -python2 ${VEF_HOME}/ifs/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs/build/bin/adafs_daemon ${HOSTFILE} - -# cleanup -rm ${HOSTFILE} diff --git a/ifs/scripts/slurm/mogon2_ior_ssd.sh b/ifs/scripts/slurm/mogon2_ior_ssd.sh deleted file mode 100755 index 1a139808d916924dfec17e088400723c100ed095..0000000000000000000000000000000000000000 --- a/ifs/scripts/slurm/mogon2_ior_ssd.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/bin/bash -# Slurm stuff - -#SBATCH -J adafs_ior -#SBATCH -p parallel -#SBATCH -t 300 -#SBATCH -A m2_zdvresearch - -usage_short() { - echo " -usage: mogon2_ior_ssd.sh [-h] [-n ] [-b ] [-i ] [-Y] [-p] - [-t ] [-s] [-r] [-v] - benchmark_dir+file_prefix adafs_daemon_path ld_preload_path - " -} - -help_msg() { - - usage_short - echo " -This slurm batch script is for IOR testing adafs - -positional arguments: - benchmark_dir - benchmark workdir - adafs_daemon_path - adafs_daemon path - ld_preload_path - ld_preload path - - - -optional arguments: - -h, --help - shows this help message and exits - - -n , --nodes - number of processes per node - defaults to '16' - -i , --iterations - number of iterations done around IOR - defaults to '1' - -b , --blocksize - total number of data written and read (use 1k, 1m, 1g, etc...) - defaults to '16m' - -t , --transfersizes - Sets the transfer sizes for the block sizes. Set a space separated list. - Each transfer size must be a multiple of the block size - Example: \"64m 32m 16m 8m 4m 2m 1m 512k 256k 128k 4k 1k\" - Defaults to example - -s, --striping - Enable random striping for readback. A random seed of 42 is used. - -r, --random - Enable random offsets for I/O - -Y, --fsync - enable fsync after writes - defaults to 'false' - -v, --verbose - enable ior verbosity - -p, --pretend - Pretend operation. Does not execute commands benchmark commands - This does start and stop the adafs daemon - " -} -# Set default values -PROC_PER_NODE=16 -ITER=1 -BLOCKSIZE="64m" -FSYNC=false -PRETEND=false -STRIPING=false -RANDOM=false -VERBOSE="" -TRANSFERSIZES="64m 32m 16m 8m 4m 2m 1m 512k 256k 128k 4k 1k" -START_TIME="$(date -u +%s)" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do -key="$1" - -case ${key} in - -n|--nodes) - PROC_PER_NODE="$2" - shift # past argument - shift # past value - ;; - -b|--blocksize) - BLOCKSIZE="$2" - shift # past argument - shift # past value - ;; - -i|--iterations) - ITER="$2" - shift # past argument - shift # past value - ;; - -t|--transfersizes) - TRANSFERSIZES="$2" - shift # past argument - shift # past value - ;; - -Y|--fsync) - FSYNC=true - shift # past argument - ;; - -r|--random) - RANDOM=true - shift # past argument - ;; - -s|--striping) - STRIPING=true - shift # past argument - ;; - -p|--pretend) - PRETEND=true - shift # past argument - ;; - -v|--verbose) - VERBOSE="-vv" - shift # past argument - ;; - -h|--help) - help_msg - exit - #shift # past argument - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; -esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -# positional arguments -if [[ ( -z ${1+x} ) || ( -z ${2+x} ) || ( -z ${3+x} ) ]]; then - echo "Positional arguments missing." - usage_short - exit -fi - -VEF_HOME="/home/vef" -HOSTFILE="${VEF_HOME}/jobdir_m2/hostfile_${SLURM_JOB_ID}" -WORKDIR=$1 -DAEMONPATH=$2 -LIBPATH=$3 -ROOTDIR="/localscratch/${SLURM_JOB_ID}" - -# Load modules and set environment variables -PATH=$PATH:/home/vef/adafs_m2/install/bin:/home/vef/.local/bin -C_INCLUDE_PATH=$C_INCLUDE_PATH:/home/vef/adafs_m2/install/include -CPATH=$CPATH:/home/vef/adafs_m2/install/include -CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/vef/adafs_m2/install/include -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vef/adafs_m2/install/lib -LIBRARY_PATH=$LIBRARY_PATH:/home/vef/adafs_m2/install/lib -export PATH -export CPATH -export C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH -export LD_LIBRARY_PATH -export LIBRARY_PATH -export LDFLAGS='-L/home/vef/adafs_m2/install/lib/' -export CPPFLAGS='-I/home/vef/adafs_m2/install/include/' -module load devel/CMake/3.7.2 -module load devel/Boost/1.65.1-foss-2017a -export CC=$(which gcc) -export CXX=$(which g++) - -# create a proper hostfile to run -srun -n ${SLURM_NNODES} hostname -s | sort -u > ${HOSTFILE} && sed -e 's/$/ max_slots=40/' -i ${HOSTFILE} - -echo "Generated hostfile no of nodes:" -cat ${HOSTFILE} | wc -l - -NONODES=$(cat ${HOSTFILE} | wc -l) -let IOR_PROC_N=${NONODES}*${PROC_PER_NODE} - -echo " -############################################################################ -############################### DAEMON TEST START ########################## -############################################################################ -" -# This is just to get some info and if all of them would start up right -# start adafs daemon on the nodes -python2 ${VEF_HOME}/ifs_m2/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0 --membind=0" ${DAEMONPATH} ${ROOTDIR} ${WORKDIR} ${HOSTFILE} - -# pssh to get logfiles. hostfile is created by startup script -${VEF_HOME}/.local/bin/pssh -O StrictHostKeyChecking=no -i -h /tmp/hostfile_pssh_${SLURM_JOB_ID} "tail /tmp/adafs_daemon.log" - -# hardkill adafs daemon on the nodes -python2 ${VEF_HOME}/ifs/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs_m2/build/bin/adafs_daemon ${HOSTFILE} -9 - -echo " -############################################################################ -############################ RUNNING BENCHMARK ############################# -############################################################################ -" -# Run benchmark - -BENCH_TMPL="mpiexec -np ${IOR_PROC_N} --map-by node --hostfile ${HOSTFILE} --mca mtl ^psm2,ofi -x LD_PRELOAD=${LIBPATH} numactl --cpunodebind=1 --membind=1 /lustre/miifs01/project/zdvresearch/vef/benchmarks/ior/build/src/ior -a POSIX -i 1 -o ${WORKDIR} -b ${BLOCKSIZE} ${VERBOSE} -x -F -w -r -W" - -# Run experiments -echo "##########################" -echo "< 2. RUNNING EXPERIMENTS >" -echo "##########################" -# Some info output -if [ "${RANDOM}" = true ] ; then - echo "## RANDOM I/O on" -fi -if [ "${STRIPING}" = true ] ; then - echo "## STRIPING on" -fi -if [ "${FSYNC}" = true ] ; then - echo "## FSYNC on" -fi -for TRANSFER in ${TRANSFERSIZES} -do - echo ";${TRANSFER}" - for ((i=1;i<=${ITER};i+=1)) - do - # Start daemon and clean rootdir - echo "Starting ADA-FS Daemon ..." - python2 ${VEF_HOME}/ifs_m2/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0 --membind=0" ${DAEMONPATH} ${ROOTDIR} ${WORKDIR} ${HOSTFILE} - echo "Startup done." - echo ";$i" - # build command from template and then execute it - CMD="${BENCH_TMPL} -t ${TRANSFER}" - echo "## iteration $i/${ITER} transfer size ${TRANSFER}" - if [ "${RANDOM}" = true ] ; then - CMD="${CMD} -z" - fi - if [ "${STRIPING}" = true ] ; then - CMD="${CMD} -Z -X 42" - fi - if [ "${FSYNC}" = true ] ; then - CMD="${CMD} -Y" - fi - echo "## Command ${CMD}" - if [ "${PRETEND}" = false ] ; then - eval ${CMD} - fi - echo ";$i" - echo "### iteration $i/${ITER} done" - # Stop daemon - echo "Stopping ADA-FS Daemon ..." - python2 ${VEF_HOME}/ifs/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs_m2/build/bin/adafs_daemon ${HOSTFILE} -9 - echo "Done." - done - echo ";${TRANSFER}" - echo "## new transfer size #################################" -done - -echo " -############################################################################ -############################### DAEMON STOP ############################### -############################################################################ -" -END_TIME="$(date -u +%s)" -ELAPSED="$((${END_TIME}-${START_TIME}))" -MINUTES=$((${ELAPSED} / 60)) -echo "##Elapsed time: ${MINUTES} minutes or ${ELAPSED} seconds elapsed for test set." - -# cleanup -rm ${HOSTFILE} diff --git a/ifs/scripts/slurm/mogon2_mdtest_ssd.sh b/ifs/scripts/slurm/mogon2_mdtest_ssd.sh deleted file mode 100755 index 2e5b4b91c65c2d497e31ec746c5742612b219c7e..0000000000000000000000000000000000000000 --- a/ifs/scripts/slurm/mogon2_mdtest_ssd.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash -# Slurm stuff - -#SBATCH -J adafs_mdtest -#SBATCH -p parallel -#SBATCH -t 300 -#SBATCH -A m2_zdvresearch - -usage_short() { - echo " -usage: adafs_mdtest.sh [-h] [-n ] [-i ] [-I ] [-u] - benchmark_dir adafs_daemon_path ld_preload_path - " -} - -help_msg() { - - usage_short - echo " -This slurm batch script is for mdtesting adafs - -positional arguments: - benchmark_dir path where the dependency downloads are put - - -optional arguments: - -h, --help - shows this help message and exits - -n - number of processes used in mdtest - defaults to '16' - -i - number of iterations done - defaults to '1' - -I - number of files per process in mdtest - defaults to '500000' - -u, --unique - use if files should be placed in a unique directory per-process in mdtest - " -} - -MD_PROC_N=16 -ITER=1 -MD_ITEMS="500000" -MD_UNIQUE="" -START_TIME="$(date -u +%s)" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do -key="$1" - -case ${key} in - -n) - MD_PROC_N="$2" - shift # past argument - shift # past value - ;; - -i) - ITER="$2" - shift # past argument - shift # past value - ;; - -I) - MD_ITEMS="$2" - shift # past argument - shift # past value - ;; - -u|--unique) - MD_UNIQUE="-u" - shift # past argument - ;; - -h|--help) - help_msg - exit - #shift # past argument - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; -esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -# positional arguments -if [[ ( -z ${1+x} ) || ( -z ${2+x} ) || ( -z ${3+x} ) ]]; then - echo "Positional arguments missing." - usage_short - exit -fi - -VEF_HOME="/home/vef" -HOSTFILE="${VEF_HOME}/jobdir_m2/hostfile_${SLURM_JOB_ID}" -MD_DIR=$1 -DAEMONPATH=$2 -LIBPATH=$3 -ROOTDIR="/localscratch/${SLURM_JOB_ID}" - -# Load modules and set environment variables -PATH=$PATH:/home/vef/adafs_m2/install/bin:/home/vef/.local/bin -C_INCLUDE_PATH=$C_INCLUDE_PATH:/home/vef/adafs_m2/install/include -CPATH=$CPATH:/home/vef/adafs_m2/install/include -CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/vef/adafs_m2/install/include -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vef/adafs_m2/install/lib -LIBRARY_PATH=$LIBRARY_PATH:/home/vef/adafs_m2/install/lib -export PATH -export CPATH -export C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH -export LD_LIBRARY_PATH -export LIBRARY_PATH -export LDFLAGS='-L/home/vef/adafs_m2/install/lib/' -export CPPFLAGS='-I/home/vef/adafs_m2/install/include/' -module load devel/CMake/3.7.2 -module load devel/Boost/1.65.1-foss-2017a -export CC=$(which gcc) -export CXX=$(which g++) - -# printing stuff -echo "files per process: ${MD_ITEMS}" - -# create a proper hostfile to run -srun -n ${SLURM_NNODES} hostname -s | sort -u > ${HOSTFILE} && sed -e 's/$/ max_slots=40/' -i ${HOSTFILE} - -echo "Generated hostfile no of nodes:" -cat ${HOSTFILE} | wc -l - -NONODES=$(cat ${HOSTFILE} | wc -l) -let MD_PROC_N=${NONODES}*16 - - -echo "Shutting down adafs_daemons that might be running" -python2 ${VEF_HOME}/ifs_m2/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs_m2/build/bin/adafs_daemon ${HOSTFILE} -9 - -echo " -############################################################################ -############################### DAEMON TEST START ########################## -############################################################################ -" -# This is just to get some info and if all of them would start up right -# start adafs daemon on the nodes -python2 ${VEF_HOME}/ifs_m2/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0 --membind=0" ${DAEMONPATH} ${ROOTDIR} ${MD_DIR} ${HOSTFILE} - -#echo "logfiles:" -#cat /tmp/adafs_daemon.log -# pssh to get logfiles. hostfile is created by startup script -${VEF_HOME}/.local/bin/pssh -O StrictHostKeyChecking=no -i -h /tmp/hostfile_pssh_${SLURM_JOB_ID} "tail /tmp/adafs_daemon.log" - -# shut down adafs daemon on the nodes -python2 ${VEF_HOME}/ifs_m2/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs_m2/build/bin/adafs_daemon ${HOSTFILE} -9 - -echo " -############################################################################ -############################ RUNNING BENCHMARK ############################# -############################################################################ -" -# Run benchmark -BENCHCMD="mpiexec -np ${MD_PROC_N} --map-by node --hostfile ${HOSTFILE} --mca mtl ^psm2,ofi -x LD_PRELOAD=${LIBPATH} numactl --cpunodebind=1 --membind=1 /lustre/miifs01/project/zdvresearch/vef/benchmarks/ior/build/src/mdtest -z 0 -b 1 -i 1 -d ${MD_DIR} -F -I ${MD_ITEMS} -C -r -T -v 1 ${MD_UNIQUE}" - -for ((i=1;i<=${ITER};i+=1)) -do - # Start daemon and clean rootdir - echo "Starting ADA-FS Daemon ..." - python2 ${VEF_HOME}/ifs_m2/scripts/startup_adafs.py -c -J ${SLURM_JOB_ID} --numactl "--cpunodebind=0 --membind=0" ${DAEMONPATH} ${ROOTDIR} ${MD_DIR} ${HOSTFILE} - echo "Startup done." - # Run benchmark iteration - echo "## Command ${BENCHCMD}" - eval ${BENCHCMD} - # Stop daemon - echo "Stopping ADA-FS Daemon ..." - python2 ${VEF_HOME}/ifs/scripts/shutdown_adafs.py -J ${SLURM_JOB_ID} ${VEF_HOME}/ifs_m2/build/bin/adafs_daemon ${HOSTFILE} -9 - echo "Done." -done - - -echo " -############################################################################ -############################### DAEMON STOP ############################### -############################################################################ -" -END_TIME="$(date -u +%s)" -ELAPSED="$((${END_TIME}-${START_TIME}))" -MINUTES=$((${ELAPSED} / 60)) -echo "##Elapsed time: ${MINUTES} minutes or ${ELAPSED} seconds elapsed for test set." - -# cleanup -rm ${HOSTFILE}