Ejemplo n.º 1
0
/** \ingroup msg_file_management
 * \brief Opens the file whose name is the string pointed to by path
 *
 * \param fullpath is the file location on the storage
 * \param data user data to attach to the file
 *
 * \return An #msg_file_t associated to the file
 */
msg_file_t MSG_file_open(const char* fullpath, void* data)
{
  char *name;
  msg_file_priv_t priv = xbt_new(s_msg_file_priv_t, 1);
  priv->data = data;
  priv->fullpath = xbt_strdup(fullpath);
  priv->simdata = xbt_new0(s_simdata_file_t,1);
  priv->simdata->smx_file = simcall_file_open(fullpath, MSG_host_self());
  name = bprintf("%s:%i:%s",MSG_host_get_name(MSG_host_self()),MSG_process_self_PID(),fullpath);
  xbt_lib_set(file_lib, name, MSG_FILE_LEVEL, priv);
  msg_file_t fd = (msg_file_t) xbt_lib_get_elm_or_null(file_lib, name);
  __MSG_file_get_info(fd);
  xbt_free(name);
  return fd;
}
Ejemplo n.º 2
0
File::File(const char*fullpath, void *userdata) {
	// this cannot fail because we get a xbt_die if the mountpoint does not exist
	p_inferior = simcall_file_open(fullpath, Host::current()->inferior());
	p_path = fullpath;
}