Break out POSIX-like definitions to posix.h
Add ISO9660 routines to convert to mode_t Record whether XA or not in iso9660_stat_t. And other definition shifting around.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: iso9660.c,v 1.14 2005/09/20 00:42:14 rocky Exp $
|
||||
$Id: iso9660.c,v 1.15 2005/11/06 00:39:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -43,12 +43,15 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: iso9660.c,v 1.14 2005/09/20 00:42:14 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: iso9660.c,v 1.15 2005/11/06 00:39:37 rocky Exp $";
|
||||
|
||||
/* Variables to hold debugger-helping enumerations */
|
||||
enum iso_enum1_s iso_enums1;
|
||||
@@ -684,6 +687,22 @@ iso9660_pathtable_init (void *pt)
|
||||
memset (pt, 0, ISO_BLOCKSIZE); /* fixme */
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns POSIX mode bitstring for a given file.
|
||||
*/
|
||||
posix_mode_t
|
||||
iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent)
|
||||
{
|
||||
posix_mode_t mode = 0;
|
||||
|
||||
if (yep == p_iso_dirent->rr.b3_rock) {
|
||||
return iso9660_get_posix_filemode_from_rock(&p_iso_dirent->rr);
|
||||
} else if (p_iso_dirent->b_xa) {
|
||||
return iso9660_get_posix_filemode_from_xa(p_iso_dirent->xa.attributes);
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
static const iso_path_table_t *
|
||||
pathtable_get_entry (const void *pt, unsigned int entrynum)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: iso9660_fs.c,v 1.31 2005/10/12 11:25:17 rocky Exp $
|
||||
$Id: iso9660_fs.c,v 1.32 2005/11/06 00:39:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.31 2005/10/12 11:25:17 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.32 2005/11/06 00:39:37 rocky Exp $";
|
||||
|
||||
/* Implementation of iso9660_t type */
|
||||
struct _iso9660_s {
|
||||
@@ -812,6 +812,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
|
||||
p_stat->size = from_733 (p_iso9660_dir->size);
|
||||
p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE);
|
||||
p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */
|
||||
p_stat->b_xa = false;
|
||||
|
||||
{
|
||||
char rr_fname[256] = "";
|
||||
@@ -899,7 +900,8 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
|
||||
xa_data->signature[0], xa_data->signature[1]);
|
||||
return p_stat;
|
||||
}
|
||||
p_stat->xa = *xa_data;
|
||||
p_stat->b_xa = true;
|
||||
p_stat->xa = *xa_data;
|
||||
}
|
||||
}
|
||||
return p_stat;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: iso9660_private.h,v 1.3 2005/02/12 10:23:18 rocky Exp $
|
||||
$Id: iso9660_private.h,v 1.4 2005/11/06 00:39:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -57,13 +57,12 @@ typedef struct iso_volume_descriptor_s {
|
||||
* See mkisofs.h
|
||||
*/
|
||||
|
||||
/* We use this to help us look up the parent inode numbers. */
|
||||
|
||||
/** We use this to help us look up the parent inode numbers. */
|
||||
typedef struct iso_path_table_s {
|
||||
uint8_t name_len; /* 7.1.1 */
|
||||
uint8_t xa_len; /* 7.1.1 */
|
||||
uint32_t extent; /* 7.3.1/7.3.2 */
|
||||
uint16_t parent; /* 7.2.1/7.2.2 */
|
||||
uint8_t name_len; /**< 7.1.1 */
|
||||
uint8_t xa_len; /**< 7.1.1 */
|
||||
uint32_t extent; /**< 7.3.1/7.3.2 */
|
||||
uint16_t parent; /**< 7.2.1/7.2.2 */
|
||||
char name[EMPTY_ARRAY_SIZE];
|
||||
} GNUC_PACKED iso_path_table_t;
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ iso9660_get_application_id
|
||||
iso9660_get_dir_len
|
||||
iso9660_get_dtime
|
||||
iso9660_get_ltime
|
||||
iso9660_get_posix_filemode
|
||||
iso9660_get_posix_filemode_from_rock
|
||||
iso9660_get_posix_filemode_from_xa
|
||||
iso9660_get_preparer_id
|
||||
iso9660_get_publisher_id
|
||||
iso9660_get_pvd_block_size
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: rock.c,v 1.14 2005/10/04 09:59:46 rocky Exp $
|
||||
$Id: rock.c,v 1.15 2005/11/06 00:39:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale
|
||||
@@ -608,3 +608,14 @@ iso9660_get_rock_attr_str(posix_mode_t st_mode)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns POSIX mode bitstring for a given file.
|
||||
*/
|
||||
posix_mode_t
|
||||
iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr)
|
||||
{
|
||||
return rr->st_mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: xa.c,v 1.4 2005/02/20 10:21:01 rocky Exp $
|
||||
$Id: xa.c,v 1.5 2005/11/06 00:39:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -28,6 +28,10 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
/*! String inside frame which identifies XA attributes. Note should
|
||||
come *before* public headers which does a #define of
|
||||
this name.
|
||||
@@ -143,3 +147,26 @@ iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
||||
|
||||
return _xa;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns POSIX mode bitstring for a given file.
|
||||
*/
|
||||
posix_mode_t
|
||||
iso9660_get_posix_filemode_from_xa(uint16_t i_perms)
|
||||
{
|
||||
posix_mode_t mode = 0;
|
||||
|
||||
if (i_perms & XA_PERM_RUSR) mode |= S_IRUSR;
|
||||
if (i_perms & XA_PERM_XUSR) mode |= S_IXUSR;
|
||||
|
||||
if (i_perms & XA_PERM_RGRP) mode |= S_IRGRP;
|
||||
if (i_perms & XA_PERM_XGRP) mode |= S_IXGRP;
|
||||
|
||||
if (i_perms & XA_PERM_ROTH) mode |= S_IROTH;
|
||||
if (i_perms & XA_PERM_XOTH) mode |= S_IXOTH;
|
||||
|
||||
if (i_perms & XA_ATTR_DIRECTORY) mode |= S_IFDIR;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user