The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/adosfs/adosfs.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: adosfs.h,v 1.5 2005/02/26 22:58:54 perry Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1994 Christian E. Hopps
    5  * Copyright (c) 1996 Matthias Scheler
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by Christian E. Hopps.
   19  * 4. The name of the author may not be used to endorse or promote products
   20  *    derived from this software without specific prior written permission
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32  */
   33 
   34 /*
   35  * Arguments to mount amigados filesystems.
   36  */
   37 struct adosfs_args {
   38         char    *fspec;         /* blocks special holding the fs to mount */
   39         struct  export_args export;     /* network export information */
   40         uid_t   uid;            /* uid that owns adosfs files */
   41         gid_t   gid;            /* gid that owns adosfs files */
   42         mode_t  mask;           /* mask to be applied for adosfs perms */
   43 };
   44 
   45 #ifdef _KERNEL
   46 #include <sys/mallocvar.h>
   47 #include <miscfs/genfs/genfs_node.h>
   48 
   49 MALLOC_DECLARE(M_ANODE);
   50 
   51 /*
   52  * Amigados datestamp. (from 1/1/1978 00:00:00 local)
   53  */
   54 struct datestamp {
   55         u_int32_t days;
   56         u_int32_t mins;
   57         u_int32_t ticks;        /* 20000 * (ticks % 50) = useconds */
   58                                 /* ticks / 50 = seconds */
   59 };
   60 
   61 enum anode_type { AROOT, ADIR, AFILE, ALDIR, ALFILE, ASLINK };
   62 
   63 /* Maximum file/directory name */
   64 #define ADMAXNAMELEN            30
   65 
   66 /*
   67  * similar to inode's, we use to represent:
   68  * the root dir, reg dirs, reg files and extension blocks
   69  * note the ``tab'' is a hash table for r/d, and a data block
   70  * table for f/e. it is always ANODETABSZ(ap) bytes in size.
   71  */
   72 struct anode {
   73         struct genfs_node gnode;
   74         LIST_ENTRY(anode) link;
   75         enum anode_type type;
   76         char name[ADMAXNAMELEN+1];      /* (r/d/f) name for object */
   77         struct datestamp mtimev;        /* (r) volume modified */
   78         struct datestamp created;       /* (r) volume created */
   79         struct datestamp mtime; /* (r/d/f) last modified */
   80         struct adosfsmount *amp;        /* owner file system */
   81         struct vnode *vp;       /* owner vnode */
   82         u_long fsize;           /* (f) size of file in bytes */
   83         u_long block;           /* block num */
   84         u_long pblock;          /* (d/f/e) parent block */
   85         u_long hashf;           /* (d/f) hash forward */
   86         u_long extb;            /* (f/e) extension block number */
   87         u_long linkto;          /* (hd/hf) header this link points at */
   88         u_long linknext;        /* (d/f/hd/hf) next link (or head) in chain */
   89         u_long lastlindblk;     /* (f/hf) last logical indirect block */
   90         u_long lastindblk;      /* (f/hf) last indirect block read */
   91         u_long *tab;            /* (r/d) hash table */
   92         int *tabi;              /* (r/d) table info */
   93         int ntabent;            /* (r/d) number of entries in table */
   94         int nwords;             /* size of blocks in long words */
   95         int adprot;             /* (d/f) amigados protection bits */
   96         uid_t  uid;             /* (d/f) uid of directory/file */
   97         gid_t  gid;             /* (d/f) gid of directory/file */
   98         int flags;              /* misc flags */
   99         char *slinkto;          /* name of file or dir */
  100 };
  101 #define VTOA(vp)                ((struct anode *)(vp)->v_data)
  102 #define ATOV(ap)                ((ap)->vp)
  103 #define ANODETABSZ(ap)          (((ap)->nwords - 56) * sizeof(long))
  104 #define ANODETABENT(ap)         ((ap)->nwords - 56)
  105 #define ANODENDATBLKENT(ap)     ((ap)->nwords - 56)
  106 
  107 /*
  108  * mount data
  109  */
  110 #define ANODEHASHSZ (512)
  111 
  112 struct adosfsmount {
  113         LIST_HEAD(anodechain, anode) anodetab[ANODEHASHSZ];
  114         struct mount *mp;       /* owner mount */
  115         u_int32_t dostype;      /* type of volume */
  116         u_long rootb;           /* root block number */
  117         u_long secsperblk;      /* sectors per block */
  118         u_long bsize;           /* size of blocks */
  119         u_long nwords;          /* size of blocks in long words */
  120         u_long dbsize;          /* data bytes per block */
  121         uid_t  uid;             /* uid of mounting user */
  122         gid_t  gid;             /* gid of mounting user */
  123         u_long mask;            /* mode mask */
  124         struct vnode *devvp;    /* blk device mounted on */
  125         struct vnode *rootvp;   /* out root vnode */
  126         struct netexport export;
  127         u_long *bitmap;         /* allocation bitmap */
  128         u_long numblks;         /* number of usable blocks */
  129         u_long freeblks;        /* number of free blocks */
  130 };
  131 
  132 #define VFSTOADOSFS(mp) ((struct adosfsmount *)(mp)->mnt_data)
  133 
  134 #define IS_FFS(amp)     ((amp)->dostype & 1)
  135 #define IS_INTER(amp)   (((amp)->dostype & 7) > 1)
  136 
  137 /*
  138  * AmigaDOS block stuff.
  139  */
  140 #define BBOFF           (0)
  141 
  142 #define BPT_SHORT       ((u_int32_t)2)
  143 #define BPT_DATA        ((u_int32_t)8)
  144 #define BPT_LIST        ((u_int32_t)16)
  145 
  146 #define BST_RDIR        ((u_int32_t)1)
  147 #define BST_UDIR        ((u_int32_t)2)
  148 #define BST_SLINK       ((u_int32_t)3)
  149 #define BST_LDIR        ((u_int32_t)4)
  150 #define BST_FILE        ((u_int32_t)-3)
  151 #define BST_LFILE       ((u_int32_t)-4)
  152 
  153 #define OFS_DATA_OFFSET (24)
  154 
  155 extern struct pool adosfs_node_pool;
  156 
  157 /*
  158  * utility protos
  159  */
  160 #if BYTE_ORDER != BIG_ENDIAN
  161 u_int32_t adoswordn __P((struct buf *, int));
  162 #else
  163 #define adoswordn(bp,wn) (*((u_int32_t *)(bp)->b_data + (wn)))
  164 #endif
  165 
  166 u_int32_t adoscksum __P((struct buf *, int));
  167 int adoscaseequ __P((const u_char *, const u_char *, int, int));
  168 int adoshash __P((const u_char *, int, int, int));
  169 int adunixprot __P((int));
  170 int adosfs_getblktype __P((struct adosfsmount *, struct buf *));
  171 
  172 struct vnode *adosfs_ahashget __P((struct mount *, ino_t));
  173 void adosfs_ainshash __P((struct adosfsmount *, struct anode *));
  174 void adosfs_aremhash __P((struct anode *));
  175 
  176 int adosfs_lookup __P((void *));
  177 
  178 extern int (**adosfs_vnodeop_p) __P((void *));
  179 
  180 #ifdef SYSCTL_SETUP_PROTO
  181 SYSCTL_SETUP_PROTO(sysctl_vfs_adosfs_setup);
  182 #endif /* SYSCTL_SETUP_PROTO */
  183 #endif /* _KERNEL */

Cache object: b135faad8dfcd3cf76f4bc6a572143d2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.