-#else
-
-ssize_t
-lprocfs_fops_read(struct file *f, char __user *buf, size_t size, loff_t *ppos)
-{
- struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
- char *page, *start = NULL;
- int rc = 0, eof = 1, count;
-
- if (*ppos >= PAGE_CACHE_SIZE)
- return 0;
-
- page = (char *)__get_free_page(GFP_KERNEL);
- if (page == NULL)
- return -ENOMEM;
-
- if (LPROCFS_ENTRY_CHECK(dp)) {
- rc = -ENOENT;
- goto out;
- }
-
- OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10);
- if (dp->read_proc)
- rc = dp->read_proc(page, &start, *ppos, PAGE_CACHE_SIZE,
- &eof, dp->data);
- if (rc <= 0)
- goto out;
-
- /* for lustre proc read, the read count must be less than PAGE_SIZE */
- LASSERT(eof == 1);
-
- if (start == NULL) {
- rc -= *ppos;
- if (rc < 0)
- rc = 0;
- if (rc == 0)
- goto out;
- start = page + *ppos;
- } else if (start < page) {
- start = page;
- }
-
- count = (rc < size) ? rc : size;
- if (copy_to_user(buf, start, count)) {
- rc = -EFAULT;
- goto out;
- }
- *ppos += count;
-
-out:
- free_page((unsigned long)page);
- return rc;
-}
-
-ssize_t
-lprocfs_fops_write(struct file *f, const char __user *buf, size_t size,
- loff_t *ppos)
-{
- struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
- int rc = -EIO;
-
- if (LPROCFS_ENTRY_CHECK(dp))
- return -ENOENT;
- if (dp->write_proc)
- rc = dp->write_proc(f, buf, size, dp->data);
- return rc;
-}
-
-static struct file_operations lprocfs_generic_fops = {
- .owner = THIS_MODULE,
- .read = lprocfs_fops_read,
- .write = lprocfs_fops_write,
-};
-
-/* for b=10866, global variable */
-DECLARE_RWSEM(_lprocfs_lock);
-EXPORT_SYMBOL(_lprocfs_lock);
-
-static struct proc_dir_entry *__lprocfs_srch(struct proc_dir_entry *head,
- const char *name)
-{
- struct proc_dir_entry *temp;
-
- if (head == NULL)
- return NULL;
-
- temp = head->subdir;
- while (temp != NULL) {
- if (strcmp(temp->name, name) == 0)
- return temp;
- temp = temp->next;
- }
- return NULL;
-}
-
-struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
- const char *name)
-{
- struct proc_dir_entry *temp;
-
- LPROCFS_SRCH_ENTRY();
- temp = __lprocfs_srch(head, name);
- LPROCFS_SRCH_EXIT();
- return temp;
-}
-EXPORT_SYMBOL(lprocfs_srch);
-
-static int __lprocfs_add_vars(struct proc_dir_entry *root,
- struct lprocfs_vars *list,
- void *data)
-{
- int rc = 0;
-
- if (root == NULL || list == NULL)
- return -EINVAL;
-
- while (list->name != NULL) {
- struct proc_dir_entry *cur_root, *proc;
- char *pathcopy, *cur, *next, pathbuf[64];
- int pathsize = strlen(list->name) + 1;
-
- proc = NULL;
- cur_root = root;
-
- /* need copy of path for strsep */
- if (strlen(list->name) > sizeof(pathbuf) - 1) {
- OBD_ALLOC(pathcopy, pathsize);
- if (pathcopy == NULL)
- GOTO(out, rc = -ENOMEM);
- } else {
- pathcopy = pathbuf;
- }
-
- next = pathcopy;
- strcpy(pathcopy, list->name);
-
- while (cur_root != NULL && (cur = strsep(&next, "/"))) {
- if (*cur =='\0') /* skip double/trailing "/" */
- continue;
-
- proc = __lprocfs_srch(cur_root, cur);
- CDEBUG(D_OTHER, "cur_root=%s, cur=%s, next=%s, (%s)\n",
- cur_root->name, cur, next,
- (proc ? "exists" : "new"));
- if (next != NULL) {
- cur_root = (proc ? proc :
- proc_mkdir(cur, cur_root));
- } else if (proc == NULL) {
- mode_t mode = 0;
- if (list->proc_mode != 0000) {
- mode = list->proc_mode;
- } else {
- if (list->read_fptr)
- mode = 0444;
- if (list->write_fptr)
- mode |= 0200;
- }
- proc = create_proc_entry(cur, mode, cur_root);
- }
- }
-
- if (pathcopy != pathbuf)
- OBD_FREE(pathcopy, pathsize);
-
- if (cur_root == NULL || proc == NULL) {
- CERROR("LprocFS: No memory to create /proc entry %s\n",
- list->name);
- GOTO(out, rc = -ENOMEM);
- }
-
- if (list->fops)
- proc->proc_fops = list->fops;
- else
- proc->proc_fops = &lprocfs_generic_fops;
- proc->read_proc = list->read_fptr;
- proc->write_proc = list->write_fptr;
- proc->data = (list->data ? list->data : data);
- list++;
- }
-out:
- return rc;
-}
-
-int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
- void *data)
-{
- int rc = 0;
-
- LPROCFS_WRITE_ENTRY();
- rc = __lprocfs_add_vars(root, list, data);
- LPROCFS_WRITE_EXIT();
-
- return rc;
-}
-EXPORT_SYMBOL(lprocfs_add_vars);
-#endif