1 May 2002
gfs_pio_set_view_index 3 Gfarm
gfs_pio_set_view_index change file view to an individual fragment

    #include <gfarm/gfarm.h>

`char *gfs_pio_set_view_index` GFS_File gf int fragment_number int fragment_index char *host int flags

## DESCRIPTION

`gfs_pio_set_view_index()` changes the process's view of the data in the file specified by gf to a file fragment with the index fragment_index.

When creating a new file, it is necessary to specify the total number of file fragments fragment_number. Every parallel process should specify the same fragment_number for the corresponding file. When the file exists, `GFARM_FILE_DONTCARE` can be specified. If fragment_number is different from the total fragment number of the existent file, it is erroneous.

host is used for explicitly specifying a filesystem node. If host is NULL, appropriate filesystem node is chosen.

Values of flag are constructed by a bitwise-inclusive-OR of the following list.

`GFARM_FILE_SEQUENTIAL`

  File will be accessed sequentially.

`GFARM_FILE_REPLICATE`

  File may be replicated to a local filesystem when accessing remotely. This flag cannot be specified with `GFARM_FILE_NOT_REPLICATE`.

`GFARM_FILE_NOT_REPLICATE`

  File may not be replicated to a local filesystem when accessing remotely. This flag cannot be specified with `GFARM_FILE_REPLICATE`.

By default, Gfarm files are accessed as a whole file in global file view where each fragment can be seamlessly accessed.

## RETURN VALUES

`NULL`

  The function terminated successfully.

`GFARM_ERR_NO_MEMORY`

  Insufficient memory was available.

`GFARM_ERR_OPERATION_NOT_PERMITTED`

  The file is not a regular fragmented file.

`GFARM_ERR_FRAGMENT_NUMBER_DOES_NOT_MATCH`

  The total number of file fragments is different from the existence one.

`GFARM_ERR_INVALID_ARGUMENT`

  Invalid arguments are specified, for instance, `GFARM_FILE_DONTCARE` is specified as the total number of fragments of a newly created file.

Others

  An error except the above occurred. The reason is shown by its pointed strings.

## SEE ALSO

gfs_pio_create 3, gfs_pio_open 3, gfs_pio_set_view_local 3