---
name: "gfs_pio_set_view_index"
section: "3"
platform: "linux"
package: "libgfarm-dev"
version: "2.4.1-1.1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/gfs_pio_set_view_index"
---

# gfs\_pio\_set\_view\_index(3)

change file view to an individual fragment

## NAME

gfs\_pio\_set\_view\_index - change file view to an individual fragment

## SYNOPSIS

**#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_create/3.md), [**gfs\_pio\_open**(3)](/gfs_pio_open/3.md), [**gfs\_pio\_set\_view\_local**(3)](/gfs_pio_set_view_local/3.md)
