X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Flprocfs_status.c;h=516d7984e5285a0b47889e563fa0e66146edbbea;hb=f100d508311d16a09040a057438ee06fd9e6d7fe;hp=521047c731add97df6da35593ce6ec60ae075968;hpb=9ddf386035767a96b54e21559f3ea0be126dc8cd;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 521047c..516d798 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -63,6 +63,13 @@ CFS_MODULE_PARM(lprocfs_no_percpu_stats, "i", int, 0644, CFS_DECLARE_RWSEM(_lprocfs_lock); EXPORT_SYMBOL(_lprocfs_lock); +int lprocfs_single_release(struct inode *inode, struct file *file) +{ + LPROCFS_EXIT(); + return single_release(inode, file); +} +EXPORT_SYMBOL(lprocfs_single_release); + int lprocfs_seq_release(struct inode *inode, struct file *file) { LPROCFS_EXIT(); @@ -1003,10 +1010,12 @@ static const char *obd_connect_names[] = { "umask", "einprogress", "grant_param", - "nanoseconds_times", + "flock_owner", "lvb_type", - "unknown", + "nanoseconds_times", "lightweight_conn", + "short_io", + "unknown", NULL }; @@ -2324,6 +2333,52 @@ int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count, } EXPORT_SYMBOL(lprocfs_write_frac_u64_helper); +static char *lprocfs_strnstr(const char *s1, const char *s2, size_t len) +{ + size_t l2; + + l2 = strlen(s2); + if (!l2) + return (char *)s1; + while (len >= l2) { + len--; + if (!memcmp(s1, s2, l2)) + return (char *)s1; + s1++; + } + return NULL; +} + +/** + * Find the string \a name in the input \a buffer, and return a pointer to the + * value immediately following \a name, reducing \a count appropriately. + * If \a name is not found the original \a buffer is returned. + */ +char *lprocfs_find_named_value(const char *buffer, const char *name, + unsigned long *count) +{ + char *val; + size_t buflen = *count; + + /* there is no strnstr() in rhel5 and ubuntu kernels */ + val = lprocfs_strnstr(buffer, name, buflen); + if (val == NULL) + return (char *)buffer; + + val += strlen(name); /* skip prefix */ + while (val < buffer + buflen && isspace(*val)) /* skip separator */ + val++; + + *count = 0; + while (val < buffer + buflen && isalnum(*val)) { + ++*count; + ++val; + } + + return val - *count; +} +EXPORT_SYMBOL(lprocfs_find_named_value); + int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name, mode_t mode, struct file_operations *seq_fops, void *data) {