* Made the iso9660 file system buildable within the fs_shell (iso9660_shell).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30639 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ce34c0c260
commit
f47bff0880
@ -9,18 +9,21 @@
|
||||
#include "iso9660.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#include <Drivers.h>
|
||||
#include <KernelExport.h>
|
||||
#include <fs_cache.h>
|
||||
#ifndef FS_SHELL
|
||||
# include <dirent.h>
|
||||
# include <fcntl.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <sys/stat.h>
|
||||
# include <time.h>
|
||||
# include <unistd.h>
|
||||
|
||||
# include <ByteOrder.h>
|
||||
# include <Drivers.h>
|
||||
# include <KernelExport.h>
|
||||
# include <fs_cache.h>
|
||||
#endif
|
||||
|
||||
#include "rock_ridge.h"
|
||||
|
||||
@ -98,8 +101,8 @@ unicode_to_utf8(const char *src, int32 *srcLen, char *dst, int32 *dstLen)
|
||||
|
||||
for (srcCount = 0; srcCount < srcLimit; srcCount += 2) {
|
||||
uint16 *UNICODE = (uint16 *)&src[srcCount];
|
||||
uchar utf8[4];
|
||||
uchar *UTF8 = utf8;
|
||||
uint8 utf8[4];
|
||||
uint8 *UTF8 = utf8;
|
||||
int32 utf8Len;
|
||||
int32 j;
|
||||
|
||||
|
@ -8,15 +8,19 @@
|
||||
#define ISO_9660_H
|
||||
|
||||
|
||||
#include "lock.h"
|
||||
#if FS_SHELL
|
||||
# include "fssh_api_wrapper.h"
|
||||
#else
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
# include <time.h>
|
||||
# include <endian.h>
|
||||
|
||||
#include <fs_interface.h>
|
||||
#include <SupportDefs.h>
|
||||
# include <fs_interface.h>
|
||||
# include <SupportDefs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <endian.h>
|
||||
# include <lock.h>
|
||||
#endif
|
||||
|
||||
|
||||
// Size of primary volume descriptor for ISO9660
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2002, Tyler Dauwalder.
|
||||
*
|
||||
* This file may be used under the terms of the MIT License.
|
||||
@ -33,27 +33,29 @@
|
||||
- 0x003A == ':'
|
||||
- 0x003B == ';'
|
||||
- 0x003F == '?'
|
||||
- 0x005C == '\'
|
||||
- 0x005C == '\'
|
||||
*/
|
||||
|
||||
#include "iso9660_identify.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#ifndef FS_SHELL
|
||||
# include <errno.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include <stdio.h>
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#include <fs_info.h>
|
||||
#include <KernelExport.h>
|
||||
# include <ByteOrder.h>
|
||||
# include <fs_info.h>
|
||||
# include <KernelExport.h>
|
||||
#endif
|
||||
|
||||
#include "iso9660.h"
|
||||
|
||||
//#define TRACE(x) ;
|
||||
#define TRACE(x) dprintf x
|
||||
|
||||
// misc constants
|
||||
|
||||
static const char *kISO9660Signature = "CD001";
|
||||
static const uint32 kVolumeDescriptorLength = 2048;
|
||||
#define ISO9660_VOLUME_IDENTIFIER_LENGTH 32
|
||||
@ -72,18 +74,18 @@ typedef enum {
|
||||
descriptor types.
|
||||
*/
|
||||
typedef struct iso9660_common_descriptor {
|
||||
uchar type;
|
||||
uint8 type;
|
||||
char standard_identifier[5]; // should be 'CD001'
|
||||
uchar version;
|
||||
uint8 version;
|
||||
// Remaining bytes are unused
|
||||
} __attribute__((packed)) iso9660_common_volume_descriptor;
|
||||
|
||||
typedef struct iso9660_volume_descriptor {
|
||||
iso9660_common_descriptor common;
|
||||
uchar flags;
|
||||
uint8 flags;
|
||||
char system_identifier[32];
|
||||
char identifier[ISO9660_VOLUME_IDENTIFIER_LENGTH];
|
||||
uchar _reserved0[8];
|
||||
uint8 _reserved0[8];
|
||||
uint32 size;
|
||||
uint32 size_big_endian;
|
||||
char escape_sequences[ISO9660_ESCAPE_SEQUENCE_LENGTH];
|
||||
@ -97,7 +99,7 @@ typedef struct iso9660_volume_descriptor {
|
||||
uint32 path_table_size;
|
||||
uint32 path_table_size_big_endian;
|
||||
uint32 _reserved1[4];
|
||||
uchar root_directory_record[34];
|
||||
uint8 root_directory_record[34];
|
||||
char set_identifier[28];
|
||||
// Remaining bytes are disinteresting to us
|
||||
} __attribute__((packed)) iso9660_volume_descriptor;
|
||||
@ -108,7 +110,7 @@ typedef struct iso9660_directory_record {
|
||||
uint32 location;
|
||||
uint32 location_big_endian;
|
||||
uint32 data_length;
|
||||
uchar _reserved[14];
|
||||
uint8 _reserved[14];
|
||||
uint16 volume_space;
|
||||
} __attribute__((packed)) iso9660_directory_record;
|
||||
|
||||
@ -199,10 +201,10 @@ iso9660_info::_SetString(char **string, const char *newString,
|
||||
if (string == NULL)
|
||||
return;
|
||||
|
||||
TRACE(("iso9660_info::set_string(%p ('%s'), '%s', %ld)\n", string,
|
||||
*string, newString, newLength));
|
||||
TRACE(("iso9660_info::set_string(%p ('%s'), '%s', %u)\n", string,
|
||||
*string, newString, (unsigned)newLength));
|
||||
|
||||
char *&oldString = *string;
|
||||
char *&oldString = *string;
|
||||
free(oldString);
|
||||
|
||||
if (newString) {
|
||||
@ -213,7 +215,7 @@ iso9660_info::_SetString(char **string, const char *newString,
|
||||
}
|
||||
} else
|
||||
oldString = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - C functions
|
||||
@ -293,16 +295,16 @@ dump_primary_descriptor(iso9660_volume_descriptor *primary,
|
||||
dump_common_descriptor(&primary->common, indent, false);
|
||||
TRACE(("%s identifier: '%.32s'\n", indent,
|
||||
primary->identifier));
|
||||
TRACE(("%s size: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(primary->size)));
|
||||
TRACE(("%s set size: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(primary->set_size)));
|
||||
TRACE(("%s sequence number: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(primary->sequence_number)));
|
||||
TRACE(("%s logical block size: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(primary->logical_block_size)));
|
||||
TRACE(("%s path table size: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(primary->path_table_size)));
|
||||
TRACE(("%s size: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(primary->size)));
|
||||
TRACE(("%s set size: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(primary->set_size)));
|
||||
TRACE(("%s sequence number: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(primary->sequence_number)));
|
||||
TRACE(("%s logical block size: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(primary->logical_block_size)));
|
||||
TRACE(("%s path table size: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(primary->path_table_size)));
|
||||
TRACE(("%s set identifier: %.28s\n", indent,
|
||||
primary->set_identifier));
|
||||
dump_directory_record((iso9660_directory_record*)
|
||||
@ -333,10 +335,10 @@ dump_directory_record(iso9660_directory_record *record, const char *indent)
|
||||
{
|
||||
TRACE(("%s root directory record:\n", indent));
|
||||
TRACE(("%s length: %d\n", indent, record->length));
|
||||
TRACE(("%s location: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(record->location)));
|
||||
TRACE(("%s data length: %ld\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT32(record->data_length)));
|
||||
TRACE(("%s location: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(record->location)));
|
||||
TRACE(("%s data length: %d\n", indent,
|
||||
(int)B_LENDIAN_TO_HOST_INT32(record->data_length)));
|
||||
TRACE(("%s volume space: %d\n", indent,
|
||||
B_LENDIAN_TO_HOST_INT16(record->volume_space)));
|
||||
}
|
||||
@ -360,7 +362,7 @@ check_common_descriptor(iso9660_common_descriptor *common)
|
||||
/*! \brief Returns true if the given partition is a valid iso9660 partition.
|
||||
|
||||
See fs_identify_hook() for more information.
|
||||
|
||||
|
||||
\todo Fill in partitionInfo->mounted_at with something useful.
|
||||
*/
|
||||
status_t
|
||||
@ -480,7 +482,7 @@ iso9660_fs_identify(int deviceFD, iso9660_info *info)
|
||||
name, info->joliet_name));
|
||||
}
|
||||
|
||||
info->SetJolietName(name, pos - name);
|
||||
info->SetJolietName(name, pos - name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -495,7 +497,7 @@ iso9660_fs_identify(int deviceFD, iso9660_info *info)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found ? B_OK : error;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2002, Tyler Dauwalder.
|
||||
*
|
||||
@ -8,7 +8,11 @@
|
||||
#define ISO9660_IDENTIFY_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#if FS_SHELL
|
||||
# include "fssh_api_wrapper.h"
|
||||
#else
|
||||
# include <SupportDefs.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! \brief Contains all the info of interest pertaining to an
|
||||
|
@ -9,28 +9,31 @@
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <fs_interface.h>
|
||||
#include <fs_cache.h>
|
||||
#ifndef FS_SHELL
|
||||
# include <dirent.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <sys/stat.h>
|
||||
# include <time.h>
|
||||
# include <unistd.h>
|
||||
|
||||
#include <fs_attr.h>
|
||||
#include <fs_info.h>
|
||||
#include <fs_index.h>
|
||||
#include <fs_query.h>
|
||||
#include <fs_volume.h>
|
||||
# include <KernelExport.h>
|
||||
# include <NodeMonitor.h>
|
||||
# include <fs_interface.h>
|
||||
# include <fs_cache.h>
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
# include <fs_attr.h>
|
||||
# include <fs_info.h>
|
||||
# include <fs_index.h>
|
||||
# include <fs_query.h>
|
||||
# include <fs_volume.h>
|
||||
|
||||
# include <util/kernel_cpp.h>
|
||||
#endif
|
||||
|
||||
#include "iso9660.h"
|
||||
#include "iso9660_identify.h"
|
||||
@ -285,7 +288,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
|
||||
} else {
|
||||
result = initResult;
|
||||
if (bytesRead == 0)
|
||||
done = TRUE;
|
||||
done = true;
|
||||
}
|
||||
blockData += bytesRead;
|
||||
blockBytesRead += bytesRead;
|
||||
@ -302,7 +305,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
|
||||
block_cache_put(ns->fBlockCache, cachedBlock);
|
||||
|
||||
} else
|
||||
done = TRUE;
|
||||
done = true;
|
||||
}
|
||||
|
||||
TRACE(("fs_walk - EXIT, result is %s, vnid is %Lu\n",
|
||||
|
@ -2,26 +2,31 @@
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
#ifndef ROCK_RIDGE_H
|
||||
#define ROCK_RIDGE_H
|
||||
|
||||
|
||||
// Altername name field flags.
|
||||
enum {
|
||||
enum NMFLAGS {
|
||||
NM_CONTINUE = 1,
|
||||
NM_CURRENT = 2,
|
||||
NM_PARENT = 4,
|
||||
NM_HOST = 32
|
||||
} NMFLAGS;
|
||||
};
|
||||
|
||||
// Symbolic link field flags
|
||||
enum {
|
||||
enum SLFLAGS {
|
||||
SL_CONTINUE = 1
|
||||
} SLFLAGS;
|
||||
};
|
||||
|
||||
// Symbolic link field component flags
|
||||
enum {
|
||||
enum SLCPFLAGS {
|
||||
SLCP_CONTINUE = 1,
|
||||
SLCP_CURRENT = 2,
|
||||
SLCP_PARENT = 4,
|
||||
SLCP_CURRENT = 2,
|
||||
SLCP_PARENT = 4,
|
||||
SLCP_ROOT = 8,
|
||||
SLCP_VOLROOT = 16,
|
||||
SLCP_VOLROOT = 16,
|
||||
SLCP_HOST = 32
|
||||
} SLCPFLAGS;
|
||||
};
|
||||
|
||||
#endif // ROCK_RIDGE_H
|
||||
|
@ -1,12 +1,12 @@
|
||||
SubDir HAIKU_TOP src tests add-ons kernel file_systems ;
|
||||
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems bfs ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems cdda ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems consistency_check ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems fs_shell ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems fragmenter ;
|
||||
#SubInclude HAIKU_TOP src tests add-ons kernel file_systems iso9660 ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems random_file_actions ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems random_read ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems udf ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs ;
|
||||
HaikuSubInclude bfs ;
|
||||
HaikuSubInclude cdda ;
|
||||
HaikuSubInclude consistency_check ;
|
||||
HaikuSubInclude fs_shell ;
|
||||
HaikuSubInclude fragmenter ;
|
||||
HaikuSubInclude iso9660 ;
|
||||
HaikuSubInclude random_file_actions ;
|
||||
HaikuSubInclude random_read ;
|
||||
HaikuSubInclude udf ;
|
||||
HaikuSubInclude userlandfs ;
|
||||
|
@ -1,3 +1,3 @@
|
||||
SubDir HAIKU_TOP src tests add-ons kernel file_systems iso9660 ;
|
||||
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems iso9660 iso9660_shell ;
|
||||
HaikuSubInclude iso9660_shell ;
|
||||
|
@ -1,31 +1,34 @@
|
||||
SubDir HAIKU_TOP src tests add-ons kernel file_systems iso9660 iso9660_shell ;
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ;
|
||||
SubDirHdrs $(HAIKU_TOP) src tests add-ons kernel file_systems fs_shell ;
|
||||
UsePrivateHeaders fs_shell ;
|
||||
|
||||
SEARCH_SOURCE
|
||||
+= [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ] ;
|
||||
|
||||
# set some additional defines
|
||||
{
|
||||
local defines = [ FDefines USER DEBUG ] ; # _NO_INLINE_ASM
|
||||
SubDirCcFlags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage
|
||||
local defines = [ FDefines FS_SHELL USER DEBUG ] ;
|
||||
SubDirCcFlags $(defines) -Wall -Wno-multichar ;
|
||||
SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-exceptions ;
|
||||
}
|
||||
|
||||
local fsShellSources =
|
||||
fsh.c rootfs.c initfs.c kernel.c cache.c external_commands.cpp sl.c
|
||||
stub.c tracker.cpp sysdep.c hexdump.c argv.c
|
||||
local libHaikuCompat ;
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE) && ! $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
|
||||
libHaikuCompat = libhaikucompat_build.a ;
|
||||
}
|
||||
|
||||
# platform specific libraries
|
||||
local fsShellCommandLibs ;
|
||||
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
fsShellCommandLibs = $(HOST_NETWORK_LIBS) ;
|
||||
}
|
||||
|
||||
BuildPlatformMain iso9660_shell
|
||||
:
|
||||
iso9660.cpp
|
||||
iso9660_identify.cpp
|
||||
kernel_interface.cpp
|
||||
|
||||
: <build>fs_shell.a $(libHaikuCompat) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++)
|
||||
$(HOST_LIBROOT) $(fsShellCommandLibs)
|
||||
;
|
||||
|
||||
SimpleTest iso9660_shell
|
||||
:
|
||||
$(fsShellSources)
|
||||
|
||||
iso.c kernel_interface.c
|
||||
:
|
||||
;
|
||||
|
||||
# Tell Jam where to find these sources
|
||||
SEARCH on [ FGristFiles
|
||||
iso.c kernel_interface.c
|
||||
] = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ] ;
|
||||
|
||||
SEARCH on [ FGristFiles
|
||||
$(fsShellSources)
|
||||
] = [ FDirName $(HAIKU_TOP) src tests add-ons kernel file_systems fs_shell ] ;
|
||||
|
@ -1,12 +0,0 @@
|
||||
/* This file is included in fs_shell:fsh.c
|
||||
* Insert your implementation of additional commands in here
|
||||
*
|
||||
* Format:
|
||||
*
|
||||
* static void
|
||||
* function(int argc, char **argv)
|
||||
* {
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
@ -1,9 +0,0 @@
|
||||
/* This file is included in fs_shell:fsh.c
|
||||
* Insert your definition of additional commands here
|
||||
*
|
||||
* Format:
|
||||
* { commandName, functionName, commandDescription },
|
||||
*
|
||||
* And don't forget the comma after the line :-)
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user