patch-2.4.20 linux-2.4.20/fs/intermezzo/sysctl.c

Next file: linux-2.4.20/fs/intermezzo/upcall.c
Previous file: linux-2.4.20/fs/intermezzo/super.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/fs/intermezzo/sysctl.c linux-2.4.20/fs/intermezzo/sysctl.c
@@ -1,4 +1,23 @@
-/*
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 1999 Peter J. Braam <braam@clusterfs.com>
+ *
+ *   This file is part of InterMezzo, http://www.inter-mezzo.org.
+ *
+ *   InterMezzo is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   InterMezzo is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with InterMezzo; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
  *  Sysctrl entries for Intermezzo!
  */
 
@@ -24,7 +43,6 @@
 
 #include <linux/intermezzo_fs.h>
 #include <linux/intermezzo_psdev.h>
-#include <linux/intermezzo_upcall.h>
 
 /* /proc entries */
 
@@ -36,8 +54,6 @@
 	int len=0;
 
 	/* this works as long as we are below 1024 characters! */
-	len += presto_sprint_mounts(buffer, length, -1);
-
 	*start = buffer + offset;
 	len -= offset;
 
@@ -67,30 +83,27 @@
 #define PSDEV_NO_UPCALL    7      /* controls lento_upcall */
 #define PSDEV_ERRORVAL     8      /* controls presto_debug_fail_blkdev */
 #define PSDEV_EXCL_GID     9      /* which GID is ignored by presto */
-#define PSDEV_ILOOKUP_UID 10      /* which UID bypasses file access perms */
 #define PSDEV_BYTES_TO_CLOSE 11   /* bytes to write before close */
 
 /* These are global presto control options */
-#define PRESTO_PRIMARY_CTLCNT 4
-static struct ctl_table presto_table[ PRESTO_PRIMARY_CTLCNT + MAX_PRESTODEV + 1] =
+#define PRESTO_PRIMARY_CTLCNT 2
+static struct ctl_table presto_table[ PRESTO_PRIMARY_CTLCNT + MAX_CHANNEL + 1] =
 {
 	{PSDEV_DEBUG, "debug", &presto_debug, sizeof(int), 0644, NULL, &proc_dointvec},
 	{PSDEV_TRACE, "trace", &presto_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_EXCL_GID, "presto_excluded_gid", &presto_excluded_gid, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_ILOOKUP_UID, "presto_ilookup_uid", &presto_ilookup_uid, sizeof(int), 0644, NULL, &proc_dointvec},
 };
 
 /*
  * Intalling the sysctl entries: strategy
  * - have templates for each /proc/sys/intermezzo/ entry
  *   such an entry exists for each /dev/presto
- *    (proto_prestodev_entry)
+ *    (proto_channel_entry)
  * - have a template for the contents of such directories
  *    (proto_psdev_table)
  * - have the master table (presto_table)
  *
  * When installing, malloc, memcpy and fix up the pointers to point to
- * the appropriate constants in upc_comms[your_minor]
+ * the appropriate constants in izo_channels[your_minor]
  */
 
 static ctl_table proto_psdev_table[] = {
@@ -99,15 +112,13 @@
 	{PSDEV_NO_JOURNAL, "no_journal", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
 	{PSDEV_NO_UPCALL, "no_upcall", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
 	{PSDEV_TIMEOUT, "timeout", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_TRACE, "trace", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_DEBUG, "debug", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
 #ifdef PRESTO_DEBUG
 	{PSDEV_ERRORVAL, "errorval", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
 #endif
 	{ 0 }
 };
 
-static ctl_table proto_prestodev_entry = {
+static ctl_table proto_channel_entry = {
 	PSDEV_INTERMEZZO, 0,  NULL, 0, 0555, 0,
 };
 
@@ -124,6 +135,7 @@
 /* we made these separate as setting may in future be more restricted
  * than getting
  */
+#ifdef RON_MINNICH
 int dosetopt(int minor, struct psdev_opt *opt)
 {
 	int retval = 0;
@@ -134,23 +146,23 @@
 	switch(opt->optname) {
 
 	case PSDEV_TIMEOUT:
-		upc_comms[minor].uc_timeout = newval;
+		izo_channels[minor].uc_timeout = newval;
 		break;
 
 	case PSDEV_HARD:
-		upc_comms[minor].uc_hard = newval;
+		izo_channels[minor].uc_hard = newval;
 		break;
 
 	case PSDEV_NO_FILTER:
-		upc_comms[minor].uc_no_filter = newval;
+		izo_channels[minor].uc_no_filter = newval;
 		break;
 
 	case PSDEV_NO_JOURNAL:
-		upc_comms[minor].uc_no_journal = newval;
+		izo_channels[minor].uc_no_journal = newval;
 		break;
 
 	case PSDEV_NO_UPCALL:
-		upc_comms[minor].uc_no_upcall = newval;
+		izo_channels[minor].uc_no_upcall = newval;
 		break;
 
 #ifdef PRESTO_DEBUG
@@ -161,17 +173,17 @@
 		 * allow setting the underlying device read-only for the
 		 * current presto cache.
 		 */
-		int errorval = upc_comms[minor].uc_errorval;
+		int errorval = izo_channels[minor].uc_errorval;
 		if (errorval < 0) {
 			if (newval == 0)
 				set_device_ro(-errorval, 0);
 			else
-				printk("device %s already read only\n",
+				CERROR("device %s already read only\n",
 				       kdevname(-errorval));
 		} else {
 			if (newval < 0)
 				set_device_ro(-newval, 1);
-			upc_comms[minor].uc_errorval = newval;
+			izo_channels[minor].uc_errorval = newval;
 			CDEBUG(D_PSDEV, "setting errorval to %d\n", newval);
 		}
 
@@ -203,32 +215,32 @@
 	switch(opt->optname) {
 
 	case PSDEV_TIMEOUT:
-		opt->optval = upc_comms[minor].uc_timeout;
+		opt->optval = izo_channels[minor].uc_timeout;
 		break;
 
 	case PSDEV_HARD:
-		opt->optval = upc_comms[minor].uc_hard;
+		opt->optval = izo_channels[minor].uc_hard;
 		break;
 
 	case PSDEV_NO_FILTER:
-		opt->optval = upc_comms[minor].uc_no_filter;
+		opt->optval = izo_channels[minor].uc_no_filter;
 		break;
 
 	case PSDEV_NO_JOURNAL:
-		opt->optval = upc_comms[minor].uc_no_journal;
+		opt->optval = izo_channels[minor].uc_no_journal;
 		break;
 
 	case PSDEV_NO_UPCALL:
-		opt->optval = upc_comms[minor].uc_no_upcall;
+		opt->optval = izo_channels[minor].uc_no_upcall;
 		break;
 
 #ifdef PSDEV_DEBUG
 	case PSDEV_ERRORVAL: {
-		int errorval = upc_comms[minor].uc_errorval;
+		int errorval = izo_channels[minor].uc_errorval;
 		if (errorval < 0 && is_read_only(-errorval))
-			printk(KERN_INFO "device %s has been set read-only\n",
+			CERROR("device %s has been set read-only\n",
 			       kdevname(-errorval));
-		opt->optval = upc_comms[minor].uc_errorval;
+		opt->optval = izo_channels[minor].uc_errorval;
 		break;
 	}
 #endif
@@ -247,29 +259,26 @@
 	EXIT;
 	return retval;
 }
+#endif
 
 
-
+/* allocate the tables for the presto devices. We need
+ * sizeof(proto_channel_table)/sizeof(proto_channel_table[0])
+ * entries for each dev
+ */
 int /* __init */ init_intermezzo_sysctl(void)
 {
 	int i;
-	extern struct upc_comm upc_comms[MAX_PRESTODEV];
-
-	/* allocate the tables for the presto devices. We need
-	 * sizeof(proto_prestodev_table)/sizeof(proto_prestodev_table[0])
-	 * entries for each dev
-	 */
-	int total_dev = MAX_PRESTODEV;
+	int total_dev = MAX_CHANNEL;
 	int entries_per_dev = sizeof(proto_psdev_table) /
 		sizeof(proto_psdev_table[0]);
 	int total_entries = entries_per_dev * total_dev;
 	ctl_table *dev_ctl_table;
 
-	PRESTO_ALLOC(dev_ctl_table, ctl_table *,
-		     sizeof(ctl_table) * total_entries);
+	PRESTO_ALLOC(dev_ctl_table, sizeof(ctl_table) * total_entries);
 
 	if (! dev_ctl_table) {
-		printk("WARNING: presto couldn't allocate dev_ctl_table\n");
+		CERROR("WARNING: presto couldn't allocate dev_ctl_table\n");
 		EXIT;
 		return -ENOMEM;
 	}
@@ -286,14 +295,14 @@
 		/* entries for the individual "files" in this "directory" */
 		ctl_table *psdev_entries = &dev_ctl_table[i * entries_per_dev];
 		/* init the psdev and psdev_entries with the prototypes */
-		*psdev = proto_prestodev_entry;
+		*psdev = proto_channel_entry;
 		memcpy(psdev_entries, proto_psdev_table,
 		       sizeof(proto_psdev_table));
 		/* now specialize them ... */
 		/* the psdev has to point to psdev_entries, and fix the number */
 		psdev->ctl_name = psdev->ctl_name + i + 1; /* sorry */
 
-		psdev->procname = kmalloc(32, GFP_KERNEL);
+		PRESTO_ALLOC((void*)psdev->procname, PROCNAME_SIZE);
 		if (!psdev->procname) {
 			PRESTO_FREE(dev_ctl_table,
 				    sizeof(ctl_table) * total_entries);
@@ -304,15 +313,13 @@
 		psdev->child = psdev_entries;
 
 		/* now for each psdev entry ... */
-		psdev_entries[0].data = &(upc_comms[i].uc_hard);
-		psdev_entries[1].data = &(upc_comms[i].uc_no_filter);
-		psdev_entries[2].data = &(upc_comms[i].uc_no_journal);
-		psdev_entries[3].data = &(upc_comms[i].uc_no_upcall);
-		psdev_entries[4].data = &(upc_comms[i].uc_timeout);
-		psdev_entries[5].data = &presto_print_entry;
-		psdev_entries[6].data = &presto_debug;
+		psdev_entries[0].data = &(izo_channels[i].uc_hard);
+		psdev_entries[1].data = &(izo_channels[i].uc_no_filter);
+		psdev_entries[2].data = &(izo_channels[i].uc_no_journal);
+		psdev_entries[3].data = &(izo_channels[i].uc_no_upcall);
+		psdev_entries[4].data = &(izo_channels[i].uc_timeout);
 #ifdef PRESTO_DEBUG
-		psdev_entries[7].data = &(upc_comms[i].uc_errorval);
+		psdev_entries[5].data = &(izo_channels[i].uc_errorval);
 #endif
 	}
 
@@ -331,8 +338,9 @@
 	return 0;
 }
 
-void cleanup_intermezzo_sysctl() {
-	int total_dev = MAX_PRESTODEV;
+void cleanup_intermezzo_sysctl(void)
+{
+	int total_dev = MAX_CHANNEL;
 	int entries_per_dev = sizeof(proto_psdev_table) /
 		sizeof(proto_psdev_table[0]);
 	int total_entries = entries_per_dev * total_dev;
@@ -346,7 +354,7 @@
 	for(i = 0; i < total_dev; i++) {
 		/* entry for this /proc/sys/intermezzo/intermezzo"i" */
 		ctl_table *psdev = &presto_table[i + PRESTO_PRIMARY_CTLCNT];
-		kfree(psdev->procname);
+		PRESTO_FREE(psdev->procname, PROCNAME_SIZE);
 	}
 	/* presto_table[PRESTO_PRIMARY_CTLCNT].child points to the
 	 * dev_ctl_table previously allocated in init_intermezzo_psdev()

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)