~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/fs/adfs/adfs.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* Internal data structures for ADFS */
  2 
  3 #define ADFS_FREE_FRAG           0
  4 #define ADFS_BAD_FRAG            1
  5 #define ADFS_ROOT_FRAG           2
  6 
  7 #define ADFS_NDA_OWNER_READ     (1 << 0)
  8 #define ADFS_NDA_OWNER_WRITE    (1 << 1)
  9 #define ADFS_NDA_LOCKED         (1 << 2)
 10 #define ADFS_NDA_DIRECTORY      (1 << 3)
 11 #define ADFS_NDA_EXECUTE        (1 << 4)
 12 #define ADFS_NDA_PUBLIC_READ    (1 << 5)
 13 #define ADFS_NDA_PUBLIC_WRITE   (1 << 6)
 14 
 15 #include "dir_f.h"
 16 
 17 /*
 18  * Directory handling
 19  */
 20 struct adfs_dir {
 21         struct super_block      *sb;
 22 
 23         int                     nr_buffers;
 24         struct buffer_head      *bh[4];
 25         unsigned int            pos;
 26         unsigned int            parent_id;
 27 
 28         struct adfs_dirheader   dirhead;
 29         union  adfs_dirtail     dirtail;
 30 };
 31 
 32 /*
 33  * This is the overall maximum name length
 34  */
 35 #define ADFS_MAX_NAME_LEN       256
 36 struct object_info {
 37         __u32           parent_id;              /* parent object id     */
 38         __u32           file_id;                /* object id            */
 39         __u32           loadaddr;               /* load address         */
 40         __u32           execaddr;               /* execution address    */
 41         __u32           size;                   /* size                 */
 42         __u8            attr;                   /* RISC OS attributes   */
 43         unsigned char   name_len;               /* name length          */
 44         char            name[ADFS_MAX_NAME_LEN];/* file name            */
 45 };
 46 
 47 struct adfs_dir_ops {
 48         int     (*read)(struct super_block *sb, unsigned int id, unsigned int sz, struct adfs_dir *dir);
 49         int     (*setpos)(struct adfs_dir *dir, unsigned int fpos);
 50         int     (*getnext)(struct adfs_dir *dir, struct object_info *obj);
 51         int     (*update)(struct adfs_dir *dir, struct object_info *obj);
 52         int     (*create)(struct adfs_dir *dir, struct object_info *obj);
 53         int     (*remove)(struct adfs_dir *dir, struct object_info *obj);
 54         void    (*free)(struct adfs_dir *dir);
 55 };
 56 
 57 struct adfs_discmap {
 58         struct buffer_head      *dm_bh;
 59         __u32                   dm_startblk;
 60         unsigned int            dm_startbit;
 61         unsigned int            dm_endbit;
 62 };
 63 
 64 /* dir stuff */
 65 
 66 
 67 /* Inode stuff */
 68 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 69 int adfs_get_block(struct inode *inode, long block,
 70                    struct buffer_head *bh, int create);
 71 #else
 72 int adfs_bmap(struct inode *inode, int block);
 73 #endif
 74 struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
 75 void adfs_read_inode(struct inode *inode);
 76 void adfs_write_inode(struct inode *inode,int unused);
 77 int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
 78 
 79 /* map.c */
 80 extern int adfs_map_lookup(struct super_block *sb, int frag_id, int offset);
 81 extern unsigned int adfs_map_free(struct super_block *sb);
 82 
 83 /* Misc */
 84 void __adfs_error(struct super_block *sb, const char *function,
 85                   const char *fmt, ...);
 86 #define adfs_error(sb, fmt...) __adfs_error(sb, __FUNCTION__, fmt)
 87 
 88 /* namei.c */
 89 extern struct dentry *adfs_lookup(struct inode *dir, struct dentry *dentry);
 90 
 91 /* super.c */
 92 
 93 /*
 94  * Inodes and file operations
 95  */
 96 
 97 /* dir_*.c */
 98 extern struct inode_operations adfs_dir_inode_operations;
 99 extern struct file_operations adfs_dir_operations;
100 extern struct dentry_operations adfs_dentry_operations;
101 extern struct adfs_dir_ops adfs_f_dir_ops;
102 extern struct adfs_dir_ops adfs_fplus_dir_ops;
103 
104 extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
105 
106 /* file.c */
107 extern struct inode_operations adfs_file_inode_operations;
108 extern struct file_operations adfs_file_operations;
109 
110 extern inline __u32 signed_asl(__u32 val, signed int shift)
111 {
112         if (shift >= 0)
113                 val <<= shift;
114         else
115                 val >>= -shift;
116         return val;
117 }
118 
119 /*
120  * Calculate the address of a block in an object given the block offset
121  * and the object identity.
122  *
123  * The root directory ID should always be looked up in the map [3.4]
124  */
125 extern inline int
126 __adfs_block_map(struct super_block *sb, unsigned int object_id,
127                  unsigned int block)
128 {
129         if (object_id & 255) {
130                 unsigned int off;
131 
132                 off = (object_id & 255) - 1;
133                 block += off << sb->u.adfs_sb.s_log2sharesize;
134         }
135 
136         return adfs_map_lookup(sb, object_id >> 8, block);
137 }
138 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.