|
|
|
@ -519,7 +519,7 @@ struct IsoFileSource_Iface
|
|
|
|
|
* Opens the source.
|
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ALREADY_OPENNED
|
|
|
|
|
* ISO_FILE_ALREADY_OPENED
|
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
@ -535,7 +535,7 @@ struct IsoFileSource_Iface
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
*/
|
|
|
|
|
int (*close)(IsoFileSource *src);
|
|
|
|
|
|
|
|
|
@ -552,7 +552,7 @@ struct IsoFileSource_Iface
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
* ISO_WRONG_ARG_VALUE -> if count == 0
|
|
|
|
|
* ISO_FILE_IS_DIR
|
|
|
|
|
* ISO_OUT_OF_MEM
|
|
|
|
@ -578,7 +578,7 @@ struct IsoFileSource_Iface
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
* ISO_FILE_IS_NOT_DIR
|
|
|
|
|
* ISO_OUT_OF_MEM
|
|
|
|
|
*/
|
|
|
|
@ -675,6 +675,18 @@ extern ino_t serial_id;
|
|
|
|
|
*/
|
|
|
|
|
struct IsoStream_Iface
|
|
|
|
|
{
|
|
|
|
|
/* reserved for future usage, set to 0 */
|
|
|
|
|
int version;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Type of Stream.
|
|
|
|
|
* "fsrc" -> Read from file source
|
|
|
|
|
* "mem " -> Read from memory
|
|
|
|
|
* "boot" -> Boot catalog
|
|
|
|
|
* "user" -> User supplied stream
|
|
|
|
|
*/
|
|
|
|
|
char type[4];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens the stream.
|
|
|
|
|
*
|
|
|
|
@ -727,14 +739,6 @@ struct IsoStream_Iface
|
|
|
|
|
void (*get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
|
|
|
|
|
ino_t *ino_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a name that identifies the Stream contents. It is used only for
|
|
|
|
|
* informational or debug purposes, so you can return anything you
|
|
|
|
|
* consider suitable for identification of the source, such as the path
|
|
|
|
|
* of the file on disc.
|
|
|
|
|
*/
|
|
|
|
|
char *(*get_name)(IsoStream *stream);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Free implementation specific data. Should never be called by user.
|
|
|
|
|
* Use iso_stream_unref() instead.
|
|
|
|
@ -2058,7 +2062,7 @@ IsoDir *iso_node_get_parent(IsoNode *node);
|
|
|
|
|
* you should free the iterator with iso_dir_iter_free.
|
|
|
|
|
* You musn't delete a child of the same dir, using iso_node_take() or
|
|
|
|
|
* iso_node_remove(), while you're using the iterator. You can use
|
|
|
|
|
* iso_node_take_iter() or iso_node_remove_iter() instead.
|
|
|
|
|
* iso_dir_iter_take() or iso_dir_iter_remove() instead.
|
|
|
|
|
*
|
|
|
|
|
* You can use the iterator in the way like this
|
|
|
|
|
*
|
|
|
|
@ -2160,6 +2164,191 @@ int iso_dir_iter_take(IsoDirIter *iter);
|
|
|
|
|
*/
|
|
|
|
|
int iso_dir_iter_remove(IsoDirIter *iter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
typedef struct iso_find_condition IsoFindCondition;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks if the node name matches the given
|
|
|
|
|
* wildcard.
|
|
|
|
|
*
|
|
|
|
|
* @param wildcard
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_name(const char *wildcard);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the node mode against a mode mask. It
|
|
|
|
|
* can be used to check both file type and permissions.
|
|
|
|
|
*
|
|
|
|
|
* For example:
|
|
|
|
|
*
|
|
|
|
|
* iso_new_find_conditions_mode(S_IFREG) : search for regular files
|
|
|
|
|
* iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character
|
|
|
|
|
* devices where owner has write permissions.
|
|
|
|
|
*
|
|
|
|
|
* @param mask
|
|
|
|
|
* Mode mask to AND against node mode.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_mode(mode_t mask);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the node gid.
|
|
|
|
|
*
|
|
|
|
|
* @param gid
|
|
|
|
|
* Desired Group Id.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_gid(gid_t gid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the node uid.
|
|
|
|
|
*
|
|
|
|
|
* @param uid
|
|
|
|
|
* Desired User Id.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_uid(uid_t uid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Possible comparison between IsoNode and given conditions.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
enum iso_find_comparisons {
|
|
|
|
|
ISO_FIND_COND_GREATER,
|
|
|
|
|
ISO_FIND_COND_GREATER_OR_EQUAL,
|
|
|
|
|
ISO_FIND_COND_EQUAL,
|
|
|
|
|
ISO_FIND_COND_LESS,
|
|
|
|
|
ISO_FIND_COND_LESS_OR_EQUAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the time of last access.
|
|
|
|
|
*
|
|
|
|
|
* @param time
|
|
|
|
|
* Time to compare against IsoNode atime.
|
|
|
|
|
* @param comparison
|
|
|
|
|
* Comparison to be done between IsoNode atime and submitted time.
|
|
|
|
|
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
|
|
|
|
|
* time is greater than the submitted time.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_atime(time_t time,
|
|
|
|
|
enum iso_find_comparisons comparison);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the time of last modification.
|
|
|
|
|
*
|
|
|
|
|
* @param time
|
|
|
|
|
* Time to compare against IsoNode mtime.
|
|
|
|
|
* @param comparison
|
|
|
|
|
* Comparison to be done between IsoNode mtime and submitted time.
|
|
|
|
|
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
|
|
|
|
|
* time is greater than the submitted time.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_mtime(time_t time,
|
|
|
|
|
enum iso_find_comparisons comparison);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that checks the time of last status change.
|
|
|
|
|
*
|
|
|
|
|
* @param time
|
|
|
|
|
* Time to compare against IsoNode ctime.
|
|
|
|
|
* @param comparison
|
|
|
|
|
* Comparison to be done between IsoNode ctime and submitted time.
|
|
|
|
|
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
|
|
|
|
|
* time is greater than the submitted time.
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_ctime(time_t time,
|
|
|
|
|
enum iso_find_comparisons comparison);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that check if the two given conditions are
|
|
|
|
|
* valid.
|
|
|
|
|
*
|
|
|
|
|
* @param a
|
|
|
|
|
* @param b
|
|
|
|
|
* IsoFindCondition to compare
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_and(IsoFindCondition *a,
|
|
|
|
|
IsoFindCondition *b);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that check if at least one the two given conditions
|
|
|
|
|
* is valid.
|
|
|
|
|
*
|
|
|
|
|
* @param a
|
|
|
|
|
* @param b
|
|
|
|
|
* IsoFindCondition to compare
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_or(IsoFindCondition *a,
|
|
|
|
|
IsoFindCondition *b);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new condition that check if the given conditions is false.
|
|
|
|
|
*
|
|
|
|
|
* @param negate
|
|
|
|
|
* @result
|
|
|
|
|
* The created IsoFindCondition, NULL on error.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
IsoFindCondition *iso_new_find_conditions_not(IsoFindCondition *negate);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Find all directory children that match the given condition.
|
|
|
|
|
*
|
|
|
|
|
* @param dir
|
|
|
|
|
* Directory where we will search children.
|
|
|
|
|
* @param cond
|
|
|
|
|
* Condition that the children must match in order to be returned.
|
|
|
|
|
* It will be free together with the iterator. Remember to delete it
|
|
|
|
|
* if this function return error.
|
|
|
|
|
* @param iter
|
|
|
|
|
* Iterator that returns only the children that match condition.
|
|
|
|
|
* @return
|
|
|
|
|
* 1 on success, < 0 on error
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
int iso_dir_find_children(IsoDir* dir, IsoFindCondition *cond,
|
|
|
|
|
IsoDirIter **iter);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the destination of a node.
|
|
|
|
|
* The returned string belongs to the node and should not be modified nor
|
|
|
|
@ -2226,6 +2415,35 @@ off_t iso_file_get_size(IsoFile *file);
|
|
|
|
|
*/
|
|
|
|
|
IsoStream *iso_file_get_stream(IsoFile *file);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the block lba of a file node, if it was imported from an old image.
|
|
|
|
|
*
|
|
|
|
|
* @param file
|
|
|
|
|
* The file
|
|
|
|
|
* @param lba
|
|
|
|
|
* Will be filled with the kba
|
|
|
|
|
* @param flag
|
|
|
|
|
* Reserved for future usage, submit 0
|
|
|
|
|
* @return
|
|
|
|
|
* 1 if lba is valid (file comes from old image), 0 if file was newly
|
|
|
|
|
* added, i.e. it does not come from an old image, < 0 error
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Like iso_file_get_old_image_lba(), but take an IsoNode.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* 1 if lba is valid (file comes from old image), 0 if file was newly
|
|
|
|
|
* added, i.e. it does not come from an old image, 2 node type has no
|
|
|
|
|
* LBA (no regular file), < 0 error
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add a new directory to the iso tree. Permissions, owner and hidden atts
|
|
|
|
|
* are taken from parent, you can modify them later.
|
|
|
|
@ -2889,7 +3107,7 @@ int iso_file_source_stat(IsoFileSource *src, struct stat *info);
|
|
|
|
|
* Opens the source.
|
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ALREADY_OPENNED
|
|
|
|
|
* ISO_FILE_ALREADY_OPENED
|
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
@ -2907,7 +3125,7 @@ int iso_file_source_open(IsoFileSource *src);
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.2
|
|
|
|
|
*/
|
|
|
|
@ -2933,7 +3151,7 @@ int iso_file_source_close(IsoFileSource *src);
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
* ISO_WRONG_ARG_VALUE -> if count == 0
|
|
|
|
|
* ISO_FILE_IS_DIR
|
|
|
|
|
* ISO_OUT_OF_MEM
|
|
|
|
@ -2961,7 +3179,7 @@ int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
|
|
|
|
|
* Error codes:
|
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
|
* ISO_FILE_NOT_OPENED
|
|
|
|
|
* ISO_FILE_IS_NOT_DIR
|
|
|
|
|
* ISO_OUT_OF_MEM
|
|
|
|
|
*
|
|
|
|
@ -3202,17 +3420,6 @@ int iso_stream_is_repeatable(IsoStream *stream);
|
|
|
|
|
*/
|
|
|
|
|
void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
|
|
|
|
|
ino_t *ino_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a name that identifies the Stream contents. It is used only for
|
|
|
|
|
* informational or debug purposes, so you can return anything you
|
|
|
|
|
* consider suitable for identification of the source, such as the path
|
|
|
|
|
* of the file on disc.
|
|
|
|
|
* Returned string should be freed when no more needed.
|
|
|
|
|
*
|
|
|
|
|
* @since 0.6.4
|
|
|
|
|
*/
|
|
|
|
|
char *iso_stream_get_name(IsoStream *stream);
|
|
|
|
|
|
|
|
|
|
/************ Error codes and return values for libisofs ********************/
|
|
|
|
|
|
|
|
|
@ -3287,6 +3494,9 @@ char *iso_stream_get_name(IsoStream *stream);
|
|
|
|
|
#define ISO_FILE_ERROR 0xE830FF80
|
|
|
|
|
|
|
|
|
|
/** Trying to open an already openned file (FAILURE,HIGH, -129) */
|
|
|
|
|
#define ISO_FILE_ALREADY_OPENED 0xE830FF7F
|
|
|
|
|
|
|
|
|
|
/* @deprecated use ISO_FILE_ALREADY_OPENED instead */
|
|
|
|
|
#define ISO_FILE_ALREADY_OPENNED 0xE830FF7F
|
|
|
|
|
|
|
|
|
|
/** Access to file is not allowed (FAILURE,HIGH, -130) */
|
|
|
|
@ -3299,7 +3509,10 @@ char *iso_stream_get_name(IsoStream *stream);
|
|
|
|
|
#define ISO_FILE_DOESNT_EXIST 0xE830FF7C
|
|
|
|
|
|
|
|
|
|
/** Trying to read or close a file not openned (FAILURE,HIGH, -133) */
|
|
|
|
|
#define ISO_FILE_NOT_OPENNED 0xE830FF7B
|
|
|
|
|
#define ISO_FILE_NOT_OPENED 0xE830FF7B
|
|
|
|
|
|
|
|
|
|
/* @deprecated use ISO_FILE_NOT_OPENED instead */
|
|
|
|
|
#define ISO_FILE_NOT_OPENNED ISO_FILE_NOT_OPENED
|
|
|
|
|
|
|
|
|
|
/** Directory used where no dir is expected (FAILURE,HIGH, -134) */
|
|
|
|
|
#define ISO_FILE_IS_DIR 0xE830FF7A
|
|
|
|
|