1/* 2 * Copyright (c) 2014, University of Washington. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#ifndef STORAGE_VSA_H 11#define STORAGE_VSA_H 12 13#ifdef BARRELFISH 14#include <barrelfish/barrelfish.h> 15 16struct storage_vsa { 17 struct capref vsacap; 18 size_t size; 19}; 20#elif defined(__linux__) 21struct storage_vsa { 22 int fd; 23 size_t size; 24}; 25#else 26# error "Unknown operating system!" 27#endif 28 29/** 30 * \brief Allocates a virtual storage area (VSA). 31 * 32 * Allocates the next available VSA of the specified size. More 33 * specific functions may be provided in the future that allow 34 * allocating VSAs of specific characteristics (e.g., storage medium, 35 * access latency, controller). An example invocation might allocate 2 36 * VSAs on flash that have 2 different controllers for parallel 37 * access. 38 * 39 * \param size Size (in bytes) of the VSA. 40 * 41 * \return Error code. 42 */ 43errval_t storage_vsa_alloc(struct storage_vsa *vsa, size_t size); 44 45errval_t storage_vsa_acquire(struct storage_vsa *vsa, const char *name, 46 size_t size); 47 48errval_t storage_vsa_resize(struct storage_vsa *vsa, size_t size); 49 50#endif 51