From Shubham Bhagat <shubhambhagat111@xxxxxxxxx>:
Shubham Bhagat has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2915 ;)
Change subject: xfs: An attempt at reading shortform dir
......................................................................
xfs: An attempt at reading shortform dir
This doesn't exactly work. Getting some random inodeID in read_stat hook
after trying to ls the root directory (It changes so it's garbage).
---
A src/add-ons/kernel/file_systems/xfs/Directory.cpp
A src/add-ons/kernel/file_systems/xfs/Directory.h
M src/add-ons/kernel/file_systems/xfs/Inode.cpp
M src/add-ons/kernel/file_systems/xfs/Inode.h
M src/add-ons/kernel/file_systems/xfs/Jamfile
A src/add-ons/kernel/file_systems/xfs/ShortDirectory.cpp
A src/add-ons/kernel/file_systems/xfs/ShortDirectory.h
M src/add-ons/kernel/file_systems/xfs/Volume.cpp
M src/add-ons/kernel/file_systems/xfs/Volume.h
M src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp
M src/add-ons/kernel/file_systems/xfs/xfs.cpp
M src/add-ons/kernel/file_systems/xfs/xfs.h
M src/tests/add-ons/kernel/file_systems/xfs/xfs_shell/Jamfile
13 files changed, 392 insertions(+), 32 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/15/2915/1
diff --git a/src/add-ons/kernel/file_systems/xfs/Directory.cpp
b/src/add-ons/kernel/file_systems/xfs/Directory.cpp
new file mode 100644
index 0000000..30f340c
--- /dev/null
+++ b/src/add-ons/kernel/file_systems/xfs/Directory.cpp
@@ -0,0 +1,65 @@
+/*
+* Copyright 2020, Shubham Bhagat, shubhambhagat111@xxxxxxxxx
+* All rights reserved. Distributed under the terms of the MIT License.
+*/
+
+#include "Directory.h"
+
+
+DirectoryIterator::DirectoryIterator(Inode* inode)
+{
+ fInode = inode;
+ fShortDir = NULL;
+}
+
+
+DirectoryIterator::~DirectoryIterator()
+{
+ delete fInode;
+ delete fShortDir;
+}
+
+status_t
+DirectoryIterator::GetNext(char* name, size_t* length, xfs_ino_t* ino)
+{
+ if(fInode->Format() == XFS_DINODE_FMT_LOCAL)
+ {
+ if(fShortDir == NULL)
+ {
+ fShortDir = new(std::nothrow) ShortDirectory(fInode);
+ if (fShortDir == NULL)
+ return B_NO_MEMORY;
+ }
+
+ status_t status = fShortDir->GetNext(name, length, ino);
+ return status;
+ } else if (fInode->Format() == XFS_DINODE_FMT_EXTENTS)
+ return B_ENTRY_NOT_FOUND;
+ else if (fInode->Format() == XFS_DINODE_FMT_BTREE)
+ return B_ENTRY_NOT_FOUND;
+
+ // Only reaches here if Inode is a device or is corrupt.
+ return B_BAD_VALUE;
+}
+
+
+status_t
+DirectoryIterator::Lookup(const char* name, size_t length, xfs_ino_t* ino)
+{
+ if(fInode->Format() == XFS_DINODE_FMT_LOCAL)
+ {
+ if (fShortDir == NULL) {
+ fShortDir = new(std::nothrow) ShortDirectory(fInode);
+ if (fShortDir == NULL)
+ return B_NO_MEMORY;
+ }
+
+ status_t status = fShortDir->Lookup(name, length, ino);
+ return status;
+ } else if(fInode->Format() == XFS_DINODE_FMT_EXTENTS)
+ return B_ENTRY_NOT_FOUND;
+ else if (fInode->Format() == XFS_DINODE_FMT_BTREE)
+ return B_ENTRY_NOT_FOUND;
+
+ return B_BAD_VALUE;
+}
\ No newline at end of file
diff --git a/src/add-ons/kernel/file_systems/xfs/Directory.h
b/src/add-ons/kernel/file_systems/xfs/Directory.h
new file mode 100644
index 0000000..a894a87
--- /dev/null
+++ b/src/add-ons/kernel/file_systems/xfs/Directory.h
@@ -0,0 +1,29 @@
+/*
+* Copyright 2020, Shubham Bhagat, shubhambhagat111@xxxxxxxxx
+* All rights reserved. Distributed under the terms of the MIT License.
+*/
+
+#ifndef _DIRECTORY_H_
+#define _DIRECTORY_H_
+
+#include "Inode.h"
+#include "ShortDirectory.h"
+
+
+class DirectoryIterator
+{
+ // This class should act as a layer between any kind of dir and the
kernel interface
+ public:
+ DirectoryIterator(Inode* inode);
+ ~DirectoryIterator();
+ bool IsLocalDir(){ return fInode->IsLocal(); }
+ status_t GetNext(char* name, size_t* length, xfs_ino_t*
ino);
+ status_t Lookup(const char* name, size_t length,
xfs_ino_t* id);
+
+ private:
+ Inode* fInode;
+ ShortDirectory* fShortDir; // Short form Directory type
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/add-ons/kernel/file_systems/xfs/Inode.cpp
b/src/add-ons/kernel/file_systems/xfs/Inode.cpp
index 6182376..5c7e365 100644
--- a/src/add-ons/kernel/file_systems/xfs/Inode.cpp
+++ b/src/add-ons/kernel/file_systems/xfs/Inode.cpp
@@ -129,16 +129,16 @@
fId = id;
fNode = new(std::nothrow) xfs_inode_t;
- uint16 inodeSize = volume->InodeSize();
+ uint16 inodeSize = fVolume->InodeSize();
fBuffer = new(std::nothrow) char[inodeSize];
status_t status = GetFromDisk();
if (status == B_OK) {
status = InitCheck();
if (status) {
- TRACE("Inode successfully read!");
+ TRACE("Inode successfully read!\n");
} else {
- TRACE("Inode wasn't read successfully!");
+ TRACE("Inode wasn't read successfully!\n");
}
}
}
diff --git a/src/add-ons/kernel/file_systems/xfs/Inode.h
b/src/add-ons/kernel/file_systems/xfs/Inode.h
index 5241c29..4baf502 100644
--- a/src/add-ons/kernel/file_systems/xfs/Inode.h
+++ b/src/add-ons/kernel/file_systems/xfs/Inode.h
@@ -8,15 +8,15 @@
#include "system_dependencies.h"
-#include "Volume.h"
#include "xfs_types.h"
-
+#include "Volume.h"
#define INODE_MAGIC 0x494e
-#define INODE_CORE_SIZE 96 // For v4 FS
-#define INODE_CORE_UNLINKED_SIZE 100 //For v4 FS
-#define DATA_FORK_OFFSET 0x64
-
+#define INODE_MINSIZE_LOG 8
+#define INODE_MAXSIZE_LOG 11
+#define INODE_CORE_SIZE 96
+#define INODE_CORE_UNLINKED_SIZE 100 // Inode core but with unlinked pointer
+#define DATA_FORK_OFFSET 0x64 // For v4 FS
#define INO_MASK(x) ((1ULL << (x)) - 1)
// Gets 2^x - 1
#define INO_TO_AGNO(id, volume) (xfs_agnumber_t)id >>
(volume->AgInodeBits())
@@ -29,6 +29,23 @@
// Gets the AG relative block number that contains inode
#define INO_TO_OFFSET(id, volume) (id & INO_MASK(volume->InodesPerBlkLog()))
// Gets the offset into the block from the inode number
+#define DIR_DFORK_PTR(dir_ino_ptr) (char*) dir_ino_ptr + DATA_FORK_OFFSET
+#define DIR_AFORK_PTR(dir_ino_ptr) \
+ (XFS_DFORK_PTR + \
+ ((uint32)dir_ino_ptr->di_forkoff<<3))
+#define DIR_AFORK_EXIST(dir_ino_ptr) dir_ino_ptr->di_forkoff!=0
+
+
+typedef struct { uint8 i[8]; } xfs_dir2_ino8_t; // 8 byte inode #
+
+
+typedef struct { uint8 i[4]; } xfs_dir2_ino4_t; // 4 byte inode #
+
+
+typedef union{
+ xfs_dir2_ino8_t i8;
+ xfs_dir2_ino4_t i4;
+} xfs_dir2_inou_t;
typedef struct xfs_timestamp
@@ -61,7 +78,7 @@
void GetChangeTime(struct timespec&
timestamp);
void GetAccessTime(struct timespec&
timestamp);
int8 Format(); // The
format of the inode
- xfs_fsize_t Size() const; // TODO
+ xfs_fsize_t Size() const;
xfs_rfsblock_t NoOfBlocks() const;
uint32 NLink();
uint16 Flags();
@@ -129,12 +146,14 @@
int8 Version() { return fNode->Version(); }
- xfs_fsize_t Size() const { return fNode->Size(); }
-
xfs_rfsblock_t NoOfBlocks() const { return
fNode->NoOfBlocks(); }
+ char* Buffer() { return fBuffer; }
+
int16 Flags() const { return fNode->Flags(); }
+ xfs_fsize_t Size() const { return fNode->Size(); }
+
void GetChangeTime(struct timespec& timestamp) const
{ fNode->GetChangeTime(timestamp); }
@@ -144,10 +163,10 @@
void GetAccessTime(struct timespec& timestamp) const
{ fNode->GetAccessTime(timestamp); }
- private:
uint32 UserId() { return fNode->UserId(); }
uint32 GroupId() { return fNode->GroupId(); }
+ private:
status_t GetFromDisk();
xfs_inode_t* fNode;
xfs_ino_t fId;
diff --git a/src/add-ons/kernel/file_systems/xfs/Jamfile
b/src/add-ons/kernel/file_systems/xfs/Jamfile
index 1a6803e..0509ce2 100644
--- a/src/add-ons/kernel/file_systems/xfs/Jamfile
+++ b/src/add-ons/kernel/file_systems/xfs/Jamfile
@@ -20,9 +20,12 @@
UseHeaders [ FDirName $(HAIKU_TOP) src libs uuid ] : true ;
local xfsSources =
+ DeviceOpener.cpp
+ Directory.cpp
Inode.cpp
kernel_cpp.cpp
kernel_interface.cpp
+ ShortDirectory.cpp
Volume.cpp
xfs.cpp
;
diff --git a/src/add-ons/kernel/file_systems/xfs/ShortDirectory.cpp
b/src/add-ons/kernel/file_systems/xfs/ShortDirectory.cpp
new file mode 100644
index 0000000..867c211
--- /dev/null
+++ b/src/add-ons/kernel/file_systems/xfs/ShortDirectory.cpp
@@ -0,0 +1,88 @@
+/*
+* Copyright 2020, Shubham Bhagat, shubhambhagat111@xxxxxxxxx
+* All rights reserved. Distributed under the terms of the MIT License.
+*/
+
+#include "ShortDirectory.h"
+
+
+ShortDirectory::ShortDirectory(Inode* inode)
+ :
+ fInode(inode),
+ fTrack(0)
+{
+ char* buf = fInode->Buffer();
+ memcpy(&fHeader, DIR_DFORK_PTR(buf), sizeof(xfs_dir2_sf_hdr_t));
+}
+
+
+ShortDirectory::~ShortDirectory()
+{
+
+}
+
+xfs_ino_t
+ShortDirectory::GetParentIno()
+{
+ TRACE("GetParentIno: \n");
+ if(fHeader.i8count)
+ {
+ uint64 parentIno;
+ memcpy(&parentIno, &fHeader.parent.i8.i, sizeof(uint8)*8);
+ return B_BENDIAN_TO_HOST_INT64(parentIno);
+ } else {
+ uint32 parentIno;
+ memcpy(&parentIno, &fHeader.parent.i4.i, sizeof(uint8)*4);
+ return B_BENDIAN_TO_HOST_INT32(parentIno);
+ }
+}
+
+
+status_t
+ShortDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
+{
+ if(strcmp(name,".") == 0 || strcmp(name, ".."))
+ {
+ xfs_ino_t rootIno = fInode->GetVolume()->Root();
+ if(strcmp(name, ".") || (rootIno == fInode->ID()))
+ {
+ *ino = fInode->ID();
+ TRACE("ShortDirectory:Lookup: name: \".\" ino: (%d)\n",
*ino);
+ return B_OK;
+ }
+ *ino = GetParentIno();
+ TRACE("Parent: (%d)\n", *ino);
+ return B_OK;
+ }
+ //TODO: Other entries
+ return B_ENTRY_NOT_FOUND;
+}
+
+status_t
+ShortDirectory::GetNext(char* name, size_t* length, xfs_ino_t* ino)
+{
+ if(fTrack == 0) // Return '.'
+ {
+ if(*length<2)
+ return B_BUFFER_OVERFLOW;
+ *length = 2;
+ strlcpy(name, ".", *length + 1);
+ *ino = fInode->ID();
+ fTrack = 1;
+ TRACE("ShortDirectory:GetNext: name: \".\" ino: (%d)\n", *ino);
+ return B_OK;
+ } else if (fTrack == 1) // Return '..'
+ {
+ if(*length < 3)
+ return B_BUFFER_OVERFLOW;
+ *length = 3;
+ strlcpy(name, "..", *length + 1);
+ *ino = GetParentIno();
+ fTrack = 2;
+ TRACE("ShortDirectory:GetNext: name: \"..\" ino:
(%d)\n", *ino);
+ return B_OK;
+ }
+ // Now iterate through sf entries
+ return B_ENTRY_NOT_FOUND;
+ // TODO
+}
\ No newline at end of file
diff --git a/src/add-ons/kernel/file_systems/xfs/ShortDirectory.h
b/src/add-ons/kernel/file_systems/xfs/ShortDirectory.h
new file mode 100644
index 0000000..b0464ed
--- /dev/null
+++ b/src/add-ons/kernel/file_systems/xfs/ShortDirectory.h
@@ -0,0 +1,64 @@
+/*
+* Copyright 2020, Shubham Bhagat, shubhambhagat111@xxxxxxxxx
+* All rights reserved. Distributed under the terms of the MIT License.
+*/
+
+#ifndef __SHORT_DIR_H__
+#define __SHORT_DIR_H__
+
+#include "Inode.h"
+
+
+typedef struct { uint8 i[2]; } xfs_dir2_sf_off_t; //offset into the literal
area
+
+
+// Short form directory header
+typedef struct xfs_dir2_sf_hdr{
+ uint8 count; // number of entries
+ uint8 i8count; // # of 64bit inode entries
+ xfs_dir2_inou_t parent; // absolute inode # of parent
+
+} xfs_dir2_sf_hdr_t;
+
+
+/* The xfs_dir2_sf_entry is split into two parts because the entries size is
variable */
+typedef struct xfs_dir2_sf_entry {
+ uint8 namelen; // length of the name, in bytes
+ xfs_dir2_sf_off_t offset; // offset tag, for directory iteration
+ uint8 name[]; // name of directory entry
+
+} xfs_dir2_sf_entry_t;
+
+
+typedef union xfs_dir2_sf_entry_inum {
+ struct xfs_ftype_inum{
+ uint8 ftype;
+ xfs_dir2_inou_t inumber;
+ };
+ struct xfs_inum{
+ xfs_dir2_inou_t inumber;
+ };
+} xfs_dir2_sf_entry_inum_t;
+
+
+class ShortDirectory
+{
+ public:
+ ShortDirectory(Inode* inode);
+ ~ShortDirectory();
+ status_t GetNext(char* name, size_t* length, xfs_ino_t*
ino);
+ xfs_ino_t GetParentIno();
+ status_t Lookup(const char* name, size_t length,
xfs_ino_t* id);
+
+ private:
+ Inode* fInode;
+ xfs_dir2_sf_hdr_t fHeader;
+ xfs_dir2_sf_off_t fLastEntryOffset;
+ // offset into the literal area
+ uint8 fTrack;
+ // If 0 return '.' dir, else if 1 return parent, else return
child entry
+
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/add-ons/kernel/file_systems/xfs/Volume.cpp
b/src/add-ons/kernel/file_systems/xfs/Volume.cpp
index aa6d14c..072f450 100644
--- a/src/add-ons/kernel/file_systems/xfs/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/xfs/Volume.cpp
@@ -4,8 +4,7 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "Volume.h"
-#include "DeviceOpener.h"
-
+#include "Inode.h"
Volume::Volume(fs_volume *volume)
: fFSVolume(volume)
@@ -92,6 +91,17 @@
}
opener.Keep();
+
+
+ //publish the root inode
+ Inode* rootInode = new(std::nothrow) Inode(this, this->Root());
+ if (rootInode != NULL) {
+ status = publish_vnode(this->FSVolume(), this->Root(),
+ (void*)rootInode, &gxfsVnodeOps, rootInode->Mode(), 0);
+
+ if (status!=B_OK)
+ return B_BAD_VALUE;
+ }
return B_OK;
}
diff --git a/src/add-ons/kernel/file_systems/xfs/Volume.h
b/src/add-ons/kernel/file_systems/xfs/Volume.h
index 1a9be65..9f8c0e6 100644
--- a/src/add-ons/kernel/file_systems/xfs/Volume.h
+++ b/src/add-ons/kernel/file_systems/xfs/Volume.h
@@ -7,6 +7,7 @@
#define _VOLUME_H_
#include "xfs.h"
+#include <DeviceOpener.h>
/* Converting the FS Blocks to Basic Blocks */
@@ -68,6 +69,8 @@
xfs_agblock_t AgBlocks() { return
fSuperBlock.AgBlocks(); }
+ uint8 SuperBlockFlags() {
return fSuperBlock.Flags(); }
+
#if 0
off_t NumBlocks() const
{
return fSuperBlock.NumBlocks(); }
diff --git a/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp
b/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp
index fef7c6f..dece11b 100644
--- a/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp
+++ b/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp
@@ -6,6 +6,7 @@
#include "system_dependencies.h"
#include "Inode.h"
#include "Volume.h"
+#include "Directory.h"
#define XFS_IO_SIZE 65536
@@ -86,15 +87,15 @@
return status;
}
- //publish the root inode
- Inode* rootInode = new(std::nothrow) Inode(volume, volume->Root());
- if (rootInode != NULL) {
- status = publish_vnode(volume->FSVolume(), volume->Root(),
- (void*)rootInode, &gxfsVnodeOps, rootInode->Mode(), 0);
+ // //publish the root inode
+ // Inode* rootInode = new(std::nothrow) Inode(volume, volume->Root());
+ // if (rootInode != NULL) {
+ // status = publish_vnode(volume->FSVolume(), volume->Root(),
+ // (void*)rootInode, &gxfsVnodeOps, rootInode->Mode(), 0);
- if (status!=B_OK)
- return B_BAD_VALUE;
- }
+ // if (status!=B_OK)
+ // return B_BAD_VALUE;
+ // }
*_rootID = volume->Root();
return B_OK;
@@ -116,6 +117,7 @@
static status_t
xfs_read_fs_info(fs_volume *_volume, struct fs_info *info)
{
+ TRACE("XFS_READ_FS_INFO:\n");
Volume* volume = (Volume*)_volume->private_volume;
info->flags = B_FS_IS_READONLY
@@ -140,6 +142,7 @@
xfs_get_vnode(fs_volume *_volume, ino_t id, fs_vnode *_node, int *_type,
uint32 *_flags, bool reenter)
{
+ TRACE("XFS_GET_VNODE:\n");
Volume* volume = (Volume*)_volume->private_volume;
Inode* inode = new(std::nothrow) Inode(volume, id);
@@ -158,7 +161,7 @@
_node->ops = &gxfsVnodeOps;
*_type = inode->Mode();
*_flags = 0;
-
+ TRACE("(%d)\n", inode->ID());
return B_OK;
}
@@ -166,7 +169,9 @@
static status_t
xfs_put_vnode(fs_volume *_volume, fs_vnode *_node, bool reenter)
{
- return B_NOT_SUPPORTED;
+ TRACE("XFS_PUT_VNODE:\n");
+ delete (Inode*)_node->private_node;
+ return B_OK;
}
@@ -208,7 +213,21 @@
xfs_lookup(fs_volume *_volume, fs_vnode *_directory, const char *name,
ino_t *_vnodeID)
{
- return B_NOT_SUPPORTED;
+ TRACE("XFS_LOOKUP: %p (%s)\n", name, name);
+ Volume* volume = (Volume*)_volume->private_volume;
+ Inode* directory = (Inode*)_directory->private_node;
+
+ if(!directory->IsDirectory())
+ return B_NOT_A_DIRECTORY;
+
+ // Not dealing with access permissions right now
+ status_t status = DirectoryIterator(directory).Lookup(name,
strlen(name), (xfs_ino_t*)_vnodeID);
+ if (status != B_OK)
+ return status;
+ TRACE("XFS_LOOKUP: ID: (%d)\n", *_vnodeID);
+ status = get_vnode(volume->FSVolume(), *_vnodeID, NULL);
+ TRACE("get_vnode status: (%d)\n", status);
+ return status;
}
@@ -224,6 +243,7 @@
xfs_read_stat(fs_volume *_volume, fs_vnode *_node, struct stat *stat)
{
Inode* inode = (Inode*)_node->private_node;
+ TRACE("XFS_READ_STAT: root_id: (%d)\n", inode->ID());
stat->st_dev = inode->GetVolume()->ID();
stat->st_ino = inode->ID();
stat->st_nlink = 1;
@@ -234,7 +254,7 @@
stat->st_mode = inode->Mode();
stat->st_type = 0; // TODO
- stat->st_size = inode->GetVolume()->InodeSize();
+ stat->st_size = inode->Size();
stat->st_blocks = inode->NoOfBlocks();
inode->GetAccessTime(stat->st_atim);
@@ -282,7 +302,7 @@
static status_t
xfs_access(fs_volume *_volume, fs_vnode *_node, int accessMode)
{
- return B_NOT_SUPPORTED;
+ return B_OK;
}
@@ -322,7 +342,21 @@
static status_t
xfs_open_dir(fs_volume * /*_volume*/, fs_vnode *_node, void **_cookie)
{
- return B_NOT_SUPPORTED;
+ Inode* inode = (Inode*)_node->private_node;
+ TRACE("XFS_OPEN_DIR: (%d)\n", inode->ID());
+
+ if(!inode->IsDirectory()){
+ return B_NOT_A_DIRECTORY;
+ }
+
+ DirectoryIterator* iterator = new(std::nothrow)
DirectoryIterator(inode);
+ if(iterator == NULL){
+ delete iterator;
+ return B_NO_MEMORY;
+ }
+
+ *_cookie = iterator;
+ return B_OK;
}
@@ -330,7 +364,39 @@
xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie,
struct dirent *dirent, size_t bufferSize, uint32 *_num)
{
- return B_NOT_SUPPORTED;
+ TRACE("XFS_READ_DIR\n");
+ DirectoryIterator* iterator = (DirectoryIterator*)_cookie;
+ Volume* volume = (Volume*)_volume->private_volume;
+
+ uint32 maxCount = *_num;
+ uint32 count = 0;
+
+ while(count < maxCount and (bufferSize > sizeof(struct dirent))) {
+ size_t length = bufferSize - sizeof(struct dirent) + 1;
+ xfs_ino_t ino;
+
+ status_t status = iterator->GetNext(dirent->d_name, &length,
&ino);
+ if(status == B_ENTRY_NOT_FOUND)
+ break;
+ if(status == B_BUFFER_OVERFLOW){
+ if(count == 0)
+ return status;
+ break;
+ }
+ if(status != B_OK)
+ return status;
+
+ dirent->d_dev = volume->ID();
+ dirent->d_ino = ino;
+ dirent->d_reclen = sizeof(dirent) + length;
+ bufferSize -= dirent->d_reclen;
+ dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen);
+ count++;
+ }
+
+ *_num = count;
+ TRACE("Count: (%d)\n", count);
+ return B_OK;
}
diff --git a/src/add-ons/kernel/file_systems/xfs/xfs.cpp
b/src/add-ons/kernel/file_systems/xfs/xfs.cpp
index 763d66f..2728b43 100644
--- a/src/add-ons/kernel/file_systems/xfs/xfs.cpp
+++ b/src/add-ons/kernel/file_systems/xfs/xfs.cpp
@@ -6,6 +6,13 @@
#include "xfs.h"
+uint8
+XfsSuperBlock::Flags()
+{
+ return sb_flags;
+}
+
+
bool
XfsSuperBlock::IsValid()
{
@@ -125,7 +132,6 @@
return sb_agcount;
}
-
xfs_agblock_t
XfsSuperBlock::AgBlocks()
{
diff --git a/src/add-ons/kernel/file_systems/xfs/xfs.h
b/src/add-ons/kernel/file_systems/xfs/xfs.h
index b7d5ed4..a3dbdbc 100644
--- a/src/add-ons/kernel/file_systems/xfs/xfs.h
+++ b/src/add-ons/kernel/file_systems/xfs/xfs.h
@@ -27,6 +27,10 @@
#define BBLOCKLOG 9 /* Log of block size should be 9 */
#define BBLOCKSIZE 1 << BBLOCKLOG /* The size of a basic block
should be 512 */
+/* Converting the FS Blocks to Basic Blocks */
+#define FSBSHIFT(fsBlockLog) (fsBlockLog - BBLOCKLOG);
+#define FSB_TO_BB(fsBlockLog, x) x << FSBSHIFT(fsBlockLog);
+
/* Version 4 superblock definition */
class XfsSuperBlock
@@ -51,7 +55,7 @@
xfs_ino_t Root() const;
xfs_agnumber_t AgCount();
xfs_agblock_t AgBlocks();
-
+ uint8 Flags();
private:
uint32 sb_magicnum;
diff --git a/src/tests/add-ons/kernel/file_systems/xfs/xfs_shell/Jamfile
b/src/tests/add-ons/kernel/file_systems/xfs/xfs_shell/Jamfile
index 64b6177..c9fe209 100644
--- a/src/tests/add-ons/kernel/file_systems/xfs/xfs_shell/Jamfile
+++ b/src/tests/add-ons/kernel/file_systems/xfs/xfs_shell/Jamfile
@@ -39,8 +39,11 @@
UseHeaders [ FDirName $(HAIKU_TOP) src tools fs_shell ] ;
local xfsSource =
+ DeviceOpener.cpp
+ Directory.cpp
Inode.cpp
kernel_interface.cpp
+ ShortDirectory.cpp
Volume.cpp
xfs.cpp
;
--
To view, visit https://review.haiku-os.org/c/haiku/+/2915
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ic4b7b61a794a1b75849e45777a383b3315b15aa8
Gerrit-Change-Number: 2915
Gerrit-PatchSet: 1
Gerrit-Owner: Shubham Bhagat <shubhambhagat111@xxxxxxxxx>
Gerrit-MessageType: newchange