Final tidy up.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.h,v 1.10 2003/08/31 08:32:40 rocky Exp $
|
$Id: iso9660.h,v 1.11 2003/08/31 09:11:25 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
#ifndef __CDIO_ISO9660_H__
|
#ifndef __CDIO_ISO9660_H__
|
||||||
#define __CDIO_ISO9660_H__
|
#define __CDIO_ISO9660_H__
|
||||||
|
|
||||||
/* Will eventually need/use glib.h */
|
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/xa.h>
|
#include <cdio/xa.h>
|
||||||
|
|
||||||
@@ -44,8 +42,6 @@
|
|||||||
#define ISO_EVD_SECTOR 17
|
#define ISO_EVD_SECTOR 17
|
||||||
|
|
||||||
#define ISO_STANDARD_ID "CD001"
|
#define ISO_STANDARD_ID "CD001"
|
||||||
#define ISO_XA_MARKER_STRING "CD-XA001"
|
|
||||||
#define ISO_XA_MARKER_OFFSET 1024
|
|
||||||
#define ISO_BLOCKSIZE 2048
|
#define ISO_BLOCKSIZE 2048
|
||||||
|
|
||||||
enum strncpy_pad_check {
|
enum strncpy_pad_check {
|
||||||
@@ -224,44 +220,7 @@ uint16_t
|
|||||||
iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent,
|
iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent,
|
||||||
uint16_t parent);
|
uint16_t parent);
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a string which interpreting the extended attribute xa_attr.
|
|
||||||
For example:
|
|
||||||
\verbatim
|
|
||||||
d---1xrxrxr
|
|
||||||
---2--r-r-r
|
|
||||||
-a--1xrxrxr
|
|
||||||
\endverbatim
|
|
||||||
|
|
||||||
A description of the characters in the string follows
|
|
||||||
The 1st character is either "d" if the entry is a directory, or "-" if not
|
|
||||||
The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not
|
|
||||||
The 3rd character is either "i" if the entry is interleaved, or "-" if not
|
|
||||||
The 4th character is either "2" if the entry is mode2 form2 or "-" if not
|
|
||||||
The 5th character is either "1" if the entry is mode2 form1 or "-" if not
|
|
||||||
Note that an entry will either be in mode2 form1 or mode form2. That
|
|
||||||
is you will either see "2-" or "-1" in the 4th & 5th positions.
|
|
||||||
|
|
||||||
The 6th and 7th characters refer to permissions for everyone while the
|
|
||||||
the 8th and 9th characters refer to permissions for a group while, and
|
|
||||||
the 10th and 11th characters refer to permissions for a user.
|
|
||||||
|
|
||||||
In each of these pairs the first character (6, 8, 10) is "x" if the
|
|
||||||
entry is executable. For a directory this means the directory is
|
|
||||||
allowed to be listed or "searched".
|
|
||||||
The second character of a pair (7, 9, 11) is "r" if the entry is allowed
|
|
||||||
to be read.
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
iso9660_get_xa_attr_str (uint16_t xa_attr);
|
|
||||||
|
|
||||||
iso9660_xa_t *
|
|
||||||
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
|
||||||
uint8_t filenum);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CDIO_ISO9660_H__ */
|
#endif /* __CDIO_ISO9660_H__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: xa.h,v 1.2 2003/08/31 08:32:40 rocky Exp $
|
$Id: xa.h,v 1.3 2003/08/31 09:11:25 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -18,6 +18,12 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __CDIO_XA_H__
|
||||||
|
#define __CDIO_XA_H__
|
||||||
|
|
||||||
|
#define ISO_XA_MARKER_STRING "CD-XA001"
|
||||||
|
#define ISO_XA_MARKER_OFFSET 1024
|
||||||
|
|
||||||
/* XA attribute definitions */
|
/* XA attribute definitions */
|
||||||
#define XA_ATTR_U_READ (1 << 0)
|
#define XA_ATTR_U_READ (1 << 0)
|
||||||
@@ -60,7 +66,47 @@ struct iso9660_xa /* big endian!! */
|
|||||||
} GNUC_PACKED;
|
} GNUC_PACKED;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a string which interpreting the extended attribute xa_attr.
|
||||||
|
For example:
|
||||||
|
\verbatim
|
||||||
|
d---1xrxrxr
|
||||||
|
---2--r-r-r
|
||||||
|
-a--1xrxrxr
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
A description of the characters in the string follows
|
||||||
|
The 1st character is either "d" if the entry is a directory, or "-" if not
|
||||||
|
The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not
|
||||||
|
The 3rd character is either "i" if the entry is interleaved, or "-" if not
|
||||||
|
The 4th character is either "2" if the entry is mode2 form2 or "-" if not
|
||||||
|
The 5th character is either "1" if the entry is mode2 form1 or "-" if not
|
||||||
|
Note that an entry will either be in mode2 form1 or mode form2. That
|
||||||
|
is you will either see "2-" or "-1" in the 4th & 5th positions.
|
||||||
|
|
||||||
|
The 6th and 7th characters refer to permissions for everyone while the
|
||||||
|
the 8th and 9th characters refer to permissions for a group while, and
|
||||||
|
the 10th and 11th characters refer to permissions for a user.
|
||||||
|
|
||||||
|
In each of these pairs the first character (6, 8, 10) is "x" if the
|
||||||
|
entry is executable. For a directory this means the directory is
|
||||||
|
allowed to be listed or "searched".
|
||||||
|
The second character of a pair (7, 9, 11) is "r" if the entry is allowed
|
||||||
|
to be read.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
iso9660_get_xa_attr_str (uint16_t xa_attr);
|
||||||
|
|
||||||
iso9660_xa_t *
|
iso9660_xa_t *
|
||||||
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
||||||
uint8_t filenum);
|
uint8_t filenum);
|
||||||
|
|
||||||
|
#endif /* __CDIO_XA_H__ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local variables:
|
||||||
|
* c-file-style: "gnu"
|
||||||
|
* tab-width: 8
|
||||||
|
* indent-tabs-mode: nil
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660_fs.c,v 1.2 2003/08/31 08:32:40 rocky Exp $
|
$Id: iso9660_fs.c,v 1.3 2003/08/31 09:11:25 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -23,7 +23,9 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
@@ -34,25 +36,7 @@
|
|||||||
#include "bytesex.h"
|
#include "bytesex.h"
|
||||||
#include "ds.h"
|
#include "ds.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.2 2003/08/31 08:32:40 rocky Exp $";
|
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.3 2003/08/31 09:11:25 rocky Exp $";
|
||||||
|
|
||||||
#define BUF_COUNT 16
|
|
||||||
#define BUF_SIZE 80
|
|
||||||
|
|
||||||
/* Return a pointer to a internal free buffer */
|
|
||||||
static char *
|
|
||||||
_getbuf (void)
|
|
||||||
{
|
|
||||||
static char _buf[BUF_COUNT][BUF_SIZE];
|
|
||||||
static int _num = -1;
|
|
||||||
|
|
||||||
_num++;
|
|
||||||
_num %= BUF_COUNT;
|
|
||||||
|
|
||||||
memset (_buf[_num], 0, BUF_SIZE);
|
|
||||||
|
|
||||||
return _buf[_num];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf)
|
_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf)
|
||||||
@@ -276,59 +260,3 @@ iso9660_fs_readdir (CdIo *obj, const char pathname[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a string which interpreting the extended attribute xa_attr.
|
|
||||||
For example:
|
|
||||||
\verbatim
|
|
||||||
d---1xrxrxr
|
|
||||||
---2--r-r-r
|
|
||||||
-a--1xrxrxr
|
|
||||||
\endverbatim
|
|
||||||
|
|
||||||
A description of the characters in the string follows
|
|
||||||
The 1st character is either "d" if the entry is a directory, or "-" if not.
|
|
||||||
The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not.
|
|
||||||
The 3rd character is either "i" if the entry is interleaved, or "-" if not.
|
|
||||||
The 4th character is either "2" if the entry is mode2 form2 or "-" if not.
|
|
||||||
The 5th character is either "1" if the entry is mode2 form1 or "-" if not.
|
|
||||||
Note that an entry will either be in mode2 form1 or mode form2. That
|
|
||||||
is you will either see "2-" or "-1" in the 4th & 5th positions.
|
|
||||||
|
|
||||||
The 6th and 7th characters refer to permissions for everyone while the
|
|
||||||
the 8th and 9th characters refer to permissions for a group while, and
|
|
||||||
the 10th and 11th characters refer to permissions for a user.
|
|
||||||
|
|
||||||
In each of these pairs the first character (6, 8, 10) is "x" if the
|
|
||||||
entry is executable. For a directory this means the directory is
|
|
||||||
allowed to be listed or "searched".
|
|
||||||
The second character of a pair (7, 9, 11) is "r" if the entry is allowed
|
|
||||||
to be read.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char *
|
|
||||||
iso9660_get_xa_attr_str (uint16_t xa_attr)
|
|
||||||
{
|
|
||||||
char *result = _getbuf();
|
|
||||||
|
|
||||||
xa_attr = uint16_from_be (xa_attr);
|
|
||||||
|
|
||||||
result[0] = (xa_attr & XA_ATTR_DIRECTORY) ? 'd' : '-';
|
|
||||||
result[1] = (xa_attr & XA_ATTR_CDDA) ? 'a' : '-';
|
|
||||||
result[2] = (xa_attr & XA_ATTR_INTERLEAVED) ? 'i' : '-';
|
|
||||||
result[3] = (xa_attr & XA_ATTR_MODE2FORM2) ? '2' : '-';
|
|
||||||
result[4] = (xa_attr & XA_ATTR_MODE2FORM1) ? '1' : '-';
|
|
||||||
|
|
||||||
result[5] = (xa_attr & XA_ATTR_O_EXEC) ? 'x' : '-';
|
|
||||||
result[6] = (xa_attr & XA_ATTR_O_READ) ? 'r' : '-';
|
|
||||||
|
|
||||||
result[7] = (xa_attr & XA_ATTR_G_EXEC) ? 'x' : '-';
|
|
||||||
result[8] = (xa_attr & XA_ATTR_G_READ) ? 'r' : '-';
|
|
||||||
|
|
||||||
result[9] = (xa_attr & XA_ATTR_U_EXEC) ? 'x' : '-';
|
|
||||||
result[10] = (xa_attr & XA_ATTR_U_READ) ? 'r' : '-';
|
|
||||||
|
|
||||||
result[11] = '\0';
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
80
lib/xa.c
80
lib/xa.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: xa.c,v 1.2 2003/08/31 08:42:11 rocky Exp $
|
$Id: xa.c,v 1.3 2003/08/31 09:11:25 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Public headers */
|
/* Public headers */
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
@@ -32,6 +36,80 @@
|
|||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
#include "bytesex.h"
|
#include "bytesex.h"
|
||||||
|
|
||||||
|
#define BUF_COUNT 16
|
||||||
|
#define BUF_SIZE 80
|
||||||
|
|
||||||
|
/* Return a pointer to a internal free buffer */
|
||||||
|
static char *
|
||||||
|
_getbuf (void)
|
||||||
|
{
|
||||||
|
static char _buf[BUF_COUNT][BUF_SIZE];
|
||||||
|
static int _num = -1;
|
||||||
|
|
||||||
|
_num++;
|
||||||
|
_num %= BUF_COUNT;
|
||||||
|
|
||||||
|
memset (_buf[_num], 0, BUF_SIZE);
|
||||||
|
|
||||||
|
return _buf[_num];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a string which interpreting the extended attribute xa_attr.
|
||||||
|
For example:
|
||||||
|
\verbatim
|
||||||
|
d---1xrxrxr
|
||||||
|
---2--r-r-r
|
||||||
|
-a--1xrxrxr
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
A description of the characters in the string follows
|
||||||
|
The 1st character is either "d" if the entry is a directory, or "-" if not.
|
||||||
|
The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not.
|
||||||
|
The 3rd character is either "i" if the entry is interleaved, or "-" if not.
|
||||||
|
The 4th character is either "2" if the entry is mode2 form2 or "-" if not.
|
||||||
|
The 5th character is either "1" if the entry is mode2 form1 or "-" if not.
|
||||||
|
Note that an entry will either be in mode2 form1 or mode form2. That
|
||||||
|
is you will either see "2-" or "-1" in the 4th & 5th positions.
|
||||||
|
|
||||||
|
The 6th and 7th characters refer to permissions for everyone while the
|
||||||
|
the 8th and 9th characters refer to permissions for a group while, and
|
||||||
|
the 10th and 11th characters refer to permissions for a user.
|
||||||
|
|
||||||
|
In each of these pairs the first character (6, 8, 10) is "x" if the
|
||||||
|
entry is executable. For a directory this means the directory is
|
||||||
|
allowed to be listed or "searched".
|
||||||
|
The second character of a pair (7, 9, 11) is "r" if the entry is allowed
|
||||||
|
to be read.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char *
|
||||||
|
iso9660_get_xa_attr_str (uint16_t xa_attr)
|
||||||
|
{
|
||||||
|
char *result = _getbuf();
|
||||||
|
|
||||||
|
xa_attr = uint16_from_be (xa_attr);
|
||||||
|
|
||||||
|
result[0] = (xa_attr & XA_ATTR_DIRECTORY) ? 'd' : '-';
|
||||||
|
result[1] = (xa_attr & XA_ATTR_CDDA) ? 'a' : '-';
|
||||||
|
result[2] = (xa_attr & XA_ATTR_INTERLEAVED) ? 'i' : '-';
|
||||||
|
result[3] = (xa_attr & XA_ATTR_MODE2FORM2) ? '2' : '-';
|
||||||
|
result[4] = (xa_attr & XA_ATTR_MODE2FORM1) ? '1' : '-';
|
||||||
|
|
||||||
|
result[5] = (xa_attr & XA_ATTR_O_EXEC) ? 'x' : '-';
|
||||||
|
result[6] = (xa_attr & XA_ATTR_O_READ) ? 'r' : '-';
|
||||||
|
|
||||||
|
result[7] = (xa_attr & XA_ATTR_G_EXEC) ? 'x' : '-';
|
||||||
|
result[8] = (xa_attr & XA_ATTR_G_READ) ? 'r' : '-';
|
||||||
|
|
||||||
|
result[9] = (xa_attr & XA_ATTR_U_EXEC) ? 'x' : '-';
|
||||||
|
result[10] = (xa_attr & XA_ATTR_U_READ) ? 'r' : '-';
|
||||||
|
|
||||||
|
result[11] = '\0';
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
iso9660_xa_t *
|
iso9660_xa_t *
|
||||||
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
|
||||||
uint8_t filenum)
|
uint8_t filenum)
|
||||||
|
|||||||
Reference in New Issue
Block a user