Fill out file modes better and clean up interface more by trying to

funnel into POSIX file mode_t. FIXME: something needs to be done to
merge ISO9660 interfaces and UDF and probably the right thing is to
make it look like POSIX. Would be nice if there were a library
e.g. from GNU fileutils I could use to help.
This commit is contained in:
rocky
2005-10-30 05:43:01 +00:00
parent 7b44e5b47e
commit 17de10953a
7 changed files with 416 additions and 68 deletions

View File

@@ -625,21 +625,33 @@ typedef struct udf_icbtag_s udf_icbtag_t;
#define ICBTAG_STRATEGY_TYPE_3 0x0003
#define ICBTAG_STRATEGY_TYPE_4 0x0004
/** File Type (ECMA 167r3 4/14.6.6) */
#define ICBTAG_FILE_TYPE_UNDEF 0x00
#define ICBTAG_FILE_TYPE_USE 0x01
#define ICBTAG_FILE_TYPE_PIE 0x02
#define ICBTAG_FILE_TYPE_IE 0x03
#define ICBTAG_FILE_TYPE_DIRECTORY 0x04
#define ICBTAG_FILE_TYPE_REGULAR 0x05
#define ICBTAG_FILE_TYPE_BLOCK 0x06
#define ICBTAG_FILE_TYPE_CHAR 0x07
#define ICBTAG_FILE_TYPE_EA 0x08
#define ICBTAG_FILE_TYPE_FIFO 0x09
#define ICBTAG_FILE_TYPE_SOCKET 0x0A
#define ICBTAG_FILE_TYPE_TE 0x0B
#define ICBTAG_FILE_TYPE_SYMLINK 0x0C
#define ICBTAG_FILE_TYPE_STREAMDIR 0x0D
/** File Type (ECMA 167r3 4/14.6.6)
Imagine the below enum values as #define'd values rather than
distinct values of an enum.
*/
typedef enum {
ICBTAG_FILE_TYPE_UNDEF = 0x00,
ICBTAG_FILE_TYPE_USE = 0x01,
ICBTAG_FILE_TYPE_PIE = 0x02,
ICBTAG_FILE_TYPE_IE = 0x03,
ICBTAG_FILE_TYPE_DIRECTORY = 0x04,
ICBTAG_FILE_TYPE_REGULAR = 0x05,
ICBTAG_FILE_TYPE_BLOCK = 0x06,
ICBTAG_FILE_TYPE_CHAR = 0x07,
ICBTAG_FILE_TYPE_EA = 0x08,
ICBTAG_FILE_TYPE_FIFO = 0x09,
ICBTAG_FILE_TYPE_SOCKET = 0x0A,
ICBTAG_FILE_TYPE_TE = 0x0B,
ICBTAG_FILE_TYPE_SYMLINK = 0x0C,
ICBTAG_FILE_TYPE_STREAMDIR = 0x0D
} icbtag_file_type_enum_t;
/** This variable is trickery to force the above enum symbol values to
be recorded in debug symbol tables. It is used to allow one refer
to above enumeration values in a debugger and debugger
expressions */
extern icbtag_file_type_enum_t debug_icbtag_file_type_enum;
/** Flags (ECMA 167r3 4/14.6.8) */
#define ICBTAG_FLAG_AD_MASK 0x0007

View File

@@ -1,5 +1,5 @@
/*
$Id: udf.h,v 1.13 2005/10/29 14:43:50 rocky Exp $
$Id: udf.h,v 1.14 2005/10/30 05:43:01 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,8 @@
#include <cdio/cdio.h>
#include <cdio/ecma_167.h>
#include <sys/stat.h>
typedef uint16_t partition_num_t;
/* FIXME: these probably don't go here. */
@@ -122,11 +124,6 @@ extern "C" {
bool b_any_partition,
partition_num_t i_partition);
/*!
Returns a string which interprets the extended attribute permissions
*/
const char *udf_get_attr_str(udf_Uint32_t permissions, char perms[]);
/*!
Return the file id descriptor of the given file.
*/
@@ -145,10 +142,9 @@ extern "C" {
/*out*/ udf_file_entry_t *p_udf_fe);
/*!
Returns a POSIX filemode string for a given p_udf_file.
Returns a POSIX mode for a given p_udf_file.
*/
const char *udf_get_posix_filemode_str(const udf_file_t *p_udf_file,
char perms[]);
mode_t udf_get_posix_filemode(const udf_file_t *p_udf_file);
/*!
Return the next subdirectory.
@@ -175,6 +171,44 @@ extern "C" {
*/
bool udf_is_dir(const udf_file_t *p_udf_file);
/*! udf_mode_string - fill in string STR with an ls-style ASCII
representation of the st_mode field of file stats block STATP.
10 characters are stored in STR; no terminating null is added.
The characters stored in STR are:
0 File type. 'd' for directory, 'c' for character
special, 'b' for block special, 'm' for multiplex,
'l' for symbolic link, 's' for socket, 'p' for fifo,
'-' for regular, '?' for any other file type
1 'r' if the owner may read, '-' otherwise.
2 'w' if the owner may write, '-' otherwise.
3 'x' if the owner may execute, 's' if the file is
set-user-id, '-' otherwise.
'S' if the file is set-user-id, but the execute
bit isn't set.
4 'r' if group members may read, '-' otherwise.
5 'w' if group members may write, '-' otherwise.
6 'x' if group members may execute, 's' if the file is
set-group-id, '-' otherwise.
'S' if it is set-group-id but not executable.
7 'r' if any user may read, '-' otherwise.
8 'w' if any user may write, '-' otherwise.
9 'x' if any user may execute, 't' if the file is "sticky"
(will be retained in swap space after execution), '-'
otherwise.
'T' if the file is sticky but not executable. */
char *udf_mode_string (mode_t mode, char *str);
#ifdef __cplusplus
}
#endif /* __cplusplus */