patch-2.4.20 linux-2.4.20/arch/alpha/kernel/srm_env.c
Next file: linux-2.4.20/arch/alpha/kernel/traps.c
Previous file: linux-2.4.20/arch/alpha/kernel/pci.c
Back to the patch index
Back to the overall index
- Lines: 162
- Date:
Thu Nov 28 15:53:08 2002
- Orig file:
linux-2.4.19/arch/alpha/kernel/srm_env.c
- Orig date:
Fri Aug 2 17:39:42 2002
diff -urN linux-2.4.19/arch/alpha/kernel/srm_env.c linux-2.4.20/arch/alpha/kernel/srm_env.c
@@ -33,6 +33,15 @@
* Changelog
* ~~~~~~~~~
*
+ * Thu, 22 Aug 2002 15:10:43 +0200
+ * - Update Config.help entry. I got a number of emails asking
+ * me to tell their senders if they could make use of this
+ * piece of code... So: "SRM is something like BIOS for your
+ * Alpha"
+ * - Update code formatting a bit to better conform CodingStyle
+ * rules.
+ * - So this is v0.0.5, with no changes (except formatting)
+ *
* Wed, 22 May 2002 00:11:21 +0200
* - Fix typo on comment (SRC -> SRM)
* - Call this "Version 0.0.4"
@@ -59,13 +68,12 @@
#define BASE_DIR "srm_environment" /* Subdir in /proc/ */
#define NAMED_DIR "named_variables" /* Subdir for known variables */
#define NUMBERED_DIR "numbered_variables" /* Subdir for all variables */
-#define VERSION "0.0.4" /* Module version */
+#define VERSION "0.0.5" /* Module version */
#define NAME "srm_env" /* Module name */
MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
MODULE_DESCRIPTION("Accessing Alpha SRM environment through procfs interface");
MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
typedef struct _srm_env {
char *name;
@@ -98,9 +106,12 @@
};
static srm_env_t srm_numbered_entries[256];
+
+
static int
srm_env_read(char *page, char **start, off_t off, int count, int *eof,
- void *data) {
+ void *data)
+{
int nbytes;
unsigned long ret;
srm_env_t *entry;
@@ -112,11 +123,11 @@
return -EFAULT;
}
- entry = (srm_env_t *)data;
+ entry = (srm_env_t *) data;
ret = callback_getenv(entry->id, page, count);
if((ret >> 61) == 0)
- nbytes = (int)ret;
+ nbytes = (int) ret;
else
nbytes = -EFAULT;
@@ -125,9 +136,11 @@
return nbytes;
}
+
static int
srm_env_write(struct file *file, const char *buffer, unsigned long count,
- void *data) {
+ void *data)
+{
#define BUFLEN 512
int nbytes;
srm_env_t *entry;
@@ -157,7 +170,7 @@
do
ret2 = callback_save_env();
while((ret2 >> 61) == 1);
- nbytes = (int)ret1;
+ nbytes = (int) ret1;
} else
nbytes = -EFAULT;
@@ -166,8 +179,10 @@
return nbytes;
}
+
static void
-srm_env_cleanup(void) {
+srm_env_cleanup(void)
+{
srm_env_t *entry;
unsigned long var_num;
@@ -211,8 +226,10 @@
return;
}
+
static int __init
-srm_env_init(void) {
+srm_env_init(void)
+{
srm_env_t *entry;
unsigned long var_num;
@@ -221,7 +238,9 @@
*/
if(!alpha_using_srm) {
printk(KERN_INFO "%s: This Alpha system doesn't "
- "know about SRM...\n", __FUNCTION__);
+ "know about SRM (or you've booted "
+ "SRM->MILO->Linux, which gets "
+ "misdetected)...\n", __FUNCTION__);
return -ENODEV;
}
@@ -275,7 +294,7 @@
if(entry->proc_entry == NULL)
goto cleanup;
- entry->proc_entry->data = (void *)entry;
+ entry->proc_entry->data = (void *) entry;
entry->proc_entry->owner = THIS_MODULE;
entry->proc_entry->read_proc = srm_env_read;
entry->proc_entry->write_proc = srm_env_write;
@@ -296,7 +315,7 @@
goto cleanup;
entry->id = var_num;
- entry->proc_entry->data = (void *)entry;
+ entry->proc_entry->data = (void *) entry;
entry->proc_entry->owner = THIS_MODULE;
entry->proc_entry->read_proc = srm_env_read;
entry->proc_entry->write_proc = srm_env_write;
@@ -304,20 +323,26 @@
printk(KERN_INFO "%s: version %s loaded successfully\n", NAME,
VERSION);
+
return 0;
cleanup:
srm_env_cleanup();
+
return -ENOMEM;
}
+
static void __exit
-srm_env_exit(void) {
+srm_env_exit(void)
+{
srm_env_cleanup();
printk(KERN_INFO "%s: unloaded successfully\n", NAME);
+
return;
}
+
module_init(srm_env_init);
module_exit(srm_env_exit);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)