starpu_disk.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013 Corentin Salingue
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. typedef void * (*disk_function)(void *, unsigned);
  17. /* list of functions to use on disk */
  18. struct disk_ops {
  19. void * (*alloc) (void *base, size_t size); /* nom de fichier: mkstemp, et retourne obj */
  20. void (*free) (void *base, void *obj, size_t size); /* supprime et libère l'obj */
  21. void * (*open) (void *base, void *pos, size_t size); /* open dans le répertoire un fichier existant, retourne l'obj */
  22. void (*close) (void *base, void *obj, size_t size); /* libère l'obj */
  23. ssize_t (*read) (void *base, void *obj, void *buf, off_t offset, size_t size); /* ~= pread */
  24. ssize_t (*write) (void *base, void *obj, const void *buf, off_t offset, size_t size);
  25. /* readv, writev, read2d, write2d, etc. */
  26. void * (*plug) (void *parameter); /* en posix, directory, retourne base */
  27. void (*unplug) (void *base); /* libère la base */
  28. };
  29. /* en posix, base = le répertoire, pos = le fichier, obj = la donnée renvoyée à starpu, ici un FILE* */
  30. extern struct disk_ops write_on_file;
  31. unsigned
  32. starpu_disk_register(struct disk_ops * func, void *parameter);
  33. void
  34. starpu_disk_free(unsigned node);