exfat & xfs: Adapt to use next_dirent and shared open_mode_to_access.
This commit is contained in:
parent
35b40030a7
commit
4133750ca3
@ -28,23 +28,6 @@ enum inode_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*! Converts the open mode, the open flags given to bfs_open(), into
|
|
||||||
access modes, e.g. since O_RDONLY requires read access to the
|
|
||||||
file, it will be converted to R_OK.
|
|
||||||
*/
|
|
||||||
inline int
|
|
||||||
open_mode_to_access(int openMode)
|
|
||||||
{
|
|
||||||
openMode &= O_RWMASK;
|
|
||||||
if (openMode == O_RDONLY)
|
|
||||||
return R_OK;
|
|
||||||
if (openMode == O_WRONLY)
|
|
||||||
return W_OK;
|
|
||||||
|
|
||||||
return R_OK | W_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*! Reads the volume name from an exfat entry and writes it to
|
/*! Reads the volume name from an exfat entry and writes it to
|
||||||
\a name as a UTF-8 char array.
|
\a name as a UTF-8 char array.
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
#include <StorageDefs.h>
|
#include <StorageDefs.h>
|
||||||
#include <util/AutoLock.h>
|
#include <util/AutoLock.h>
|
||||||
|
#include <file_systems/fs_ops_support.h>
|
||||||
|
|
||||||
#include "DirectoryIterator.h"
|
#include "DirectoryIterator.h"
|
||||||
#include "exfat.h"
|
#include "exfat.h"
|
||||||
@ -608,10 +609,8 @@ exfat_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
dirent->d_dev = volume->ID();
|
dirent->d_dev = volume->ID();
|
||||||
dirent->d_ino = id;
|
dirent->d_ino = id;
|
||||||
dirent->d_reclen = offsetof(struct dirent, d_name) + length + 1;
|
|
||||||
|
|
||||||
bufferSize -= dirent->d_reclen;
|
dirent = next_dirent(dirent, length, bufferSize);
|
||||||
dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de.
|
|
||||||
* Copyright 2020, Shubham Bhagat, shubhambhagat111@yahoo.com
|
|
||||||
* This file may be used under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef UTILITY_H
|
|
||||||
#define UTILITY_H
|
|
||||||
|
|
||||||
|
|
||||||
/*! Converts the open mode, the open flags given to xfs_open(), into
|
|
||||||
access modes, e.g. since O_RDONLY requires read access to the
|
|
||||||
file, it will be converted to R_OK.
|
|
||||||
*/
|
|
||||||
inline int
|
|
||||||
open_mode_to_access(int openMode)
|
|
||||||
{
|
|
||||||
openMode &= O_RWMASK;
|
|
||||||
if (openMode == O_RDONLY)
|
|
||||||
return R_OK;
|
|
||||||
if (openMode == O_WRONLY)
|
|
||||||
return W_OK;
|
|
||||||
|
|
||||||
return R_OK | W_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // UTILITY_H
|
|
@ -10,14 +10,14 @@
|
|||||||
#include "Inode.h"
|
#include "Inode.h"
|
||||||
#include "ShortAttribute.h"
|
#include "ShortAttribute.h"
|
||||||
#include "Symlink.h"
|
#include "Symlink.h"
|
||||||
#include "Utility.h"
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
|
#include <file_systems/fs_ops_support.h>
|
||||||
|
|
||||||
|
|
||||||
#define XFS_IO_SIZE 65536
|
#define XFS_IO_SIZE 65536
|
||||||
|
|
||||||
struct identify_cookie
|
struct identify_cookie {
|
||||||
{
|
|
||||||
/* super_block_struct super_block;
|
/* super_block_struct super_block;
|
||||||
* No structure yet implemented.
|
* No structure yet implemented.
|
||||||
*/
|
*/
|
||||||
@ -437,9 +437,8 @@ xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
buffer->d_dev = volume->ID();
|
buffer->d_dev = volume->ID();
|
||||||
buffer->d_ino = ino;
|
buffer->d_ino = ino;
|
||||||
buffer->d_reclen = offsetof(struct dirent, d_name) + length + 1;
|
|
||||||
bufferSize -= buffer->d_reclen;
|
buffer = next_dirent(buffer, length, bufferSize);
|
||||||
buffer = (struct dirent*)((uint8*)buffer + buffer->d_reclen);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user