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>
This program is free software; you can redistribute it and/or modify
@@ -60,42 +60,49 @@ extern udf_enum1_t debug_udf_enums1;
extern "C" {
#endif /* __cplusplus */
/*!
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,
/*!
Close UDF and free resources associated with p_udf.
*/
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,
lsn_t i_start, long int i_blocks);
/*!
/*!
Open an UDF for reading. Maybe in the future we will have
a mode. NULL is returned on error.
Caller must free result - use udf_close for that.
*/
udf_t *udf_open (const char *psz_path);
*/
udf_t *udf_open (const char *psz_path);
/*!
/*!
Get the root in p_udf. If b_any_partition is false then
the root must be in the given partition.
NULL is returned if the partition is not found or a root is not found or
there is on error.
Caller must free result - use udf_file_free for that.
*/
udf_file_t *udf_get_root (udf_t *p_udf, bool b_any_partition,
*/
udf_file_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)
* psz_volid, place to put the string
* i_volid_size, size of the buffer volid points to
* returns the size of buffer needed for all data
*/
int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,
int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,
unsigned int i_volid);
/**
/**
* Gets the Volume Set Identifier, as a 128-byte dstring (not decoded)
* WARNING This is not a null terminated string
* volsetid, place to put the data
@@ -107,7 +114,7 @@ int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,
int udf_get_volumeset_id(udf_t *p_udf, /*out*/ uint8_t *volsetid,
unsigned int i_volsetid);
/*!
/*!
Return a file pointer matching pzz_name. If b_any_partition is false then
the root must be in the given partition.
*/
@@ -121,36 +128,42 @@ 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[]);
/*!
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,
char perms[]);
/*!
Return the name of the file
*/
bool udf_get_file_entry(const udf_file_t *p_udf_file,
/*out*/ udf_file_entry_t *p_udf_fe);
/*!
Return the next subdirectory.
*/
udf_file_t *udf_get_sub(const udf_t *p_udf, const udf_file_t *p_udf_file);
bool udf_get_fileid_descriptor(const udf_file_t *p_udf_file,
/*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
*/
bool udf_get_file_entry(const udf_file_t *p_udf_file,
/*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.
*/
udf_file_t *udf_get_sub(const udf_t *p_udf, const udf_file_t *p_udf_file);
/*!
Return the next 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.

View File

@@ -12,7 +12,10 @@ VSD_STD_ID_TEA01
udf_close
udf_file_free
udf_get_file_entry
udf_get_fileid_descriptor
udf_get_filename
udf_get_part_number
udf_get_posix_filemode_str
udf_get_next
udf_get_sub
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>
@@ -77,6 +77,32 @@ udf_get_file_entry(const udf_file_t *p_udf_file,
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
udf_is_dir(const udf_file_t *p_udf_file)
{