proc.c
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           RT-WMP              --------------------
00003  *------------------------------------------------------------------------
00004  *
00005  *
00006  *
00007  *  File: ./src/core/proc.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 #include <linux/module.h>
00038 #include <linux/version.h>
00039 #include <linux/kernel.h>
00040 #include <asm/uaccess.h>
00041 #include <linux/proc_fs.h>
00042 #include "config/compiler.h"
00043 #include "core/interface/wmp_interface.h"
00044 #include "core/include/lqm.h"
00045 
00046 /* Variables for the directory and all the files */
00047 static struct proc_dir_entry *directory;
00048 
00049 static struct proc_dir_entry *fNodeId;
00050 static struct proc_dir_entry *fNumOfNodes;
00051 static struct proc_dir_entry *fLatestLQM;
00052 static struct proc_dir_entry *fLatestDistances;
00053 
00054 static struct proc_dir_entry *fNetworkConnected;
00055 
00056 static struct proc_dir_entry *fCpuDelay;
00057 static struct proc_dir_entry *fTimeout;
00058 static struct proc_dir_entry *fWCMult;
00059 static struct proc_dir_entry *fRate;
00060 
00061 static struct proc_dir_entry *fFreePositionsInTXQueue;
00062 static struct proc_dir_entry *fElementsInTXQueue;
00063 static struct proc_dir_entry *fElementsInRXQueue;
00064 
00065 static struct proc_dir_entry *fNetIT;
00066 static struct proc_dir_entry *fMTU;
00067 
00068 static struct proc_dir_entry *fActiveSearch;
00069 
00070 static struct proc_dir_entry *fInstanceId;
00071 static struct proc_dir_entry *fPrimBasedRouting;
00072 static struct proc_dir_entry *fMessageReschedule;
00073 static struct proc_dir_entry *fFlowControl;
00074 
00075 static struct proc_dir_entry *fSerial;
00076 static struct proc_dir_entry *fLoopId;
00077 
00078 
00079 
00080 /* Functions for reading and writing the files */
00081 int f_getNodeId(char *page, char **start, off_t off, int count, int *eof, void *data){
00082    if (off > 0) {
00083       *eof = 1;
00084       return 0;
00085    }
00086    else {
00087       return sprintf(page, "%d\n", wmpGetNodeId());
00088    }
00089 }
00090 
00091 int f_getNumOfNodes(char *page, char **start, off_t off, int count, int *eof, void *data){
00092    if (off > 0) {
00093       *eof = 1;
00094       return 0;
00095    }
00096    else {
00097       return sprintf(page, "%d\n", wmpGetNumOfNodes());
00098    }
00099 }
00100 
00101 int f_getLatestLQM(char *page, char **start, off_t off, int count, int *eof, void *data){
00102    if (off > 0) {
00103       *eof = 1;
00104       return 0;
00105    }
00106    else {
00107       int i, j, size = wmpGetNumOfNodes();
00108       char lqm[size*size];
00109       char *p = page;
00110       wmpGetLatestLQM(lqm);
00111 
00112       for (i = 0; i<size ; i++){
00113          for (j = 0; j<size ; j++){
00114             p += sprintf(p, " %04d ",lqm[i*size+j]);
00115          }
00116          p += sprintf(p, "\n");
00117       }
00118       return p-page;             // Returns the size
00119    }
00120 }
00121 
00122 int f_getLatestDistances(char *page, char **start, off_t off, int count, int *eof, void *data){
00123    if (off > 0) {
00124       *eof = 1;
00125       return 0;
00126    }
00127    else {
00128       int i, j, size = wmpGetNumOfNodes();
00129       char *p = page;
00130       for (i = 0; i<size ; i++){
00131          for (j = 0; j<size ; j++){
00132             p += sprintf(p, " %04d ",lqm_get_distance(i,j));
00133          }
00134          p += sprintf(p, "\n");
00135       }
00136       return p-page;             // Returns the size
00137    }
00138 }
00139 
00140 int f_networkConnected(char *page, char **start, off_t off, int count, int *eof, void *data){
00141    if (off > 0) {
00142       *eof = 1;
00143       return 0;
00144    }
00145    else {
00146       if(wmpIsNetworkConnected()){
00147          return sprintf(page, "Connected\n");
00148       }
00149       else{
00150          return sprintf(page, "Not connected\n");
00151       }
00152    }
00153 }
00154 
00155 int f_CpuDelay_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00156    if (off > 0) {
00157       *eof = 1;
00158       return 0;
00159    }
00160    else {
00161       return sprintf(page, "%d\n", wmpGetCpuDelay());
00162    }
00163 }
00164 int f_CpuDelay_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00165    char aux[20];
00166    int size = (len>20?20:len);
00167    int val;
00168 
00169    if (copy_from_user(aux, buff, size)) {
00170       return -EFAULT;
00171    }
00172    aux[size-1]='\0';
00173 
00174    val = atoi(aux);
00175 
00176    if(val <= 0){
00177       printk(KERN_INFO "Delay must be over 0.");
00178    }
00179    else{
00180       wmpSetCpuDelay(val);
00181    }
00182 
00183    return len;
00184 }
00185 
00186 int f_Timeout_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00187    if (off > 0) {
00188       *eof = 1;
00189       return 0;
00190    }
00191    else {
00192       return sprintf(page, "%d\n", wmpGetTimeout());
00193    }
00194 }
00195 int f_Timeout_write(struct file *f, const char __user *buff, unsigned long len, void *data ) {
00196    char aux[20];
00197    int size = (len>20?20:len);
00198    int val;
00199 
00200    if (copy_from_user(aux, buff, size)) {
00201       return -EFAULT;
00202    }
00203    aux[size-1]='\0';
00204 
00205    val = atoi(aux);
00206 
00207    if(val < 0){
00208       printk(KERN_INFO "Timeout must be at least 0.");
00209    }
00210    else{
00211       wmpSetTimeout(val);
00212    }
00213 
00214    return len;
00215 }
00216 
00217 int f_WCMult_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00218    if (off > 0) {
00219       *eof = 1;
00220       return 0;
00221    }
00222    else {
00223       int mult = wmpGetWCMult();
00224       return sprintf(page, "%d\n", (int) mult);
00225    }
00226 }
00227 int f_WCMult_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00228    char aux[32];
00229    int size = (len>32?32:len);
00230    int val;
00231 
00232    if (copy_from_user(aux, buff, size)) {
00233       return -EFAULT;
00234    }
00235    aux[size-1]='\0';
00236 
00237    val = atoi(aux);
00238    wmpSetWCMult(val);
00239 
00240    return len;
00241 }
00242 
00243 int f_Rate_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00244    if (off > 0) {
00245       *eof = 1;
00246       return 0;
00247    }
00248    else {
00249       unsigned long decimales;
00250       int rate = wmpGetRate();
00251      // kernel_fpu_begin();
00252       decimales = (rate- (int)rate)*1000;
00253      // kernel_fpu_end();
00254       return sprintf(page, "%d.%03lu\n", (int)rate, decimales);
00255    }
00256 }
00257 int f_Rate_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00258    char aux[32];
00259    int size = (len>32?32:len);
00260    int val;
00261 
00262    if (copy_from_user(aux, buff, size)) {
00263       return -EFAULT;
00264    }
00265    aux[size-1]='\0';
00266 
00267    val = atoi(aux);
00268    wmpSetRate(val);
00269 
00270    return len;
00271 }
00272 
00273 int f_getFreePositionsInTXQueue(char *page, char **start, off_t off, int count, int *eof, void *data){
00274    if (off > 0) {
00275       *eof = 1;
00276       return 0;
00277    }
00278    else {
00279       return sprintf(page, "%d\n", wmp_queue_tx_get_room());
00280    }
00281 }
00282 
00283 int f_getElementsInTXQueue(char *page, char **start, off_t off, int count, int *eof, void *data){
00284    if (off > 0) {
00285       *eof = 1;
00286       return 0;
00287    }
00288    else {
00289       return sprintf(page, "%d\n", wmpGetNumOfElementsInTXQueue());
00290    }
00291 }
00292 
00293 int f_getElementsInRXQueue(char *page, char **start, off_t off, int count, int *eof, void *data){
00294    if (off > 0) {
00295       *eof = 1;
00296       return 0;
00297    }
00298    else {
00299       return sprintf(page, "%d\n", wmpGetNumOfElementsInRXQueue(0));
00300    }
00301 }
00302 
00303 int f_getNetIT(char *page, char **start, off_t off, int count, int *eof, void *data){
00304    if (off > 0) {
00305       *eof = 1;
00306       return 0;
00307    }
00308    else {
00309       return sprintf(page, "%d\n", wmpGetNetIT());
00310    }
00311 }
00312 
00313 int f_getMTU(char *page, char **start, off_t off, int count, int *eof, void *data){
00314    if (off > 0) {
00315       *eof = 1;
00316       return 0;
00317    }
00318    else {
00319       return sprintf(page, "%u\n", wmpGetMTU());
00320    }
00321 }
00322 
00323 int f_activeSearch_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00324    char aux[10];
00325    int val, size;
00326    size = (len>10?10:len);
00327 
00328    if (copy_from_user(aux, buff, size)) {
00329       return -EFAULT;
00330    }
00331    aux[size-1]='\0';
00332    val = atoi(aux);
00333    if(val != 0 && val != 1){
00334       printk(KERN_INFO "The only possible values are 0 (off) and 1 (on).\n");
00335    }
00336    else{
00337       wmpSetActiveSearch(val);
00338    }
00339 
00340    return len;
00341 }
00342 int f_activeSearch_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00343    if (off > 0) {
00344       *eof = 1;
00345       return 0;
00346    }
00347    else {
00348       return sprintf(page, "%d\n", wmpGetActiveSearch());
00349    }
00350 }
00351 
00352 int f_instanceId_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00353    char aux[10];
00354    int val, size;
00355    size = (len>10?10:len);
00356 
00357    if (copy_from_user(aux, buff, size)) {
00358       return -EFAULT;
00359    }
00360    aux[size-1]='\0';
00361    val = atoi(aux);
00362    if(val <= 0){
00363       printk(KERN_INFO "The instance ID must be positive.\n");
00364    }
00365    else{
00366       wmpSetInstanceId(val);
00367    }
00368 
00369    return len;
00370 }
00371 int f_instanceId_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00372    if (off > 0) {
00373       *eof = 1;
00374       return 0;
00375    }
00376    else {
00377       return sprintf(page, "%d\n", wmpGetInstanceId());
00378    }
00379 }
00380 
00381 int f_primBasedRouting_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00382    char aux[10];
00383    int val, size;
00384    size = (len>10?10:len);
00385 
00386    if (copy_from_user(aux, buff, size)) {
00387       return -EFAULT;
00388    }
00389    aux[size-1]='\0';
00390    val = atoi(aux);
00391 
00392    wmpSetPrimBasedRouting(val);
00393 
00394    return len;
00395 }
00396 int f_primBasedRouting_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00397    if (off > 0) {
00398       *eof = 1;
00399       return 0;
00400    }
00401    else {
00402       return sprintf(page, "%d\n", wmpGetPrimBasedRouting());
00403    }
00404 }
00405 
00406 int f_messageReschedule_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00407    char aux[10];
00408    int val, size;
00409    size = (len>10?10:len);
00410 
00411    if (copy_from_user(aux, buff, size)) {
00412       return -EFAULT;
00413    }
00414    aux[size-1]='\0';
00415    val = atoi(aux);
00416 
00417    wmpSetMessageReschedule(val);
00418 
00419    return len;
00420 }
00421 int f_messageReschedule_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00422    if (off > 0) {
00423       *eof = 1;
00424       return 0;
00425    }
00426    else {
00427       return sprintf(page, "%d\n", wmpGetMessageReschedule());
00428    }
00429 }
00430 
00431 int f_flowControl_write(struct file *f, const char __user *buff, unsigned long len, void *data ){
00432    char aux[10];
00433    int val, size;
00434    size = (len>10?10:len);
00435 
00436    if (copy_from_user(aux, buff, size)) {
00437       return -EFAULT;
00438    }
00439    aux[size-1]='\0';
00440    val = atoi(aux);
00441 
00442    wmpSetFlowControl(val);
00443 
00444    return len;
00445 }
00446 int f_flowControl_read(char *page, char **start, off_t off, int count, int *eof, void *data){
00447    if (off > 0) {
00448       *eof = 1;
00449       return 0;
00450    }
00451    else {
00452       return sprintf(page, "%d\n", wmpGetFlowControl());
00453    }
00454 }
00455 
00456 int f_serial(char *page, char **start, off_t off, int count, int *eof, void *data){
00457    if (off > 0) {
00458       *eof = 1;
00459       return 0;
00460    }
00461    else {
00462       return sprintf(page, "%u\n", wmpGetSerial());
00463    }
00464 }
00465 
00466 int f_loopId(char *page, char **start, off_t off, int count, int *eof, void *data){
00467    if (off > 0) {
00468       *eof = 1;
00469       return 0;
00470    }
00471    else {
00472       return sprintf(page, "%u\n", wmpGetLoopId());
00473    }
00474 }
00475 
00476 typedef enum { NODEID, NUMOFNODES, LATESTLQM, LATESTDISTANCES, NETWORKCONNECTED, CPUDELAY,
00477                TIMEOUT, WCMULT, RATE, FREEPOSTX, ELEMSTX, ELEMSRX, NETIT, GETMTU,
00478                ACTIVESEARCH, INSTANCEID, PRIMBASEDROUTING, MESSAGERESCHEDULE,
00479                FLOWCONTROL, SERIAL, LOOPID, ALL} tpClose;
00480 
00481 /* Removes /proc/rt-wmp/ and all the files inside it created before 'where' */
00482 void __close_proc(tpClose where){
00483    switch(where){
00484       case ALL:
00485          remove_proc_entry(fLoopId->name, fLoopId->parent);
00486       case LOOPID:
00487          remove_proc_entry(fSerial->name, fSerial->parent);
00488       case SERIAL:
00489          remove_proc_entry(fFlowControl->name, fFlowControl->parent);
00490       case FLOWCONTROL:
00491          remove_proc_entry(fMessageReschedule->name, fMessageReschedule->parent);
00492       case MESSAGERESCHEDULE:
00493          remove_proc_entry(fPrimBasedRouting->name, fPrimBasedRouting->parent);
00494       case PRIMBASEDROUTING:
00495          remove_proc_entry(fInstanceId->name, fInstanceId->parent);
00496       case INSTANCEID:
00497          remove_proc_entry(fActiveSearch->name, fActiveSearch->parent);
00498       case ACTIVESEARCH:
00499          remove_proc_entry(fMTU->name, fMTU->parent);
00500       case GETMTU:
00501          remove_proc_entry(fNetIT->name, fNetIT->parent);
00502       case NETIT:
00503          remove_proc_entry(fElementsInRXQueue->name, fElementsInRXQueue->parent);
00504       case ELEMSRX:
00505          remove_proc_entry(fElementsInTXQueue->name, fElementsInTXQueue->parent);
00506       case ELEMSTX:
00507          remove_proc_entry(fFreePositionsInTXQueue->name, fFreePositionsInTXQueue->parent);
00508       case FREEPOSTX:
00509          remove_proc_entry(fRate->name, fRate->parent);
00510       case RATE:
00511          remove_proc_entry(fWCMult->name, fWCMult->parent);
00512       case WCMULT:
00513          remove_proc_entry(fTimeout->name, fTimeout->parent);
00514       case TIMEOUT:
00515          remove_proc_entry(fCpuDelay->name, fCpuDelay->parent);
00516       case CPUDELAY:
00517          remove_proc_entry(fNetworkConnected->name, fNetworkConnected->parent);
00518       case NETWORKCONNECTED:
00519          remove_proc_entry(fLatestDistances->name, fLatestDistances->parent);
00520       case LATESTDISTANCES:
00521           remove_proc_entry(fLatestLQM->name, fLatestLQM->parent);
00522        case LATESTLQM:
00523           remove_proc_entry(fNumOfNodes->name, fNumOfNodes->parent);
00524       case NUMOFNODES:
00525          remove_proc_entry(fNodeId->name, fNodeId->parent);
00526       case NODEID:
00527          remove_proc_entry(directory->name, directory->parent);
00528       //case DIR:
00529    }
00530 }
00531 
00532 struct proc_dir_entry * get_proc_root(){
00533         return directory;
00534 }
00535 
00536 
00537 /* Creates /proc/rt-wmp/ and all the files inside it */
00538 int init_proc(void){
00539    directory = proc_mkdir( "rt-wmp",NULL );
00540    if(!directory){
00541       //__close_proc(DIR);
00542       return -ENOMEM;
00543    }
00544 
00545    fNodeId = create_proc_read_entry("nodeId", 0666, directory, f_getNodeId, NULL);
00546    if(!fNodeId){
00547       __close_proc(NODEID);
00548       return -ENOMEM;
00549    }
00550 
00551    fNumOfNodes = create_proc_read_entry("numOfNodes", 0666, directory, f_getNumOfNodes, NULL);
00552    if(!fNumOfNodes){
00553       __close_proc(NUMOFNODES);
00554       return -ENOMEM;
00555    }
00556 
00557    fLatestLQM = create_proc_read_entry("latestLQM", 0666, directory, f_getLatestLQM, NULL);
00558    if(!fLatestLQM){
00559       __close_proc(LATESTLQM);
00560       return -ENOMEM;
00561    }
00562 
00563    fLatestDistances = create_proc_read_entry("latestDistances", 0666, directory, f_getLatestDistances, NULL);
00564    if(!fLatestDistances){
00565       __close_proc(LATESTDISTANCES);
00566       return -ENOMEM;
00567    }
00568 
00569    fNetworkConnected = create_proc_read_entry("networkConnected", 0666, directory, f_networkConnected, NULL);
00570    if(!fNetworkConnected){
00571       __close_proc(NETWORKCONNECTED);
00572       return -ENOMEM;
00573    }
00574 
00575    fCpuDelay = create_proc_entry("cpuDelay", 0666, directory);
00576    if(!fCpuDelay){
00577       __close_proc(CPUDELAY);
00578       return -ENOMEM;
00579    }
00580    fCpuDelay->read_proc = f_CpuDelay_read;
00581    fCpuDelay->write_proc = f_CpuDelay_write;
00582 
00583    fTimeout = create_proc_entry("timeout", 0666, directory);
00584    if(!fTimeout){
00585       __close_proc(TIMEOUT);
00586       return -ENOMEM;
00587    }
00588    fTimeout->read_proc = f_Timeout_read;
00589    fTimeout->write_proc = f_Timeout_write;
00590 
00591    fWCMult = create_proc_entry("WCMult", 0666, directory);
00592    if(!fWCMult){
00593       __close_proc(WCMULT);
00594       return -ENOMEM;
00595    }
00596    fWCMult->read_proc = f_WCMult_read;
00597    fWCMult->write_proc = f_WCMult_write;
00598 
00599    fRate = create_proc_entry("rate", 0666, directory);
00600    if(!fRate){
00601       __close_proc(RATE);
00602       return -ENOMEM;
00603    }
00604    fRate->read_proc = f_Rate_read;
00605    fRate->write_proc = f_Rate_write;
00606 
00607    fFreePositionsInTXQueue = create_proc_read_entry("freePositionsInTXQueue", 0666, directory, f_getFreePositionsInTXQueue, NULL);
00608    if(!fFreePositionsInTXQueue){
00609       __close_proc(FREEPOSTX);
00610       return -ENOMEM;
00611    }
00612 
00613    fElementsInTXQueue = create_proc_read_entry("elementsInTXQueue", 0666, directory, f_getElementsInTXQueue, NULL);
00614    if(!fElementsInTXQueue){
00615       __close_proc(ELEMSTX);
00616       return -ENOMEM;
00617    }
00618 
00619    fElementsInRXQueue = create_proc_read_entry("elementsInRXQueue", 0666, directory, f_getElementsInRXQueue, NULL);
00620    if(!fElementsInRXQueue){
00621       __close_proc(ELEMSRX);
00622       return -ENOMEM;
00623    }
00624 
00625    fNetIT = create_proc_read_entry("netIT", 0666, directory, f_getNetIT, NULL);
00626    if(!fNetIT){
00627       __close_proc(NETIT);
00628       return -ENOMEM;
00629    }
00630 
00631    fMTU = create_proc_read_entry("mtu", 0666, directory, f_getMTU, NULL);
00632    if(!fMTU){
00633       __close_proc(GETMTU);
00634       return -ENOMEM;
00635    }
00636 
00637    fActiveSearch = create_proc_entry("activeSearch", 0666, directory);
00638    if(!fActiveSearch){
00639       __close_proc(ACTIVESEARCH);
00640       return -ENOMEM;
00641    }
00642    fActiveSearch->read_proc = f_activeSearch_read;
00643    fActiveSearch->write_proc = f_activeSearch_write;
00644 
00645    fInstanceId = create_proc_entry("instanceId", 0666, directory);
00646    if(!fInstanceId){
00647       __close_proc(INSTANCEID);
00648       return -ENOMEM;
00649    }
00650    fInstanceId->read_proc = f_instanceId_read;
00651    fInstanceId->write_proc = f_instanceId_write;
00652 
00653    fPrimBasedRouting = create_proc_entry("primBasedRouting", 0666, directory);
00654    if(!fPrimBasedRouting){
00655       __close_proc(PRIMBASEDROUTING);
00656       return -ENOMEM;
00657    }
00658    fPrimBasedRouting->read_proc = f_primBasedRouting_read;
00659    fPrimBasedRouting->write_proc = f_primBasedRouting_write;
00660 
00661    fMessageReschedule = create_proc_entry("messageReschedule", 0666, directory);
00662    if(!fMessageReschedule){
00663       __close_proc(MESSAGERESCHEDULE);
00664       return -ENOMEM;
00665    }
00666    fMessageReschedule->read_proc = f_messageReschedule_read;
00667    fMessageReschedule->write_proc = f_messageReschedule_write;
00668 
00669    fFlowControl = create_proc_entry("flowControl", 0666, directory);
00670    if(!fFlowControl){
00671       __close_proc(FLOWCONTROL);
00672       return -ENOMEM;
00673    }
00674    fFlowControl->read_proc = f_flowControl_read;
00675    fFlowControl->write_proc = f_flowControl_write;
00676 
00677    fSerial = create_proc_read_entry("serial", 0666, directory, f_serial, NULL);
00678    if(!fSerial){
00679       __close_proc(SERIAL);
00680       return -ENOMEM;
00681    }
00682 
00683    fLoopId = create_proc_read_entry("loopId", 0666, directory, f_loopId, NULL);
00684    if(!fLoopId){
00685       __close_proc(LOOPID);
00686       return -ENOMEM;
00687    }
00688 
00689    return 1;
00690 }
00691 
00692 /* Removes /proc/rt-wmp/ and all the files inside it */
00693 void close_proc(void){
00694    __close_proc(ALL);
00695 }


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:10