diff --git a/headers/private/kernel/util/khash.h b/headers/private/kernel/util/khash.h index ae1b71fd5a..609b08a58d 100644 --- a/headers/private/kernel/util/khash.h +++ b/headers/private/kernel/util/khash.h @@ -12,13 +12,6 @@ #include -// The use of offsetof() on non-PODs is invalid. Since many structs use -// templated members (i.e. DoublyLinkedList) which makes them non-PODs we -// can't use offsetof() anymore. This macro does the same, but requires an -// instance of the object in question. -#define offset_of_member(OBJECT, MEMBER) \ - ((size_t)((char*)&OBJECT.MEMBER - (char*)&OBJECT)) - // can be allocated on the stack typedef struct hash_iterator { void *current; diff --git a/headers/private/kernel/util/list.h b/headers/private/kernel/util/list.h index 94102e0291..5424c10fb6 100644 --- a/headers/private/kernel/util/list.h +++ b/headers/private/kernel/util/list.h @@ -20,6 +20,15 @@ * you don't have to care about the difference between a link and an item. */ + +// The use of offsetof() on non-PODs is invalid. Since many structs use +// templated members (i.e. DoublyLinkedList) which makes them non-PODs we +// can't use offsetof() anymore. This macro does the same, but requires an +// instance of the object in question. +#define offset_of_member(OBJECT, MEMBER) \ + ((size_t)((char*)&OBJECT.MEMBER - (char*)&OBJECT)) + + typedef struct list_link list_link; /* The object that is put into the list must begin with these diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 5acca18d24..6e98ac4f5e 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -5145,10 +5145,11 @@ vfs_init(kernel_args* args) vnode::StaticInit(); sVnodeTable = new(std::nothrow) VnodeTable(); - if (sVnodeTable == NULL | sVnodeTable->Init(VNODE_HASH_TABLE_SIZE) != B_OK) + if (sVnodeTable == NULL || sVnodeTable->Init(VNODE_HASH_TABLE_SIZE) != B_OK) panic("vfs_init: error creating vnode hash table\n"); - list_init_etc(&sUnusedVnodeList, offsetof(struct vnode, unused_link)); + struct vnode dummy_vnode; + list_init_etc(&sUnusedVnodeList, offset_of_member(dummy_vnode, unused_link)); struct fs_mount dummyMount; sMountsTable = new(std::nothrow) MountTable();