added fs_get_vnode_name

cleanup of Jamfile
clean license


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16549 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-02-28 17:30:47 +00:00
parent 63beb9cd39
commit 3b723f7914
4 changed files with 46 additions and 57 deletions
@@ -3,24 +3,10 @@ SubDir HAIKU_TOP src add-ons kernel file_systems iso9660 ;
# save original optimization level # save original optimization level
oldOPTIM = $(OPTIM) ; oldOPTIM = $(OPTIM) ;
# set some additional defines (most of them are currently unused in the iso9660 add-on) # set some additional defines
{ {
local defines = SubDirCcFlags -Wall -Wno-multichar ;
KEEP_WRONG_DIRENT_RECLEN SubDirC++Flags -Wall -Wno-multichar -fno-rtti ;
;
# if $(COMPILE_FOR_R5) {
defines += COMPILE_FOR_R5 ;
# }
if $(DEBUG) = 0 {
# the gcc on BeOS doesn't compile BFS correctly with -O2 or more
OPTIM = -O1 ;
}
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) -Wall -Wno-multichar ;
SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ;
} }
KernelAddon iso9660 : kernel file_systems : KernelAddon iso9660 : kernel file_systems :
@@ -34,17 +20,6 @@ SEARCH on [ FGristFiles
kernel_cpp.cpp kernel_cpp.cpp
] = [ FDirName $(HAIKU_TOP) src system kernel util ] ; ] = [ FDirName $(HAIKU_TOP) src system kernel util ] ;
rule InstallISO9660
{
Depends $(<) : $(>) ;
}
actions ignore InstallISO9660
{
cp $(>) /boot/home/config/add-ons/kernel/file_systems/
}
InstallISO9660 install : iso9660 ;
# restore original optimization level # restore original optimization level
OPTIM = $(oldOPTIM) ; OPTIM = $(oldOPTIM) ;
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2002, Tyler Dauwalder.
// by the OpenBeOS license. * This file may be used under the terms of the MIT License.
//--------------------------------------------------------------------- */
/*! /*!
\file iso9660.cpp \file iso9660.cpp
\brief disk_scanner filesystem module for iso9660 CD-ROM filesystems \brief disk_scanner filesystem module for iso9660 CD-ROM filesystems
@@ -1,3 +1,8 @@
/*
* Copyright 2002, Tyler Dauwalder.
* This file may be used under the terms of the MIT License.
*/
#ifndef _ISO9660_H #ifndef _ISO9660_H
#define _ISO9660_H #define _ISO9660_H
@@ -50,6 +50,8 @@ static status_t fs_mount(mount_id mountID, const char *device, uint32 flags,
const char *args, void **_data, vnode_id *_rootID); const char *args, void **_data, vnode_id *_rootID);
static status_t fs_unmount(void *ns); static status_t fs_unmount(void *ns);
static status_t fs_get_vnode_name(void *_ns, void *_node,
char *buffer, size_t bufferSize);
static status_t fs_walk(void *_ns, void *_base, const char *file, static status_t fs_walk(void *_ns, void *_base, const char *file,
vnode_id *_vnodeID, int *_type); vnode_id *_vnodeID, int *_type);
@@ -79,14 +81,14 @@ static status_t fs_rewind_dir(void *_ns, void *_node, void *cookie);
// fs_closedir - Do whatever you need to to close a directory (sometimes // fs_closedir - Do whatever you need to to close a directory (sometimes
// nothing), but DON'T free the cookie! // nothing), but DON'T free the cookie!
static status_t fs_close_dir(void *_ns, void *_node, void *cookie); static status_t fs_close_dir(void *_ns, void *_node, void *cookie);
// fs_fee_dircookie - Free the fs-specific cookie struct // fs_free_dircookie - Free the fs-specific cookie struct
static status_t fs_free_dir_cookie(void *_ns, void *_node, void *cookie); static status_t fs_free_dir_cookie(void *_ns, void *_node, void *cookie);
// fs_rfsstat - Fill in fs_info struct for device. // fs_rfsstat - Fill in fs_info struct for device.
static status_t fs_read_fs_stat(void *_ns, struct fs_info *); static status_t fs_read_fs_stat(void *_ns, struct fs_info *);
// fs_readlink - Read in the name of a symbolic link. // fs_readlink - Read in the name of a symbolic link.
static status_t fs_read_link(void *_ns, void *_node, char *buf, size_t *bufsize); static status_t fs_read_link(void *_ns, void *_node, char *buf, size_t *bufsize);
// #pragma mark - Scanning // #pragma mark - Scanning
@@ -277,6 +279,17 @@ fs_read_fs_stat(void *_ns, struct fs_info *fss)
return 0; return 0;
} }
static status_t
fs_get_vnode_name(void *ns, void *_node, char *buffer, size_t bufferSize)
{
vnode *node = (vnode*)_node;
strlcpy(buffer, node->fileIDString, bufferSize);
return B_OK;
}
/* fs_walk - the walk function just "walks" through a directory looking for /* fs_walk - the walk function just "walks" through a directory looking for
the specified file. When you find it, call get_vnode on its vnid to init the specified file. When you find it, call get_vnode on its vnid to init
it for the kernel. it for the kernel.
@@ -393,7 +406,8 @@ fs_walk(void *_ns, void *base, const char *file, vnode_id *_vnodeID, int *_type)
done = TRUE; done = TRUE;
} }
*_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode; if (newNode)
*_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode;
} }
TRACE(("fs_walk - EXIT, result is %s, vnid is %Lu\n", strerror(result), *_vnodeID)); TRACE(("fs_walk - EXIT, result is %s, vnid is %Lu\n", strerror(result), *_vnodeID));
@@ -480,10 +494,10 @@ fs_read_stat(void *_ns, void *_node, struct stat *st)
{ {
nspace *ns = (nspace*)_ns; nspace *ns = (nspace*)_ns;
vnode *node = (vnode*)_node; vnode *node = (vnode*)_node;
int result = B_NO_ERROR; status_t result = B_NO_ERROR;
time_t time; time_t time;
TRACE(("fs_rstat - ENTER\n")); TRACE(("fs_read_stat - ENTER\n"));
st->st_dev = ns->id; st->st_dev = ns->id;
st->st_ino = node->id; st->st_ino = node->id;
@@ -498,7 +512,7 @@ fs_read_stat(void *_ns, void *_node, struct stat *st)
if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR) if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR)
st->st_ctime = st->st_mtime = st->st_atime = time; st->st_ctime = st->st_mtime = st->st_atime = time;
TRACE(("fs_rstat - EXIT, result is %s\n", strerror(result))); TRACE(("fs_read_stat - EXIT, result is %s\n", strerror(result)));
return result; return result;
} }
@@ -597,27 +611,21 @@ fs_read(void *_ns, void *_node, void *cookie, off_t pos, void *buf, size_t *len)
*len += startLen; *len += startLen;
block_cache_put(ns->fBlockCache, cachedBlock); block_cache_put(ns->fBlockCache, cachedBlock);
startBlock++; startBlock++;
} } else
else result = EIO; result = EIO;
} }
// Read in the middle blocks. // Read in the middle blocks.
if (numBlocks > 0 && result == B_NO_ERROR) { if (numBlocks > 0 && result == B_NO_ERROR) {
TRACE(("fs_read - getting middle blocks\n")); TRACE(("fs_read - getting middle blocks\n"));
/* char *endBuf = ((char *)buf) + startLen;
result = cached_read(ns->fd, startBlock,
((char *)buf) + startLen,
numBlocks,
blockSize);
*/
for (int32 i=startBlock; i<startBlock+numBlocks; i++) { for (int32 i=startBlock; i<startBlock+numBlocks; i++) {
char *blockData = (char *)block_cache_get_etc(ns->fBlockCache, i, 0, blockSize); char *blockData = (char *)block_cache_get_etc(ns->fBlockCache, i, 0, blockSize);
memcpy(((char *)buf) + startLen + (i - startBlock) * blockSize, blockData, blockSize); memcpy(endBuf, blockData, blockSize);
*len += blockSize; *len += blockSize;
endBuf += blockSize;
block_cache_put(ns->fBlockCache, i); block_cache_put(ns->fBlockCache, i);
} }
/*if (result == B_NO_ERROR)
*len += blockSize * numBlocks;*/
} }
// Read in the last partial block. // Read in the last partial block.
@@ -692,12 +700,13 @@ fs_read_link(void *_ns, void *_node, char *buffer, size_t *_bufferSize)
if (S_ISLNK(node->attr.stat[FS_DATA_FORMAT].st_mode)) { if (S_ISLNK(node->attr.stat[FS_DATA_FORMAT].st_mode)) {
size_t length = strlen(node->attr.slName); size_t length = strlen(node->attr.slName);
if (length > *_bufferSize) if (length > *_bufferSize)
memcpy(buffer, node->attr.slName, *_bufferSize);
else {
memcpy(buffer, node->attr.slName, length); memcpy(buffer, node->attr.slName, length);
else *_bufferSize = length;
memcpy(buffer, node->attr.slName, length); }
result = B_NO_ERROR; result = B_NO_ERROR;
*_bufferSize = length;
} }
return result; return result;
@@ -857,7 +866,7 @@ static file_system_module_info sISO660FileSystem = {
/* vnode operations */ /* vnode operations */
&fs_walk, &fs_walk,
NULL, // &fs_get_vnode_name() &fs_get_vnode_name,
&fs_read_vnode, &fs_read_vnode,
&fs_release_vnode, &fs_release_vnode,
NULL, // &fs_remove_vnode() NULL, // &fs_remove_vnode()
@@ -871,12 +880,12 @@ static file_system_module_info sISO660FileSystem = {
NULL, // &fs_ioctl NULL, // &fs_ioctl
NULL, // &fs_set_flags NULL, // &fs_set_flags
NULL, // &bfs_select NULL, // &fs_select
NULL, // &bfs_deselect NULL, // &fs_deselect
NULL, // &fs_fsync NULL, // &fs_fsync
&fs_read_link, &fs_read_link,
NULL, // write link NULL, // write link
NULL, // &fs_create_symlink, NULL, // &fs_create_symlink,
NULL, // &fs_link, NULL, // &fs_link,