Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Typedefs | Functions | Variables

smgrtype.c File Reference

#include "postgres.h"
#include "storage/smgr.h"
Include dependency graph for smgrtype.c:

Go to the source code of this file.

Data Structures

struct  smgrid

Typedefs

typedef struct smgrid smgrid

Functions

Datum smgrin (PG_FUNCTION_ARGS)
Datum smgrout (PG_FUNCTION_ARGS)
Datum smgreq (PG_FUNCTION_ARGS)
Datum smgrne (PG_FUNCTION_ARGS)

Variables

static const smgrid StorageManager []
static const int NStorageManagers = lengthof(StorageManager)

Typedef Documentation

typedef struct smgrid smgrid

Function Documentation

Datum smgreq ( PG_FUNCTION_ARGS   ) 

Definition at line 64 of file smgrtype.c.

References PG_GETARG_INT16, and PG_RETURN_BOOL.

Datum smgrin ( PG_FUNCTION_ARGS   ) 

Definition at line 36 of file smgrtype.c.

References elog, ERROR, i, NStorageManagers, PG_GETARG_CSTRING, and PG_RETURN_INT16.

{
    char       *s = PG_GETARG_CSTRING(0);
    int16       i;

    for (i = 0; i < NStorageManagers; i++)
    {
        if (strcmp(s, StorageManager[i].smgr_name) == 0)
            PG_RETURN_INT16(i);
    }
    elog(ERROR, "unrecognized storage manager name \"%s\"", s);
    PG_RETURN_INT16(0);
}

Datum smgrne ( PG_FUNCTION_ARGS   ) 

Definition at line 73 of file smgrtype.c.

References PG_GETARG_INT16, and PG_RETURN_BOOL.

Datum smgrout ( PG_FUNCTION_ARGS   ) 

Definition at line 51 of file smgrtype.c.

References elog, ERROR, i, NStorageManagers, PG_GETARG_INT16, PG_RETURN_CSTRING, and pstrdup().

{
    int16       i = PG_GETARG_INT16(0);
    char       *s;

    if (i >= NStorageManagers || i < 0)
        elog(ERROR, "invalid storage manager ID: %d", i);

    s = pstrdup(StorageManager[i].smgr_name);
    PG_RETURN_CSTRING(s);
}


Variable Documentation

const int NStorageManagers = lengthof(StorageManager) [static]

Definition at line 32 of file smgrtype.c.

Referenced by smgrin(), and smgrout().

const smgrid StorageManager[] [static]
Initial value:
 {
    {"magnetic disk"}
}

Definition at line 28 of file smgrtype.c.