Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / examples / simdag / io / sd_io.c
1 /* Copyright (c) 2013-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include "simdag/simdag.h"
10 #include "xbt/ex.h"
11 #include "xbt/log.h"
12
13 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_io,
14                              "Logging specific to this SimDag example");
15 int main(int argc, char **argv)
16 {
17   unsigned int ctr;
18   const SD_workstation_t *workstations;
19   int total_nworkstations;
20   xbt_dict_t current_storage_list;
21   char *mount_name;
22   char *storage_name;
23   xbt_dict_cursor_t cursor = NULL;
24
25   SD_init(&argc, argv);
26   /* Set the workstation model to default, as storage is not supported by the
27    * ptask_L07 model yet.
28    */
29   SD_config("workstation/model", "default");
30   SD_create_environment(argv[1]);
31   workstations = SD_workstation_get_list();
32   total_nworkstations = SD_workstation_get_number();
33
34   for (ctr=0; ctr<total_nworkstations;ctr++){
35     current_storage_list = SD_workstation_get_mounted_storage_list(workstations[ctr]);
36     xbt_dict_foreach(current_storage_list,cursor,mount_name,storage_name)
37       XBT_INFO("Workstation '%s' mounts '%s'",
38          SD_workstation_get_name(workstations[ctr]), mount_name);
39     xbt_dict_free(&current_storage_list);
40   }
41   SD_exit();
42   return 0;
43 }