X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=libcfs%2Flibcfs%2Flinux%2Flinux-proc.c;h=e82b67584597e2320f53d7a6ad5b3926667a0351;hb=617e8e1229637908d4cce6725878dd5668960420;hp=c6c81e41a33d24bdc0fccc082d59291c15880fa8;hpb=19ec037c0a9427250b87a69c53beb153d533ab1c;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/linux/linux-proc.c b/libcfs/libcfs/linux/linux-proc.c index c6c81e4..e82b675 100644 --- a/libcfs/libcfs/linux/linux-proc.c +++ b/libcfs/libcfs/linux/linux-proc.c @@ -97,6 +97,7 @@ enum { PSDEV_CONSOLE_BACKOFF, /* delay increase factor */ PSDEV_DEBUG_PATH, /* crashdump log location */ PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */ + PSDEV_CPT_TABLE, /* information about cpu partitions */ PSDEV_LNET_UPCALL, /* User mode upcall script */ PSDEV_LNET_MEMUSED, /* bytes currently PORTAL_ALLOCated */ PSDEV_LNET_CATASTROPHE, /* if we have LBUGged or panic'd */ @@ -121,6 +122,7 @@ enum { #define PSDEV_CONSOLE_BACKOFF CTL_UNNUMBERED #define PSDEV_DEBUG_PATH CTL_UNNUMBERED #define PSDEV_DEBUG_DUMP_PATH CTL_UNNUMBERED +#define PSDEV_CPT_TABLE CTL_UNNUMBERED #define PSDEV_LNET_UPCALL CTL_UNNUMBERED #define PSDEV_LNET_MEMUSED CTL_UNNUMBERED #define PSDEV_LNET_CATASTROPHE CTL_UNNUMBERED @@ -356,6 +358,48 @@ int LL_PROC_PROTO(proc_fail_loc) return rc; } +static int __proc_cpt_table(void *data, int write, + loff_t pos, void *buffer, int nob) +{ + char *buf = NULL; + int len = 4096; + int rc = 0; + + if (write) + return -EPERM; + + LASSERT(cfs_cpt_table != NULL); + + while (1) { + LIBCFS_ALLOC(buf, len); + if (buf == NULL) + return -ENOMEM; + + rc = cfs_cpt_table_print(cfs_cpt_table, buf, len); + if (rc >= 0) + break; + + LIBCFS_FREE(buf, len); + if (rc == -EFBIG) { + len <<= 1; + continue; + } + goto out; + } + + if (pos >= rc) { + rc = 0; + goto out; + } + + rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL); + out: + if (buf != NULL) + LIBCFS_FREE(buf, len); + return rc; +} +DECLARE_PROC_HANDLER(proc_cpt_table) + static cfs_sysctl_table_t lnet_table[] = { /* * NB No .strategy entries have been provided since sysctl(8) prefers @@ -424,6 +468,14 @@ static cfs_sysctl_table_t lnet_table[] = { .proc_handler = &proc_dostring, }, + { + .ctl_name = PSDEV_CPT_TABLE, + .procname = "cpu_partition_table", + .maxlen = 128, + .mode = 0444, + .proc_handler = &proc_cpt_table, + }, + { INIT_CTL_NAME(PSDEV_LNET_UPCALL) .procname = "upcall",