From c9d768eb279c4c87ff01f8e0136db90f0ec3e527 Mon Sep 17 00:00:00 2001 From: lukeg Date: Sat, 22 Feb 2003 00:30:40 +0000 Subject: [PATCH] *** empty log message *** --- README | 30 +++++++++++++----------------- lib/enfs/bin/run_procfs.sh | 2 +- lib/enfs/src/nfs_procfs.erl | 19 ++++++++++++++++++- lib/enfs/src/nfs_server.erl | 25 ++++++++++++++++++++++++- lib/ermacs/README | 1 - lib/slang/README | 8 +------- 6 files changed, 57 insertions(+), 28 deletions(-) diff --git a/README b/README index 5fec8c5..8a8f329 100644 --- a/README +++ b/README @@ -4,11 +4,12 @@ How to use the Jungerl Simple! You just do 'make' to build all the erlang programs. If you want, you can add the bin/ directory to your $PATH, and use the -useful program(s) in there! +useful programs in there. One is 'jerl', a simple wrapper around 'erl' +that adds all the Jungerl applications to the code path. -If a program is giving you trouble, just put a file called SKIP in its -top-level directory. For example, if you want to skip the 'tuntap' -program, do: touch lib/tuntap/SKIP +If a program is giving you trouble, just put an empty file called SKIP +in its top-level directory. For example, if you want to skip the +'tuntap' program, you can do: touch lib/tuntap/SKIP How to add an application to the Jungerl @@ -17,16 +18,12 @@ How to add an application to the Jungerl Each application has its own directory called lib/. The absolute minimum requirement for an application is to have a -Makefile in the lib/ directory with three targets: +Makefile in the lib/ directory with two targets: 'all' should build the program. 'clean' should delete any object files. - 'conf' should do any necessary configuration. Most likely this is - nothing, but it can be used for e.g. application-specific autoconf - scripts. - Realistically, your lib// dir should also have any of these subdirectories that are appropriate: @@ -40,13 +37,13 @@ subdirectories that are appropriate: doc/ (not sure what this is for..) -Once you have created your application, you should edit the top level -Makefile like this: +Once you have created your application, you should edit the 'lib/' +directory Makefile like this: Add your to the "LIBS" variable. - If you depend on other applications, add a line that says so. For - example . + If you depend on other applications, add a line that says so. (These + are down near the bottom.) Makefile Helpers @@ -56,9 +53,8 @@ The support/ directory contains a couple of useful include files for your Makefiles: subdirs.mk: Intended for your lib// directory, this defines - targets for 'all', 'clean', and 'config' that just cd into - $(SUBDIRS) (by default c_src and src) and does the same "make" in - each of them. + targets for 'all' and 'clean' that just cd into $(SUBDIRS) (by + default c_src and src) and does the same "make" in each of them. include.mk: This defines a bunch of useful things for building C and Erlang programs. For C it has 'configure'-detected CC and CFLAGS @@ -73,5 +69,5 @@ your Makefiles: building ../ebin/*.beam from *.erl. That probably wasn't very clear, but if you look at how the 'tuntap' -program's Makefiles are done then it should be obvious. +program's Makefiles are done then it should be obvious! diff --git a/lib/enfs/bin/run_procfs.sh b/lib/enfs/bin/run_procfs.sh index 4e63c98..ecaf3ca 100755 --- a/lib/enfs/bin/run_procfs.sh +++ b/lib/enfs/bin/run_procfs.sh @@ -1,5 +1,5 @@ #!/bin/sh basedir=$(dirname $0) -erl -pz ${basedir}/../ebin -pz ${basedir}/../rpc-ebin \ +erl -pz ${basedir}/../ebin -pz ${basedir}/../../rpc/ebin \ -s nfs_procfs start_link diff --git a/lib/enfs/src/nfs_procfs.erl b/lib/enfs/src/nfs_procfs.erl index 87387c2..c9d4edb 100644 --- a/lib/enfs/src/nfs_procfs.erl +++ b/lib/enfs/src/nfs_procfs.erl @@ -8,13 +8,15 @@ -module(nfs_procfs). -author('luke@bluetail.com'). --export([start_link/0, root/0, getattr/1, lookup/2, dirlist/1, read/1]). +-export([start_link/0, root/0, getattr/1, lookup/2, dirlist/1, read/1, + statfs/1]). start_link() -> {ok, Pid} = nfs_server:start_link(), nfs_server:add_mountpoint("/procfs", ?MODULE), {ok, Pid}. +%% Returns: ID of root directory, any erlang term. root() -> root. @@ -95,3 +97,18 @@ now_timestamp() -> {Mega, Sec, Micro} = now(), {((Mega * 1000000) + Sec) band 16#ffffffff, Micro}. +%% Callback: statfs(ID) -> {ok, {Tsize, Bsize, Blocks, Bfree, Bavail}} | +%% {error, Reason} +%% Return values: +%% Tsize The optimum transfer size of the server in bytes. This is +%% the number of bytes the server would like to have in the +%% data part of READ and WRITE requests. +%% Bsize The block size in bytes of the filesystem. +%% Blocks The total number of "bsize" blocks on the filesystem. +%% Bfree The number of free "bsize" blocks on the filesystem. +%% Bavail The number of "bsize" blocks available to non-privileged +%% users. + +statfs(_) -> + {ok, {65535, 1024, 1024, 0, 0}}. % pulled out of the air + diff --git a/lib/enfs/src/nfs_server.erl b/lib/enfs/src/nfs_server.erl index a803d7f..e387248 100644 --- a/lib/enfs/src/nfs_server.erl +++ b/lib/enfs/src/nfs_server.erl @@ -244,9 +244,31 @@ handle_call({nfsproc_read_2, {FH, Offset, Count, _}, C}, From, State) -> end, {reply, R, State}; +%% ---------------------------------------------------------------------- +%% NFSPROC_READ +%% ---------------------------------------------------------------------- + +handle_call({nfsproc_statfs_2, FH, C}, From, State) -> + R = case fh2id(FH) of + {ok, ID} -> + Mod = fh2mod(FH), + case catch apply(Mod, statfs, [ID]) of + {ok, Res = {Tsize, Bsize, Blocks, Bfree, Bavail}} -> + {'NFS_OK', Res}; + {error, Reason} -> + {error(Reason), void}; + Other -> + io:format("Bad return from ~p:statfs/1: ~p~n", + [Mod, Other]) + end; + error -> + {'NFSERR_STALE', void} + end, + {reply, R, State}; + handle_call(Request, From, State) -> io:format("Undefined callback: ~p~n", [Request]), - Reply = ok, + Reply = {error, nocallback}, {reply, Reply, State}. handle_cast(Msg, State) -> @@ -365,6 +387,7 @@ new_fsid(Mod) -> [{next_fsid, N}] = ets:lookup(?misc_tab, next_fsid), ets:update_counter(?misc_tab, next_fsid, 1), ets:insert(?fsid_mod_tab, {N, Mod}), + ets:insert(?mod_fsid_tab, {Mod, N}), N. fsid2mod(FSID) -> diff --git a/lib/ermacs/README b/lib/ermacs/README index 8ac758f..100c6dd 100644 --- a/lib/ermacs/README +++ b/lib/ermacs/README @@ -1,4 +1,3 @@ - Ermacs: an erlang clone of emacs. ================================= diff --git a/lib/slang/README b/lib/slang/README index 5752879..c4799c8 100644 --- a/lib/slang/README +++ b/lib/slang/README @@ -1,4 +1,3 @@ - This is slang, an erlang interface to the amazing highly portable tty interface that gave us such nice tty applications as mutt and slrn @@ -23,10 +22,5 @@ $ (cd config; ./configure) $ make +(By klacke@bluetail.com) - - - - - -