rpm  5.4.15
Macros | Enumerations | Functions | Variables
rpmsm.c File Reference
#include "system.h"
#include <rpmsm.h>
#include <rpmlog.h>
#include <rpmmacro.h>
#include <argv.h>
#include <mire.h>
#include "debug.h"
Include dependency graph for rpmsm.c:

Go to the source code of this file.

Macros

#define _RPMSM_INTERNAL
 
#define F_ISSET(_sm, _FLAG)   (((_sm)->flags & ((RPMSM_FLAGS_##_FLAG) & ~0x40000000)) != RPMSM_FLAGS_NONE)
 

Enumerations

enum  rpmsmState_e {
  RPMSM_STATE_CLOSED = 0, RPMSM_STATE_SELECTED = 1, RPMSM_STATE_ACCESSED = 2, RPMSM_STATE_CREATED = 3,
  RPMSM_STATE_CONNECTED = 4, RPMSM_STATE_TRANSACTION = 5
}
 

Functions

static int rpmsmBegin (rpmsm sm, char *arg)
 
static int rpmsmDisconnect (rpmsm sm, char *arg)
 
static int rpmsmReload (rpmsm sm, char *arg)
 
static int rpmsmInstallBase (rpmsm sm, char *arg)
 
static int rpmsmInstall (rpmsm sm, char *arg)
 
static int rpmsmUpgrade (rpmsm sm, char *arg)
 
static int rpmsmRemove (rpmsm sm, char *arg)
 
static int rpmsmList (rpmsm sm, char *arg)
 
static int rpmsmCommit (rpmsm sm, char *arg)
 
static void rpmsmFini (void *_sm)
 
static rpmsm rpmsmGetPool (rpmioPool pool)
 
rpmsm rpmsmNew (const char *fn, unsigned int flags)
 Create and load a semanage wrapper. More...
 
static rpmsm rpmsmI (void)
 
rpmRC rpmsmRun (rpmsm sm, char **av, const char **resultp)
 Run semanage commands. More...
 

Variables

int _rpmsm_debug = 0
 
rpmsm _rpmsmI = NULL
 
rpmioPool _rpmsmPool = NULL
 
static const char _rpmsmI_fn [] = "minimum"
 
static int _rpmsmI_flags
 

Macro Definition Documentation

#define _RPMSM_INTERNAL

Definition at line 11 of file rpmsm.c.

#define F_ISSET (   _sm,
  _FLAG 
)    (((_sm)->flags & ((RPMSM_FLAGS_##_FLAG) & ~0x40000000)) != RPMSM_FLAGS_NONE)

Definition at line 26 of file rpmsm.c.

Referenced by rpmsmCommit(), and rpmsmRun().

Enumeration Type Documentation

Enumerator
RPMSM_STATE_CLOSED 
RPMSM_STATE_SELECTED 
RPMSM_STATE_ACCESSED 
RPMSM_STATE_CREATED 
RPMSM_STATE_CONNECTED 
RPMSM_STATE_TRANSACTION 

Definition at line 28 of file rpmsm.c.

Function Documentation

static int rpmsmBegin ( rpmsm  sm,
char *  arg 
)
static

Definition at line 121 of file rpmsm.c.

References _rpmsm_debug, and RPMSM_STATE_TRANSACTION.

Referenced by rpmsmNew(), and rpmsmRun().

static int rpmsmCommit ( rpmsm  sm,
char *  arg 
)
static

Definition at line 284 of file rpmsm.c.

References _rpmsm_debug, F_ISSET, and RPMSM_FLAGS_COMMIT.

Referenced by rpmsmRun().

static int rpmsmDisconnect ( rpmsm  sm,
char *  arg 
)
static

Definition at line 136 of file rpmsm.c.

References _rpmsm_debug, RPMSM_STATE_CLOSED, and RPMSM_STATE_CONNECTED.

Referenced by rpmsmFini(), and rpmsmRun().

static void rpmsmFini ( void *  _sm)
static

Definition at line 304 of file rpmsm.c.

References _free(), argvFree(), rpmiobFree(), RPMSM_STATE_CLOSED, and rpmsmDisconnect().

Referenced by rpmsmGetPool().

static rpmsm rpmsmGetPool ( rpmioPool  pool)
static

Definition at line 329 of file rpmsm.c.

References _rpmsm_debug, _rpmsmPool, rpmioGetPool(), rpmioNewPool(), and rpmsmFini().

Referenced by rpmsmNew().

static rpmsm rpmsmI ( void  )
static

Definition at line 389 of file rpmsm.c.

References _rpmsmI, and rpmsmNew().

Referenced by rpmsmRun().

static int rpmsmInstall ( rpmsm  sm,
char *  arg 
)
static

Definition at line 186 of file rpmsm.c.

References _rpmsm_debug, and RPMSM_FLAGS_COMMIT.

Referenced by rpmsmRun().

static int rpmsmInstallBase ( rpmsm  sm,
char *  arg 
)
static

Definition at line 169 of file rpmsm.c.

References _rpmsm_debug, and RPMSM_FLAGS_COMMIT.

Referenced by rpmsmRun().

static int rpmsmList ( rpmsm  sm,
char *  arg 
)
static

Definition at line 241 of file rpmsm.c.

References _free(), _rpmsm_debug, j, mireApply(), mireFree(), mireNew(), mireRegcomp(), rpmExpand(), rpmiobAppend(), and RPMMIRE_REGEX.

Referenced by rpmsmRun().

rpmsm rpmsmNew ( const char *  fn,
unsigned int  flags 
)

Create and load a semanage wrapper.

Parameters
fnsemanage policy store (i.e. "targeted")
flagssemanage flags
Returns
new semanage wrapper

Definition at line 343 of file rpmsm.c.

References rpmiobNew(), RPMSM_FLAGS_ACCESS, RPMSM_FLAGS_BEGIN, RPMSM_FLAGS_CONNECT, RPMSM_FLAGS_CREATE, RPMSM_FLAGS_SELECT, rpmsmBegin(), rpmsmFree(), rpmsmGetPool(), and rpmsmLink().

Referenced by expandMacro(), and rpmsmI().

static int rpmsmReload ( rpmsm  sm,
char *  arg 
)
static

Definition at line 152 of file rpmsm.c.

References _rpmsm_debug.

Referenced by rpmsmRun().

static int rpmsmRemove ( rpmsm  sm,
char *  arg 
)
static

Definition at line 224 of file rpmsm.c.

References _rpmsm_debug, and RPMSM_FLAGS_COMMIT.

Referenced by rpmsmRun().

rpmRC rpmsmRun ( rpmsm  sm,
char **  av,
const char **  resultp 
)

Run semanage commands.

Commands are keyword strings with appended optional argument.

Parameters
smsemanage wrapper
avsemanage commands
Return values
*resultpstring result (malloc'd)
Returns
RPMRC_OK on success, RPMRC_FAIL on error

Definition at line 400 of file rpmsm.c.

References _rpmsm_debug, argvCount(), cmd, F_ISSET, i, rpmiobAppend(), rpmiobEmpty(), rpmiobLen(), rpmiobRTrim(), rpmiobStr(), RPMRC_FAIL, RPMRC_OK, RPMSM_FLAGS_COMMIT, RPMSM_FLAGS_NOAUDIT, rpmsmBegin(), rpmsmCommit(), rpmsmDisconnect(), rpmsmI(), rpmsmInstall(), rpmsmInstallBase(), rpmsmList(), rpmsmReload(), rpmsmRemove(), rpmsmUpgrade(), and xisspace().

Referenced by expandMacro().

static int rpmsmUpgrade ( rpmsm  sm,
char *  arg 
)
static

Definition at line 205 of file rpmsm.c.

References _rpmsm_debug, and RPMSM_FLAGS_COMMIT.

Referenced by rpmsmRun().

Variable Documentation

int _rpmsm_debug = 0
rpmsm _rpmsmI = NULL

Definition at line 24 of file rpmsm.c.

Referenced by rpmioClean(), and rpmsmI().

int _rpmsmI_flags
static

Definition at line 387 of file rpmsm.c.

const char _rpmsmI_fn[] = "minimum"
static

Definition at line 385 of file rpmsm.c.

rpmioPool _rpmsmPool = NULL

Definition at line 327 of file rpmsm.c.

Referenced by rpmioClean(), and rpmsmGetPool().