From 98c0dbd4424a6a8177167b573791d25dd01b447d Mon Sep 17 00:00:00 2001 From: navarro Date: Tue, 21 Feb 2012 13:51:06 +0100 Subject: [PATCH] First step to create model storage. --- buildtools/Cmake/DefinePackages.cmake | 1 + src/include/surf/surf.h | 17 +++++++++ src/surf/storage.c | 54 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 src/surf/storage.c diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index 2d5507dd3a..73dd6acb88 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -244,6 +244,7 @@ set(SURF_SRC src/surf/cpu_ti.c src/surf/cpu_cas01.c src/surf/sg_platf.c + src/surf/storage.c src/xbt/xbt_sg_stubs.c ) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 84f17e7d31..aff8a88f87 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -199,6 +199,22 @@ typedef struct s_surf_file { } s_surf_file_t; typedef struct s_surf_file *surf_file_t; +/* Storage model */ + +/** \brief Storage model extension public + * \ingroup SURF_models + * + * Public functions specific to the Storage model. + */ +typedef struct surf_storage_model_extension_public { + surf_action_t(*open) (void *workstation, const char* path, const char* mode); + surf_action_t(*close) (void *workstation, surf_file_t fp); + surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream); + surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream); + surf_action_t(*stat) (void *workstation, int fd, void* buf); +void* (*create_resource) (const char *name); +} s_surf_model_extension_storage_t; + /** \brief Workstation model extension public * \ingroup SURF_models * @@ -294,6 +310,7 @@ typedef struct surf_model { union extension { s_surf_model_extension_cpu_t cpu; s_surf_model_extension_network_t network; + s_surf_model_extension_storage_t storage; s_surf_model_extension_workstation_t workstation; } extension; } s_surf_model_t; diff --git a/src/surf/storage.c b/src/surf/storage.c new file mode 100644 index 0000000000..c471d8f3d7 --- /dev/null +++ b/src/surf/storage.c @@ -0,0 +1,54 @@ +/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "xbt/ex.h" +#include "xbt/dict.h" +#include "portable.h" +#include "surf_private.h" +#include "surf/surf_resource.h" + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, + "Logging specific to the SURF storage module"); + +surf_model_t surf_storage_model = NULL; + +static surf_action_t storage_action_open(void *workstation, const char* path, const char* mode) +{ + return NULL; +} + +static surf_action_t storage_action_close(void *workstation, surf_file_t fp) +{ + return NULL; +} + +static surf_action_t storage_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream) +{ + return NULL; +} + +static surf_action_t storage_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream) +{ + return NULL; +} + +static surf_action_t storage_action_stat(void *workstation, int fd, void* buf) +{ + return NULL; +} + +static void surf_storage_model_init_internal(void) +{ + surf_storage_model = surf_model_init(); + + surf_storage_model->name = "Storage"; + + surf_storage_model->extension.workstation.open = storage_action_open; + surf_storage_model->extension.workstation.close = storage_action_close; + surf_storage_model->extension.workstation.read = storage_action_read; + surf_storage_model->extension.workstation.write = storage_action_write; + surf_storage_model->extension.workstation.stat = storage_action_stat; +} -- 2.20.1