From: James Morris <jmorris@namei.org>
To: Phillip Hellewell <phillip@hellewell.homeip.net>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
mike@halcrow.us, mhalcrow@us.ibm.com, mcthomps@us.ibm.com,
yoder1@us.ibm.com
Subject: Re: [PATCH 5/12: eCryptfs] Header declarations
Date: Thu, 3 Nov 2005 18:37:16 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.63.0511031833150.22256@excalibur.intercode> (raw)
In-Reply-To: <20051103035039.GE3005@sshock.rn.byu.edu>
On Wed, 2 Nov 2005, Phillip Hellewell wrote:
> +struct ecryptfs_password {
> + char password[ECRYPTFS_MAX_PASSWORD_LENGTH];
> + int password_size;
> + unsigned char salt[ECRYPTFS_SALT_SIZE];
> + int saltless; /* If set, this is the ``seed'' token from which
> + * other salted tokens are derived. Note that
> + * this is _not_ the same as a token that just
> + * has not received its salt yet. */
> + int hash_algo;
> + int hash_iterations;
> + /* Iterated-hash concatenation of salt and passphrase */
> + unsigned char session_key_encryption_key[ECRYPTFS_MAX_KEY_BYTES];
> + int session_key_encryption_key_size; /* In bytes */
> + int session_key_encryption_key_set;
> + /* Always in expanded hex */
> + unsigned char signature[ECRYPTFS_PASSWORD_SIG_SIZE + 1];
> +};
Generally, you should put the smallest components of a data structure at
the front, so the compiler can optimize alignment.
> +#define RECORDS_PER_PAGE(crypt_stats) (crypt_stats->extent_size / \
> + (crypt_stats->iv_bytes))
> +#define PG_IDX_TO_LWR_PG_IDX(crypt_stats, idx) \
> + ((idx / crypt_stats->records_per_page) + idx \
> + + crypt_stats->num_header_pages + 1)
> +#define RECORD_IDX(crypt_stats, idx) (idx % crypt_stats->records_per_page)
> +#define RECORD_OFFSET(crypt_stats, idx) \
> + (RECORD_IDX(crypt_stats, idx) * (crypt_stats->iv_bytes \
> + + crypt_stats->hmac_bytes))
> +#define LAST_RECORDS_PAGE_IDX(crypt_stats, idx) \
> + (PG_IDX_TO_LWR_PG_IDX(crypt_stats, idx) \
> + - RECORD_IDX(crypt_stats,idx) - 1)
These should all be static inline (and any other similar).
> + */
> +#define FILE_TO_PRIVATE(file) ((struct ecryptfs_file_info *)((file)->private_data))
> +#define FILE_TO_PRIVATE_SM(file) ((file)->private_data)
> +#define FILE_TO_LOWER(file) ((FILE_TO_PRIVATE(file))->wfi_file)
> +#define INODE_TO_PRIVATE(ino) ((struct ecryptfs_inode_info *)(ino)->u.generic_ip)
> +#define INODE_TO_PRIVATE_SM(ino) ((ino)->u.generic_ip)
> +#define INODE_TO_LOWER(ino) (INODE_TO_PRIVATE(ino)->wii_inode)
> +#define SUPERBLOCK_TO_PRIVATE(super) ((struct ecryptfs_sb_info *)(super)->s_fs_info)
> +#define SUPERBLOCK_TO_PRIVATE_SM(super) ((super)->s_fs_info)
> +#define SUPERBLOCK_TO_LOWER(super) (SUPERBLOCK_TO_PRIVATE(super)->wsi_sb)
> +#define DENTRY_TO_PRIVATE_SM(dentry) ((dentry)->d_fsdata)
> +#define DENTRY_TO_PRIVATE(dentry) ((struct ecryptfs_dentry_info *)(dentry)->d_fsdata)
> +#define DENTRY_TO_LOWER(dentry) (DENTRY_TO_PRIVATE(dentry)->wdi_dentry)
These macro names are too generic.
- James
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2005-11-03 23:37 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-03 3:32 [PATCH 0/12: eCryptfs] eCryptfs version 0.1 Phillip Hellewell
2005-11-03 3:42 ` [PATCH 1/12: eCryptfs] Makefile and Kconfig Phillip Hellewell
2005-11-03 15:21 ` Michael Thompson
2005-11-03 23:05 ` Greg KH
2005-11-04 16:09 ` Michael Thompson
2005-11-04 16:22 ` Anton Altaparmakov
2005-11-04 16:28 ` Michael Thompson
2005-11-04 16:35 ` Greg KH
2005-11-04 17:07 ` Michael Thompson
2005-11-03 3:43 ` [PATCH 2/12: eCryptfs] Documentation Phillip Hellewell
2005-11-03 3:43 ` [PATCH 3/12: eCryptfs] Makefile Phillip Hellewell
2005-11-03 3:49 ` [PATCH 4/12: eCryptfs] Main module functions Phillip Hellewell
2005-11-03 6:02 ` Greg KH
2005-11-03 15:09 ` Michael Thompson
2005-11-03 15:47 ` Alexey Dobriyan
2005-11-03 15:40 ` Michael Thompson
2005-11-03 21:34 ` Michael Thompson
2005-11-04 23:28 ` [PATCH: eCryptfs] Remove debug wrappers Michael Halcrow
2005-11-03 3:50 ` [PATCH 5/12: eCryptfs] Header declarations Phillip Hellewell
2005-11-03 23:37 ` James Morris [this message]
2005-11-03 3:51 ` [PATCH 6/12: eCryptfs] Superblock operations Phillip Hellewell
2005-11-03 23:47 ` James Morris
2005-11-03 3:52 ` [PATCH 7/12: eCryptfs] File operations Phillip Hellewell
2005-11-03 23:49 ` James Morris
2005-11-03 3:53 ` [PATCH 8/12: eCryptfs] Dentry operations Phillip Hellewell
2005-11-03 3:54 ` [PATCH 9/12: eCryptfs] Inode operations Phillip Hellewell
2005-11-03 23:51 ` James Morris
2005-11-04 0:24 ` Andreas Schwab
2005-11-04 6:29 ` James Morris
2005-11-03 3:55 ` [PATCH 10/12: eCryptfs] Mmap operations Phillip Hellewell
2005-11-03 5:32 ` Michael Halcrow
2005-11-07 20:39 ` [PATCH: eCryptfs] Encrypt on writepage() Michael Halcrow
2005-11-03 3:56 ` [PATCH 11/12: eCryptfs] Keystore Phillip Hellewell
2005-11-03 23:59 ` James Morris
2005-11-04 0:08 ` Michael Halcrow
2005-11-04 17:52 ` Timothy R. Chavez
2005-11-03 3:56 ` [PATCH 12/12: eCryptfs] Crypto functions Phillip Hellewell
2005-11-03 22:06 ` Dave Kleikamp
2005-11-03 22:25 ` Michael Thompson
2005-11-03 22:30 ` Dave Kleikamp
2005-11-04 0:08 ` James Morris
2005-11-04 0:14 ` Michael Halcrow
-- strict thread matches above, loose matches on Subject: below --
2005-11-19 4:11 [PATCH 0/12: eCryptfs] eCryptfs version 0.1 Phillip Hellewell
2005-11-19 4:18 ` [PATCH 5/12: eCryptfs] Header declarations Phillip Hellewell
2005-11-19 10:37 ` Pekka Enberg
2005-11-21 15:50 ` Michael Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.63.0511031833150.22256@excalibur.intercode \
--to=jmorris@namei.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcthomps@us.ibm.com \
--cc=mhalcrow@us.ibm.com \
--cc=mike@halcrow.us \
--cc=phillip@hellewell.homeip.net \
--cc=yoder1@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).