Loading...
Searching...
No Matches
mapset_msc.c File Reference

GIS library - Mapset user permission routines. More...

`#include <grass/config.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include <stdbool.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
Include dependency graph for mapset_msc.c:

Go to the source code of this file.

## Functions

int | G_make_mapset_element (const char *p_element)
| Create element in the current mapset.
int | G_make_mapset_object_group (const char *type)
| Create directory for group of elements of a given type.
int | G_make_mapset_dir_object (const char *type, const char *name)
| Create directory for an object of a given type.
int | G_make_mapset_element_tmp (const char *p_element)
| Create element in the temporary directory.
int | G_make_mapset_object_group_tmp (const char *type)
| Create directory for type of objects in the temporary directory.
int | G_make_mapset_object_group_basedir (const char *type, const char *basedir)
| Create directory for type of objects in the temporary directory.
int | G__make_mapset_element_misc (const char *dir, const char *name)
| Create misc element in the current mapset.
int | G_mapset_permissions (const char *mapset)
| Check for user mapset permission.
int | G_mapset_permissions2 (const char *gisdbase, const char *location, const char *mapset)
| Check for user mapset permission.

## Detailed Description

GIS library - Mapset user permission routines.

(C) 1999-2014 The GRASS development team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Definition in file mapset_msc.c.

## Function Documentation

## G__make_mapset_element_misc()

int G__make_mapset_element_misc | ( | const char * | dir,
|  | const char * | name )

Create misc element in the current mapset.

Parameters

  dir | directory path (e.g., cell_misc)
  name | element to be created in mapset (e.g., elevation)

Returns
  0 no element defined
  1 on success

Definition at line 261 of file mapset_msc.c.

References G_make_mapset_dir_object(), and name.

## G_make_mapset_dir_object()

int G_make_mapset_dir_object | ( | const char * | type,
|  | const char * | name )

Create directory for an object of a given type.

Creates the specified element directory in the current mapset. It will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists to ensure that it exists.

Any failure to create it, including the case when it exists (i.e., was created by another process after the existence test) is considered a failure because two processes should not attempt to create two objects of the same name (and type).

This function is for objects which are directories (the function does not create files).

Calls G_fatal_error() on failure.

Parameters

  type | object type (e.g., vector)
  name | object name (e.g., bridges)

Returns
  0 no element defined
  1 on success

See also
  G_make_mapset_object_group()

Definition at line 109 of file mapset_msc.c.

References G_file_name(), G_make_mapset_object_group(), G_mapset(), name, and NULL.

Referenced by G__make_mapset_element_misc().

## G_make_mapset_element()

int G_make_mapset_element | ( | const char * | p_element | ) |

Create element in the current mapset.

Make the specified element in the current mapset will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists.

Calls G_fatal_error() on failure.

Deprecated
  This function is deprecated due to confusion in element terminology. Use G_make_mapset_object_group() or G_make_mapset_dir_object() instead.

Parameters

  p_element | element to be created in mapset

Returns
  0 no element defined
  1 on success

Definition at line 45 of file mapset_msc.c.

References G_file_name(), G_mapset(), and NULL.

## G_make_mapset_element_tmp()

int G_make_mapset_element_tmp | ( | const char * | p_element | ) |

Create element in the temporary directory.

See G_file_name_tmp() for details.

Parameters

  p_element | element to be created in mapset (e.g., elevation)

Note
  Use G_make_mapset_object_group_tmp() for creating common, shared directories which are for multiple concrete elements (objects).

Returns
  0 no element defined
  1 on success

Definition at line 132 of file mapset_msc.c.

References G_file_name_tmp(), G_mapset(), and NULL.

## G_make_mapset_object_group()

int G_make_mapset_object_group | ( | const char * | type | ) |

Create directory for group of elements of a given type.

Creates the specified element directory in the current mapset. It will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists to ensure that it exists.

If creation fails, but the directory exists after the failure, the function reports success. Therefore, two processes creating a directory in this way can work in parallel.

Calls G_fatal_error() on failure.

Parameters

  type | object type (e.g., cell)

Returns
  0 no element defined
  1 on success

See also
  G_make_mapset_dir_object()
  G_make_mapset_object_group_tmp()

Definition at line 75 of file mapset_msc.c.

References G_file_name(), G_mapset(), and NULL.

Referenced by G__temp_element(), G__temp_element_basedir(), G_make_mapset_dir_object(), and M_do_copy().

## G_make_mapset_object_group_basedir()

int G_make_mapset_object_group_basedir | ( | const char * | type,
|  | const char * | basedir )

Create directory for type of objects in the temporary directory.

See G_file_name_basedir() for details.

Parameters

  type | object type (e.g., cell)

Note
  Use G_make_mapset_object_group_basedir() for creating common, shared directories for temporary data.

Returns
  0 no element defined
  1 on success

Definition at line 176 of file mapset_msc.c.

References G_file_name_basedir(), G_mapset(), and NULL.

Referenced by G__temp_element_basedir().

## G_make_mapset_object_group_tmp()

int G_make_mapset_object_group_tmp | ( | const char * | type | ) |

Create directory for type of objects in the temporary directory.

See G_file_name_tmp() for details.

Parameters

  type | object type (e.g., cell)

Note
  Use G_make_mapset_object_group_tmp() for creating common, shared directories which are for multiple concrete elements (objects).

Returns
  0 no element defined
  1 on success

Definition at line 154 of file mapset_msc.c.

References G_file_name_tmp(), G_mapset(), and NULL.

Referenced by G__temp_element().

## G_mapset_permissions()

int G_mapset_permissions | ( | const char * | mapset | ) |

Check for user mapset permission.

Parameters

  mapset | mapset name

Returns
  1 mapset exists, and user has permission
  0 mapset exists, BUT user denied permission
  -1 mapset does not exist

Definition at line 292 of file mapset_msc.c.

References G_file_name(), and G_stat().

Referenced by G__get_list_of_mapsets(), and G__gisinit().

## G_mapset_permissions2()

int G_mapset_permissions2 | ( | const char * | gisdbase,
|  | const char * | location,
|  | const char * | mapset )

Check for user mapset permission.

Parameters

  gisdbase | full path to GISDBASE
  location | location name
  mapset | mapset name

Returns
  1 mapset exists, and user has permission
  0 mapset exists, BUT user denied permission
  -1 mapset does not exist

Definition at line 321 of file mapset_msc.c.

References G_stat().