From 3b723f79140b51ec56913b1d7b8ccaa3a59b26f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 28 Feb 2006 17:30:47 +0000 Subject: [PATCH] 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 --- .../kernel/file_systems/iso9660/Jamfile | 33 ++--------- .../kernel/file_systems/iso9660/iso9660.cpp | 8 +-- .../kernel/file_systems/iso9660/iso9660.h | 5 ++ .../file_systems/iso9660/kernel_interface.cpp | 57 +++++++++++-------- 4 files changed, 46 insertions(+), 57 deletions(-) diff --git a/src/add-ons/kernel/file_systems/iso9660/Jamfile b/src/add-ons/kernel/file_systems/iso9660/Jamfile index cf6d22354b..0ce0891b1d 100644 --- a/src/add-ons/kernel/file_systems/iso9660/Jamfile +++ b/src/add-ons/kernel/file_systems/iso9660/Jamfile @@ -3,24 +3,10 @@ SubDir HAIKU_TOP src add-ons kernel file_systems iso9660 ; # save original optimization level oldOPTIM = $(OPTIM) ; -# set some additional defines (most of them are currently unused in the iso9660 add-on) +# set some additional defines { - local defines = - KEEP_WRONG_DIRENT_RECLEN - ; - -# 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 ; + SubDirCcFlags -Wall -Wno-multichar ; + SubDirC++Flags -Wall -Wno-multichar -fno-rtti ; } KernelAddon iso9660 : kernel file_systems : @@ -34,17 +20,6 @@ SEARCH on [ FGristFiles kernel_cpp.cpp ] = [ 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 OPTIM = $(oldOPTIM) ; + diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp index 44aff14f3f..a331347ca3 100644 --- a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp @@ -1,7 +1,7 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- +/* + * Copyright 2002, Tyler Dauwalder. + * This file may be used under the terms of the MIT License. + */ /*! \file iso9660.cpp \brief disk_scanner filesystem module for iso9660 CD-ROM filesystems diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.h b/src/add-ons/kernel/file_systems/iso9660/iso9660.h index ef3ee57def..acd9e09c3f 100644 --- a/src/add-ons/kernel/file_systems/iso9660/iso9660.h +++ b/src/add-ons/kernel/file_systems/iso9660/iso9660.h @@ -1,3 +1,8 @@ +/* + * Copyright 2002, Tyler Dauwalder. + * This file may be used under the terms of the MIT License. + */ + #ifndef _ISO9660_H #define _ISO9660_H diff --git a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp index b317a89ac8..82c35f6248 100644 --- a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp @@ -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); 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, 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 // nothing), but DON'T free the 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); // fs_rfsstat - Fill in fs_info struct for device. static status_t fs_read_fs_stat(void *_ns, struct fs_info *); // 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 @@ -277,6 +279,17 @@ fs_read_fs_stat(void *_ns, struct fs_info *fss) 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 the specified file. When you find it, call get_vnode on its vnid to init it for the kernel. @@ -393,7 +406,8 @@ fs_walk(void *_ns, void *base, const char *file, vnode_id *_vnodeID, int *_type) 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)); @@ -480,10 +494,10 @@ fs_read_stat(void *_ns, void *_node, struct stat *st) { nspace *ns = (nspace*)_ns; vnode *node = (vnode*)_node; - int result = B_NO_ERROR; + status_t result = B_NO_ERROR; time_t time; - TRACE(("fs_rstat - ENTER\n")); + TRACE(("fs_read_stat - ENTER\n")); st->st_dev = ns->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) 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; } @@ -597,27 +611,21 @@ fs_read(void *_ns, void *_node, void *cookie, off_t pos, void *buf, size_t *len) *len += startLen; block_cache_put(ns->fBlockCache, cachedBlock); startBlock++; - } - else result = EIO; + } else + result = EIO; } // Read in the middle blocks. if (numBlocks > 0 && result == B_NO_ERROR) { TRACE(("fs_read - getting middle blocks\n")); - /* - result = cached_read(ns->fd, startBlock, - ((char *)buf) + startLen, - numBlocks, - blockSize); - */ + char *endBuf = ((char *)buf) + startLen; for (int32 i=startBlock; ifBlockCache, i, 0, blockSize); - memcpy(((char *)buf) + startLen + (i - startBlock) * blockSize, blockData, blockSize); + memcpy(endBuf, blockData, blockSize); *len += blockSize; + endBuf += blockSize; block_cache_put(ns->fBlockCache, i); } - /*if (result == B_NO_ERROR) - *len += blockSize * numBlocks;*/ } // 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)) { size_t length = strlen(node->attr.slName); if (length > *_bufferSize) + memcpy(buffer, node->attr.slName, *_bufferSize); + else { memcpy(buffer, node->attr.slName, length); - else - memcpy(buffer, node->attr.slName, length); + *_bufferSize = length; + } result = B_NO_ERROR; - *_bufferSize = length; } return result; @@ -857,7 +866,7 @@ static file_system_module_info sISO660FileSystem = { /* vnode operations */ &fs_walk, - NULL, // &fs_get_vnode_name() + &fs_get_vnode_name, &fs_read_vnode, &fs_release_vnode, NULL, // &fs_remove_vnode() @@ -871,12 +880,12 @@ static file_system_module_info sISO660FileSystem = { NULL, // &fs_ioctl NULL, // &fs_set_flags - NULL, // &bfs_select - NULL, // &bfs_deselect + NULL, // &fs_select + NULL, // &fs_deselect NULL, // &fs_fsync &fs_read_link, - NULL, // write link + NULL, // write link NULL, // &fs_create_symlink, NULL, // &fs_link,