chore: first commit
This commit is contained in:
		
						commit
						5381313b02
					
				
					 12 changed files with 190 additions and 0 deletions
				
			
		
							
								
								
									
										27
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
*.in
 | 
			
		||||
*.o
 | 
			
		||||
Makefile
 | 
			
		||||
*~
 | 
			
		||||
config.h
 | 
			
		||||
*.log
 | 
			
		||||
*.status
 | 
			
		||||
stamp-h1
 | 
			
		||||
*.cache
 | 
			
		||||
.deps
 | 
			
		||||
configure
 | 
			
		||||
depcomp
 | 
			
		||||
install-sh
 | 
			
		||||
missing
 | 
			
		||||
ar-lib
 | 
			
		||||
compile
 | 
			
		||||
aclocal.m4
 | 
			
		||||
*.a
 | 
			
		||||
*.exe
 | 
			
		||||
src/stpdfs-fuse
 | 
			
		||||
 | 
			
		||||
*.cmd
 | 
			
		||||
*.symvers
 | 
			
		||||
*.ko
 | 
			
		||||
*.mod
 | 
			
		||||
*.mod.*
 | 
			
		||||
*.order
 | 
			
		||||
							
								
								
									
										1
									
								
								Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Makefile.am
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
SUBDIRS = lib src module
 | 
			
		||||
							
								
								
									
										6
									
								
								Makefile.kernel
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Makefile.kernel
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
obj-m=$(module_DATA)
 | 
			
		||||
MI_OBJS      = $(module_DATA)
 | 
			
		||||
 | 
			
		||||
all clean:
 | 
			
		||||
	mv Makefile.automake Makefile
 | 
			
		||||
	$(MAKE) $@
 | 
			
		||||
							
								
								
									
										25
									
								
								configure.ac
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								configure.ac
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
AC_INIT([StupidFS], [0.0])
 | 
			
		||||
 | 
			
		||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
 | 
			
		||||
 | 
			
		||||
AC_CONFIG_MACRO_DIRS([m4])
 | 
			
		||||
 | 
			
		||||
AC_LANG(C)
 | 
			
		||||
AC_PROG_CC
 | 
			
		||||
AC_PROG_CPP
 | 
			
		||||
AM_PROG_AR
 | 
			
		||||
AC_PROG_INSTALL
 | 
			
		||||
AM_PROG_CC_C_O
 | 
			
		||||
 | 
			
		||||
PKG_CHECK_MODULES([FUSE], [fuse3])
 | 
			
		||||
 | 
			
		||||
AC_CHECK_INCLUDES_DEFAULT
 | 
			
		||||
AC_C_CONST
 | 
			
		||||
AC_C_INLINE
 | 
			
		||||
 | 
			
		||||
AC_CONFIG_FILES([Makefile
 | 
			
		||||
				lib/Makefile
 | 
			
		||||
				module/Makefile
 | 
			
		||||
				src/Makefile])
 | 
			
		||||
 | 
			
		||||
AC_OUTPUT
 | 
			
		||||
							
								
								
									
										0
									
								
								lib/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								lib/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										20
									
								
								lib/stpdfs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								lib/stpdfs.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#ifndef STPDFS_H
 | 
			
		||||
# define STPDFS_H 1
 | 
			
		||||
 | 
			
		||||
#define STPDFS_MAGIC 0x44505453
 | 
			
		||||
 | 
			
		||||
#define STPDFS_BLOCK_SIZE 512
 | 
			
		||||
 | 
			
		||||
struct stpdfs_superblock {
 | 
			
		||||
	uint32_t magic;
 | 
			
		||||
	uint32_t isize;
 | 
			
		||||
	uint32_t fsize;
 | 
			
		||||
	uint32_t free[100];
 | 
			
		||||
	uint8_t nfree;
 | 
			
		||||
	uint8_t flock;
 | 
			
		||||
	uint8_t ilock;
 | 
			
		||||
	uint8_t fmod;
 | 
			
		||||
	uint32_t time[2];
 | 
			
		||||
} __attribute__((packed));
 | 
			
		||||
 | 
			
		||||
#endif /* !STPDFS_H */
 | 
			
		||||
							
								
								
									
										20
									
								
								module/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								module/Makefile.am
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
moduledir = @moduledir@
 | 
			
		||||
KBUILD_VERBOSE = 1
 | 
			
		||||
MOD_DEVDIR = $(PWD)
 | 
			
		||||
 | 
			
		||||
export module_DATA
 | 
			
		||||
 | 
			
		||||
EXTRA_PROGRAMS = stpdfs_module
 | 
			
		||||
stpdfs_module_SOURCES = module_stpdfs.c 
 | 
			
		||||
module_DATA = module_stpdfs.o 
 | 
			
		||||
 | 
			
		||||
$(module_DATA): $(stpdfs_module_SOURCES) 
 | 
			
		||||
	mv Makefile Makefile.automake 
 | 
			
		||||
	cp $(srcdir)/../Makefile.kernel Makefile 
 | 
			
		||||
	CPPFLAGS="" CFLAGS="" LDFLAGS="" \
 | 
			
		||||
	$(MAKE) -C /lib/modules/$(shell uname -r)/build \
 | 
			
		||||
        ARCH="x86" CC="gcc" M=$(PWD) modules\
 | 
			
		||||
		KBUILD_VERBOSE=$(KBUILD_VERBOSE) 
 | 
			
		||||
	mv Makefile.automake Makefile 
 | 
			
		||||
 | 
			
		||||
CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@)
 | 
			
		||||
							
								
								
									
										24
									
								
								module/module_stpdfs.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								module/module_stpdfs.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
#include <linux/init.h>
 | 
			
		||||
#include <linux/module.h>
 | 
			
		||||
 | 
			
		||||
static int __init
 | 
			
		||||
stpdfs_mod_init(void)
 | 
			
		||||
{
 | 
			
		||||
	printk("Hello, world!\n");
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module_init(stpdfs_mod_init);
 | 
			
		||||
 | 
			
		||||
static void __exit
 | 
			
		||||
stpdfs_mod_exit(void)
 | 
			
		||||
{
 | 
			
		||||
	printk("Goodbye, world!\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module_exit(stpdfs_mod_exit);
 | 
			
		||||
 | 
			
		||||
MODULE_LICENSE("BSD3");
 | 
			
		||||
MODULE_AUTHOR("d0p1");
 | 
			
		||||
MODULE_DESCRIPTION("Stupid File System");
 | 
			
		||||
MODULE_VERSION("1.0");
 | 
			
		||||
							
								
								
									
										6
									
								
								src/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/Makefile.am
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
AM_CFLAGS = $(FUSE_CFLAGS)
 | 
			
		||||
LDADD = $(FUSE_LIBS)
 | 
			
		||||
 | 
			
		||||
bin_PROGRAMS = stpdfs-fuse
 | 
			
		||||
 | 
			
		||||
stpdfs_fuse_SOURCES = main.c
 | 
			
		||||
							
								
								
									
										61
									
								
								src/main.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/main.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#define FUSE_USE_VERSION 31
 | 
			
		||||
#include <fuse.h>
 | 
			
		||||
 | 
			
		||||
static void *
 | 
			
		||||
stpdfs_init(struct fuse_conn_info *conn,
 | 
			
		||||
			struct fuse_config *config)
 | 
			
		||||
{
 | 
			
		||||
	(void)conn;
 | 
			
		||||
 | 
			
		||||
	return (NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
stpdfs_getattr(const char *path, struct stat *stbuf,
 | 
			
		||||
				struct fuse_file_info *fi)
 | 
			
		||||
{
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
stpdfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
 | 
			
		||||
				off_t offset, struct fuse_file_info *fi,
 | 
			
		||||
				enum fuse_readdir_flags flags)
 | 
			
		||||
{
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
stpdfs_open(const char *path, struct fuse_file_info *fi)
 | 
			
		||||
{
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
stpdfs_read(const char *path, char *buf, size_t size, off_t offset,
 | 
			
		||||
			struct fuse_file_info *fi)
 | 
			
		||||
{
 | 
			
		||||
	return (size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct fuse_operations stpdfs_oper = {
 | 
			
		||||
	.init  = stpdfs_init,
 | 
			
		||||
	.getattr = stpdfs_getattr,
 | 
			
		||||
	.readdir = stpdfs_readdir,
 | 
			
		||||
	.open = stpdfs_open,
 | 
			
		||||
	.read = stpdfs_read
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
 | 
			
		||||
 | 
			
		||||
	ret = fuse_main(args.argc, args.argv, &stpdfs_oper, NULL);
 | 
			
		||||
	fuse_opt_free_args(&args);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										0
									
								
								win32/stpdfs.rc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								win32/stpdfs.rc
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								win32/stpdinit.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								win32/stpdinit.c
									
										
									
									
									
										Normal file
									
								
							
		Loading…
	
	Add table
		
		Reference in a new issue