refactor: module -> linux, src -> fuse

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-05-21 10:56:19 +02:00
parent 4691a463c3
commit 2d05773902
17 changed files with 898 additions and 59 deletions

View file

@ -1 +1,9 @@
SUBDIRS = lib src module SUBDIRS = lib
if BUILD_FUSE
SUBDIRS += fuse
endif
if BUILD_LINUX
SUBDIRS += linux
endif

View file

@ -4,14 +4,23 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_HOST
AC_LANG(C) AC_LANG(C)
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
AM_PROG_AR AM_PROG_AR
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_RANLIB
AM_PROG_CC_C_O AM_PROG_CC_C_O
PKG_CHECK_MODULES([FUSE], [fuse3]) AS_IF([ test "x$host_os" != "xmingw32" ], [
PKG_CHECK_MODULES([FUSE], [fuse3])
])
AM_CONDITIONAL(BUILD_FUSE, test "x$host_os" != "xmingw32")
AM_CONDITIONAL(BUILD_LINUX, test "x$host_os" = "xlinux")
AC_CHECK_INCLUDES_DEFAULT AC_CHECK_INCLUDES_DEFAULT
AC_C_CONST AC_C_CONST
@ -19,7 +28,7 @@ AC_C_INLINE
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
lib/Makefile lib/Makefile
module/Makefile linux/Makefile
src/Makefile]) fuse/Makefile])
AC_OUTPUT AC_OUTPUT

BIN
docs/book/fig/gfdl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

58
docs/book/main.tex Normal file
View file

@ -0,0 +1,58 @@
\documentclass[a4paper, 12pt, openright, english]{scrbook}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{ lmodern}
\usepackage[
pdftitle={StupidFS},
pdfauthor={\@author},
]{hyperref}
\date{\today}
\title{%
StupidFS Algorithm \& Data Structure \\
\large 1st Edition}
\author{d0p1}
\lowertitleback{Copyright \copyright{} 2022 d0p1
\medskip\\
\begin{tabular}{lp{.8\textwidth}}
\raisebox{-12pt}{\includegraphics[height=18pt]{fig/gfdl}} &
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. \\
\end{tabular}
}
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\chapter{Magic Numbers}
\begin{center}
\begin{tabular}{ |c|c|c|c| }
\hline
\textbf{Flag} & \textbf{Hexadecimal} & \textbf{ASCII} & \textbf{Data structure} \\
\hline
STPDFS\_SB\_MAGIC & 0x44505453 & STPD & TODO \\
\hline
\end{tabular}
\end{center}
\chapter{Structures}
\section{Superblocks}
\appendix
\end{document}

View file

@ -0,0 +1,2 @@
noinst_LIBRARIES = libstpdfs.a
libstpdfs_a_SOURCES = codec/base64.c

0
lib/codec/.dirstamp Normal file
View file

43
lib/codec/base64.c Normal file
View file

@ -0,0 +1,43 @@
#include <stddef.h>
#include <stdint.h>
static const char ALPHABET[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
size_t
base64_encode(char *dest, const char *src, size_t srclen)
{
size_t encodedlen;
size_t i, j;
uint8_t a, b, c;
uint32_t triple;
encodedlen = 4 * ((srclen + 2) / 3) + 4;
if (dest == NULL)
{
return (encodedlen);
}
for (i = 0, j = 0; i < srclen;)
{
a = (i < srclen ? src[i++] : 0);
b = (i < srclen ? src[i++] : 0);
c = (i < srclen ? src[i++] : 0);
triple = (a << 0x10) | (b << 0x08) | c;
dest[j++] = ALPHABET[(triple >> 3 * 6) & 0x3F];
dest[j++] = ALPHABET[(triple >> 2 * 6) & 0x3F];
dest[j++] = ALPHABET[(triple >> 1 * 6) & 0x3F];
dest[j++] = ALPHABET[(triple >> 0 * 6) & 0x3F];
}
if (srclen % 3 != 0)
{
dest[encodedlen - 1] = '=';
if (srclen % 3 == 1)
{
dest[encodedlen - 2] = '=';
}
}
return (encodedlen);
}

0
lib/compression/lzp.c Normal file
View file

0
lib/crypto/hchacha12.c Normal file
View file

57
lib/crypto/xchacha12.c Normal file
View file

@ -0,0 +1,57 @@
/*
; hash(h, x) (h = (h << 4) ^ x)
section '.code' code
; xor hash, hash
; xor mask, mask
; j = 1
; while (insz > 0)
; {
; if (ecx == 8)
; {
; mov [out], mask
; xor ecx, ecx
; xor mask, mask
; j = 1;
; }
; c = in[inpos++]
; if (c == table[hash])
; {
; mask |= 1 << ecx
; }
; else
; {
; table[hash] = c
; out[j] = c;
; }
; HASH(hash, c)
; ecx++;
; }
*/
#include <stdint.h>
#define LZP_HASH_ORDER 16
#define LZP_HASH_SIZE (1 << LZP_HASH_ORDER)
#define HASH(h, x) ((h << 4) ^ x)
void
lzp_compress()
{
uint32_t hash = 0;
uint32_t mask = 0;
char c;
uint8_t table[LZP_HASH_SIZE] = { 0 };
while (1)
{
hash = HASH(hash, c);
}
}
void
lzp_decompress()
{
}

View file

@ -1,11 +1,24 @@
#include <cstdint>
#ifndef STPDFS_H #ifndef STPDFS_H
# define STPDFS_H 1 # define STPDFS_H 1
# include <stdint.h> # include <stdint.h>
#define STPDFS_MAGIC 0x44505453 # define STPDFS_SB_MAGIC 0x44505453
#define STPDFS_BLOCK_SIZE 512 # define STPDFS_BLOCK_SIZE 512
# define STPDFS_LZP_COMPRESSION (1 << 0)
# define STPDFS_FILE_ENCRYPTION (1 << 1)
typedef uint32_t stpdfs_addr_t;
typedef uint32_t stpdfs_off_t;
typedef uint64_t stpdfs_time_t;
struct stpdfs_free {
uint32_t free[100];
uint8_t nfree;
} __attribute__((packed));
/** /**
* \brief StupidFS Superblock * \brief StupidFS Superblock
@ -22,4 +35,27 @@ struct stpdfs_sb {
uint32_t time[2]; uint32_t time[2];
} __attribute__((packed)); } __attribute__((packed));
/**
* \brief StupidFS I-node
*/
struct inode {
uint16_t mode;
uint8_t nlink;
uint8_t uid;
uint8_t gid;
uint32_t size;
uint16_t addr[8];
uint32_t actime[2];
uint32_t modtime[2];
} __attribute__((packed));
#define INODE_SIZE sizeof(struct inode)
struct file {
uint32_t inode;
char filename[32];
};
#endif /* !STPDFS_H */ #endif /* !STPDFS_H */

View file

@ -1,20 +1,20 @@
moduledir = @moduledir@ moduledir = @moduledir@
KBUILD_VERBOSE = 1 KBUILD_VERBOSE = 1
MOD_DEVDIR = $(PWD) MOD_DEVDIR = $(PWD)
export module_DATA export module_DATA
EXTRA_PROGRAMS = stpdfs_module EXTRA_PROGRAMS = stpdfs_module
stpdfs_module_SOURCES = module.c stpdfs_module_SOURCES = module.c
module_DATA = module.o module_DATA = module.o
$(module_DATA): $(stpdfs_module_SOURCES) $(module_DATA): $(stpdfs_module_SOURCES)
mv Makefile Makefile.automake mv Makefile Makefile.automake
cp $(srcdir)/../Makefile.kernel Makefile cp $(srcdir)/../Makefile.kernel Makefile
CPPFLAGS="" CFLAGS="" LDFLAGS="" \ CPPFLAGS="" CFLAGS="" LDFLAGS="" \
$(MAKE) -C /lib/modules/$(shell uname -r)/build \ $(MAKE) -C /lib/modules/$(shell uname -r)/build \
ARCH="x86" CC="gcc" M=$(PWD) modules\ ARCH="x86" CC="gcc" M=$(PWD) modules\
KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_VERBOSE=$(KBUILD_VERBOSE)
mv Makefile.automake Makefile mv Makefile.automake Makefile
CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@) CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@)

610
linux/Makefile.automake Normal file
View file

@ -0,0 +1,610 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# linux/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/stupidfs
pkgincludedir = $(includedir)/stupidfs
pkglibdir = $(libdir)/stupidfs
pkglibexecdir = $(libexecdir)/stupidfs
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-w64-mingw32
host_triplet = x86_64-w64-mingw32
EXTRA_PROGRAMS = stpdfs_module$(EXEEXT)
subdir = linux
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am_stpdfs_module_OBJECTS = module.$(OBJEXT)
stpdfs_module_OBJECTS = $(am_stpdfs_module_OBJECTS)
stpdfs_module_LDADD = $(LDADD)
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/module.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(stpdfs_module_SOURCES)
DIST_SOURCES = $(stpdfs_module_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(moduledir)"
DATA = $(module_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} '/c/Users/conta/Workspace/StupidFS/missing' aclocal-1.16
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 1
AR = ar
AUTOCONF = ${SHELL} '/c/Users/conta/Workspace/StupidFS/missing' autoconf
AUTOHEADER = ${SHELL} '/c/Users/conta/Workspace/StupidFS/missing' autoheader
AUTOMAKE = ${SHELL} '/c/Users/conta/Workspace/StupidFS/missing' automake-1.16
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CSCOPE = cscope
CTAGS = ctags
CYGPATH_W = cygpath -w
DEFS = -DPACKAGE_NAME=\"StupidFS\" -DPACKAGE_TARNAME=\"stupidfs\" -DPACKAGE_VERSION=\"0.0\" -DPACKAGE_STRING=\"StupidFS\ 0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"stupidfs\" -DVERSION=\"0.0\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1
DEPDIR = .deps
ECHO_C =
ECHO_N = -n
ECHO_T =
ETAGS = etags
EXEEXT = .exe
FUSE_CFLAGS =
FUSE_LIBS =
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS =
LIBOBJS =
LIBS =
LTLIBOBJS =
MAKEINFO = ${SHELL} '/c/Users/conta/Workspace/StupidFS/missing' makeinfo
MKDIR_P = /usr/bin/mkdir -p
OBJEXT = o
PACKAGE = stupidfs
PACKAGE_BUGREPORT =
PACKAGE_NAME = StupidFS
PACKAGE_STRING = StupidFS 0.0
PACKAGE_TARNAME = stupidfs
PACKAGE_URL =
PACKAGE_VERSION = 0.0
PATH_SEPARATOR = :
PKG_CONFIG = /ucrt64/bin/pkg-config
PKG_CONFIG_LIBDIR =
PKG_CONFIG_PATH = /ucrt64/lib/pkgconfig:/ucrt64/share/pkgconfig
RANLIB = ranlib
SET_MAKE =
SHELL = /bin/sh
STRIP =
VERSION = 0.0
abs_builddir = /c/Users/conta/Workspace/StupidFS/linux
abs_srcdir = /c/Users/conta/Workspace/StupidFS/linux
abs_top_builddir = /c/Users/conta/Workspace/StupidFS
abs_top_srcdir = /c/Users/conta/Workspace/StupidFS
ac_ct_AR = ar
ac_ct_CC = gcc
am__include = include
am__leading_dot = .
am__quote =
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-w64-mingw32
build_alias = x86_64-w64-mingw32
build_cpu = x86_64
build_os = mingw32
build_vendor = w64
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-w64-mingw32
host_alias =
host_cpu = x86_64
host_os = mingw32
host_vendor = w64
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /c/Users/conta/Workspace/StupidFS/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /ucrt64
program_transform_name = s,x,x,
psdir = ${docdir}
runstatedir = ${localstatedir}/run
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
moduledir = @moduledir@
KBUILD_VERBOSE = 1
MOD_DEVDIR = $(PWD)
stpdfs_module_SOURCES = module.c
module_DATA = module.o
CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign linux/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign linux/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
stpdfs_module$(EXEEXT): $(stpdfs_module_OBJECTS) $(stpdfs_module_DEPENDENCIES) $(EXTRA_stpdfs_module_DEPENDENCIES)
@rm -f stpdfs_module$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stpdfs_module_OBJECTS) $(stpdfs_module_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
include ./$(DEPDIR)/module.Po # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
$(am__mv) $$depbase.Tpo $$depbase.Po
# $(AM_V_CC)source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(COMPILE) -c -o $@ $<
.c.obj:
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
$(am__mv) $$depbase.Tpo $$depbase.Po
# $(AM_V_CC)source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
install-moduleDATA: $(module_DATA)
@$(NORMAL_INSTALL)
@list='$(module_DATA)'; test -n "$(moduledir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \
$(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(moduledir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(moduledir)" || exit $$?; \
done
uninstall-moduleDATA:
@$(NORMAL_UNINSTALL)
@list='$(module_DATA)'; test -n "$(moduledir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(moduledir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(moduledir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/module.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-moduleDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/module.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-moduleDATA
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-moduleDATA \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-moduleDATA
.PRECIOUS: Makefile
export module_DATA
$(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
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,35 +1,35 @@
/** /**
* \addtogroup driver * \addtogroup driver
* @{ * @{
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
/** /**
* \defgroup linux Linux Kernel Module * \defgroup linux Linux Kernel Module
* @{ * @{
*/ */
static int __init static int __init
stpdfs_mod_init(void) stpdfs_mod_init(void)
{ {
printk("Hello, world!\n"); printk("Hello, world!\n");
return 0; return 0;
} }
module_init(stpdfs_mod_init); module_init(stpdfs_mod_init);
static void __exit static void __exit
stpdfs_mod_exit(void) stpdfs_mod_exit(void)
{ {
printk("Goodbye, world!\n"); printk("Goodbye, world!\n");
} }
module_exit(stpdfs_mod_exit); module_exit(stpdfs_mod_exit);
MODULE_LICENSE("CECILL-B or BSD3"); MODULE_LICENSE("CECILL-B or BSD3");
MODULE_AUTHOR("d0p1"); MODULE_AUTHOR("d0p1");
MODULE_DESCRIPTION("Stupid File System"); MODULE_DESCRIPTION("Stupid File System");
MODULE_VERSION("1.0"); MODULE_VERSION("1.0");
/** @} @} */ /** @} @} */

16
mkfs/main.c Normal file
View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
static const char *prg_name;
void
usage(int retval)
{
}
int
main(void)
{
return (EXIT_SUCCESS);
}