GnomeVFS - Filesystem Abstraction library | ||||
---|---|---|---|---|
enum GnomeVFSFileFlags; enum GnomeVFSFileType; enum GnomeVFSFileInfoFields; enum GnomeVFSFilePermissions; enum GnomeVFSFileInfoOptions; enum GnomeVFSSetFileInfoMask; GnomeVFSGetFileInfoResult; typedef GnomeVFSInodeNumber; GnomeVFSFileInfo; #define GNOME_VFS_FILE_INFO_SYMLINK (info) #define GNOME_VFS_FILE_INFO_SET_SYMLINK (info, value) #define GNOME_VFS_FILE_INFO_LOCAL (info) #define GNOME_VFS_FILE_INFO_SET_LOCAL (info, value) #define GNOME_VFS_FILE_INFO_SUID (info) #define GNOME_VFS_FILE_INFO_SGID (info) #define GNOME_VFS_FILE_INFO_STICKY (info) #define GNOME_VFS_FILE_INFO_SET_SUID (info, value) #define GNOME_VFS_FILE_INFO_SET_SGID (info, value) #define GNOME_VFS_FILE_INFO_SET_STICKY (info, value) GnomeVFSFileInfo* gnome_vfs_file_info_new (void); void gnome_vfs_file_info_unref (GnomeVFSFileInfo *info); void gnome_vfs_file_info_ref (GnomeVFSFileInfo *info); void gnome_vfs_file_info_clear (GnomeVFSFileInfo *info); const char* gnome_vfs_file_info_get_mime_type (GnomeVFSFileInfo *info); void gnome_vfs_file_info_copy (GnomeVFSFileInfo *dest, const GnomeVFSFileInfo *src); GnomeVFSFileInfo* gnome_vfs_file_info_dup (const GnomeVFSFileInfo *orig); gboolean gnome_vfs_file_info_matches (const GnomeVFSFileInfo *a, const GnomeVFSFileInfo *b); GList* gnome_vfs_file_info_list_ref (GList *list); GList* gnome_vfs_file_info_list_unref (GList *list); GList* gnome_vfs_file_info_list_copy (GList *list); void gnome_vfs_file_info_list_free (GList *list); GnomeVFSGetFileInfoResult* gnome_vfs_get_file_info_result_dup (GnomeVFSGetFileInfoResult *result); void gnome_vfs_get_file_info_result_free (GnomeVFSGetFileInfoResult *result);
typedef enum { GNOME_VFS_FILE_FLAGS_NONE = 0, GNOME_VFS_FILE_FLAGS_SYMLINK = 1 << 0, GNOME_VFS_FILE_FLAGS_LOCAL = 1 << 1 } GnomeVFSFileFlags;
Packed boolean bitfield representing special flags a GnomeVFSFileInfo struct can have.
typedef enum { GNOME_VFS_FILE_TYPE_UNKNOWN, GNOME_VFS_FILE_TYPE_REGULAR, GNOME_VFS_FILE_TYPE_DIRECTORY, GNOME_VFS_FILE_TYPE_FIFO, GNOME_VFS_FILE_TYPE_SOCKET, GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE, GNOME_VFS_FILE_TYPE_BLOCK_DEVICE, GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK } GnomeVFSFileType;
Maps to a stat
mode, and identifies the kind of file represented by a
GnomeVFSFileInfo struct, stored in the type
field.
typedef enum { GNOME_VFS_FILE_INFO_FIELDS_NONE = 0, GNOME_VFS_FILE_INFO_FIELDS_TYPE = 1 << 0, GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS = 1 << 1, GNOME_VFS_FILE_INFO_FIELDS_FLAGS = 1 << 2, GNOME_VFS_FILE_INFO_FIELDS_DEVICE = 1 << 3, GNOME_VFS_FILE_INFO_FIELDS_INODE = 1 << 4, GNOME_VFS_FILE_INFO_FIELDS_LINK_COUNT = 1 << 5, GNOME_VFS_FILE_INFO_FIELDS_SIZE = 1 << 6, GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT = 1 << 7, GNOME_VFS_FILE_INFO_FIELDS_IO_BLOCK_SIZE = 1 << 8, GNOME_VFS_FILE_INFO_FIELDS_ATIME = 1 << 9, GNOME_VFS_FILE_INFO_FIELDS_MTIME = 1 << 10, GNOME_VFS_FILE_INFO_FIELDS_CTIME = 1 << 11, GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME = 1 << 12, GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE = 1 << 13, GNOME_VFS_FILE_INFO_FIELDS_ACCESS = 1 << 14, GNOME_VFS_FILE_INFO_FIELDS_IDS = 1 << 15, GNOME_VFS_FILE_INFO_FIELDS_ACL = 1 << 16, GNOME_VFS_FILE_INFO_FIELDS_SELINUX_CONTEXT = 1 << 17 } GnomeVFSFileInfoFields;
Flags indicating what fields in a GnomeVFSFileInfo struct are valid. Name is always assumed valid (how else would you have gotten a FileInfo struct otherwise?)
typedef enum { GNOME_VFS_PERM_SUID = S_ISUID, GNOME_VFS_PERM_SGID = S_ISGID, GNOME_VFS_PERM_STICKY = 01000, /* S_ISVTX not defined on all systems */ GNOME_VFS_PERM_USER_READ = S_IRUSR, GNOME_VFS_PERM_USER_WRITE = S_IWUSR, GNOME_VFS_PERM_USER_EXEC = S_IXUSR, GNOME_VFS_PERM_USER_ALL = S_IRUSR | S_IWUSR | S_IXUSR, GNOME_VFS_PERM_GROUP_READ = S_IRGRP, GNOME_VFS_PERM_GROUP_WRITE = S_IWGRP, GNOME_VFS_PERM_GROUP_EXEC = S_IXGRP, GNOME_VFS_PERM_GROUP_ALL = S_IRGRP | S_IWGRP | S_IXGRP, GNOME_VFS_PERM_OTHER_READ = S_IROTH, GNOME_VFS_PERM_OTHER_WRITE = S_IWOTH, GNOME_VFS_PERM_OTHER_EXEC = S_IXOTH, GNOME_VFS_PERM_OTHER_ALL = S_IROTH | S_IWOTH | S_IXOTH, GNOME_VFS_PERM_ACCESS_READABLE = 1 << 16, GNOME_VFS_PERM_ACCESS_WRITABLE = 1 << 17, GNOME_VFS_PERM_ACCESS_EXECUTABLE = 1 << 18 } GnomeVFSFilePermissions;
File permissions. Some of these fields correspond to traditional UNIX semantics, others provide more abstract concepts.
GNOME_VFS_PERM_ACCESS_
* fields.
typedef enum { GNOME_VFS_FILE_INFO_DEFAULT = 0, GNOME_VFS_FILE_INFO_GET_MIME_TYPE = 1 << 0, GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE = 1 << 1, GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE = 1 << 2, GNOME_VFS_FILE_INFO_FOLLOW_LINKS = 1 << 3, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS = 1 << 4, GNOME_VFS_FILE_INFO_NAME_ONLY = 1 << 5, GNOME_VFS_FILE_INFO_GET_ACL = 1 << 6, GNOME_VFS_FILE_INFO_GET_SELINUX_CONTEXT = 1 << 7 } GnomeVFSFileInfoOptions;
Packed boolean bitfield representing options that can
be passed into a gnome_vfs_get_file_info()
call (or other
related calls that return file info) and affect the operation
of get_file_info.
typedef enum { GNOME_VFS_SET_FILE_INFO_NONE = 0, GNOME_VFS_SET_FILE_INFO_NAME = 1 << 0, GNOME_VFS_SET_FILE_INFO_PERMISSIONS = 1 << 1, GNOME_VFS_SET_FILE_INFO_OWNER = 1 << 2, GNOME_VFS_SET_FILE_INFO_TIME = 1 << 3, GNOME_VFS_SET_FILE_INFO_ACL = 1 << 4, GNOME_VFS_SET_FILE_INFO_SELINUX_CONTEXT = 1 << 5, GNOME_VFS_SET_FILE_INFO_SYMLINK_NAME = 1 << 6 } GnomeVFSSetFileInfoMask;
Packed boolean bitfield representing the aspects of the file
to be changed in a gnome_vfs_set_file_info()
call.
typedef struct { GnomeVFSURI *uri; GnomeVFSResult result; GnomeVFSFileInfo *file_info; } GnomeVFSGetFileInfoResult;
This data structure encapsulates the details of an individual file
info request that was part of a mass file info request launched
through gnome_vfs_async_get_file_info()
, and is passed to a
GnomeVFSAsyncGetFileInfoCallback.
GnomeVFSURI *uri ; |
The GnomeVFSURI the file info was requested for. |
GnomeVFSResult result ; |
The GnomeVFSResult of the file info request. |
GnomeVFSFileInfo *file_info ; |
The GnomeVFSFileInfo that was retrieved. |
typedef GnomeVFSFileSize GnomeVFSInodeNumber;
Represents the i-node of a file, this is a low level data structure that the operating system uses to hold information about a file.
typedef struct { char *name; GnomeVFSFileInfoFields valid_fields; GnomeVFSFileType type; GnomeVFSFilePermissions permissions; GnomeVFSFileFlags flags; dev_t device; GnomeVFSInodeNumber inode; guint link_count; guint uid; guint gid; GnomeVFSFileSize size; GnomeVFSFileSize block_count; guint io_block_size; time_t atime; time_t mtime; time_t ctime; char *symlink_name; char *mime_type; guint refcount; /* File ACLs */ GnomeVFSACL *acl; /* SELinux security context. -- ascii string, raw format. */ char* selinux_context; } GnomeVFSFileInfo;
io_block_size
if applicable.
For network file systems, this may be set to very big values allowing
parallelization.
The GnomeVFSFileInfo structure contains information about a file.
char *name ; |
A char * specifying the base name of the file (without any path string). |
GnomeVFSFileInfoFields valid_fields ; |
GnomeVFSFileInfoFields specifying which fields of
GnomeVFSFileInfo are valid. Note that name is always
assumed to be valid, i.e. clients may assume that it is not NULL.
|
GnomeVFSFileType type ; |
The GnomeVFSFileType of the file (i.e. regular, directory, block device, ...)
if valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_TYPE.
|
GnomeVFSFilePermissions permissions ; |
The GnomeVFSFilePermissions corresponding to the UNIX-like
permissions of the file, if valid_fields provides
GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS, and the
GnomeVFSFilePermissions corresponding to abstract access
concepts (GNOME_VFS_PERM_ACCESS_READABLE, GNOME_VFS_PERM_ACCESS_WRITABLE,
and GNOME_VFS_PERM_ACCESS_EXECUTABLE) if valid_fields
provides GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS.
|
GnomeVFSFileFlags flags ; |
GnomeVFSFileFlags providing additional information about the file,
for instance whether it is local or a symbolic link, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_FLAGS.
|
dev_t device ; |
Identifies the device the file is located on, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_DEVICE.
|
GnomeVFSInodeNumber inode ; |
Identifies the inode corresponding to the file, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_INODE.
|
guint link_count ; |
Counts the number of hard links to the file, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_LINK_COUNT.
|
guint uid ; |
The user owning the file, if valid_fields provides
GNOME_VFS_FILE_INFO_FIELDS_IDS.
|
guint gid ; |
The user owning the file, if valid_fields provides
GNOME_VFS_FILE_INFO_FIELDS_IDS.
|
GnomeVFSFileSize size ; |
The size of the file in bytes (a GnomeVFSFileSize),
if valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_SIZE.
|
GnomeVFSFileSize block_count ; |
The size of the file in file system blocks (a GnomeVFSFileSize),
if valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT.
|
guint io_block_size ; |
The optimal buffer size for reading/writing the file, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_IO_BLOCK_SIZE.
|
time_t atime ; |
The time of the last file access, if valid_fields provides
GNOME_VFS_FILE_INFO_FIELDS_ATIME.
|
time_t mtime ; |
The time of the last file contents modification, if valid_fields
provides GNOME_VFS_FILE_INFO_FIELDS_MTIME.
|
time_t ctime ; |
The time of the last inode change, if valid_fields provides
GNOME_VFS_FILE_INFO_FIELDS_CTIME.
|
char *symlink_name ; |
This is the name of the file this link points to, type
is GNOME_VFS_FILE_FLAGS_SYMLINK, and valid_fields
provides GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME.
|
char *mime_type ; |
This is a char * identifying the type of the file, if
valid_fields provides GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE.
|
guint refcount ; |
The reference count of this file info, which is one by default, and
that can be increased using gnome_vfs_file_info_ref() and decreased
using gnome_vfs_file_info_unref() . When it drops to zero, the file info
is freed and its memory is invalid. Make sure to keep your own
reference to a file info if you received it from GnomeVFS, i.e.
if you didn't call gnome_vfs_file_info_new() yourself.
|
GnomeVFSACL *acl ; |
|
char *selinux_context ; |
#define GNOME_VFS_FILE_INFO_SYMLINK(info)
Determines whether a file is a symbolic link given info
.
info : |
GnomeVFSFileInfo struct |
#define GNOME_VFS_FILE_INFO_SET_SYMLINK(info, value)
Set the symbolic link field in info
to value
.
info : |
GnomeVFSFileInfo struct |
value : |
if TRUE , info is set to indicate the file is a symbolic link
|
#define GNOME_VFS_FILE_INFO_LOCAL(info)
Determines whether a file is local given info
.
info : |
GnomeVFSFileInfo struct |
#define GNOME_VFS_FILE_INFO_SET_LOCAL(info, value)
Set the "local file" field in info
to value
.
info : |
GnomeVFSFileInfo struct |
value : |
if TRUE , info is set to indicate the file is local
|
#define GNOME_VFS_FILE_INFO_SUID(info)
Determines whether a file belongs to the super user.
info : |
GnomeVFSFileInfo struct |
#define GNOME_VFS_FILE_INFO_SGID(info)
Determines whether a file belongs to the super user's group.
info : |
GnomeVFSFileInfo struct |
#define GNOME_VFS_FILE_INFO_STICKY(info)
Determines whether a file has the sticky bit set, given info
info : |
GnomeVFSFileInfo struct |
#define GNOME_VFS_FILE_INFO_SET_SUID(info, value)
Set the SUID field in info
to value
.
info : |
GnomeVFSFileInfo struct |
value : |
if TRUE , info is set to indicate the file belongs to the super user
|
#define GNOME_VFS_FILE_INFO_SET_SGID(info, value)
Set the SGID field in info
to value
.
info : |
GnomeVFSFileInfo struct |
value : |
if TRUE , info is set to indicate the file belongs to the super user's group
|
#define GNOME_VFS_FILE_INFO_SET_STICKY(info, value)
Set the sticky bit in info
to value
.
info : |
GnomeVFSFileInfo struct |
value : |
if TRUE , info is set to indicate the file has the sticky bit set
|
GnomeVFSFileInfo* gnome_vfs_file_info_new (void);
Allocate and initialize a new GnomeVFSFileInfo struct.
Returns : | a pointer to the newly allocated file information struct. |
void gnome_vfs_file_info_unref (GnomeVFSFileInfo *info);
Decreases the refcount of info
by 1. Frees the struct info
if refcount becomes 0.
info : |
pointer to a file information struct. |
void gnome_vfs_file_info_ref (GnomeVFSFileInfo *info);
Increment refcount of info
by 1.
info : |
pointer to a file information struct. |
void gnome_vfs_file_info_clear (GnomeVFSFileInfo *info);
Clear info
so that it's ready to accept new data. This is
supposed to be used when info
already contains meaningful information which
we want to replace.
info : |
pointer to a file information struct. |
const char* gnome_vfs_file_info_get_mime_type (GnomeVFSFileInfo *info);
Retrieve MIME type from info
. There is no need to free the return
value.
info : |
a pointer to a file information struct. |
Returns : | a pointer to a string representing the MIME type. |
void gnome_vfs_file_info_copy (GnomeVFSFileInfo *dest, const GnomeVFSFileInfo *src);
Copy information from src
into dest
.
dest : |
pointer to a struct to copy src 's information into.
|
src : |
pointer to the information to be copied into dest .
|
GnomeVFSFileInfo* gnome_vfs_file_info_dup (const GnomeVFSFileInfo *orig);
Duplicates orig
and returns it.
orig : |
pointer to a file information structure to duplicate. |
Returns : | a new file information struct that duplicates the information in orig .
|
gboolean gnome_vfs_file_info_matches (const GnomeVFSFileInfo *a, const GnomeVFSFileInfo *b);
Compare the two file info structs, return TRUE
if they match exactly
the same file data.
a : |
first GnomeVFSFileInfo struct to compare. |
b : |
second GnomeVFSFileInfo struct to compare. |
Returns : | TRUE if the two GnomeVFSFileInfos match, otherwise return FALSE .
|
GList* gnome_vfs_file_info_list_ref (GList *list);
Increments the refcount of the items in list
by one.
list : |
list of GnomeVFSFileInfo elements. |
Returns : | list .
|
GList* gnome_vfs_file_info_list_unref (GList *list);
Decrements the refcount of the items in list
by one.
Note that the list is *not freed* even if each member of the list
is freed.
list : |
list of GnomeVFSFileInfo elements. |
Returns : | list .
|
GList* gnome_vfs_file_info_list_copy (GList *list);
Creates a duplicate of list
, and references each member of
that list.
list : |
list of GnomeVFSFileInfo elements. |
Returns : | a newly referenced duplicate of list .
|
void gnome_vfs_file_info_list_free (GList *list);
Decrements the refcount of each member of list
by one,
and frees the list itself.
list : |
list of GnomeVFSFileInfo elements. |
GnomeVFSGetFileInfoResult* gnome_vfs_get_file_info_result_dup (GnomeVFSGetFileInfoResult *result);
Duplicate result
.
Note: The internal uri and fileinfo objects are not duplicated but their refcount is incremented by 1.
result : |
a GnomeVFSGetFileInfoResult. |
Returns : | a duplicated version of result .
|
Since 2.12
void gnome_vfs_get_file_info_result_free (GnomeVFSGetFileInfoResult *result);
Unrefs the internal uri and fileinfo objects and frees the
memory allocated for result
.
result : |
a GnomeVFSGetFileInfoResult. |
Since 2.12