this is a test commit for io debug

This commit is contained in:
FactorialN 2023-11-30 17:13:56 -08:00
parent 8a5f50574a
commit 73b2142d17
5 changed files with 18 additions and 85 deletions

View File

@ -1,6 +1,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <fs.hpp> #include <fs.hpp>
#include "fuse_common.h" #include <fuse.h>
#include "direntry.h" #include "direntry.h"
class FilesOperation { class FilesOperation {
@ -23,7 +23,7 @@ class FilesOperation {
int fischl_mkdir(const char*, mode_t); int fischl_mkdir(const char*, mode_t);
int fischl_mknod(const char*, mode_t, dev_t);//for special file int fischl_mknod(const char*, mode_t, dev_t);//for special file
int fischl_create(const char *, mode_t, struct fuse_file_info *);//for regular file int fischl_create(const char *, mode_t, struct fuse_file_info *);//for regular file
//int fischl_readdir(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags); int fischl_readdir(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags);
int fischl_unlink (const char *); int fischl_unlink (const char *);
int fischl_open (const char *, struct fuse_file_info *);//open file int fischl_open (const char *, struct fuse_file_info *);//open file
int fischl_release (const char *, struct fuse_file_info *);//close file int fischl_release (const char *, struct fuse_file_info *);//close file

View File

@ -1,82 +0,0 @@
#ifndef FUSE_COMMON_H_
#define FUSE_COMMON_H_
#include <stdint.h>
#include <sys/types.h>
/**
* Information about an open file.
*
* File Handles are created by the open, opendir, and create methods and closed
* by the release and releasedir methods. Multiple file handles may be
* concurrently open for the same file. Generally, a client will create one
* file handle per file descriptor, though in some cases multiple file
* descriptors can share a single file handle.
*/
struct fuse_file_info {
/** Open flags. Available in open() and release() */
int flags;
/** In case of a write operation indicates if this was caused
by a delayed write from the page cache. If so, then the
context's pid, uid, and gid fields will not be valid, and
the *fh* value may not match the *fh* value that would
have been sent with the corresponding individual write
requests if write caching had been disabled. */
unsigned int writepage : 1;
/** Can be filled in by open/create, to use direct I/O on this file. */
unsigned int direct_io : 1;
/** Can be filled in by open and opendir. It signals the kernel that any
currently cached data (ie., data that the filesystem provided the
last time the file/directory was open) need not be invalidated when
the file/directory is closed. */
unsigned int keep_cache : 1;
/** Can be filled by open/create, to allow parallel direct writes on this
* file */
unsigned int parallel_direct_writes : 1;
/** Indicates a flush operation. Set in flush operation, also
maybe set in highlevel lock operation and lowlevel release
operation. */
unsigned int flush : 1;
/** Can be filled in by open, to indicate that the file is not
seekable. */
unsigned int nonseekable : 1;
/* Indicates that flock locks for this file should be
released. If set, lock_owner shall contain a valid value.
May only be set in ->release(). */
unsigned int flock_release : 1;
/** Can be filled in by opendir. It signals the kernel to
enable caching of entries returned by readdir(). Has no
effect when set in other contexts (in particular it does
nothing when set by open()). */
unsigned int cache_readdir : 1;
/** Can be filled in by open, to indicate that flush is not needed
on close. */
unsigned int noflush : 1;
/** Padding. Reserved for future use*/
unsigned int padding : 23;
unsigned int padding2 : 32;
/** File handle id. May be filled in by filesystem in create,
* open, and opendir(). Available in most other file operations on the
* same file handle. */
uint64_t fh;
/** Lock owner id. Available in locking operations and flush */
uint64_t lock_owner;
/** Requested poll events. Available in ->poll. Only set on kernels
which support it. If unsupported, this field is set to zero. */
uint32_t poll_events;
};
#endif /* FUSE_COMMON_H_ */

View File

@ -1,4 +1,6 @@
//#include "fuse.h" add this when layer3 //#include "fuse.h" add this when layer3
#define FUSE_USE_VERSION 31
#include "files.h" #include "files.h"
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>

View File

@ -51,7 +51,6 @@ add_executable(${TARGET_DIR_API}
# Link Google Test to your test executables # Link Google Test to your test executables
target_link_libraries(${TARGET_LAYER0} gtest gtest_main) target_link_libraries(${TARGET_LAYER0} gtest gtest_main)
target_link_libraries(${TARGET_LAYER1_API} gtest gtest_main) target_link_libraries(${TARGET_LAYER1_API} gtest gtest_main)
target_link_libraries(${TARGET_LAYER2_API} gtest gtest_main)
target_link_libraries(${TARGET_DIR_API} gtest gtest_main) target_link_libraries(${TARGET_DIR_API} gtest gtest_main)
# add test to activate ctest -VV # add test to activate ctest -VV
@ -59,3 +58,15 @@ add_test(NAME ${TARGET_LAYER0} COMMAND sudo ./${TARGET_LAYER0} ${DIR_PLACE})
add_test(NAME ${TARGET_LAYER1_API} COMMAND sudo ./${TARGET_LAYER1_API} ${DIR_PLACE}) add_test(NAME ${TARGET_LAYER1_API} COMMAND sudo ./${TARGET_LAYER1_API} ${DIR_PLACE})
add_test(NAME ${TARGET_LAYER2_API} COMMAND sudo ./${TARGET_LAYER2_API} ${DIR_PLACE}) add_test(NAME ${TARGET_LAYER2_API} COMMAND sudo ./${TARGET_LAYER2_API} ${DIR_PLACE})
add_test(NAME ${TARGET_DIR_API} COMMAND sudo ./${TARGET_DIR_API} ${DIR_PLACE}) add_test(NAME ${TARGET_DIR_API} COMMAND sudo ./${TARGET_DIR_API} ${DIR_PLACE})
# Add the -Wall flag
target_compile_options(${TARGET_LAYER2_API} PRIVATE -Wall)
# Use pkg-config to get flags for fuse3
find_package(PkgConfig REQUIRED)
pkg_search_module(FUSE3 REQUIRED fuse3)
# Add the flags from pkg-config for fuse3
target_include_directories(${TARGET_LAYER2_API} PRIVATE ${FUSE3_INCLUDE_DIRS})
target_link_libraries(${TARGET_LAYER2_API} PRIVATE ${FUSE3_LIBRARIES} gtest gtest_main)

View File

@ -1,3 +1,5 @@
#define FUSE_USE_VERSION 31
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <assert.h> #include <assert.h>