file
shfs_8h
[ ]
define
SHFS_LEVEL_PUBLIC
0
[ ]
define
SHFS_MAX_LEVELS
1
[ ]
define
SHINODE_NULL
0
An inode reference to nothing.
define
SHINODE_APP
100
Inode is in reference to an application-specific directory.
Note
See also:
shfs_node.d_type
define
SHINODE_PARTITION
101
Inode is the root of an entire sharefs partition.
Note
See also:
shfs_node.d_type
define
SHINODE_PEER
102
Inode is a reference to a remote sharefs partition.
Note
See also:
shfs_node.d_type
define
SHINODE_ARCHIVE
104
An archive of files and/or directories.
Note
See also:
shfs_node.d_type
define
SHINODE_REFERENCE
105
A reference to another inode.
Note
The referenced inode may be local or remote.
define
SHINODE_META
106
A meta definition hashmap (meta map).
Note
The referenced inode may be local or remote.
define
SHINODE_DIRECTORY
107
A directory containing multiple file references.
define
SHINODE_AUX
108
An auxillary unparseable data segment stored in the sharefs sub-system.
define
SHINODE_FILE
109
A generic reference to a path which contains further references to data.
define
SHINODE_BINARY
110
Raw binary data referenced by a.
See
inode. SHINODE_FILE group__libshare__fs_1gaefe1cc3781ca42b779d0239528f68679 member
Note
A SHINODE_BINARY inode contains SHINODE_AUX referencing the raw binary data segments.
define
SHINODE_COMPRESS
112
A zlib compressed binary segment.
define
SHINODE_CRYPT
113
A TEA encoded binary segment.
define
SHINODE_DATABASE
114
A reference to a sqlite database.
define
SHINODE_ACCESS
115
Inode specific permissions based on credentials.
define
SHINODE_FILE_LOCK
116
Inode specific access mutex.
define
SHINODE_LICENSE
117
define
SHINODE_EXTERNAL
118
define
SHINODE_REPOSITORY
120
A repository of file revisions.
define
SHINODE_REVISION
121
A reference to a particular version of a file.
define
SHINODE_DELTA
122
Inode is a reference to a binary delta of a file revision.
define
SHINODE_OBJECT
130
A generic reference to a collection of data.
define
SHINODE_OBJECT_KEY
131
define
SHINODE_TEST
140
A libshare inode type used for testing purposes.
define
SHINODE_DEVICE
150
A libshare inode containing auxillary SEXE bytecode.
The SEXE bytecode is executed in order to pipe a read / write stream.
define
IS_INODE_CONTAINER
(_type != SHINODE_AUX && \ _type != SHINODE_REFERENCE && \ _type != SHINODE_EXTERNAL && \ _type != SHINODE_LICENSE && \ _type != SHINODE_FILE_LOCK && \ _type != SHINODE_OBJECT_KEY)
define
SHFS_MAX_BLOCK_SIZE
4096
The maximum size a single block can contain.
Note
Each block segment is 4096 bytes which is equal to the size of structure.
shfs_ino_t structshfs__ino__t compound
define
SHFS_BLOCK_DATA_SIZE
(SHFS_MAX_BLOCK_SIZE - sizeof())structshfs__hdr__tcompoundshfs_hdr_t
The size of the data segment each inode contains.
define
SHFS_MAX_BLOCK
57344
The maximum number of blocks in a sharefs journal.
define
SHFS_PATH_MAX
(SHFS_BLOCK_DATA_SIZE - 34)
The maximum length of a sharefs file name.
Note
The length is subtracted by 16 bytes of a hash tag incase to track longer filenames and 1 byte for a null-terminator.
define
SHFS_ATTR_BITS
"abcdefhlmrstvwxz"
The character tokens representing the inode attributes.
define
SHATTR_ARCH
(1 << 0)
Indicates the inode contains an SHINODE_ARCHIVE file containing stored directories and/or files.
define
SHATTR_BLOCK
(1 << 1)
define
SHATTR_CRED
(1 << 2)
Indicates the inode has SHINODE_ACCESS credentials.
define
SHATTR_DB
(1 << 3)
Indicates the inode is a database.
define
SHATTR_ENC
(1 << 4)
Indicates the inode is encrypted.
define
SHATTR_FLOCK
(1 << 5)
Indicates the inode has a SHINODE_FILE_LOCK lock blocking access.
define
SHATTR_HIDDEN
(1 << 6)
Indicates the inode is not listed in a directory listing.
define
SHATTR_LINK
(1 << 7)
Indicates the inode is a SHINODE_REFERENCE to another inode.
define
SHATTR_META
(1 << 8)
This inode has supplementatal SHINODE_META information.
define
SHATTR_READ
(1 << 9)
Indicates the inode has global read access.
define
SHATTR_SYNC
(1 << 10)
Indicates the inode synchronizes with the share daemon.
define
SHATTR_TEMP
(1 << 11)
Indicates that inode is not persistent.
define
SHATTR_VER
(1 << 12)
This inode has multiple revision versions.
define
SHATTR_WRITE
(1 << 13)
This inode has global write access.
define
SHATTR_EXE
(1 << 14)
This inode has global execute access.
define
SHATTR_COMP
(1 << 15)
Indicates the inode is storing compressed data.
define
SHATTR_LINK_EXT
(SHATTR_LINK)
A SHINODE_EXTERNAL inode referencing a local-disk path.
define
HAS_SHMETA_INODE
( (_ino->blk.hdr.attr & SHATTR_META) || \ )
define
SHINODE_DEFAULT_ATTR_FORMAT
( \ ((_attr) & SHATTR_DB) ? SHINODE_DATABASE : \ ((_attr) & SHATTR_VER) ? SHINODE_REVISION : \ ((_attr) & SHATTR_ENC) ? SHINODE_CRYPT : \ ((_attr) & SHATTR_COMP) ? SHINODE_COMPRESS : \ SHINODE_BINARY \ )
The default format for data contained by a SHINODE_FILE inode.
Note
Does not apply to SHINODE_LINK references.
define
IS_SHINODE_ARCHIVABLE
(shfs_format(_ino) == SHINODE_DIRECTORY)
can inode be archived.
define
IS_SHINODE_COMPRESSABLE
(shfs_format(_ino) == SHINODE_BINARY)
can inode be compressed.
define
IS_SHINODE_ENCRYPTABLE
(shfs_format(_ino) == SHINODE_BINARY || \ shfs_format(_ino) == SHINODE_COMPRESS)
can inode be encrypted.
define
IS_SHINODE_VERSIONABLE
(shfs_format(_ino) == SHINODE_BINARY)
can inode be converted into a revision repository.
define
MAX_JOURNAL_CACHE_SIZE
256
The maximum number of sharefs journals (and sub-sequent file descriptor) open at once.
define
SHFS_MAX_JOURNAL
57344
The number of journals a sharefs filesystem contains.
shfs_journal_t.index structshfs__journal__t_1aa57dd3556ed79f58879abf613a9bebd6 member
define
SHFS_MAX_JOURNAL_SIZE
(SHFS_MAX_BLOCK * SHFS_MAX_BLOCK_SIZE)
The maximum number of bytes in a sharefs file-system journal.
define
SHMETA_READ
"read"
define
SHMETA_WRITE
"write"
define
SHMETA_EXEC
"exec"
define
SHMETA_USER
"user"
The read-access group assigned to the inode.
define
SHMETA_GROUP
"group"
define
SHMETA_SIGNATURE
"signature"
A digital signature.
define
SHMETA_DESC
"desc"
A textual description of the inode.
define
SHMETA_USER_NAME
"user.name"
login user's real name
define
SHMETA_USER_EMAIL
"user.email"
login user's email address.
define
SHMETA_USER_GEO
"user.geo"
define
SHMETA_USER_PASS
"sys.pass"
login user's password key.
define
SHMETA_USER_SALT
"sys.salt"
login user's password salt.
define
SHMETA_MIME_TYPE
"mime.name"
login user's password salt.
define
BASE_SHMETA_PATH
"meta"
A directory prefix referencing file meta information.
define
shfs_meta_free
shmap_free(_meta_p)
Free an instance to a sharedfs meta definition hashmap.
Note
Directly calls .
shmap_free() group__libshare__memmap_1ga5f1038ec61685cc6883b94272aa81731 member
define
SHFS_DIR_CERTIFICATE
"crt"
The system-level certificate directory.
define
SHFS_DIR_PAM
"pam"
The system-level password authentification module directory.
define
SHFS_DIR_PACKAGE
"pkg"
The system-level package hierarchy.
define
SHFS_DIR_APPLICATION
"app"
The system-level application hierarchy.
define
SHFS_DIR_MIME
"mime"
The system-level mime-type directory.
define
SHFS_DIR_LICENSE
"lic"
The system-level license directory.
define
SHFS_DIR_DATABASE
"db"
THe system-level database directory.
define
SHFS_FILE_EXECUTABLE
"exec"
define
SHLIST_F
((shfs_list_f)(_f))
define
SHFS_MAX_REFERENCE_HIERARCHY
( (SHFS_BLOCK_DATA_SIZE - sizeof()) / sizeof() )structshpeer__tcompoundshpeer_tstructshkey__tcompoundshkey_t
define
SHFS_STREAM_OPEN
(1 << 0)
define
SHFS_STREAM_READ
(1 << 1)
define
SHFS_STREAM_WRITE
(1 << 2)
define
SHFS_STREAM_FSALLOC
(1 << 3)
define
SHFS_STREAM_DIRTY
(1 << 4)
define
SHFS_STREAM_CREATE
(1 << 6)
define
SHFS_STREAM_SYNC
(1 << 7)
Incremental writes cannot be made until a full write occurs.
define
SHCERT_VERSION_1
1
define
SHCERT_VERSION_2
2
define
SHCERT_VERSION_3
3
define
SHCERT_ENT_INDIVIDUAL
(1 << 0)
An indication that the certificate is issued by an individual.
define
SHCERT_ENT_ORGANIZATION
(1 << 2)
An indication that the certificate is issued by an organization.
define
SHCERT_ENT_COMPANY
(1 << 3)
An indication that the certificate is issued by a company.
define
SHCERT_ENT_PRIVATE
(1 << 4)
An indication that the certificate is in a private state.
define
SHCERT_CERT_NONREPUDIATION_ENCIPHER
(1 << 8)
The certificate contains supplemental encipher authorization.
define
SHCERT_CERT_RIGHTS_ISSUER
(1 << 9)
The certificate can allocate new rights to derived entities.
define
SHCERT_CERT_CHAIN
(1 << 10)
Indicates the certificate has a parent authority.
define
SHCERT_CERT_SIGN
(1 << 11)
The public key is capable of being used as a digital signature.
define
SHCERT_CERT_CRL
(1 << 12)
Indicates the ability to sign a CRL.
define
SHCERT_CERT_DIGITAL
(1 << 13)
Indicates the ability to act as a digital signature.
define
SHCERT_CERT_KEY
(1 << 14)
The public key is capability of being used for a key agreement.
define
SHCERT_CERT_ENCIPHER
(1 << 16)
The public key is capability of being used for data encipherment.
define
SHCERT_CERT_NONREPUDIATION
(1 << 17)
An authentication that can be asserted to be genuine with high assurance.
define
SHCERT_CERT_LICENSE
(1 << 18)
The public key is capable of being used for licensing.
define
SHCERT_AUTH_WEB_CLIENT
(1 << 20)
Indiciates that the certificate can be validated by a web client.
define
SHCERT_AUTH_WEB_SERVER
(1 << 21)
Indiciates that the certificate can be validated via a web server.
define
SHCERT_AUTH_FILE
(1 << 22)
An indication that the certificate can be validated via a system certificate file.
define
SHCERT_AUTH_DEVICE
(1 << 23)
define
SHMIMEOP_NONE
0
A non-specific mime definition directive.
define
SHMIMEOP_SEXE
1
A SEXE executable path to process the mime type.
define
SHMIME_BINARY
"application/octet-stream"
define
SHMIME_TEXT_PLAIN
"text/plain"
define
SHMIME_APP_GZIP
"application/x-gzip"
define
SHMIME_APP_LINUX
"application/octet-stream/elf"
define
SHMIME_APP_LINUX_32
"application/octet-stream/elf-32"
define
SHMIME_APP_TAR
"application/x-tar"
define
SHMIME_APP_PEM
"application/x-pem-file"
define
SHMIME_APP_SQLITE
"application/x-sqlite3"
define
SHMIME_APP_SEXE
"application/x-sexe"
define
MAX_DEFAULT_SHARE_MIME_TYPES
10
define
MAX_MIME_HEADER_SIZE
512
Maximum length of a file's header to scan in order to detect mime type.
typedef
typedef struct shfs_t shfs_t
A type defintion for the sharefs filesytem structure.
typedef
typedef struct shfs_ino_t shfs_ino_t
A sharefs filesystem inode.
typedef
typedef __uint16_t shfs_inode_off_t
A sharefs filesystem inode or journal reference.
typedef
typedef __uint16_t shfs_ino_type_t
A sharefs inode type definition.
typedef
typedef __uint32_t shfs_attr_t
A sharefs inode attribute definitions.
typedef
typedef struct shfs_idx_t shfs_idx_t
A sharefs filesystem inode position header.
typedef
typedef struct shfs_hdr_t shfs_hdr_t
typedef
typedef struct shfs_block_t shfs_block_t
typedef
typedef struct shfs_t SHFS
A convienence macro for accessing a sharefs file partition.
typedef
typedef struct shfs_ino_t SHFL
A convienence macro for accessing a sharefs file node.
typedef
typedef struct shfs_root_t shfs_root_t
typedef
typedef struct shstat shstat
typedef
typedef struct shfs_dirent_t shfs_dirent_t
typedef
typedef int(* shfs_list_f)(shfs_ino_t *file, void *arg)
typedef
typedef struct shfs_dir_t shfs_dir_t
typedef
typedef shfs_dir_t* SHDIR
typedef
typedef struct shfs_block_obj_t shfs_block_obj_t
typedef
typedef struct shfstream_t shfstream_t
typedef
typedef struct shlic_t shlic_t
typedef
typedef struct shmime_def_t shmime_def_t
typedef
typedef struct sqlite3 shdb_t
typedef
typedef int(* shdb_cb_t)(void *, int, char **, char **)
typedef
typedef uint64_t shdb_idx_t
function
shfs_ino_t* shfs_inode
(shfs_ino_t *parent, char *name, int mode)
Retrieve a sharefs inode entry based on a given parent inode and path name.
Note
Searches for a reference to a sharefs inode labelled "name" in the inode. parent A new inode is created if a pre-existing one is not found.
Return Value
A is returned based on the , , mode specified. If one already exists it will be returned, and otherwise a new entry will be created.
shfs_node parent name and
Note
A new inode will be linked to the sharefs partition if it does not exist.
Param
parent
The parent inode such as a directory where the file presides.
name
The relational pathname of the file being referenced.
mode
The type of information that this inode is referencing (SHINODE_XX).
function
shfs_ino_t* shfs_inode_load
(shfs_ino_t *parent, shkey_t *key)
Retrieve a sharefs inode child entry based on a token key.
function
shfs_t* shfs_inode_tree
(shfs_ino_t *inode)
Obtain the shfs partition associated with a particular inode.
Param
inode
The inode in reference.
function
shpeer_t* shfs_inode_peer
(shfs_ino_t *inode)
function
shfs_ino_t* shfs_inode_root
(shfs_ino_t *inode)
Obtain the root partition inode associated with a particular inode.
Param
inode
The inode in reference.
function
shfs_ino_t* shfs_inode_parent
(shfs_ino_t *inode)
Obtain the parent [directory/container] inode associated with a particular inode.
Param
inode
The inode in reference.
function
int shfs_inode_write_entity
(shfs_ino_t *ent)
Write an entity such as a file inode.
function
int shfs_inode_truncate
(shfs_ino_t *inode, shsize_t ino_len)
Truncates the inode's underlying data to a specified size if the size is greater than the size of the inode or increases the size with blank data if the specified size is greater.
Param
inode
The non-container inode to adjust data size.
ino_len
The desired length of the inode's underlying data segment.
Note
Increasing the file size does not immediately increase the underlying data content size.
function
shsize_t shfs_size
(shfs_ino_t *file)
function
int shfs_inode_write_block
(shfs_t *tree, shfs_block_t *blk)
Writes a single inode block to a sharefs filesystem journal.
function
int shfs_inode_read_block
(shfs_t *tree, shfs_idx_t *pos, shfs_block_t *blk)
Retrieve a single data block from a sharefs filesystem inode.
See
shfs_init() group__libshare__fspartition_1ga15a8d8f6327752a7e924d348f260aa33 member
Return Value
Returns 0 on success and a SHERR_XXX on failure.
Param
tree
The sharefs partition allocated by . shfs_init() group__libshare__fspartition_1ga15a8d8f6327752a7e924d348f260aa33 member
inode
The inode whose data is being retrieved.
hdr
A specification of where the block is location in the sharefs filesystem partition.
inode
The inode block data to be filled in.
function
shkey_t* shfs_token_init
(shfs_ino_t *parent, int mode, char *fname)
Returns a unique key token representing an inode.
Param
parent
The parent inode of the inode being referenced.
Note
free the returned key with shkey_free()
function
void shfs_filename_set
(shfs_ino_t *inode, char *name)
Assign an inode a filename.
function
char* shfs_filename
(shfs_ino_t *inode)
Returns the filename of the inode.
function
char* shfs_inode_path
(shfs_ino_t *inode)
function
char* shfs_inode_id
(shfs_ino_t *inode)
A unique hexadecimal string representing a sharefs inode.
function
char* shfs_inode_print
(shfs_ino_t *inode)
function
char* shfs_inode_block_print
(shfs_block_t *jblk)
function
char* shfs_inode_size_str
(shsize_t size)
function
uint64_t shfs_crc_init
(shfs_block_t *blk)
Create a inode checksum.
function
uint64_t shfs_crc
(shfs_ino_t *file)
The share library file inode's data checksum.
function
int shfs_block_type
(shfs_block_t *blk)
The type of an inode block.
function
int shfs_type
(shfs_ino_t *inode)
The type of inode.
function
int shfs_block_format
(shfs_block_t *blk)
The format of an inode block.
function
int shfs_format
(shfs_ino_t *inode)
The format of an inode.
function
int shfs_format_set
(shfs_ino_t *file, int format)
Convert the inode to hold a different data format.
function
char* shfs_type_str
(int type)
A string representation of an inode type.
function
char shfs_type_char
(int type)
A single-character reference to an inode type.
function
char* shfs_format_str
(int format)
A string representation of an inode format.
function
int shfs_block_stat
(shfs_block_t *blk, shstat *st)
function
int shfs_fstat
(shfs_ino_t *file, shstat *st)
Obtain inode attribute information.
An SHERR_NOENT error occurs if inode format is not set.
Param
The
inode to generate info for.
st
The result info structure.
Return Value
Zero (0) on success or a libshare error code.
function
int shfs_stat
(shfs_t *fs, const char *path, shstat *st)
Obtain inode attribute information for a path.
function
shkey_t* shfs_token
(shfs_ino_t *inode)
function
int shfs_inode_remove
(shfs_ino_t *file)
function
int shfs_unlink
(shfs_t *fs, char *path)
Clear the contents of a sharefs inode.
function
shtime_t shfs_ctime
(shfs_ino_t *ino)
function
shtime_t shfs_mtime
(shfs_ino_t *ino)
function
char* shfs_app_name
(char *app_name)
function
char* shfs_app_path
(char *exec_path)
function
int shfs_proc_lock
(char *process_path, char *runtime_mode)
function
shfs_t* shfs_init
(shpeer_t *peer)
Creates a reference to a sharefs filesystem.
Param
peer
A local or remote reference to a sharefs partition. A combination of SHFS_PARTITION_XXX flags. flags
Return Value
A share partition associated with the peer specified or the local default partition if a NULL peer is specified. shfs_t structshfs__t compound
Todo write local file '/system/version' with current version. todo_1_todo000001
function
char* shfs_sys_dir
(char *sys_dir, char *fname)
function
shfs_t* shfs_sys_init
(char *sys_dir, char *fname, shfs_ino_t **file_p)
Access the system-level sharefs partition.
function
shpeer_t* shfs_peer
(shfs_t *fs)
function
void shfs_free
(shfs_t **tree_p)
Free a reference to a sharefs partition.
Param
tree_p
A reference to the sharefs partition instance to free.
function
shkey_t* shfs_partition_id
(shfs_t *tree)
Obtain the partition id for a sharefs partition.
Note
The local parition will always return zero (0).
function
shfs_t* shfs_uri_init
(char *path, int flags, shfs_ino_t **ino_p)
Obtain the share-fs and optional file for a share-fs URI path.
function
size_t shfs_avail
(void)
The total number of megabytes available on the file-system utilized.
function
void shfs_journal_path
(shfs_t *tree, int index, char *ret_path)
The local file-system path where a sharefs journal is stored.
function
shfs_journal_t* shfs_journal_open
(shfs_t *tree, int index)
Returns an instance to a sharefs filesystem journal.
function
int shfs_journal_scan
(shfs_t *tree, shkey_t *key, shfs_idx_t *idx)
Search for the first empty inode entry in a journal.
Param
tree
The sharefs filesystem partition.
key
The token name of the inode being referenced.
idx
The index number of the journal.
Return Value
A inode index number or zero (0) on failure.
Note
Inode index #0 is reserved for system use.
function
int shfs_journal_close
(shfs_journal_t **jrnl_p)
Release all resources being used to reference a shared partition journal.
Param
jrnl_p
A reference to the journal.
Return Value
A zero (0) on success and a negative error code on failure.
function
shfs_block_t* shfs_journal_block
(shfs_journal_t *jrnl, int ino)
Retrieve an inode block from a journal.
function
size_t shfs_journal_size
(shfs_journal_t *jrnl)
Calculates the byte size of a sharefs partition journal.
function
void shfs_journal_cache_free
(shfs_t *tree)
function
int shfs_journal_index
(shkey_t *key)
Identify the default journal number for a inode's name.
Return Value
A sharefs filesystem journal index number.
Note
Journal #0 is reserved for system use.
function
int shfs_link
(shfs_ino_t *parent, shfs_ino_t *inode)
Link a child inode inside a parent's directory listing.
Note
The birth timestamp and token key is assigned on link.
function
int shfs_link_find
(shfs_ino_t *parent, shkey_t *key, shfs_block_t *ret_blk)
Find an inode in it's parent using it's key name.
function
int shfs_link_count
(shfs_ino_t *parent)
Obtain the number of inode's contained by a parent.
function
void shfs_list_free
(shfs_dirent_t **ent_p)
Frees a list of directory entries.
Param
ent_p
A reference to the array of entries.
function
int shfs_list
(shfs_ino_t *file, char *fspec, shfs_dirent_t **ent_p)
Obtain a list of inode's contained by the parent.
Param
file
The inode to list the contents of.
fspec
NULL to list all entries or a file-spec format (i.e. "file*name")
Return Value
The number of directory entries returned or a negative libshare error code.
function
int shfs_list_cb
(shfs_ino_t *parent, char *fspec, shfs_list_f cb, void *arg)
function
int shfs_lock
(shfs_ino_t *inode, int mask)
function
int shfs_lock_of
(shfs_ino_t *inode, int mask, size_t of, size_t len)
function
int shfs_unlock
(shfs_ino_t *inode)
function
int shfs_locked
(shfs_ino_t *inode)
function
shfs_ino_t* shfs_dir_base
(shfs_t *tree)
The base SHINODE_PARTITION type inode for a sharefs partition.
function
shfs_ino_t* shfs_dir_cwd
(shfs_t *tree)
The current working inode directory for a sharefs partition.
function
shfs_ino_t* shfs_dir_parent
(shfs_ino_t *inode)
Return Value
The SHINODE_DIRECTORY parent of an inode.
function
shfs_ino_t* shfs_dir_entry
(shfs_ino_t *inode, char *fname)
Return an inode from a directory inode.
function
shfs_ino_t* shfs_dir_find
(shfs_t *tree, char *path)
Locate a directory inode on a sharefs partition by an absolute pathname.
function
shfs_dir_t* shfs_opendir
(shfs_t *fs, char *path)
Open a directory to be listed.
Param
fs
The sharefs partition to use or NULL for default.
Return Value
A resource for tracking a directory list.
function
shfs_dirent_t* shfs_readdir
(shfs_dir_t *dir)
function
int shfs_closedir
(shfs_dir_t *dir)
function
int shfs_chroot
(shfs_t *fs, shfs_ino_t *dir)
function
int shfs_chroot_path
(shfs_t *fs, char *path)
function
int shfs_dir_remove
(shfs_ino_t *dir)
function
int shfs_list_fnmatch
(shfs_ino_t *file, char *fspec, shfs_dirent_t **ent_p)
function
int shfs_meta
(shfs_t *tree, shfs_ino_t *ent, shmap_t **val_p)
Obtain a reference to the meta definition hashmap associated with the inode entry.
Note
The inode will cache the hashmap reference.
shfs_ino_t structshfs__ino__t compound
Param
ent
The inode entry.
val_p
A memory reference to the meta definition hashmap being filled in.
function
int shfs_meta_save
(shfs_t *tree, shfs_ino_t *ent, shmap_t *h)
Flush the inode's meta map to disk.
Param
The
inode associated with the meta map.
val
The meta map to store to disk.
Return Value
A zero (0) on success and a negative one (-1) on failure.
function
const char* shfs_meta_get
(shfs_ino_t *file, char *def)
Retrieve a SHMETA_XX meta defintion from a share library file.
function
int shfs_meta_perm
(shfs_ino_t *file, char *def, shkey_t *user)
function
int shfs_meta_set
(shfs_ino_t *file, char *def, char *value)
function
shkey_t* shfs_sig_get
(shfs_ino_t *file)
function
int shfs_sig_set
(shfs_ino_t *file, shkey_t *sig_key)
function
int shfs_sig_verify
(shfs_ino_t *file, shkey_t *sig_key)
function
int shfs_write
(shfs_ino_t *file, shbuf_t *buff)
Write auxillary data to a sharefs file inode.
function
int shfs_read_of
(shfs_ino_t *file, shbuf_t *buff, off_t of, size_t size)
Obtain a segment from a file's data content.
Note
An SHERR_NOENT error occurs if file format is not set.
function
int shfs_read
(shfs_ino_t *file, shbuf_t *buff)
Obtain file data content.
Note
An SHERR_NOENT error occurs if file format is not set.
function
int shfs_file_read
(shfs_ino_t *file, unsigned char *data, size_t data_len)
function
int shfs_file_write
(shfs_ino_t *file, unsigned char *data, size_t data_len)
function
shfs_ino_t* shfs_file_find
(shfs_t *tree, char *path)
function
int shfs_file_pipe
(shfs_ino_t *file, int fd)
function
int shfs_file_notify
(shfs_ino_t *file)
function
int shfs_file_copy
(shfs_ino_t *src_file, shfs_ino_t *dest_file)
function
int shfs_file_remove
(shfs_ino_t *file)
function
int shfs_truncate
(shfs_ino_t *file, shsize_t len)
Change the file size of a formatted inode.
Note
Only SHFS_BINARY is currently supported.
function
shfs_ino_t* shfs_cache_get
(shfs_ino_t *parent, shkey_t *name)
function
void shfs_cache_set
(shfs_ino_t *parent, shfs_ino_t *inode)
function
void shfs_inode_cache_free
(shfs_ino_t *inode)
function
int shfs_aux_read
(shfs_ino_t *inode, shbuf_t *ret_buff)
Retrieve a full data segment of a sharefs filesystem inode.
Param
inode
The inode whose data is being retrieved.
ret_buff
The return buffer.
shbuf_t structshbuf__t compound
Return Value
A zero (0) on success or an libshare error code no failure.
function
int shfs_aux_pread
(shfs_ino_t *inode, shbuf_t *ret_buff, off_t seek_of, size_t seek_max)
Retrieve a full or partial data segment of a sharefs filesystem inode.
Param
inode
The inode whose data is being retrieved.
ret_buff
The return buffer.
shbuf_t structshbuf__t compound
seek_of
The offset to begin reading data from the inode.
seek_max
The length of data to be read or zero (0) to indicate no limit.
Return Value
A zero (0) on success or an libshare error code no failure.
function
int shfs_aux_write
(shfs_ino_t *inode, shbuf_t *buff)
Stores a full data segment to a sharefs filesystem inode.
Param
inode
The inode whose data is being retrieved.
buff
The data segment to write to the inode.
Return Value
A zero (0) on success or an libshare error code no failure.
Note
A inode must be linked before it can be written to.
function
int shfs_aux_pwrite
(shfs_ino_t *inode, shbuf_t *buff, off_t seek_of, size_t seek_max)
Stores a full or partial data segment to a sharefs filesystem inode.
Param
inode
The inode whose data is being retrieved.
buff
The data segment to write to the inode.
seek_of
The offset to begin writing data to the inode.
seek_max
The length of data to be write or zero (0) to indicate no limit.
Return Value
A zero (0) on success or an libshare error code no failure.
Note
A inode must be linked before it can be written to.
function
ssize_t shfs_aux_pipe
(shfs_ino_t *inode, int fd)
Writes the auxillary contents of the inode to the file descriptor.
Param
inode
The sharefs filesystem inode to print from.
fd
A posix file descriptor number representing a socket or local filesystem file reference.
Return Value
The size of the bytes written or a SHERR_XX error code on error. On error one of the following error codes will be set: SHERR_BADF fd is not a valid file descriptor or is not open for writing.
function
uint64_t shfs_aux_crc
(shfs_ino_t *inode)
function
int shfs_access_read
(shfs_ino_t *file, shkey_t *id_key)
Check whether a user has read permission to an inode.
function
int shfs_access_write
(shfs_ino_t *file, shkey_t *id_key)
Check whether a user has write permission to an inode.
function
int shfs_access_exec
(shfs_ino_t *file, shkey_t *id_key)
Check whether a user has exec permission to an inode.
function
int shfs_access_owner_set
(shfs_ino_t *file, shkey_t *id_key)
Set the owner of a file to an identity key.
function
shkey_t* shfs_access_owner_get
(shfs_ino_t *file)
Get a file owner's identity key.
function
char* shfs_attr_label
(int attr_idx)
function
shfs_attr_t shfs_block_attr
(shfs_block_t *blk)
function
shfs_attr_t shfs_attr
(shfs_ino_t *inode)
function
char* shfs_attr_str
(shfs_attr_t attr)
function
int shfs_attr_set
(shfs_ino_t *file, int attr)
function
int shfs_attr_unset
(shfs_ino_t *file, int attr)
function
int shfs_cred_store
(shfs_ino_t *file, shkey_t *key, unsigned char *data, size_t data_len)
function
int shfs_cred_load
(shfs_ino_t *file, shkey_t *key, unsigned char *data, size_t max_len)
function
int shfs_zlib_read
(shfs_ino_t *file, shbuf_t *buff)
function
int shfs_zlib_write
(shfs_ino_t *file, shbuf_t *buff)
function
int shfs_bin_read_of
(shfs_ino_t *file, shbuf_t *buff, off_t of, size_t size)
Read binary segment from a file.
function
int shfs_bin_read
(shfs_ino_t *file, shbuf_t *buff)
Read binary content from a file.
function
int shfs_bin_write
(shfs_ino_t *file, shbuf_t *buff)
Write binary content to a file.
function
int shfs_ref_read
(shfs_ino_t *file, shbuf_t *buff)
Retrieve information about a reference share-fs inode.
function
int shfs_ref_write
(shfs_ino_t *file, shbuf_t *buff)
Create a reference to another share-fs inode.
function
int shfs_ref_set
(shfs_ino_t *file, shfs_ino_t *ref_file)
Create a reference to another share-fs inode.
function
int shfs_ref_get
(shfs_ino_t *file, shfs_t **ref_fs_p, shfs_ino_t **ref_file_p)
Obtain a reference to another share-fs inode.
function
int shfs_mem_read
(char *path, shbuf_t *buff)
Read a file from the local filesystem into a memory buffer.
function
int shfs_read_mem
(char *path, char **data_p, size_t *data_len_p)
Read a file from the local filesystem into memory.
function
int shfs_mem_write
(char *path, shbuf_t *buff)
Write a file from a memory buffer to the local filesystem.
function
int shfs_write_mem
(char *path, void *data, size_t data_len)
Write a file from memory to the local filesystem.
function
int shfs_rev_init
(shfs_ino_t *file)
function
int shfs_rev_clear
(shfs_ino_t *file)
function
shfs_ino_t* shfs_rev_branch_resolve
(shfs_ino_t *repo, char *name)
Obtain a revision inode from a branch name.
function
shfs_ino_t* shfs_rev_tag_resolve
(shfs_ino_t *repo, char *name)
Obtain a revision inode from a tag name.
function
shfs_ino_t* shfs_rev_base
(shfs_ino_t *repo)
Obtain the current committed revision.
function
int shfs_rev_ref_read
(shfs_ino_t *file, char *group, char *name, shbuf_t *buff)
function
int shfs_rev_ref_write
(shfs_ino_t *file, char *group, char *name, shbuf_t *buff)
function
shfs_ino_t* shfs_rev_prev
(shfs_ino_t *rev)
function
int shfs_rev_delta_read
(shfs_ino_t *rev, shbuf_t *buff)
function
int shfs_rev_delta_write
(shfs_ino_t *rev, shbuf_t *buff)
function
const char* shfs_rev_desc_get
(shfs_ino_t *rev)
function
int shfs_rev_commit
(shfs_ino_t *file, shfs_ino_t **rev_p)
function
int shfs_rev_cat
(shfs_ino_t *file, shkey_t *rev_key, shbuf_t *buff, shfs_ino_t **rev_p)
function
int shfs_rev_delta
(shfs_ino_t *file, shbuf_t *diff_buff)
Obtain a binary delta containing the differences between the current file's data-content and the last committed revision's data-content.
function
int shfs_rev_branch
(shfs_ino_t *repo, char *name, shfs_ino_t *rev)
function
int shfs_rev_tag
(shfs_ino_t *repo, char *name, shfs_ino_t *rev)
function
int shfs_rev_switch
(shfs_ino_t *file, char *ref_name, shfs_ino_t **rev_p)
function
int shfs_rev_revert
(shfs_ino_t *file)
function
int shfs_rev_checkout
(shfs_ino_t *file, shkey_t *key, shfs_ino_t **rev_p)
function
int shfs_rev_diff
(shfs_ino_t *file, shkey_t *rev_key, shbuf_t *buff)
function
void shfs_rev_desc_set
(shfs_ino_t *rev, char *desc)
function
int shfs_obj_set
(shfs_ino_t *file, char *name, shkey_t *key)
function
int shfs_obj_get
(shfs_ino_t *file, char *name, shkey_t **key_p)
function
shfs_t* shfs_home_fs
(shkey_t *id_key)
function
shfs_ino_t* shfs_home_file
(shfs_t *fs, char *path)
function
shpeer_t* shfs_home_peer
(shkey_t *id_key)
function
int shfstream_init
(shfstream_t *stream, SHFL *file)
[ ]
Initialize a file stream.
function
int shfstream_open
(shfstream_t *stream, const char *path, shfs_t *fs)
Open a file stream.
function
shfstream_t* shfstream_get
(int fd)
Obtain a file stream's descriptor data.
function
int shfstream_getfd
(void)
Get the next available file stream descriptor number.
function
int shfstream_setpos
(shfstream_t *stream, size_t pos)
Set the current byte position of a file stream.
function
size_t shfstream_getpos
(shfstream_t *stream)
Obtain the current byte position of a file stream.
function
int shfstream_close
(shfstream_t *stream)
Transition file stream into a closed state.
function
int shfstream_stat
(shfstream_t *stream, struct stat *buf)
function
int shfstream_truncate
(shfstream_t *stream, size_t len)
function
int shfstream_alloc
(shfstream_t *stream, size_t size)
function
int shfstream_flush
(shfstream_t *stream)
function
ssize_t shfstream_read
(shfstream_t *stream, void *ptr, size_t size)
function
ssize_t shfstream_write
(shfstream_t *stream, const void *ptr, size_t size)
function
int shfstream_sync
(shfstream_t *stream)
Flushes any unwritten data to the file-system.
Note
Flushes at a maximum rate of once per second.
function
shmime_t* shmime
(char *type)
function
shmime_t* shmime_file
(shfs_ino_t *file)
function
char* shmime_print
(shmime_t *mime)
function
char** shmime_default_dirs
(void)
function
shdb_t* shdb_open
(char *db_name)
function
shdb_t* shdb_open_peer
(char *db_name, shpeer_t *peer)
function
int shdb_exec
(shdb_t *db, char *sql)
function
void shdb_close
(shdb_t *db)
function
int shdb_row_find
(shdb_t *db, char *table, uint64_t *rowid_p, char *col, char *val, int flags)
function
int shdb_col_num_cb
(void *p, int arg_nr, char **args, char **cols)
function
int shdb_col_value_cb
(void *p, int arg_nr, char **args, char **cols)
function
char* shdb_row_value
(shdb_t *db, char *table, shdb_idx_t rowid, char *col)
function
int shdb_row_delete
(shdb_t *db, char *table, shdb_idx_t rowid)
function
shjson_t* shdb_json_write
(shdb_t *db, char *table, shdb_idx_t rowid_of, shdb_idx_t rowid_len)
Obtain a set of rows from a shdb database table in JSON format.
Param
db
The database to obtain the records from.
rowid_of
The rowid offset or 0 for none.
rowid_len
The maximum number of records to obtain or 0 for unlimited.
Return Value
An allocated JSON hierarchy compatible with libshare.
See
shjson_free group__libshare__memjson_1gae9a7788305c14ad5cfb2b08c8d1a1fb4 member
function
int shdb_json_read
(shdb_t *db, shjson_t *json)
Parse JSON into a database.
function
int shdb_row_set_time_adj
(shdb_t *db, char *table, shdb_idx_t rowid, char *col, unsigned int dur)
function
int shdb_row_set
(shdb_t *db, char *table, shdb_idx_t rowid, char *col, char *text)
function
int shdb_row_new
(shdb_t *db, char *table, shdb_idx_t *rowid_p)
function
int shdb_exec_cb
(shdb_t *db, char *sql, shdb_cb_t func, void *arg)
function
int shdb_col_new
(shdb_t *db, char *table, char *col)
function
int shdb_table_new
(shdb_t *db, char *table)
function
int shfs_arch_read
(SHFL *file, shbuf_t *buff)
[ ]
Read an 'archive' directory inode into SHZ format.
function
int shfs_arch_write
(SHFL *file, shbuf_t *buff)
[ ]
Write SHZ formatted data to a directory.
function
int shopen
(const char *path, const char *mode, shfs_t *fs)
Open a sharefs file inode for stream-based I/O.
Param
fs
The sharefs partition or NULL for default.
function
int shclose
(int fd)
Close a previously opened stream.
function
int shfsetpos
(int fd, size_t pos)
Set the current seek offset in a sharefs file stream.
function
int shfgetpos
(int fd, size_t *pos)
Get the current seek offset of a sharefs file stream.
function
size_t shftell
(int fd)
Get the current seek offset of a sharefs file stream.
function
int shrewind
(int fd)
Set the current seek offset to the beginning of the stream.
function
ssize_t shfseek
(int fd, size_t offset, int whence)
Set the current seek offset in a sharefs file stream.
See
fseek()
function
int shread
(int fd, void *ptr, size_t size)
Read a segment of data from a stream.
function
int shwrite
(int fd, void *ptr, size_t size)
Write a segment of data to a stream.
function
int shflush
(int fd)
Flush any pending data to be written from a buffered stream to a file.
function
int shftruncate
(int fd, size_t len)
Truncate a data stream to a specified length.
function
int shfstat
(int fd, struct stat *buf)
Obtain file information using POSIX style "stat" struct.