Rename some functions to be more like POSIX file reading, i.e. add

udf_opendir() and udf_readdir(). udf_file_entry_t -> udf_dirent_t.
This commit is contained in:
rocky
2005-11-01 03:14:49 +00:00
parent c68faa94c1
commit 7de9d148bf
10 changed files with 181 additions and 170 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: udf.h,v 1.15 2005/10/30 07:35:37 rocky Exp $
$Id: udf.h,v 1.16 2005/11/01 03:14:49 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@ typedef uint8_t ubyte;
/** Opaque structures. */
typedef struct udf_s udf_t;
typedef struct udf_file_s udf_file_t;
typedef struct udf_dirent_s udf_dirent_t;
/**
Imagine the below a #define'd value rather than distinct values of
@@ -98,8 +99,8 @@ extern "C" {
Caller must free result - use udf_file_free for that.
*/
udf_file_t *udf_get_root (udf_t *p_udf, bool b_any_partition,
partition_num_t i_partition);
udf_dirent_t *udf_get_root (udf_t *p_udf, bool b_any_partition,
partition_num_t i_partition);
/**
* Gets the Volume Identifier string, in 8bit unicode (latin-1)
@@ -126,9 +127,9 @@ extern "C" {
Return a file pointer matching pzz_name. If b_any_partition is false then
the root must be in the given partition.
*/
udf_file_t *udf_find_file(udf_t *p_udf, const char *psz_name,
bool b_any_partition,
partition_num_t i_partition);
udf_dirent_t *udf_find_file(udf_t *p_udf, const char *psz_name,
bool b_any_partition,
partition_num_t i_partition);
/*! udf_mode_string - fill in string PSZ_STR with an ls-style ASCII
representation of the i_mode. PSZ_STR is returned.

View File

@@ -1,5 +1,5 @@
/*
$Id: udf_file.h,v 1.1 2005/10/30 07:36:15 rocky Exp $
$Id: udf_file.h,v 1.2 2005/11/01 03:14:50 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
@@ -34,49 +34,54 @@ extern "C" {
/*!
Return the file id descriptor of the given file.
*/
bool udf_get_fileid_descriptor(const udf_file_t *p_udf_file,
bool udf_get_fileid_descriptor(const udf_dirent_t *p_udf_dirent,
/*out*/ udf_fileid_desc_t *p_udf_fid);
/*!
Return the name of the file
*/
const char *udf_get_filename(const udf_file_t *p_udf_file);
const char *udf_get_filename(const udf_dirent_t *p_udf_dirent);
/*!
Return the name of the file
*/
bool udf_get_file_entry(const udf_file_t *p_udf_file,
bool udf_get_file_entry(const udf_dirent_t *p_udf_dirent,
/*out*/ udf_file_entry_t *p_udf_fe);
/*!
Return the number of hard links of the file. Return 0 if error.
*/
uint16_t udf_get_link_count(const udf_file_t *p_udf_file);
uint16_t udf_get_link_count(const udf_dirent_t *p_udf_dirent);
/*!
Returns a POSIX mode for a given p_udf_file.
Returns a POSIX mode for a given p_udf_dirent.
*/
mode_t udf_get_posix_filemode(const udf_file_t *p_udf_file);
mode_t udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent);
/*!
Return the next subdirectory.
*/
udf_file_t *udf_get_sub(const udf_t *p_udf, const udf_file_t *p_udf_file);
udf_dirent_t *udf_opendir(udf_t *p_udf, const udf_dirent_t *p_udf_dirent);
/*!
Return the next file.
Advances p_udf_direct to the the next directory entry in the
pointed to by p_udf_dir. It also returns this as the value. NULL
is returned on reaching the end-of-file or if an error. Also
p_udf_dirent is free'd. If the end of is not reached the caller
must call udf_dirent_free() with p_udf_dirent when done with it to
release resources.
*/
udf_file_t *udf_get_next(const udf_t *p_udf, udf_file_t *p_udf_file);
udf_dirent_t *udf_readdir(udf_dirent_t *p_udf_dirent);
/*!
free free resources associated with p_udf_file.
free free resources associated with p_udf_dirent.
*/
bool udf_file_free(udf_file_t *p_udf_file);
bool udf_dirent_free(udf_dirent_t *p_udf_dirent);
/*!
Return true if the file is a directory.
*/
bool udf_is_dir(const udf_file_t *p_udf_file);
bool udf_is_dir(const udf_dirent_t *p_udf_dirent);
#ifdef __cplusplus
}

View File

@@ -1,5 +1,5 @@
/*
$Id: udf_time.h,v 1.3 2005/10/30 14:10:44 rocky Exp $
$Id: udf_time.h,v 1.4 2005/11/01 03:14:50 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
@@ -36,33 +36,33 @@ extern "C" {
/*!
Return the access time of the file.
*/
time_t udf_get_access_time(const udf_file_t *p_udf_file);
time_t udf_get_access_time(const udf_dirent_t *p_udf_dirent);
/*!
Return the attribute (most recent create or access) time of the file
*/
time_t udf_get_attribute_time(const udf_file_t *p_udf_file);
time_t udf_get_attribute_time(const udf_dirent_t *p_udf_dirent);
/*!
Return the modification time of the file.
*/
time_t udf_get_modification_time(const udf_file_t *p_udf_file);
time_t udf_get_modification_time(const udf_dirent_t *p_udf_dirent);
/*!
Return the access timestamp of the file
*/
udf_timestamp_t *udf_get_access_timestamp(const udf_file_t *p_udf_file);
udf_timestamp_t *udf_get_access_timestamp(const udf_dirent_t *p_udf_dirent);
/*!
Return the modification timestamp of the file
*/
udf_timestamp_t *udf_get_modification_timestamp(const udf_file_t
*p_udf_file);
udf_timestamp_t *udf_get_modification_timestamp(const udf_dirent_t
*p_udf_dirent);
/*!
Return the attr timestamp of the file
*/
udf_timestamp_t *udf_get_attr_timestamp(const udf_file_t *p_udf_file);
udf_timestamp_t *udf_get_attr_timestamp(const udf_dirent_t *p_udf_dirent);
/*!
Convert a UDF timestamp to a time_t. If microseconds are desired,