diff options
-rw-r--r-- | fs/ecryptfs/super.c | 52 |
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 | */ |
162 | static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt) | 162 | static 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 | |
183 | out: | 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 | ||
187 | const struct super_operations ecryptfs_sops = { | 197 | const struct super_operations ecryptfs_sops = { |