e_specific
} lprofilers_e;
-typedef struct lprocfs_vars{
- char* name;
- read_proc_t* read_fptr;
- write_proc_t* write_fptr;
-} lprocfs_vars_t;
-
typedef struct lprocfs_group {
char** dir_namespace;
- lprocfs_vars_t* count_func_namespace;
+ struct lprocfs_vars* count_func_namespace;
lprofilers_e prof_type;
} lprocfs_group_t;
int lprocfs_get_idx(struct namespace_index* class, const char* dir_name);
unsigned int lprocfs_add_var(struct obd_device* device,
struct proc_dir_entry* root,
- lprocfs_vars_t* variable,
+ struct lprocfs_vars* variable,
int dir_arr_index,
int cnt_arr_index,
unsigned int cnt_arr_size,
#ifndef _LPROCFS_SNMP_H
#define _LPROCFS_SNMP_H
-/*
+
#ifndef LPROC_SNMP
#define LPROC_SNMP
#endif
-*/
+
#include <linux/proc_fs.h>
-typedef struct lprocfs_vars{
+struct lprocfs_vars{
char* name;
read_proc_t* read_fptr;
write_proc_t* write_fptr;
-} lprocfs_vars_t;
+};
#ifdef LPROC_SNMP
const char* name);
void lprocfs_remove_all(struct proc_dir_entry* root);
struct proc_dir_entry* lprocfs_new_dir(struct proc_dir_entry* root,
- const char* string, const char* tok);
-int lprocfs_new_vars(struct proc_dir_entry* root, lprocfs_vars_t* list,
- const char* tok, void* data);
-int lprocfs_add_vars(struct proc_dir_entry* root, lprocfs_vars_t* var,
+ const char* string,
+ const char* tok);
+int lprocfs_new_vars(struct proc_dir_entry* root,
+ struct lprocfs_vars* list, const char* tok, void* data);
+
+int lprocfs_add_vars(struct proc_dir_entry* root,
+ struct lprocfs_vars* var,
void* data);
-int lprocfs_reg_obd(struct obd_device* device, lprocfs_vars_t* list,
+int lprocfs_reg_obd(struct obd_device* device,
+ struct lprocfs_vars* list,
void* data);
int lprocfs_dereg_obd(struct obd_device* device);
struct proc_dir_entry* lprocfs_reg_mnt(char *mnt_name);
int lprocfs_dereg_mnt(struct proc_dir_entry* root);
-int lprocfs_reg_class(struct obd_type* type, lprocfs_vars_t* list, void* data);
+
+int lprocfs_reg_class(struct obd_type* type, struct lprocfs_vars* list,
+ void* data);
int lprocfs_dereg_class(struct obd_type* class);
int lprocfs_reg_main(void);
int lprocfs_dereg_main(void);
static inline int lprocfs_add_vars(struct proc_dir_entry* root,
- lprocfs_vars_t* var, void* data)
+ struct lprocfs_vars* var,
+ void* data)
+
{
return 0;
}
-static inline int lprocfs_reg_obd(struct obd_device* device,
- lprocfs_vars_t* list,
+
+static inline int lprocfs_reg_obd(struct obd_device* device,
+ struct lprocfs_vars* list,
void* data)
{
return 0;
}
static inline int lprocfs_reg_class(struct obd_type* type,
- lprocfs_vars_t* list, void* data)
+ struct lprocfs_vars* list,
+ void* data)
+
{
return 0;
}
* <shaver> // XXX if this were any uglier, I'd get my own show on MTV */
extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
-int class_register_type(struct obd_ops *ops, lprocfs_vars_t* vars, char *nm);
+int class_register_type(struct obd_ops *ops, struct lprocfs_vars* vars,
+ char *nm);
int class_unregister_type(char *nm);
int class_name2dev(char *name);
int class_uuid2dev(char *uuid);
return len;
}
-int rd_blktotal(char* page, char **start, off_t off,
+int rd_kbytestotal(char* page, char **start, off_t off,
int count, int *eof, void *data)
{
int len=0;
}
-int rd_kbfree(char* page, char **start, off_t off,
- int count, int *eof, void *data)
+int rd_kbytesfree(char* page, char **start, off_t off,
+ int count, int *eof, void *data)
{
int len=0;
struct super_block *sb=(struct super_block*)data;
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/mntpt_path", rd_path, 0},
{"status/fs_type", rd_fstype, 0},
{"status/blocksize",rd_blksize, 0},
- {"status/blockstotal",rd_blktotal, 0},
- {"status/blocksfree",rd_blkfree, 0},
- {"status/kbytesfree", rd_kbfree, 0},
+ {"status/kbytestotal",rd_kbytestotal, 0},
+ {"status/kbytesfree", rd_kbytesfree, 0},
{"status/filestotal", rd_filestotal, 0},
{"status/filesfree", rd_filesfree, 0},
{"status/filegroups", rd_filegroups, 0},
int count, int *eof, void *data);
-extern lprocfs_vars_t status_var_nm_1[];
+extern struct lprocfs_vars status_var_nm_1[];
static char *ll_read_opt(const char *opt, char *data)
{
/* Lprocfs variables */
char mnt_name[100];
char uuid_name[100];
- lprocfs_vars_t d_vars[3];
+ struct lprocfs_vars d_vars[3];
goto out_dev;
/* Add the static configuration info */
- lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)status_var_nm_1,
+ lprocfs_add_vars(sbi->ll_mnt_root,
+ (struct lprocfs_vars*)status_var_nm_1,
(void*)sb);
/* Add the dynamic configuration stuff */
+
/* MDC */
obd = class_uuid2obd(mdc);
d_vars[0].write_fptr=0;
d_vars[0].name=(char*)mnt_name;
- memset(uuid_name, '\0', strlen(uuid_name));
- sprintf(uuid_name, "status/%s/uuid", obd->obd_type->typ_name);
+
+ snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
+ obd->obd_type->typ_name);
d_vars[1].read_fptr=rd_dev_uuid;
d_vars[1].write_fptr=0;
d_vars[1].name=(char*)uuid_name;
- err=lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)d_vars,
+ err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
(void*)obd);
if (err) {
CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
}
+
/* OSC or LOV*/
obd = class_uuid2obd(osc);
/* Reuse mnt_name */
- memset(mnt_name, '\0', strlen(mnt_name));
- sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name);
+
+ snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name",
+ obd->obd_type->typ_name);
memset(d_vars, 0, sizeof(d_vars));
d_vars[0].read_fptr=rd_dev_name;
d_vars[0].write_fptr=0;
d_vars[0].name=(char*)mnt_name;
- memset(uuid_name, '\0', strlen(uuid_name));
- sprintf(uuid_name, "status/%s/uuid", obd->obd_type->typ_name);
+
+ snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
+ obd->obd_type->typ_name);
d_vars[1].read_fptr=rd_dev_uuid;
d_vars[1].write_fptr=0;
d_vars[1].name=(char*)uuid_name;
- err=lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)d_vars,
+ err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
(void*)obd);
if (err) {
CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
#include <asm/div64.h>
#include <linux/lprocfs_status.h>
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
static kmem_cache_t *lov_file_cache;
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
RETURN(-ENOMEM);
rc = class_register_type(&lov_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
OBD_LOV_DEVICENAME);
if (rc) RETURN(rc);
return len;
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/stripesize",rd_stripesize, 0},
{"status/stripeoffset",rd_stripeoffset, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/blocksize",rd_blksize, 0},
{"status/kbytestotal",rd_kbtotal, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
#define REQUEST_MINOR 244
extern int mds_queue_req(struct ptlrpc_request *);
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
/* should become mdc_getinfo() */
int mdc_getstatus(struct lustre_handle *conn, struct ll_fid *rootfid)
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
{
int rc;
rc = class_register_type(&mdc_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
LUSTRE_MDC_NAME);
if(rc)
RETURN(rc);
struct ptlrpc_request *req);
static int mds_cleanup(struct obd_device * obddev);
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
{
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
if (mds_file_cache == NULL)
return -ENOMEM;
- class_register_type(&mds_obd_ops, (lprocfs_vars_t*)status_class_var,
+ class_register_type(&mds_obd_ops,
+ (struct lprocfs_vars*)status_class_var,
LUSTRE_MDS_NAME);
class_register_type(&mdt_obd_ops, 0, LUSTRE_MDT_NAME);
{
return 0;
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/f_blocksize",rd_blksize, 0},
{"status/f_blockstotal",rd_blktotal, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
list_add(&type->typ_chain, &obd_types);
memcpy(type->typ_ops, ops, sizeof(*type->typ_ops));
strcpy(type->typ_name, nm);
- rc = lprocfs_reg_class(type, (lprocfs_vars_t *)vars, (void*)type);
+ rc = lprocfs_reg_class(type, (struct lprocfs_vars*)vars, (void*)type);
if(rc)
RETURN(rc);
*/
char tok[] = {'/', (char)0};
-
-
/*
* Externs
*/
struct proc_dir_entry *temp=root;
struct proc_dir_entry* rm_entry;
+ struct proc_dir_entry* parent=root->parent;
while(1){
while(temp->subdir){
temp=temp->subdir;
- }
+ }
rm_entry=temp;
temp=temp->parent;
remove_proc_entry(rm_entry->name, rm_entry->parent);
- if(temp==root->parent) break;
+ if(temp==parent) break;
}
char* my_str;
char* mover_str;
- /*
- * Remove trailing escaping character
- */
- memset(temp_string, 0, MAX_STRING_SIZE);
- if (strlen(string) >= MAX_STRING_SIZE) {
- CDEBUG(D_OTHER, "Directory namespace too long");
- return 0;
- }
- strcpy(temp_string, string);
+ strncpy(temp_string, string, MAX_STRING_SIZE-1);
temp_string[strlen(string) + 1] = '\0';
new_root=root;
}
int lprocfs_new_vars(struct proc_dir_entry* root,
- lprocfs_vars_t* list,
+ struct lprocfs_vars* list,
const char* tok,
void* data)
{
return -EINVAL;
}
/* Convert the last element into a leaf-node */
- memset(temp_string, 0, MAX_STRING_SIZE);
- strcpy(temp_string, temp_root->name);
+
+ strncpy(temp_string, temp_root->name, MAX_STRING_SIZE-1);
temp_string[strlen(temp_root->name) + 1] = '\0';
new_parent=temp_root->parent;
if (new_parent != 0){
*/
int lprocfs_add_vars(struct proc_dir_entry* root,
- lprocfs_vars_t* var,
+ struct lprocfs_vars* var,
void* data)
{
}
int lprocfs_reg_obd(struct obd_device* device,
- lprocfs_vars_t* list,
+ struct lprocfs_vars* list,
void* data)
{
}
int lprocfs_reg_class(struct obd_type* type,
- lprocfs_vars_t* list,
+ struct lprocfs_vars* list,
void* data)
{
struct proc_dir_entry* root;
* and Andreas Dilger <adilger@clusterfs.com>
*/
-static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.43 2002/11/02 01:09:28 braam Exp $";
-#define OBDECHO_VERSION "$Revision: 1.43 $"
+static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.44 2002/11/02 02:41:31 thantry Exp $";
+#define OBDECHO_VERSION "$Revision: 1.44 $"
#define EXPORT_SYMTAB
#define ECHO_PROC_STAT "sys/obdecho"
#define ECHO_INIT_OBJID 0x1000000000000000ULL
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
int echo_proc_read(char *page, char **start, off_t off, int count, int *eof,
void *data)
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
echo_proc_init();
rc = class_register_type(&echo_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
OBD_ECHO_DEVICENAME);
if (rc) RETURN(rc);
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/fstype", rd_fstype, 0},
{0}
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
#include <linux/stringify.h>
#include <linux/lprocfs_status.h>
-extern lprocfs_vars_t status_class_var[];
-extern lprocfs_vars_t status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
static kmem_cache_t *filter_open_cache;
static kmem_cache_t *filter_dentry_cache;
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
}
return class_register_type(&filter_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
OBD_FILTER_DEVICENAME);
}
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/blocksize",rd_blksize, 0},
{"status/kbytestotal",rd_kbtotal, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/f_blocksize",rd_blksize, 0},
{"status/f_blockstotal",rd_blktotal, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
#include <portals/lib-types.h> /* for PTL_MD_MAX_IOV */
#include <linux/lprocfs_status.h>
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
static int osc_getattr(struct lustre_handle *conn, struct obdo *oa,
struct lov_stripe_md *md)
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
int rc;
rc = class_register_type(&osc_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
LUSTRE_OSC_NAME);
if (rc)
RETURN(rc);
return 0;
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{"status/blocksize",rd_blksize, 0},
{"status/kbytesfree", rd_kbfree, 0},
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
#include <linux/init.h>
#include <linux/lprocfs_status.h>
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
static int ost_destroy(struct ptlrpc_request *req)
{
/* lprocfs_reg_dev(dev, (lprocfs_group_t*)lprocfs_ptlrpc_nm,
sizeof(struct lprofiler_ptlrpc));
*/
- lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return 0;
}
int rc;
rc = class_register_type(&ost_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
LUSTRE_OST_NAME);
if (rc) RETURN(rc);
}
-lprocfs_vars_t status_var_nm_1[]={
+struct lprocfs_vars status_var_nm_1[]={
{"status/uuid", rd_uuid, 0},
{0}
};
return len;
}
-lprocfs_vars_t status_class_var[]={
+struct lprocfs_vars status_class_var[]={
{"status/num_devices", rd_numdevices, 0},
{0}
};
extern int ptlrpc_init_portals(void);
extern void ptlrpc_exit_portals(void);
-extern lprocfs_vars_t status_var_nm_1[];
-extern lprocfs_vars_t status_class_var[];
+extern struct lprocfs_vars status_var_nm_1[];
+extern struct lprocfs_vars status_class_var[];
int connmgr_setup(struct obd_device *obddev, obd_count len, void *buf)
{
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (lprocfs_vars_t*)status_var_nm_1, (void*)dev);
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ (void*)dev);
return rc;
}
RETURN(rc);
ptlrpc_init_connection();
rc = class_register_type(&recovd_obd_ops,
- (lprocfs_vars_t*)status_class_var,
+ (struct lprocfs_vars*)status_class_var,
LUSTRE_HA_NAME);
if (rc)
RETURN(rc);