Skip to content

Commit

Permalink
kernel/isofs: Add all iso9660 number conversion routines.
Browse files Browse the repository at this point in the history
Mainly to remove 7.2.2 and 7.3.2 routines from lib/libstand.

While there, fix return type for 7.1.2 to be signed as per ISO9660.

This commit breaks sysutils/hal dport again,
it should have been patched in the first place.

Taken-from: FreeBSD
  • Loading branch information
zrj-rimwis authored and zrj committed Jan 29, 2016
1 parent 800ad2f commit 0d1c136
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
13 changes: 0 additions & 13 deletions lib/libstand/cd9660.c
Expand Up @@ -116,19 +116,6 @@ struct ptable_ent {

#define cdb2devb(bno) ((bno) * (ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE))

/* XXX these should be in the system headers */
static __inline int
isonum_722(u_char *p)
{
return (*p << 8)|p[1];
}

static __inline int
isonum_732(u_char *p)
{
return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3];
}

static ISO_SUSP_HEADER *
susp_lookup_record(struct open_file *f, const char *identifier,
struct iso_directory_record *dp, int lenskip)
Expand Down
46 changes: 41 additions & 5 deletions sys/vfs/isofs/cd9660/iso.h
Expand Up @@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)iso.h 8.6 (Berkeley) 5/10/95
* $FreeBSD: src/sys/isofs/cd9660/iso.h,v 1.19.2.1 2000/07/08 14:35:56 bp Exp $
* $FreeBSD: head/sys/fs/cd9660/iso.h 151447 2005-10-18 13:35:08Z des $
*/

#define ISODCL(from, to) (to - from + 1)
Expand Down Expand Up @@ -275,26 +275,62 @@ u_short sgetrune(const char *, size_t, char const **, int, void *);
* outside the kernel. Thus we don't hide them here.
*/

/*
* 7xy
* x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
* y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
*/

static __inline uint8_t
isonum_711(unsigned char *p)
isonum_711(const unsigned char *p)
{
return (p[0]);
}

static __inline int8_t
isonum_712(const unsigned char *p)
{
return ((signed char)p[0]);
}

static __inline uint8_t
isonum_712(unsigned char *p)
isonum_713(const unsigned char *p)
{
return (p[0]);
}

static __inline uint16_t
isonum_723(unsigned char *p)
isonum_721(const unsigned char *p)
{
return (p[0] | p[1] << 8);
}

static __inline uint16_t
isonum_722(const unsigned char *p)
{
return (p[1] | p[0] << 8);
}

static __inline uint16_t
isonum_723(const unsigned char *p)
{
return (p[0] | p[1] << 8);
}

static __inline uint32_t
isonum_733(unsigned char *p)
isonum_731(const unsigned char *p)
{
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
}

static __inline uint32_t
isonum_732(const unsigned char *p)
{
return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
}

static __inline uint32_t
isonum_733(const unsigned char *p)
{
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
}
Expand Down

0 comments on commit 0d1c136

Please sign in to comment.