Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

*** empty log message ***

  • Loading branch information...
commit c9d768eb279c4c87ff01f8e0136db90f0ec3e527 1 parent 4943d1d
authored
30  README
@@ -4,11 +4,12 @@ How to use the Jungerl
4 4
 Simple! You just do 'make' to build all the erlang programs.
5 5
 
6 6
 If you want, you can add the bin/ directory to your $PATH, and use the
7  
-useful program(s) in there!
  7
+useful programs in there. One is 'jerl', a simple wrapper around 'erl'
  8
+that adds all the Jungerl applications to the code path.
8 9
 
9  
-If a program is giving you trouble, just put a file called SKIP in its
10  
-top-level directory. For example, if you want to skip the 'tuntap'
11  
-program, do:  touch lib/tuntap/SKIP
  10
+If a program is giving you trouble, just put an empty file called SKIP
  11
+in its top-level directory. For example, if you want to skip the
  12
+'tuntap' program, you can do: touch lib/tuntap/SKIP
12 13
 
13 14
 
14 15
 How to add an application to the Jungerl
@@ -17,16 +18,12 @@ How to add an application to the Jungerl
17 18
 Each application has its own directory called lib/<appname>.
18 19
 
19 20
 The absolute minimum requirement for an application is to have a
20  
-Makefile in the lib/<appname> directory with three targets:
  21
+Makefile in the lib/<appname> directory with two targets:
21 22
 
22 23
   'all' should build the program.
23 24
 
24 25
   'clean' should delete any object files.
25 26
 
26  
-  'conf' should do any necessary configuration. Most likely this is
27  
-  nothing, but it can be used for e.g. application-specific autoconf
28  
-  scripts.
29  
-
30 27
 Realistically, your lib/<appname>/ dir should also have any of these
31 28
 subdirectories that are appropriate:
32 29
 
@@ -40,13 +37,13 @@ subdirectories that are appropriate:
40 37
 
41 38
   doc/   (not sure what this is for..)
42 39
 
43  
-Once you have created your application, you should edit the top level
44  
-Makefile like this:
  40
+Once you have created your application, you should edit the 'lib/'
  41
+directory Makefile like this:
45 42
 
46 43
   Add your <appname> to the "LIBS" variable.
47 44
 
48  
-  If you depend on other applications, add a line that says so. For
49  
-  example <none yet..>.
  45
+  If you depend on other applications, add a line that says so. (These
  46
+  are down near the bottom.)
50 47
 
51 48
 
52 49
 Makefile Helpers
@@ -56,9 +53,8 @@ The support/ directory contains a couple of useful include files for
56 53
 your Makefiles:
57 54
 
58 55
   subdirs.mk: Intended for your lib/<appname>/ directory, this defines
59  
-  targets for 'all', 'clean', and 'config' that just cd into
60  
-  $(SUBDIRS) (by default c_src and src) and does the same "make" in
61  
-  each of them.
  56
+    targets for 'all' and 'clean' that just cd into $(SUBDIRS) (by
  57
+    default c_src and src) and does the same "make" in each of them.
62 58
 
63 59
   include.mk: This defines a bunch of useful things for building C and
64 60
     Erlang programs. For C it has 'configure'-detected CC and CFLAGS
@@ -73,5 +69,5 @@ your Makefiles:
73 69
     building ../ebin/*.beam from *.erl.
74 70
 
75 71
 That probably wasn't very clear, but if you look at how the 'tuntap'
76  
-program's Makefiles are done then it should be obvious.
  72
+program's Makefiles are done then it should be obvious!
77 73
 
2  lib/enfs/bin/run_procfs.sh
... ...
@@ -1,5 +1,5 @@
1 1
 #!/bin/sh
2 2
 basedir=$(dirname $0)
3  
-erl -pz ${basedir}/../ebin -pz ${basedir}/../rpc-ebin \
  3
+erl -pz ${basedir}/../ebin -pz ${basedir}/../../rpc/ebin \
4 4
     -s nfs_procfs start_link
5 5
 
19  lib/enfs/src/nfs_procfs.erl
@@ -8,13 +8,15 @@
8 8
 -module(nfs_procfs).
9 9
 -author('luke@bluetail.com').
10 10
 
11  
--export([start_link/0, root/0, getattr/1, lookup/2, dirlist/1, read/1]).
  11
+-export([start_link/0, root/0, getattr/1, lookup/2, dirlist/1, read/1,
  12
+	 statfs/1]).
12 13
 
13 14
 start_link() ->
14 15
     {ok, Pid} = nfs_server:start_link(),
15 16
     nfs_server:add_mountpoint("/procfs", ?MODULE),
16 17
     {ok, Pid}.
17 18
 
  19
+%% Returns: ID of root directory, any erlang term.
18 20
 root() ->
19 21
     root.
20 22
 
@@ -95,3 +97,18 @@ now_timestamp() ->
95 97
     {Mega, Sec, Micro} = now(),
96 98
     {((Mega * 1000000) + Sec) band 16#ffffffff, Micro}.
97 99
 
  100
+%% Callback: statfs(ID) -> {ok, {Tsize, Bsize, Blocks, Bfree, Bavail}} |
  101
+%%                         {error, Reason}
  102
+%% Return values:
  103
+%%       Tsize   The optimum transfer size of the server in bytes.  This is
  104
+%%               the number of bytes the server would like to have in the
  105
+%%               data part of READ and WRITE requests.
  106
+%%       Bsize   The block size in bytes of the filesystem.
  107
+%%       Blocks  The total number of "bsize" blocks on the filesystem.
  108
+%%       Bfree   The number of free "bsize" blocks on the filesystem.
  109
+%%       Bavail  The number of "bsize" blocks available to non-privileged
  110
+%%               users.
  111
+
  112
+statfs(_) ->
  113
+    {ok, {65535, 1024, 1024, 0, 0}}.	% pulled out of the air
  114
+
25  lib/enfs/src/nfs_server.erl
@@ -244,9 +244,31 @@ handle_call({nfsproc_read_2, {FH, Offset, Count, _}, C}, From, State) ->
244 244
 	end,
245 245
     {reply, R, State};
246 246
 
  247
+%% ----------------------------------------------------------------------
  248
+%% NFSPROC_READ
  249
+%% ----------------------------------------------------------------------
  250
+
  251
+handle_call({nfsproc_statfs_2, FH, C}, From, State) ->
  252
+    R = case fh2id(FH) of
  253
+	    {ok, ID} ->
  254
+		Mod = fh2mod(FH),
  255
+		case catch apply(Mod, statfs, [ID]) of
  256
+		    {ok, Res = {Tsize, Bsize, Blocks, Bfree, Bavail}} ->
  257
+			{'NFS_OK', Res};
  258
+		    {error, Reason} ->
  259
+			{error(Reason), void};
  260
+		    Other ->
  261
+			io:format("Bad return from ~p:statfs/1: ~p~n",
  262
+				  [Mod, Other])
  263
+		end;
  264
+	    error ->
  265
+		{'NFSERR_STALE', void}
  266
+	end,
  267
+    {reply, R, State};
  268
+
247 269
 handle_call(Request, From, State) ->
248 270
     io:format("Undefined callback: ~p~n", [Request]),
249  
-    Reply = ok,
  271
+    Reply = {error, nocallback},
250 272
     {reply, Reply, State}.
251 273
 
252 274
 handle_cast(Msg, State) ->
@@ -365,6 +387,7 @@ new_fsid(Mod) ->
365 387
     [{next_fsid, N}] = ets:lookup(?misc_tab, next_fsid),
366 388
     ets:update_counter(?misc_tab, next_fsid, 1),
367 389
     ets:insert(?fsid_mod_tab, {N, Mod}),
  390
+    ets:insert(?mod_fsid_tab, {Mod, N}),
368 391
     N.
369 392
 
370 393
 fsid2mod(FSID) ->
1  lib/ermacs/README
... ...
@@ -1,4 +1,3 @@
1  
-
2 1
 Ermacs: an erlang clone of emacs.
3 2
 =================================
4 3
 
8  lib/slang/README
... ...
@@ -1,4 +1,3 @@
1  
-
2 1
 This is slang, an erlang interface to the amazing highly portable tty 
3 2
 interface that gave us such nice tty applications as mutt and slrn
4 3
 
@@ -23,10 +22,5 @@ $ (cd config; ./configure)
23 22
 $ make
24 23
 
25 24
 
  25
+(By klacke@bluetail.com)
26 26
 
27  
-
28  
-
29  
-
30  
-
31  
-
32  
- 

0 notes on commit c9d768e

Please sign in to comment.
Something went wrong with that request. Please try again.