Add more access functions.

This commit is contained in:
rocky
2005-10-29 14:43:50 +00:00
parent df6402a4fd
commit 031b7199e9
3 changed files with 106 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: udf.h,v 1.12 2005/10/27 11:18:56 rocky Exp $ $Id: udf.h,v 1.13 2005/10/29 14:43:50 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -61,9 +61,16 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/*! /*!
Seek to a position i_start and then read i_blocks. Number of blocks read is Close UDF and free resources associated with p_udf.
returned. One normally expects the return to be equal to i_blocks.
*/ */
bool udf_close (udf_t *p_udf);
/*!
Seek to a position i_start and then read i_blocks. Number of
blocks read is returned. One normally expects the return to be
equal to i_blocks.
*/
driver_return_code_t udf_read_sectors (const udf_t *p_udf, void *ptr, driver_return_code_t udf_read_sectors (const udf_t *p_udf, void *ptr,
lsn_t i_start, long int i_blocks); lsn_t i_start, long int i_blocks);
@@ -121,10 +128,15 @@ int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,
const char *udf_get_attr_str(udf_Uint32_t permissions, char perms[]); const char *udf_get_attr_str(udf_Uint32_t permissions, char perms[]);
/*! /*!
Returns a POSIX filemode string for a given p_udf_file. Return the file id descriptor of the given file.
*/ */
const char *udf_get_posix_filemode_str(const udf_file_t *p_udf_file, bool udf_get_fileid_descriptor(const udf_file_t *p_udf_file,
char perms[]); /*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);
/*! /*!
Return the name of the file Return the name of the file
@@ -132,25 +144,26 @@ int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,
bool udf_get_file_entry(const udf_file_t *p_udf_file, bool udf_get_file_entry(const udf_file_t *p_udf_file,
/*out*/ udf_file_entry_t *p_udf_fe); /*out*/ udf_file_entry_t *p_udf_fe);
/*!
Returns a POSIX filemode string for a given p_udf_file.
*/
const char *udf_get_posix_filemode_str(const udf_file_t *p_udf_file,
char perms[]);
/*! /*!
Return the next subdirectory. Return the next subdirectory.
*/ */
udf_file_t *udf_get_sub(const udf_t *p_udf, const udf_file_t *p_udf_file); udf_file_t *udf_get_sub(const udf_t *p_udf, const udf_file_t *p_udf_file);
/*!
Return the name of the file
*/
const char *udf_get_filename(const udf_file_t *p_udf_file);
/*! /*!
Return the next file. Return the next file.
*/ */
udf_file_t *udf_get_next(const udf_t *p_udf, udf_file_t *p_udf_file); udf_file_t *udf_get_next(const udf_t *p_udf, udf_file_t *p_udf_file);
/*! /*!
Close UDF and free resources associated with p_udf. Return the partition number of the file
*/ */
bool udf_close (udf_t *p_udf); int16_t udf_get_part_number(const udf_t *p_udf);
/*! /*!
free free resources associated with p_udf_file. free free resources associated with p_udf_file.

View File

@@ -12,7 +12,10 @@ VSD_STD_ID_TEA01
udf_close udf_close
udf_file_free udf_file_free
udf_get_file_entry udf_get_file_entry
udf_get_fileid_descriptor
udf_get_filename udf_get_filename
udf_get_part_number
udf_get_posix_filemode_str
udf_get_next udf_get_next
udf_get_sub udf_get_sub
udf_is_dir udf_is_dir

View File

@@ -1,5 +1,5 @@
/* /*
$Id: udf.c,v 1.3 2005/10/27 11:18:57 rocky Exp $ $Id: udf.c,v 1.4 2005/10/29 14:43:50 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -77,6 +77,32 @@ udf_get_file_entry(const udf_file_t *p_udf_file,
return true; return true;
} }
/*!
Return the file id descriptor of the given file.
*/
bool udf_get_fileid_descriptor(const udf_file_t *p_udf_file,
/*out*/ udf_fileid_desc_t *p_udf_fid)
{
if (!p_udf_file) return false;
if (!p_udf_file->fid) {
/* FIXME do something about trying to get the descriptor. */
return false;
}
memcpy(p_udf_fid, p_udf_file->fid, sizeof(udf_fileid_desc_t));
return true;
}
/*!
Return the partition number of the file
*/
int16_t udf_get_part_number(const udf_t *p_udf)
{
if (!p_udf) return -1;
return p_udf->i_partition;
}
bool bool
udf_is_dir(const udf_file_t *p_udf_file) udf_is_dir(const udf_file_t *p_udf_file)
{ {