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();
}
EXPORT_SYMBOL(lprocfs_add_vars);
-void lprocfs_remove(struct proc_dir_entry **rooth)
+void lprocfs_remove_nolock(struct proc_dir_entry **rooth)
{
struct proc_dir_entry *root = *rooth;
struct proc_dir_entry *temp = root;
parent = root->parent;
LASSERT(parent != NULL);
- LPROCFS_WRITE_ENTRY(); /* search vs remove race */
while (1) {
while (temp->subdir != NULL)
if (temp == parent)
break;
}
- LPROCFS_WRITE_EXIT();
+}
+
+void lprocfs_remove(struct proc_dir_entry **rooth)
+{
+ LPROCFS_WRITE_ENTRY(); /* search vs remove race */
+ lprocfs_remove_nolock(rooth);
+ LPROCFS_WRITE_EXIT();
}
EXPORT_SYMBOL(lprocfs_remove);
}
EXPORT_SYMBOL(lprocfs_remove_proc_entry);
+void lprocfs_try_remove_proc_entry(const char *name,
+ struct proc_dir_entry *parent)
+{
+ struct proc_dir_entry *t = NULL;
+ struct proc_dir_entry **p;
+ int len, busy = 0;
+
+ LASSERT(parent != NULL);
+ len = strlen(name);
+
+ LPROCFS_WRITE_ENTRY();
+
+ /* lookup target name */
+ for (p = &parent->subdir; *p; p = &(*p)->next) {
+ if ((*p)->namelen != len)
+ continue;
+ if (memcmp(name, (*p)->name, len))
+ continue;
+ t = *p;
+ break;
+ }
+
+ if (t) {
+ /* verify it's empty: do not count "num_refs" */
+ for (p = &t->subdir; *p; p = &(*p)->next) {
+ if ((*p)->namelen != strlen("num_refs")) {
+ busy = 1;
+ break;
+ }
+ if (memcmp("num_refs", (*p)->name,
+ strlen("num_refs"))) {
+ busy = 1;
+ break;
+ }
+ }
+ }
+
+ if (busy == 0)
+ lprocfs_remove_nolock(&t);
+
+ LPROCFS_WRITE_EXIT();
+
+ return;
+}
+EXPORT_SYMBOL(lprocfs_try_remove_proc_entry);
+
struct proc_dir_entry *lprocfs_register(const char *name,
struct proc_dir_entry *parent,
struct lprocfs_vars *list, void *data)
"umask",
"einprogress",
"grant_param",
+ "flock_owner",
+ "lvb_type",
+ "nanoseconds_times",
+ "lightweight_conn",
+ "short_io",
+ "unknown",
NULL
};
LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotacheck);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, quota_adjust_qunit);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
}
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)
{
c += cfs_hash_debug_str(obd->obd_uuid_hash, page + c, count - c);
c += cfs_hash_debug_str(obd->obd_nid_hash, page + c, count - c);
c += cfs_hash_debug_str(obd->obd_nid_stats_hash, page+c, count-c);
-#ifdef HAVE_QUOTA_SUPPORT
- if (obd->u.obt.obt_qctxt.lqc_lqs_hash)
- c += cfs_hash_debug_str(obd->u.obt.obt_qctxt.lqc_lqs_hash,
- page + c, count - c);
-#endif
return c;
}