Alien-Libjio

 view release on metacpan or  search on metacpan

libjio/bindings/python/libjio.c  view on Meta::CPAN


/*
 * Python (2 and 3) bindings for libjio
 * Alberto Bertogli (albertito@blitiri.com.ar)
 */

#define PY_SSIZE_T_CLEAN 1

#include <Python.h>

#include <libjio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

/*
 * This module provides two classes and some functions.
 *
 * The classes are jfile (created with open()) and jtrans (created with
 * jfile.new_trans()).
 *
 * The first one represents a journaled file where you operate using read(),
 * write() and so on; to close it, just call del(). This is similar to the
 * UNIX file.
 *
 * The second one represents a single transaction, which is composed of
 * several operations that get added by its add() method. It gets committed
 * with commit(), and rolled back with rollback().
 *
 * There rest of the module's functions are related to file checking, at the
 * moment only jfsck(), which is just a wrapper to the real C functions.
 */

/*
 * Type definitions
 */

/* jfile */
typedef struct {
	PyObject_HEAD
	jfs_t *fs;
} jfile_object;

static PyTypeObject jfile_type;


/* jtrans */
typedef struct {
	PyObject_HEAD
	jtrans_t *ts;
	jfile_object *jfile;

	/* add_r() allocates views which must be freed by the destructor */
	Py_buffer **views;
	size_t nviews;
} jtrans_object;

static PyTypeObject jtrans_type;


/*
 * The jfile object



( run in 1.143 second using v1.01-cache-2.11-cpan-2398b32b56e )