Functions

dsi_read.c File Reference

#include <stdio.h>
#include <fcntl.h>
#include "grpc.h"
Include dependency graph for dsi_read.c:

Go to the source code of this file.

Functions

grpc_error_t grpc_dsi_read_vector (DSI_OBJECT *dsi_obj, void *data, int count, enum datatype data_type, int *bytes_read)
grpc_error_t grpc_dsi_read_matrix (DSI_OBJECT *dsi_obj, void *data, int rows, int cols, enum datatype data_type, int *bytes_read)

Function Documentation

grpc_error_t grpc_dsi_read_matrix ( DSI_OBJECT *  dsi_obj,
void *  data,
int  rows,
int  cols,
enum datatype  data_type,
int *  bytes_read 
)

Definition at line 73 of file dsi_read.c.

{
  return grpc_dsi_read_vector(dsi_obj, data, rows*cols, data_type, bytes_read);
}

Here is the call graph for this function:

grpc_error_t grpc_dsi_read_vector ( DSI_OBJECT *  dsi_obj,
void *  data,
int  count,
enum datatype  data_type,
int *  bytes_read 
)

Definition at line 11 of file dsi_read.c.

{
#ifdef DSI 
  int read_allowed;
  int perm;
  int offset, extent, length;
  int my_dsig;
  uid_t my_uid;

#ifdef DSI_IBP
  struct ibp_timer ls_timeout;
#endif

  my_dsig = pvmgetdsig();
  extent = gs_get_element_size(data_type, my_dsig);
  length = count*extent;

  my_uid = getuid();

  if(my_uid == dsi_obj->dsi_file->uid)
    perm = dsi_obj->dsi_file->perm / 100;
  else
    perm = dsi_obj->dsi_file->perm % 10;
  
  read_allowed = perm & 4;

  if(read_allowed && ((dsi_obj->dsi_file->flag&O_RDONLY) || 
         (dsi_obj->dsi_file->flag&O_RDWR))) {

    offset = dsi_obj->offset;
    
    if(dsi_obj->dsi_file->storage_system == GS_DSI_IBP) {
#ifdef DSI_IBP
      int return_value;

      ls_timeout.ServerSync = 10;
      ls_timeout.ClientTimeout = 10;

      return_value =
        IBP_load(dsi_obj->dsi_file->dsi_specifics.ibp.cap->readCap, 
                 &ls_timeout, data, length, offset);
      if(return_value == 0)
        GRPC_RETURN(GRPC_OTHER_ERROR_CODE, GRPC_DSI_LOAD_ERROR);

      *bytes_read = return_value/extent;

      GRPC_RETURN(GRPC_NO_ERROR, GRPC_NO_MINOR_ERROR);
#endif
    }
  }
  else
    GRPC_RETURN(GRPC_OTHER_ERROR_CODE, GRPC_DSI_EACCES);

  *bytes_read = 0;
  GRPC_RETURN(GRPC_NO_ERROR, GRPC_NO_MINOR_ERROR);
#endif

  GRPC_RETURN(GRPC_OTHER_ERROR_CODE, GRPC_DSI_DISABLED);
}

Here is the call graph for this function:

Here is the caller graph for this function: