- struct lu_nodemap *nodemap = m->private;
-
- return seq_printf(m, "%d\n", (int)nodemap->nmf_allow_root_access);
-}
-
-#ifdef NODEMAP_PROC_DEBUG
-/**
- * Helper functions to set nodemap flags.
- *
- * \param[in] buffer string, which is "1" or "0" to set/unset flag
- * \param[in] count \a buffer length
- * \param[out] flag_p where to store flag value
- * \retval \a count on success
- * \retval negative number on error
- */
-static int nodemap_proc_read_flag(const char __user *buffer,
- unsigned long count, unsigned int *flag_p)
-{
- char scratch[NODEMAP_LPROC_FLAG_LEN + 1];
- long unsigned int flag_buf;
- int rc;
-
- if (count == 0)
- return 0;
-
- if (count >= sizeof(scratch))
- return -EINVAL;
-
- if (copy_from_user(scratch, buffer, count))
- return -EFAULT;
-
- scratch[count] = '\0';
- rc = kstrtoul(scratch, 10, &flag_buf);
- if (rc != 0)
- return -EINVAL;
-
- *flag_p = flag_buf;
-
- return count;
-}
-
-/**
- * Set the squash UID.
- *
- * \param[in] file proc file
- * \param[in] buffer string representing squash UID to set
- * \param[in] count \a buffer length
- * \param[in] off unused
- * \retval \a count on success
- * \retval negative number on error
- */
-static ssize_t
-nodemap_squash_uid_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
-{
- char squash[NODEMAP_LPROC_ID_LEN + 1];
- struct seq_file *m = file->private_data;
- struct lu_nodemap *nodemap = m->private;
- long unsigned int squash_uid;
- int rc;
-
- if (count == 0)
- return 0;
-
- if (count >= sizeof(squash))
- return -EINVAL;
-
- if (copy_from_user(squash, buffer, count))
- return -EFAULT;
-
- squash[count] = '\0';
- rc = kstrtoul(squash, 10, &squash_uid);
- if (rc != 0)
- return -EINVAL;
-
- nodemap->nm_squash_uid = squash_uid;
-
- return count;
-}
-
-/**
- * Set the squash GID.
- *
- * \param[in] file proc file
- * \param[in] buffer string representing squash GID to set
- * \param[in] count \a buffer length
- * \param[in] off unused
- * \retval \a count on success
- * \retval negative number on error
- */
-static ssize_t
-nodemap_squash_gid_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
-{
- char squash[NODEMAP_LPROC_ID_LEN + 1];
- struct seq_file *m = file->private_data;
- struct lu_nodemap *nodemap = m->private;
- long unsigned int squash_gid;
- int rc;
-
- if (count == 0)
- return 0;
-
- if (count >= sizeof(squash))
- return -EINVAL;
-
- if (copy_from_user(squash, buffer, count))
- return -EFAULT;
-
- squash[count] = '\0';
- rc = kstrtoul(squash, 10, &squash_gid);
- if (rc != 0)
- return -EINVAL;
-
- nodemap->nm_squash_gid = squash_gid;
-
- return count;
-}
-
-/**
- * Set/unset the trusted flag.
- *
- * \param[in] file proc file
- * \param[in] buffer string, "1" or "0"
- * \param[in] count \a buffer length
- * \param[in] off unused
- * \retval \a count on success
- * \retval negative number on error
- */
-static ssize_t
-nodemap_trusted_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
-{
- struct seq_file *m = file->private_data;
- struct lu_nodemap *nodemap = m->private;
- int flags;
- int rc;
-
- rc = nodemap_proc_read_flag(buffer, count, &flags);
- if (rc >= 0) {
- nodemap->nmf_trust_client_ids = !!flags;
- nm_member_revoke_locks(nodemap);