aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-02-06 04:38:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:12 -0500
commit99db6e4a9764887842006a2b1aa804de6171db42 (patch)
tree5d45cd3f74aaeeb9209dea2e9a00d197d4e2cc06
parent8e3a6f16ba5874b69968cd450334829262513fd1 (diff)
ecryptfs: make show_options reflect actual mount options
Change ecryptfs_show_options to reflect the actual mount options in use. Note that this does away with the "dir=" output, which is not a valid mount option and appears to be unused. Mount options such as "ecryptfs_verbose" and "ecryptfs_xattr_metadata" are somewhat indeterminate for a given fs, but in any case the reported mount options can be used in a new mount command to get the same behavior. [akpm@linux-foundation.org: fix printk warning] Signed-off-by: Eric Sandeen <sandeen@redhat.com> Acked-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ecryptfs/super.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c
index 4859c4eecd65..0556604e8dc2 100644
--- a/fs/ecryptfs/super.c
+++ b/fs/ecryptfs/super.c
@@ -156,32 +156,42 @@ static void ecryptfs_clear_inode(struct inode *inode)
156/** 156/**
157 * ecryptfs_show_options 157 * ecryptfs_show_options
158 * 158 *
159 * Prints the directory we are currently mounted over. 159 * Prints the mount options for a given superblock.
160 * Returns zero on success; non-zero otherwise 160 * Returns zero; does not fail.
161 */ 161 */
162static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt) 162static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt)
163{ 163{
164 struct super_block *sb = mnt->mnt_sb; 164 struct super_block *sb = mnt->mnt_sb;
165 struct dentry *lower_root_dentry = ecryptfs_dentry_to_lower(sb->s_root); 165 struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
166 struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(sb->s_root); 166 &ecryptfs_superblock_to_private(sb)->mount_crypt_stat;
167 char *tmp_page; 167 struct ecryptfs_global_auth_tok *walker;
168 char *path; 168
169 int rc = 0; 169 mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
170 170 list_for_each_entry(walker,
171 tmp_page = (char *)__get_free_page(GFP_KERNEL); 171 &mount_crypt_stat->global_auth_tok_list,
172 if (!tmp_page) { 172 mount_crypt_stat_list) {
173 rc = -ENOMEM; 173 seq_printf(m, ",ecryptfs_sig=%s", walker->sig);
174 goto out;
175 }
176 path = d_path(lower_root_dentry, lower_mnt, tmp_page, PAGE_SIZE);
177 if (IS_ERR(path)) {
178 rc = PTR_ERR(path);
179 goto out;
180 } 174 }
181 seq_printf(m, ",dir=%s", path); 175 mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
182 free_page((unsigned long)tmp_page); 176
183out: 177 /* Note this is global and probably shouldn't be a mount option */
184 return rc; 178 if (ecryptfs_verbosity)
179 seq_printf(m, ",ecryptfs_debug=%d\n", ecryptfs_verbosity);
180
181 seq_printf(m, ",ecryptfs_cipher=%s",
182 mount_crypt_stat->global_default_cipher_name);
183
184 if (mount_crypt_stat->global_default_cipher_key_size)
185 seq_printf(m, ",ecryptfs_key_bytes=%zd",
186 mount_crypt_stat->global_default_cipher_key_size);
187 if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)
188 seq_printf(m, ",ecryptfs_passthrough");
189 if (mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED)
190 seq_printf(m, ",ecryptfs_xattr_metadata");
191 if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
192 seq_printf(m, ",ecryptfs_encrypted_view");
193
194 return 0;
185} 195}
186 196
187const struct super_operations ecryptfs_sops = { 197const struct super_operations ecryptfs_sops = {