Subversion Repositories HelenOS

Rev

Rev 3022 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 161... Line 161...
161
        } else {
161
        } else {
162
            subtree = subtree->next;
162
            subtree = subtree->next;
163
            i = 0;
163
            i = 0;
164
        }  
164
        }  
165
    }
165
    }
-
 
166
 
166
    panic("Not reached\n");
167
    panic("Not reached.");
167
    return NULL;
168
    return NULL;
168
}
169
}
169
 
170
 
170
void sysinfo_set_item_val(const char *name, sysinfo_item_t **root, unative_t val)
171
void sysinfo_set_item_val(const char *name, sysinfo_item_t **root, unative_t val)
171
{
172
{
Line 175... Line 176...
175
    /* If already created create only returns pointer
176
    /* If already created create only returns pointer
176
       If not, create it */
177
       If not, create it */
177
    sysinfo_item_t *item = sysinfo_create_path(name, root);
178
    sysinfo_item_t *item = sysinfo_create_path(name, root);
178
   
179
   
179
    if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */
180
    if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */
180
        item->val.val=val;                  
181
        item->val.val = val;                  
181
        item->val_type = SYSINFO_VAL_VAL;
182
        item->val_type = SYSINFO_VAL_VAL;
182
    }
183
    }
183
}
184
}
184
 
185
 
185
void sysinfo_set_item_function(const char *name, sysinfo_item_t **root, sysinfo_val_fn_t fn)
186
void sysinfo_set_item_function(const char *name, sysinfo_item_t **root, sysinfo_val_fn_t fn)
Line 190... Line 191...
190
    /* If already created create only returns pointer
191
    /* If already created create only returns pointer
191
       If not, create it */
192
       If not, create it */
192
    sysinfo_item_t *item = sysinfo_create_path(name, root);
193
    sysinfo_item_t *item = sysinfo_create_path(name, root);
193
   
194
   
194
    if (item != NULL) { /* If in subsystem, unable to create or return so  unable to set */
195
    if (item != NULL) { /* If in subsystem, unable to create or return so  unable to set */
195
        item->val.fn=fn;                  
196
        item->val.fn = fn;                  
196
        item->val_type = SYSINFO_VAL_FUNCTION;
197
        item->val_type = SYSINFO_VAL_FUNCTION;
197
    }
198
    }
198
}
199
}
199
 
200
 
200
 
201
 
Line 242... Line 243...
242
            val = ((sysinfo_val_fn_t) (root->val.fn)) (root);
243
            val = ((sysinfo_val_fn_t) (root->val.fn)) (root);
243
            vtype = "FUN";
244
            vtype = "FUN";
244
            break;
245
            break;
245
        }
246
        }
246
       
247
       
247
        printf("%s    %s val:%d(%x) sub:%s\n", root->name, vtype, val,
248
        printf("%s    %s val:%" PRIun "(%" PRIxn ") sub:%s\n", root->name, vtype, val,
248
            val, (root->subinfo_type == SYSINFO_SUBINFO_NONE) ?
249
            val, (root->subinfo_type == SYSINFO_SUBINFO_NONE) ?
249
            "NON" : ((root->subinfo_type == SYSINFO_SUBINFO_TABLE) ?
250
            "NON" : ((root->subinfo_type == SYSINFO_SUBINFO_TABLE) ?
250
            "TAB" : "FUN"));
251
            "TAB" : "FUN"));
251
       
252
       
252
        if (root->subinfo_type == SYSINFO_SUBINFO_TABLE)
253
        if (root->subinfo_type == SYSINFO_SUBINFO_TABLE)
Line 279... Line 280...
279
            ret.val = ((sysinfo_val_fn_t) (item->val.fn)) (item);
280
            ret.val = ((sysinfo_val_fn_t) (item->val.fn)) (item);
280
    }
281
    }
281
    return ret;
282
    return ret;
282
}
283
}
283
 
284
 
-
 
285
#define SYSINFO_MAX_LEN 1024
-
 
286
 
284
unative_t sys_sysinfo_valid(unative_t ptr, unative_t len)
287
unative_t sys_sysinfo_valid(unative_t ptr, unative_t len)
285
{
288
{
286
    char *str;
289
    char *str;
287
    sysinfo_rettype_t ret = {0, 0};
290
    sysinfo_rettype_t ret = {0, 0};
-
 
291
 
-
 
292
    if (len > SYSINFO_MAX_LEN)
-
 
293
        return ret.valid;
288
    str = malloc(len + 1, 0);
294
    str = malloc(len + 1, 0);
289
   
295
   
290
    ASSERT(str);
296
    ASSERT(str);
291
    if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len])))
297
    if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len])))
292
        ret = sysinfo_get_val(str, NULL);
298
        ret = sysinfo_get_val(str, NULL);
Line 297... Line 303...
297
 
303
 
298
unative_t sys_sysinfo_value(unative_t ptr, unative_t len)
304
unative_t sys_sysinfo_value(unative_t ptr, unative_t len)
299
{
305
{
300
    char *str;
306
    char *str;
301
    sysinfo_rettype_t ret = {0, 0};
307
    sysinfo_rettype_t ret = {0, 0};
-
 
308
   
-
 
309
    if (len > SYSINFO_MAX_LEN)
-
 
310
        return ret.val;
302
    str = malloc(len + 1, 0);
311
    str = malloc(len + 1, 0);
303
   
312
   
304
    ASSERT(str);
313
    ASSERT(str);
305
    if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len])))
314
    if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len])))
306
        ret = sysinfo_get_val(str, NULL);
315
        ret = sysinfo_get_val(str, NULL);