1 /*-------------------------------------------------------------------------
6 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
13 *-------------------------------------------------------------------------
17 #include "storage/smgr.h"
22 const char *smgr_name
;
26 * StorageManager[] -- List of defined storage managers.
28 static const smgrid StorageManager
[] = {
32 static const int NStorageManagers
= lengthof(StorageManager
);
36 smgrin(PG_FUNCTION_ARGS
)
38 char *s
= PG_GETARG_CSTRING(0);
41 for (i
= 0; i
< NStorageManagers
; i
++)
43 if (strcmp(s
, StorageManager
[i
].smgr_name
) == 0)
46 elog(ERROR
, "unrecognized storage manager name \"%s\"", s
);
51 smgrout(PG_FUNCTION_ARGS
)
53 int16 i
= PG_GETARG_INT16(0);
56 if (i
>= NStorageManagers
|| i
< 0)
57 elog(ERROR
, "invalid storage manager id: %d", i
);
59 s
= pstrdup(StorageManager
[i
].smgr_name
);
64 smgreq(PG_FUNCTION_ARGS
)
66 int16 a
= PG_GETARG_INT16(0);
67 int16 b
= PG_GETARG_INT16(1);
69 PG_RETURN_BOOL(a
== b
);
73 smgrne(PG_FUNCTION_ARGS
)
75 int16 a
= PG_GETARG_INT16(0);
76 int16 b
= PG_GETARG_INT16(1);
78 PG_RETURN_BOOL(a
!= b
);