提交 6c6f57f3 编写于 作者: M Michael Halcrow 提交者: Linus Torvalds

eCryptfs: comments for some structs

Andrew Morton wrote:
> > +struct ecryptfs_global_auth_tok {
> > +#define ECRYPTFS_AUTH_TOK_INVALID 0x00000001
> > +     u32 flags;
> > +     struct list_head mount_crypt_stat_list;
> > +     struct key *global_auth_tok_key;
> > +     struct ecryptfs_auth_tok *global_auth_tok;
> > +     unsigned char sig[ECRYPTFS_SIG_SIZE_HEX + 1];
> > +};
> > +
> > +struct ecryptfs_key_tfm {
> > +     struct crypto_blkcipher *key_tfm;
> > +     size_t key_size;
> > +     struct mutex key_tfm_mutex;
> > +     struct list_head key_tfm_list;
> > +     unsigned char cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1];
> > +};
>
> Please consider commenting your struct fields carefully: it's a
> great way to help other to understand your code.

Add some comments to the ecryptfs_global_auth_tok and ecryptfs_key_tfm
structs to make their functions more easily ascertained.
Signed-off-by: NMichael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fcd12835
...@@ -273,20 +273,36 @@ struct ecryptfs_dentry_info { ...@@ -273,20 +273,36 @@ struct ecryptfs_dentry_info {
struct ecryptfs_crypt_stat *crypt_stat; struct ecryptfs_crypt_stat *crypt_stat;
}; };
/**
* ecryptfs_global_auth_tok structs refer to authentication token keys
* in the user keyring that apply to newly created files. A list of
* these objects hangs off of the mount_crypt_stat struct for any
* given eCryptfs mount. This struct maintains a reference to both the
* key contents and the key itself so that the key can be put on
* unmount.
*/
struct ecryptfs_global_auth_tok { struct ecryptfs_global_auth_tok {
#define ECRYPTFS_AUTH_TOK_INVALID 0x00000001 #define ECRYPTFS_AUTH_TOK_INVALID 0x00000001
u32 flags; u32 flags;
struct list_head mount_crypt_stat_list; struct list_head mount_crypt_stat_list; /* Default auth_tok list for
struct key *global_auth_tok_key; * the mount_crypt_stat */
struct ecryptfs_auth_tok *global_auth_tok; struct key *global_auth_tok_key; /* The key from the user's keyring for
unsigned char sig[ECRYPTFS_SIG_SIZE_HEX + 1]; * the sig */
struct ecryptfs_auth_tok *global_auth_tok; /* The key contents */
unsigned char sig[ECRYPTFS_SIG_SIZE_HEX + 1]; /* The key identifier */
}; };
/**
* Typically, eCryptfs will use the same ciphers repeatedly throughout
* the course of its operations. In order to avoid unnecessarily
* destroying and initializing the same cipher repeatedly, eCryptfs
* keeps a list of crypto API contexts around to use when needed.
*/
struct ecryptfs_key_tfm { struct ecryptfs_key_tfm {
struct crypto_blkcipher *key_tfm; struct crypto_blkcipher *key_tfm;
size_t key_size; size_t key_size;
struct mutex key_tfm_mutex; struct mutex key_tfm_mutex;
struct list_head key_tfm_list; struct list_head key_tfm_list; /* The module's tfm list */
unsigned char cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; unsigned char cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1];
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册