ext2: Fix build warnings, enable Werror
This fix is for ticket #9460 to enable -Werror for ext2. - Unused functions are removed. - The ASSERT macro was redefining a different ASSERT macro from the included files. Now it gets undefined first. - One comparison side was cast to ptrdiff_t because X86_gcc2 complained about signed/unsigned comparison Change-Id: Ib0caade2f83de34c04acc0fc6aa5ed50712daec4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4453 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
4d21f567e7
commit
1fb138bf94
@@ -675,7 +675,7 @@ rule ArchitectureSetupWarnings architecture
|
||||
EnableWerror src add-ons kernel drivers video ;
|
||||
EnableWerror src add-ons kernel file_systems bfs ;
|
||||
EnableWerror src add-ons kernel file_systems cdda ;
|
||||
# EnableWerror src add-ons kernel file_systems ext2 ;
|
||||
EnableWerror src add-ons kernel file_systems ext2 ;
|
||||
# EnableWerror src add-ons kernel file_systems fat ;
|
||||
# EnableWerror src add-ons kernel file_systems googlefs ;
|
||||
EnableWerror src add-ons kernel file_systems iso9660 ;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "Inode.h"
|
||||
|
||||
|
||||
#undef ASSERT
|
||||
|
||||
//#define TRACE_EXT2
|
||||
#ifdef TRACE_EXT2
|
||||
# define TRACE(x...) dprintf("\33[34mext2:\33[0m " x)
|
||||
@@ -840,8 +842,10 @@ DirectoryIterator::_CheckDirEntry(const ext2_dir_entry* dirEntry, const uint8* b
|
||||
errmsg = "Length is not a multiple of 4";
|
||||
else if (dirEntry->Length() < EXT2_DIR_REC_LEN(dirEntry->NameLength()))
|
||||
errmsg = "Length is too short for the name";
|
||||
else if (((uint8*)dirEntry - buffer) + dirEntry->Length() > fBlockSize)
|
||||
else if (((uint8*)dirEntry - buffer) + dirEntry->Length()
|
||||
> (ptrdiff_t)fBlockSize) {
|
||||
errmsg = "Length is too big for the blocksize";
|
||||
}
|
||||
|
||||
TRACE("DirectoryIterator::_CheckDirEntry() %s\n", errmsg);
|
||||
return errmsg == NULL;
|
||||
|
||||
@@ -45,29 +45,6 @@ struct identify_cookie {
|
||||
};
|
||||
|
||||
|
||||
//! ext2_io() callback hook
|
||||
static status_t
|
||||
iterative_io_get_vecs_hook(void* cookie, io_request* request, off_t offset,
|
||||
size_t size, struct file_io_vec* vecs, size_t* _count)
|
||||
{
|
||||
Inode* inode = (Inode*)cookie;
|
||||
|
||||
return file_map_translate(inode->Map(), offset, size, vecs, _count,
|
||||
inode->GetVolume()->BlockSize());
|
||||
}
|
||||
|
||||
|
||||
//! ext2_io() callback hook
|
||||
static status_t
|
||||
iterative_io_finished_hook(void* cookie, io_request* request, status_t status,
|
||||
bool partialTransfer, size_t bytesTransferred)
|
||||
{
|
||||
Inode* inode = (Inode*)cookie;
|
||||
rw_lock_read_unlock(inode->Lock());
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Scanning
|
||||
|
||||
|
||||
@@ -401,34 +378,6 @@ ext2_write_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_io(fs_volume* _volume, fs_vnode* _node, void* _cookie, io_request* request)
|
||||
{
|
||||
Volume* volume = (Volume*)_volume->private_volume;
|
||||
Inode* inode = (Inode*)_node->private_node;
|
||||
|
||||
#ifndef EXT2_SHELL
|
||||
if (io_request_is_write(request) && volume->IsReadOnly()) {
|
||||
notify_io_request(request, B_READ_ONLY_DEVICE);
|
||||
return B_READ_ONLY_DEVICE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (inode->FileCache() == NULL) {
|
||||
#ifndef EXT2_SHELL
|
||||
notify_io_request(request, B_BAD_VALUE);
|
||||
#endif
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
// We lock the node here and will unlock it in the "finished" hook.
|
||||
rw_lock_read_lock(inode->Lock());
|
||||
|
||||
return do_iterative_fd_io(volume->Device(), request,
|
||||
iterative_io_get_vecs_hook, iterative_io_finished_hook, inode);
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset,
|
||||
size_t size, struct file_io_vec* vecs, size_t* _count)
|
||||
@@ -1634,14 +1583,6 @@ ext2_rewind_attr_dir(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
||||
|
||||
|
||||
/* attribute operations */
|
||||
static status_t
|
||||
ext2_create_attr(fs_volume* _volume, fs_vnode* _node,
|
||||
const char* name, uint32 type, int openMode, void** _cookie)
|
||||
{
|
||||
return EROFS;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_open_attr(fs_volume* _volume, fs_vnode* _node, const char* name,
|
||||
int openMode, void** _cookie)
|
||||
@@ -1691,15 +1632,6 @@ ext2_read_attr(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_write_attr(fs_volume* _volume, fs_vnode* _node, void* cookie,
|
||||
off_t pos, const void* buffer, size_t* length)
|
||||
{
|
||||
return EROFS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_read_attr_stat(fs_volume* _volume, fs_vnode* _node,
|
||||
void* _cookie, struct stat* stat)
|
||||
@@ -1713,30 +1645,6 @@ ext2_read_attr_stat(fs_volume* _volume, fs_vnode* _node,
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_write_attr_stat(fs_volume* _volume, fs_vnode* _node,
|
||||
void* cookie, const struct stat* stat, int statMask)
|
||||
{
|
||||
return EROFS;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_rename_attr(fs_volume* _volume, fs_vnode* fromVnode,
|
||||
const char* fromName, fs_vnode* toVnode, const char* toName)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_remove_attr(fs_volume* _volume, fs_vnode* vnode,
|
||||
const char* name)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
fs_volume_ops gExt2VolumeOps = {
|
||||
&ext2_unmount,
|
||||
&ext2_read_fs_info,
|
||||
@@ -1806,16 +1714,16 @@ fs_vnode_ops gExt2VnodeOps = {
|
||||
&ext2_rewind_attr_dir,
|
||||
|
||||
/* attribute operations */
|
||||
NULL, //&ext2_create_attr,
|
||||
NULL,
|
||||
&ext2_open_attr,
|
||||
&ext2_close_attr,
|
||||
&ext2_free_attr_cookie,
|
||||
&ext2_read_attr,
|
||||
NULL, //&ext2_write_attr,
|
||||
NULL,
|
||||
&ext2_read_attr_stat,
|
||||
NULL, //&ext2_write_attr_stat,
|
||||
NULL, //&ext2_rename_attr,
|
||||
NULL, //&ext2_remove_attr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user