1#ifndef __SHMEM_FS_H
2#define __SHMEM_FS_H
3
4/* inode in-kernel data */
5
6#define SHMEM_NR_DIRECT 16
7
8/*
9 * A swap entry has to fit into a "unsigned long", as
10 * the entry is hidden in the "index" field of the
11 * swapper address space.
12 *
13 * We have to move it here, since not every user of fs.h is including
14 * mm.h, but mm.h is including fs.h via sched .h :-/
15 */
16typedef struct {
17	unsigned long val;
18} swp_entry_t;
19
20extern atomic_t shmem_nrpages;
21
22struct shmem_inode_info {
23	spinlock_t		lock;
24	struct semaphore 	sem;
25	unsigned long		next_index;
26	swp_entry_t		i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
27	void		      **i_indirect; /* indirect blocks */
28	unsigned long		swapped;
29	int			locked;     /* into memory */
30	struct list_head	list;
31	struct inode	       *inode;
32};
33
34struct shmem_sb_info {
35	unsigned long max_blocks;   /* How many blocks are allowed */
36	unsigned long free_blocks;  /* How many are left for allocation */
37	unsigned long max_inodes;   /* How many inodes are allowed */
38	unsigned long free_inodes;  /* How many are left for allocation */
39	spinlock_t    stat_lock;
40};
41
42#define SHMEM_I(inode)  (&inode->u.shmem_i)
43
44#endif
45