wmpInit.c
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           RT-WMP              --------------------
00003  *------------------------------------------------------------------------
00004  *                                                         
00005  *
00006  *
00007  *  File: ./src/platforms/linux_ks/wmpInit.c
00008  *  Authors: Rubén Durán
00009  *           Danilo Tardioli
00010  *  ----------------------------------------------------------------------
00011  *  Copyright (C) 2000-2011, Universidad de Zaragoza, SPAIN
00012  *
00013  *  Contact Addresses: Danilo Tardioli                   dantard@unizar.es
00014  *
00015  *  RT-WMP is free software; you can  redistribute it and/or  modify it
00016  *  under the terms of the GNU General Public License  as published by the
00017  *  Free Software Foundation;  either  version 2, or (at  your option) any
00018  *  later version.
00019  *
00020  *  RT-WMP  is distributed  in the  hope  that  it will be   useful, but
00021  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00022  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00023  *  General Public License for more details.
00024  *
00025  *  You should have received  a  copy of  the  GNU General Public  License
00026  *  distributed with RT-WMP;  see file COPYING.   If not,  write to the
00027  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00028  *  02111-1307, USA.
00029  *
00030  *  As a  special exception, if you  link this  unit  with other  files to
00031  *  produce an   executable,   this unit  does  not  by  itself cause  the
00032  *  resulting executable to be covered by the  GNU General Public License.
00033  *  This exception does  not however invalidate  any other reasons why the
00034  *  executable file might be covered by the GNU Public License.
00035  *
00036  *----------------------------------------------------------------------*/
00037 
00038 #include "config/compiler.h"
00039 #include "core/include/global.h"
00040 
00041 #include <linux/module.h>
00042 #include <linux/kernel.h>
00043 #include <asm/uaccess.h>
00044 #include "core/include/wmp_misc.h"
00045 
00046 int wmpReadConfiguration(Status * status) {
00047         struct file *f;
00048         char param[30], val[20], line[256];
00049         int exists;
00050 
00051         f = filp_open("/etc/rt-wmp/rt-wmp.cfg", O_RDONLY, 0);
00052         if (IS_ERR(f)) {
00053                 printk(KERN_INFO "File /etc/rt-wmp/rt-wmp.cfg not found...\n");
00054                 printk(KERN_INFO "Using default values (timeout: %d).\n", status->TIMEOUT);
00055                 return -1;
00056         }
00057 
00058         printk(KERN_INFO "Reading /etc/rt-wmp/rt-wmp.cfg...\n");
00059 
00060         while (fgets(line, 256, f) != NULL) {
00061                 if (line[0] < 65 || line[0] > 90) {
00062                         continue;
00063                 }
00064                 sscanf(line, "%s %s", param, val);
00065 
00066                 exists = apply_config(status, param, val);
00067 
00068                 if (exists) {
00069                         printk          (KERN_INFO "READ OPTION: %s = %s\n", param, val);
00070                 } else {
00071                         printk(KERN_INFO "*** UKNOWN OPTION %s = %s\n", param, val);
00072                 }
00073         }
00074         printk(KERN_INFO "Done.\n");
00075         filp_close(f,0);
00076         return 1;
00077 }


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:56