[xiph-commits] r12316 - in trunk/fusd: . doc examples include kfusd libfusd

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sat Jan 13 01:30:17 PST 2007


Author: xiphmont
Date: 2007-01-13 01:30:10 -0800 (Sat, 13 Jan 2007)
New Revision: 12316

Removed:
   trunk/fusd/doc/make-examples.pl
   trunk/fusd/make.include
Modified:
   trunk/fusd/doc/Makefile
   trunk/fusd/examples/Makefile
   trunk/fusd/examples/console-read.c
   trunk/fusd/examples/drums.c
   trunk/fusd/examples/drums2.c
   trunk/fusd/examples/drums3.c
   trunk/fusd/examples/echo.c
   trunk/fusd/examples/helloworld.c
   trunk/fusd/examples/ioctl.c
   trunk/fusd/examples/logring.c
   trunk/fusd/examples/pager.c
   trunk/fusd/examples/uid-filter.c
   trunk/fusd/include/fusd.h
   trunk/fusd/include/fusd_msg.h
   trunk/fusd/include/kfusd.h
   trunk/fusd/kfusd/kfusd.c
   trunk/fusd/libfusd/libfusd.c
Log:
Sufficiently updated docs, build system and a few of the examples for
an initial release.

Primary remaining problem: udev-style kernels don't allow registration of a
preexisting class right now.  This will need to be fixed semi-immediately.



Modified: trunk/fusd/doc/Makefile
===================================================================
--- trunk/fusd/doc/Makefile	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/doc/Makefile	2007-01-13 09:30:10 UTC (rev 12316)
@@ -1,13 +1,10 @@
 default: docs
 
 clean:
-	@rm -f *.[ch].example
+	rm -f *.[ch].example
+	rm -f fusd.dvi
 
-examples:
-	@rm -f *.[ch].example
-	@./make-examples.pl ../examples/*.[ch]
-
-docs: examples
+docs:
 	latex fusd
 	latex fusd
 

Deleted: trunk/fusd/doc/make-examples.pl
===================================================================
--- trunk/fusd/doc/make-examples.pl	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/doc/make-examples.pl	2007-01-13 09:30:10 UTC (rev 12316)
@@ -1,50 +0,0 @@
-#!/usr/bin/perl -w
-
-
-foreach $path (@ARGV) {
-    $writing = 0;
-
-    if (!open(IN, $path)) {
-	print "trying to open $path: $!\n";
-	next;
-    }
-
-    while ($line = <IN>) {
-	if ($line =~ /EXAMPLE (\w*) ([\w\-\.]*)/) {
-	    $command = $1;
-	    $filename = $2 . ".example";
-
-	    if ($command eq 'START') {
-		if ($writing == 0) {
-		    if (!open(OUT, ">>$filename")) {
-			print "trying to write to $filename: $!\n";
-		    } else {
-			print "$path: writing to $filename\n";
-			$writing = 1;
-		    }
-		} else {
-		    print "$path: got $line while already writing!\n";
-		}
-	    }
-
-	    if ($command eq 'STOP') {
-		if ($writing == 1) {
-		    close(OUT);
-		    $writing = 0;
-		} else {
-		    chomp($line);
-		    die "$path line $.: got $line when not writing!\n";
-		}
-	    }
-	} else {
-	    if ($writing && $line !~ /SKIPLINE/) {
-		print OUT $line;
-	    }
-	}
-    }
-    if ($writing) {
-	close(OUT);
-    }
-    close(IN);
-}
-

Modified: trunk/fusd/examples/Makefile
===================================================================
--- trunk/fusd/examples/Makefile	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/Makefile	2007-01-13 09:30:10 UTC (rev 12316)
@@ -2,9 +2,17 @@
 	drums2.c drums.c ioctl.c uid-filter.c
 OBJ  = console-read.o drums3.o echo.o helloworld.o logring.o pager.o\
 	drums2.o drums.o ioctl.o uid-filter.o
-TARGETS = console-read drums3 echo helloworld logring pager\
-	drums2 drums ioctl uid-filter
+TARGETS = helloworld
 
+# right now, several examples do not work properly; the current
+# version of fusd is unable to add new devices to a preexisting class
+# (unless the device calsss is 'sound') and for that reason, examples
+# that register multiple devices build but do not run properly.  Will
+# be fixed soon (requires a minor kernel extension).
+
+#TARGETS = console-read drums3 echo helloworld logring pager\
+#	drums2 drums ioctl uid-filter
+
 default: $(TARGETS)
 
 install: $(TARGETS)

Modified: trunk/fusd/examples/console-read.c
===================================================================
--- trunk/fusd/examples/console-read.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/console-read.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -40,7 +40,7 @@
  * need a template from which to start on a real driver, use pager.c
  * instead.
  *
- * $Id: console-read.c,v 1.4 2003/07/11 22:29:38 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>
@@ -57,7 +57,7 @@
 }
 
 /* EXAMPLE START console-read.c */
-int do_read(struct fusd_file_info *file, char *user_buffer, 
+ssize_t do_read(struct fusd_file_info *file, char *user_buffer, 
 	    size_t user_length, loff_t *offset)
 {
   char buf[128];
@@ -88,7 +88,7 @@
     read: do_read,
     close: do_open_or_close };
   
-  if (fusd_register("/dev/console-read", "misc", "console-read", 0666, NULL, &fops) < 0)
+  if (fusd_register("/dev/console-read", "test", "console-read", 0666, NULL, &fops) < 0)
     perror("Unable to register device");
   else {
     printf("/dev/console-read should now exist - calling fusd_run...\n");


Property changes on: trunk/fusd/examples/console-read.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/drums.c
===================================================================
--- trunk/fusd/examples/drums.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/drums.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -42,7 +42,7 @@
  * directory: /dev/drums/bam, /dev/drums/bum, etc.  If you cat one of
  * these devices, it returns a string that's the same as its name.
  *
- * $Id: drums.c,v 1.4 2003/07/11 22:29:38 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>


Property changes on: trunk/fusd/examples/drums.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/drums2.c
===================================================================
--- trunk/fusd/examples/drums2.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/drums2.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -47,7 +47,7 @@
  * to remember if this user has read before; cat /dev/drums/X will
  * read infinitely
  *
- * $Id: drums2.c,v 1.6 2003/07/11 22:29:38 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>


Property changes on: trunk/fusd/examples/drums2.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/drums3.c
===================================================================
--- trunk/fusd/examples/drums3.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/drums3.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -43,7 +43,7 @@
  * However, it also prints a prompt to the console, asking the user if
  * how loud the drums should be.
  *
- * $Id: drums3.c,v 1.3 2003/07/11 22:29:38 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>
@@ -63,7 +63,7 @@
 
 int volume = 2; /* default volume is 2 */
 
-int drums_read(struct fusd_file_info *file, char *user_buffer,
+ssize_t drums_read(struct fusd_file_info *file, char *user_buffer,
 	       size_t user_length, loff_t *offset)
 {
   int len;


Property changes on: trunk/fusd/examples/drums3.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/echo.c
===================================================================
--- trunk/fusd/examples/echo.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/echo.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -41,7 +41,7 @@
  * stored.  Then, when you read (e.g. "cat /dev/echo"), you get back
  * whatever you wrote most recently.
  *
- * $Id: echo.c,v 1.6 2003/07/11 22:29:38 cerpa Exp $ 
+ * $Id$ 
  */
 
 #include <stdio.h>
@@ -58,7 +58,7 @@
 char *data = NULL;
 int data_length = 0;
 
-int echo_read(struct fusd_file_info *file, char *user_buffer,
+ssize_t echo_read(struct fusd_file_info *file, char *user_buffer,
 	      size_t user_length, loff_t *offset)
 {
   /* if the user has read past the end of the data, return EOF */


Property changes on: trunk/fusd/examples/echo.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/helloworld.c
===================================================================
--- trunk/fusd/examples/helloworld.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/helloworld.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -37,7 +37,7 @@
  * hello-world: Simply creates a device called /dev/hello-world, which
  * greets you when you try to get it.
  *
- * $Id: helloworld.c,v 1.11 2003/07/11 22:29:38 cerpa Exp $
+ * $Id$
  */
 
 /* EXAMPLE START helloworld.c */


Property changes on: trunk/fusd/examples/helloworld.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/ioctl.c
===================================================================
--- trunk/fusd/examples/ioctl.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/ioctl.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -41,7 +41,7 @@
  * the other examples, anyway), because this program is both an
  * example and part of the regression test suite.
  *
- * $Id: ioctl.c,v 1.4 2003/07/11 22:29:39 cerpa Exp $ 
+ * $Id$ 
  */
 
 #include <stdio.h>
@@ -115,8 +115,9 @@
 
   case IOCTL_TEST1:
   case IOCTL_TEST2:
-    printf("ioctl server: got test1/2, arg=%d, returning it\n", (int) arg);
-    return (int) arg;
+    printf("ioctl server: got test1/2, arg=%p, *arg= %d, returning it\n", 
+	   arg, *(int *)arg);
+    return *(int *) arg;
     break;
 
 /* EXAMPLE START ioctl-server.c */
@@ -185,7 +186,8 @@
     /* ioctl server */
     struct fusd_file_operations f = { open: zeroreturn, close: zeroreturn,
 				      ioctl: do_ioctl};
-    if (fusd_register("ioctltest", 0666, NULL, &f) < 0)
+    if (fusd_register("/dev/ioctltest", "misc", "ioctltest", 
+		      0666, NULL, &f) < 0)
       perror("registering ioctltest");
     printf("server starting\n");
     fusd_run();
@@ -216,18 +218,24 @@
     CHECK(ret == 0);
 
     /* test1: issue a command with a simple (integer) argument */
-    ret = ioctl(fd, IOCTL_TEST1, TEST1_NUM);
-    CHECK(ret == TEST1_NUM);
-    CHECK(errno == 0);
-    printf("ioctl test1: got %d, errno=%d (expecting %d, errno=0)\n\n",
-	   ret, errno, TEST1_NUM);
+    {
+      int arg = TEST1_NUM;
+      ret = ioctl(fd, IOCTL_TEST1, &arg);
+      CHECK(ret == TEST1_NUM);
+      CHECK(errno == 0);
+      printf("ioctl test1: got %d, errno=%d (expecting %d, errno=0)\n\n",
+	     ret, errno, TEST1_NUM);
+    }
 
     /* test2 again: make sure errno is set properly */
-    ret = ioctl(fd, IOCTL_TEST2, -ELIBBAD);
-    CHECK(errno == ELIBBAD);
-    CHECK(ret == -1);
-    printf("ioctl test2: got %d, errno=%d (expecting -1, errno=%d)\n\n",
-	   ret, errno, ELIBBAD);
+    {
+      int arg = -ELIBBAD;
+      ret = ioctl(fd, IOCTL_TEST2, &arg);
+      CHECK(errno == ELIBBAD);
+      CHECK(ret == -1);
+      printf("ioctl test2: got %d, errno=%d (expecting -1, errno=%d)\n\n",
+	     ret, errno, ELIBBAD);
+    }
 
     printf("ioctl test3: expecting retval 0, string This Is Test3\n");
 /* EXAMPLE START ioctl-client.c */


Property changes on: trunk/fusd/examples/ioctl.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/logring.c
===================================================================
--- trunk/fusd/examples/logring.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/logring.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -71,7 +71,7 @@
  * but want to use it on a system that does not have FUSD, check out
  * emlog at http://www.circlemud.org/~jelson/software/emlog.
  *
- * $Id: logring.c,v 1.8 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>
@@ -340,7 +340,7 @@
  * may come from the kernel before the driver has returned the first
  * one; if this happens, use fusd_destroy() to get rid of the older one.
  */
-ssize_t logring_polldiff(struct fusd_file_info *file, unsigned int flags)
+int logring_polldiff(struct fusd_file_info *file, unsigned int flags)
 {
   struct logring_client *c = (struct logring_client *) file->private_data;
 


Property changes on: trunk/fusd/examples/logring.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/pager.c
===================================================================
--- trunk/fusd/examples/pager.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/pager.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -60,7 +60,7 @@
  * If you close the FD and then reopen it, there will be a race (pages
  * that arrive between the close and open will not be delivered).
  *
- * $Id: pager.c,v 1.9 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>


Property changes on: trunk/fusd/examples/pager.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/examples/uid-filter.c
===================================================================
--- trunk/fusd/examples/uid-filter.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/examples/uid-filter.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -42,7 +42,7 @@
  * not be read by anyone other than the driver owner (not even root!).
  * When you read from the device, it returns your PID to you.
  *
- * $Id: uid-filter.c,v 1.4 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
 #include <stdio.h>
@@ -71,7 +71,7 @@
   return 0;
 }
 
-int do_read(struct fusd_file_info *file, char *user_buffer,
+ssize_t do_read(struct fusd_file_info *file, char *user_buffer,
 	    size_t user_length, loff_t *offset)
 {
   char buf[128];


Property changes on: trunk/fusd/examples/uid-filter.c
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/fusd/include/fusd.h
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/fusd/include/fusd_msg.h
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/include/kfusd.h
===================================================================
--- trunk/fusd/include/kfusd.h	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/include/kfusd.h	2007-01-13 09:30:10 UTC (rev 12316)
@@ -37,7 +37,7 @@
  *
  * Private header file used by the Linux Kernel Module
  *
- * $Id: kfusd.h,v 1.41 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
 #ifndef __KFUSD_H__


Property changes on: trunk/fusd/include/kfusd.h
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/kfusd/kfusd.c
===================================================================
--- trunk/fusd/kfusd/kfusd.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/kfusd/kfusd.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -38,7 +38,7 @@
  * Copyright (c) 2001, Sensoria Corporation
  * Copyright (c) 2002-2003, Regents of the University of California
  *
- * $Id: kfusd.c,v 1.97 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
 /*


Property changes on: trunk/fusd/kfusd/kfusd.c
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/fusd/libfusd/libfusd.c
===================================================================
--- trunk/fusd/libfusd/libfusd.c	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/libfusd/libfusd.c	2007-01-13 09:30:10 UTC (rev 12316)
@@ -35,10 +35,10 @@
  *
  * authors: jelson and girod
  *
- * $Id: libfusd.c,v 1.61 2003/07/11 22:29:39 cerpa Exp $
+ * $Id$
  */
 
-char libfusd_c_id[] = "$Id: libfusd.c,v 1.61 2003/07/11 22:29:39 cerpa Exp $";
+char libfusd_c_id[] = "$Id$";
 
 #include <stdio.h>
 #include <stdlib.h>


Property changes on: trunk/fusd/libfusd/libfusd.c
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: trunk/fusd/make.include
===================================================================
--- trunk/fusd/make.include	2007-01-13 09:00:28 UTC (rev 12315)
+++ trunk/fusd/make.include	2007-01-13 09:30:10 UTC (rev 12316)
@@ -1,149 +0,0 @@
-
-# auto-dependency generation makefile
-
-
-#### Default values
-
-SRCEXTENSIONS := c C cpp
-CC := gcc
-CPP := g++
-LD := ld
-AR := ar
-
-#### build object directory token 
-
-CPU := $(shell uname -m)
-OS := $(shell uname -s | tr '[A-Z]' '[a-z]')
-
-DEFAULT_ARCH := $(CPU)-$(OS)
-
-ifeq ($(strip $(ARCH)),)
-	ARCH := $(DEFAULT_ARCH)
-endif
-
-OBJTOKEN := obj.$(ARCH)
-
-#
-#  Under most circumstances, paths are simple
-#
-
-ifeq ($(POSTROOT),..)
-	MODPATH := .
-	OBJDIR := $(OBJTOKEN)
-else
-	MODPATH := $(POSTROOT)/$(MODULENAME)
-	OBJDIR := $(MODPATH)/$(OBJTOKEN)
-endif
-
-
-#
-# Directories
-#
-
-MODLIBS := \
-	-L$(OBJDIR) \
-	$(foreach dir, $(MODULES), -L$(POSTROOT)/$(dir)/$(OBJTOKEN))
-MODINCLUDES := \
-	-I$(MODPATH)/include \
-	$(foreach dir, $(MODULES), -I$(POSTROOT)/$(dir)/include)
-ALLTARGETS := \
-	$(foreach targ, $(TARGETS), $(OBJDIR)/$(targ))
-VPATH := \
-	$(MODPATH)/include \
-	$(foreach dir, $(SRCDIRS), $(MODPATH)/$(dir)) \
-	$(foreach dir, $(MODULES), $(POSTROOT)/$(dir)/include)
-
-
-#### include paths
-
-LIBPATH := $(MODLIBS)
-INCLUDEPATH += -I. -Iinclude $(MODINCLUDES)
-KCFLAGS = -O2 \
- -Wall -Werror -Wstrict-prototypes \
- -fno-strict-aliasing -fomit-frame-pointer \
- -DMODULE -D__KERNEL__ 
-
-CFLAGS :=  -fPIC -Wall -O2 -g
-CCFLAGS := -Werror
-CPPFLAGS := -ftemplate-depth-30
-
-#### Architecture deps
-
-KERNEL_INCLUDE := $(KERNEL_HOME)/include
-BINSTRIP := strip
-
-KCFLAGS += $(INCLUDEPATH)
-CFLAGS += $(INCLUDEPATH) $(LIBPATH)
-
-CCFLAGS += $(CFLAGS)
-CPPFLAGS += $(CFLAGS)
-
-#
-#  targets
-# 
-
-default:	$(ALLTARGETS)
-
-####################################################
-
-
-#
-#  Dependency generation
-#
-
-
-# Get list of all source files
-SOURCES := \
-	$(notdir $(wildcard \
-		$(foreach dir, $(SRCDIRS), \
-			$(foreach ext, $(SRCEXTENSIONS), $(dir)/*.$(ext)))))
-
-# Convert all .c, .cpp, .C to .d
-SRC_AND_DEPENDS := $(foreach ext, $(SRCEXTENSIONS),\
-	$(patsubst %.$(ext),%.d,$(SOURCES)))
-
-DEPENDS := $(foreach file, $(filter %.d,$(SRC_AND_DEPENDS)), $(OBJDIR)/$(file))
-
-
-
-BASE = $(subst /,\/,$*)
-ODIR = $(subst /,\/,$(OBJDIR))
-
-# This magic is from the 'make' manual (with mods by jelson)
-$(OBJDIR)/%.d: %.c 
-	@mkdir -p $(OBJDIR)
-	set -e; $(CC) -MM -I$(KERNEL_INCLUDE) $(CFLAGS) $< \
-	| sed 's/\($(BASE)\)\.o[ :]*/$(ODIR)\/$(BASE).o $(ODIR)\/$(BASE).d : /g' > $@; \
-	[ -s $@ ] || rm -f $@
-
-$(OBJDIR)/%.d: %.C 
-	@mkdir -p $(OBJDIR)
-	set -e; $(CC) -MM $(CPPFLAGS) $< \
-	| sed 's/\($(BASE)\)\.o[ :]*/$(ODIR)\/$(BASE).o $(ODIR)\/$(BASE).d : /g' > $@; \
-	[ -s $@ ] || rm -f $@
-
-$(OBJDIR)/%.d: %.cpp 
-	@mkdir -p $(OBJDIR)
-	set -e; $(CC) -MM $(CPPFLAGS) $< \
-	| sed 's/\($(BASE)\)\.o[ :]*/$(ODIR)\/$(BASE).o $(ODIR)\/$(BASE).d : /g' > $@; \
-	[ -s $@ ] || rm -f $@
-
-
-#
-# Rules
-#
-
-$(OBJDIR)/%.o: %.cpp
-	$(CPP) $(CPPFLAGS) $< -c -o $@
-
-$(OBJDIR)/%.o: %.C
-	$(CPP) $(CPPFLAGS) $< -c -o $@
-
-$(OBJDIR)/%.o: %.c
-	$(CC) $(CCFLAGS) $< -c -o $@
-
-clean:
-	rm -f $(ALLTARGETS) $(OBJDIR)/*.[oa] $(OBJDIR)/*.so.* $(DEPENDS)
-
-
-include $(DEPENDS)



More information about the commits mailing list