diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-02-08 08:26:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-02-08 08:26:36 +0100 |
commit | 79606b51ed58819bd71bc6ca7d1a41185f83c89c (patch) | |
tree | ac057d11a56341df849761c9f08e6e8be353e3aa /include/linux/dcache.h | |
parent | 05261801e9cde103b3c4df843472027c007531da (diff) | |
parent | f0c29241001e44f6d29b757be9c7efeed6b0b2fe (diff) | |
download | barebox-79606b51ed58819bd71bc6ca7d1a41185f83c89c.tar.gz barebox-79606b51ed58819bd71bc6ca7d1a41185f83c89c.tar.xz |
Merge branch 'for-next/linux-headers'
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h new file mode 100644 index 0000000000..dfb466722c --- /dev/null +++ b/include/linux/dcache.h @@ -0,0 +1,80 @@ +#ifndef __LINUX_DCACHE_H +#define __LINUX_DCACHE_H + +/* + * linux/include/linux/dcache.h + * + * Dirent cache data structures + * + * (C) Copyright 1997 Thomas Schoebel-Theuer, + * with heavy changes by Linus Torvalds + */ + +#include <linux/list.h> +#include <linux/spinlock.h> + +#define IS_ROOT(x) ((x) == (x)->d_parent) + +/* The hash is always the low bits of hash_len */ +#ifdef __LITTLE_ENDIAN + #define HASH_LEN_DECLARE u32 hash; u32 len + #define bytemask_from_count(cnt) (~(~0ul << (cnt)*8)) +#else + #define HASH_LEN_DECLARE u32 len; u32 hash + #define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8)) +#endif + +/* + * "quick string" -- eases parameter passing, but more importantly + * saves "metadata" about the string (ie length and the hash). + * + * hash comes first so it snuggles against d_parent in the + * dentry. + */ +struct qstr { + union { + struct { + HASH_LEN_DECLARE; + }; + u64 hash_len; + }; + const unsigned char *name; +}; + +#define QSTR_INIT(n,l) { { { .len = l } }, .name = n } +#define hashlen_hash(hashlen) ((u32) (hashlen)) +#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) +#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash)) + +#define DNAME_INLINE_LEN_MIN 36 + +struct dentry { + unsigned int d_flags; /* protected by d_lock */ + spinlock_t d_lock; /* per dentry lock */ + struct inode *d_inode; /* Where the name belongs to - NULL is + * negative */ + /* + * The next three fields are touched by __d_lookup. Place them here + * so they all fit in a cache line. + */ + struct hlist_node d_hash; /* lookup hash list */ + struct dentry *d_parent; /* parent directory */ + struct qstr d_name; + + struct list_head d_lru; /* LRU list */ + /* + * d_child and d_rcu can share memory + */ + struct list_head d_subdirs; /* our children */ + struct list_head d_alias; /* inode alias list */ + unsigned long d_time; /* used by d_revalidate */ + struct super_block *d_sb; /* The root of the dentry tree */ + void *d_fsdata; /* fs-specific data */ +#ifdef CONFIG_PROFILING + struct dcookie_struct *d_cookie; /* cookie, if any */ +#endif + int d_mounted; + unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ +}; + +#endif /* __LINUX_DCACHE_H */ |