Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeg committed Feb 22, 2003
1 parent 4943d1d commit c9d768e
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
30 changes: 13 additions & 17 deletions README
Expand Up @@ -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
Expand All @@ -17,16 +18,12 @@ How to add an application to the Jungerl
Each application has its own directory called lib/<appname>.

The absolute minimum requirement for an application is to have a
Makefile in the lib/<appname> directory with three targets:
Makefile in the lib/<appname> 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/<appname>/ dir should also have any of these
subdirectories that are appropriate:

Expand All @@ -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 <appname> to the "LIBS" variable.

If you depend on other applications, add a line that says so. For
example <none yet..>.
If you depend on other applications, add a line that says so. (These
are down near the bottom.)


Makefile Helpers
Expand All @@ -56,9 +53,8 @@ The support/ directory contains a couple of useful include files for
your Makefiles:

subdirs.mk: Intended for your lib/<appname>/ 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
Expand All @@ -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!

2 changes: 1 addition & 1 deletion 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

19 changes: 18 additions & 1 deletion lib/enfs/src/nfs_procfs.erl
Expand Up @@ -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.

Expand Down Expand Up @@ -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

25 changes: 24 additions & 1 deletion lib/enfs/src/nfs_server.erl
Expand Up @@ -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) ->
Expand Down Expand Up @@ -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) ->
Expand Down
1 change: 0 additions & 1 deletion lib/ermacs/README
@@ -1,4 +1,3 @@

Ermacs: an erlang clone of emacs.
=================================

Expand Down
8 changes: 1 addition & 7 deletions 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

Expand All @@ -23,10 +22,5 @@ $ (cd config; ./configure)
$ make


(By klacke@bluetail.com)







0 comments on commit c9d768e

Please sign in to comment.