[xiph-commits] r12351 - in trunk/fusd: examples include kfusd
libfusd
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Thu Jan 18 23:23:00 PST 2007
Author: xiphmont
Date: 2007-01-18 23:22:54 -0800 (Thu, 18 Jan 2007)
New Revision: 12351
Modified:
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:
Throttle logging so that it's not so bloody easy to accidentally take out a machine with a zombified daemon.
Property changes on: trunk/fusd/examples/console-read.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/drums.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/drums2.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/drums3.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/echo.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/helloworld.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/ioctl.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/logring.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/pager.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/examples/uid-filter.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/include/fusd.h
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/include/fusd_msg.h
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Modified: trunk/fusd/include/kfusd.h
===================================================================
--- trunk/fusd/include/kfusd.h 2007-01-19 04:00:37 UTC (rev 12350)
+++ trunk/fusd/include/kfusd.h 2007-01-19 07:22:54 UTC (rev 12351)
@@ -121,16 +121,15 @@
struct task_struct* task;
char *name; /* Name of the device under devfs (/dev) */
- char *class_name;
- char *dev_name;
- struct CLASS *clazz;
- int owns_class;
- struct class_device *class_device;
-
+ char *class_name;
+ char *dev_name;
+ struct CLASS *clazz;
+ int owns_class;
+ struct class_device *class_device;
+
void *private_data; /* User's private data */
- struct cdev* handle;
- dev_t dev_id;
-// devfs_handle_t handle; /* The devfs-provided handle */
+ struct cdev* handle;
+ dev_t dev_id;
fusd_file_t **files; /* Array of this device's open files */
int array_size; /* Size of the array pointed to by 'files' */
Property changes on: trunk/fusd/include/kfusd.h
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Modified: trunk/fusd/kfusd/kfusd.c
===================================================================
--- trunk/fusd/kfusd/kfusd.c 2007-01-19 04:00:37 UTC (rev 12350)
+++ trunk/fusd/kfusd/kfusd.c 2007-01-19 07:22:54 UTC (rev 12351)
@@ -103,11 +103,6 @@
* __wake_up. */
/* #define CONFIG_FUSD_USE_WAKEUPSYNC */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,9)
-# define vsnprintf(str, size, format, ap) vsprintf(str, format, ap)
-# define snprintf(str, len, args...) sprintf(str, args)
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
#define CLASS class_simple
@@ -138,8 +133,8 @@
#include "fusd_msg.h"
#include "kfusd.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-# error "***FUSD doesn't work before Linux Kernel v2.4.0"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+# error "***FUSD doesn't work before Linux Kernel v2.6.0"
#endif
STATIC struct cdev* fusd_control_device;
@@ -181,6 +176,10 @@
module_param(fusd_debug_level, int, S_IRUGO);
#define BUFSIZE 1000 /* kernel's kmalloc pool has a 1012-sized bucket */
+static int debug_throttle = 0; /* emit a maximum number of debug
+ messages, else it's possible to take
+ out the machine accidentally if a
+ daemon disappears with open files */
STATIC void rdebug_real(char *fmt, ...)
{
@@ -188,6 +187,9 @@
int len;
char *message;
+ if(debug_throttle > 100) return;
+ debug_throttle++;
+
/* I'm kmallocing since you don't really want 1k on the stack. I've
* had stack overflow problems before; the kernel stack is quite
* small... */
@@ -634,8 +636,8 @@
if (transaction->subcmd != subcmd)
{
- RDEBUG(2, "Incomplete transaction %ld thrown out, was expecting subcmd %d but received %d",
- transaction->transid, transaction->subcmd, subcmd);
+ RDEBUG(2, "Incomplete transaction %ld thrown out, was expecting subcmd %d but received %d",
+ transaction->transid, transaction->subcmd, subcmd);
fusd_cleanup_transaction(fusd_file, transaction);
return NULL;
}
@@ -1164,7 +1166,7 @@
if (retval >= 0)
retval = fusd_fops_call_wait(fusd_file, NULL, transaction);
- RDEBUG(5, "fusd_client_release: call_wait %d", retval);
+ RDEBUG(5, "fusd_client_release: call_wait %d", retval);
/* delete the file off the device's file-list, and free it. note
* that device may be a zombie right now and may be freed when we
* come back from free_fusd_file. we only release the lock if the
@@ -1195,6 +1197,10 @@
int retval = -EPIPE;
GET_FUSD_FILE_AND_DEV(file->private_data, fusd_file, fusd_dev);
+
+ if(ZOMBIE(fusd_dev))
+ goto zombie_dev;
+
LOCK_FUSD_FILE(fusd_file);
RDEBUG(3, "got a read on /dev/%s (owned by pid %d) from pid %d",
@@ -1203,7 +1209,7 @@
transaction = fusd_find_incomplete_transaction(fusd_file, FUSD_READ);
if (transaction && transaction->size > count)
{
- RDEBUG(3, "Incomplete I/O transaction %ld thrown out, as the transaction's size of %d bytes was greater than "
+ RDEBUG(2, "Incomplete I/O transaction %ld thrown out, as the transaction's size of %d bytes was greater than "
"the retry's size of %d bytes", transaction->transid, transaction->size, (int)count);
fusd_cleanup_transaction(fusd_file, transaction);
@@ -1273,6 +1279,7 @@
invalid_file:
invalid_dev:
+ zombie_dev:
RDEBUG(3, "got a read on client file from pid %d, driver has disappeared",
current->pid);
return -EPIPE;
@@ -1362,6 +1369,10 @@
struct fusd_transaction* transaction;
GET_FUSD_FILE_AND_DEV(file->private_data, fusd_file, fusd_dev);
+
+ if(ZOMBIE(fusd_dev))
+ goto zombie_dev;
+
LOCK_FUSD_FILE(fusd_file);
RDEBUG(3, "got a write on /dev/%s (owned by pid %d) from pid %d",
@@ -1437,7 +1448,8 @@
invalid_file:
invalid_dev:
- RDEBUG(3, "got a read on client file from pid %d, driver has disappeared",
+ zombie_dev:
+ RDEBUG(3, "got a write on client file from pid %d, driver has disappeared",
current->pid);
return -EPIPE;
}
@@ -1453,6 +1465,10 @@
struct fusd_transaction* transaction;
GET_FUSD_FILE_AND_DEV(file->private_data, fusd_file, fusd_dev);
+
+ if(ZOMBIE(fusd_dev))
+ goto zombie_dev;
+
LOCK_FUSD_FILE(fusd_file);
RDEBUG(3, "got an ioctl on /dev/%s (owned by pid %d) from pid %d",
@@ -1527,7 +1543,8 @@
invalid_file:
invalid_dev:
- RDEBUG(3, "got a read on client file from pid %d, driver has disappeared",
+ zombie_dev:
+ RDEBUG(3, "got an ioctl on client file from pid %d, driver has disappeared",
current->pid);
return -EPIPE;
}
@@ -1576,6 +1593,10 @@
struct fusd_mmap_instance* mmap_instance;
GET_FUSD_FILE_AND_DEV(file->private_data, fusd_file, fusd_dev);
+
+ if(ZOMBIE(fusd_dev))
+ goto zombie_dev;
+
LOCK_FUSD_FILE(fusd_file);
RDEBUG(3, "got a mmap on /dev/%s (owned by pid %d) from pid %d",
@@ -1626,6 +1647,7 @@
invalid_file:
invalid_dev:
+ zombie_dev:
RDEBUG(3, "got a mmap on client file from pid %d, driver has disappeared",
current->pid);
return -EPIPE;
@@ -2654,7 +2676,7 @@
}
len += snprintf(buf + len, buf_size - len,
- "\nFUSD $Revision: 1.97-kor-hacked-11 $ - %d devices used by %d clients\n",
+ "\nFUSD $Revision$ - %d devices used by %d clients\n",
total_files, total_clients);
out:
@@ -2803,7 +2825,7 @@
printk(KERN_INFO
- "fusd: starting, $Revision: 1.97-kor-hacked-11 $, $Date: 2003/07/11 22:29:39 $");
+ "fusd: starting, $Revision$, $Date$");
#ifdef CVSTAG
printk(", release %s", CVSTAG);
#endif
Property changes on: trunk/fusd/kfusd/kfusd.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
Property changes on: trunk/fusd/libfusd/libfusd.c
___________________________________________________________________
Name: svn:keywords
- Id
+ Author Date Id Revision
More information about the commits
mailing list