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/bsd/hfs/hfs_catalog.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 /*
    2  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 #ifndef __HFS_CATALOG__
   26 #define __HFS_CATALOG__
   27 
   28 #include <sys/appleapiopts.h>
   29 
   30 #ifdef KERNEL
   31 #ifdef __APPLE_API_PRIVATE
   32 #include <sys/namei.h>
   33 #include <sys/vnode.h>
   34 #include <sys/lock.h>
   35 
   36 #include <hfs/hfs_format.h>
   37 
   38 /* HFS Catalog */
   39 
   40 
   41 /*
   42  * Catalog ADTs
   43  *
   44  * The cat_desc, cat_attr, and cat_fork structures are
   45  * use to import/export data to/from the Catalog file.
   46  * The fields in these structures are always in BSD
   47  * runtime format (e.g. dates and names).
   48  */
   49  
   50 typedef u_int32_t       cnid_t;
   51 
   52 /*
   53  * Catalog Node Descriptor (runtime)
   54  */
   55 struct cat_desc {
   56         u_int8_t  cd_flags;       /* see below (8 bits) */
   57         u_int8_t  cd_encoding;    /* name encoding */
   58         int16_t   cd_namelen;     /* length of cnode name */
   59         char *    cd_nameptr;     /* pointer to cnode name */
   60         cnid_t    cd_parentcnid;  /* parent directory CNID */
   61         u_long    cd_hint;        /* catalog file hint */
   62         cnid_t    cd_cnid;        /* cnode id (for getattrlist) */
   63 };
   64 
   65 /* cd_flags */
   66 #define CD_HASBUF       0x01    /* allocated filename buffer */
   67 #define CD_DECOMPOSED   0x02    /* name is fully decomposed */
   68 #define CD_ISMETA       0x40    /* describes a metadata file */
   69 #define CD_ISDIR        0x80    /* describes a directory */
   70 
   71 /*
   72  * Catalog Node Attributes (runtime)
   73  */
   74 struct cat_attr {
   75         cnid_t          ca_fileid;      /* inode number (for stat) normally == cnid */
   76         mode_t          ca_mode;        /* file access mode and type (16 bits) */
   77         nlink_t         ca_nlink;       /* file link count (16 bit integer) */
   78         uid_t           ca_uid;         /* file owner */
   79         gid_t           ca_gid;         /* file group */
   80         dev_t           ca_rdev;        /* device a special file represents */
   81         time_t          ca_atime;       /* last access time */
   82         time_t          ca_mtime;       /* last data modification time */
   83         int32_t         ca_mtime_nsec;  /* last data modification time nanosec */
   84         time_t          ca_ctime;       /* last file status change */
   85         time_t          ca_itime;       /* file initialization time */
   86         time_t          ca_btime;       /* last backup time */
   87         u_long          ca_flags;       /* status flags (chflags) */
   88         union {
   89                 u_int32_t  cau_blocks;  /* total file blocks used (rsrc + data) */
   90                 u_int32_t  cau_entries; /* total directory entries (valence) */
   91         } ca_union;
   92         u_int8_t        ca_finderinfo[32]; /* Opaque Finder information */
   93 };
   94 /* Aliases for common fields */
   95 #define ca_blocks       ca_union.cau_blocks
   96 #define ca_entries      ca_union.cau_entries
   97 
   98 /*
   99  * Catalog Node Fork (runtime)
  100  *
  101  * NOTE: this is not the same as a struct HFSPlusForkData
  102  */
  103 struct cat_fork {
  104         u_int64_t      cf_size;        /* fork's logical size in bytes */
  105         union {
  106             u_int32_t  cfu_clump;      /* fork's clump size in bytes (sys files only) */
  107             u_int64_t  cfu_bytesread;  /* bytes read from this fork */
  108         } cf_union;
  109         u_int32_t      cf_vblocks;     /* virtual (unalloated) blocks */
  110         u_int32_t      cf_blocks;      /* total blocks used by this fork */
  111         struct HFSPlusExtentDescriptor  cf_extents[8];  /* initial set of extents */
  112 };
  113 
  114 #define cf_clump        cf_union.cfu_clump
  115 #define cf_bytesread    cf_union.cfu_bytesread
  116 
  117 
  118 /*
  119  * Catalog Node Entry
  120  *
  121  * A cat_entry is used for bulk enumerations (hfs_readdirattr).
  122  */
  123 struct cat_entry {
  124         struct cat_desc ce_desc;
  125         struct cat_attr ce_attr;
  126         off_t           ce_datasize;
  127         off_t           ce_rsrcsize;
  128         u_long          ce_datablks;
  129         u_long          ce_rsrcblks;
  130 };
  131 
  132 #define MAXCATENTRIES 8
  133 /*
  134  * Catalog Node Entry List
  135  *
  136  * A cat_entrylist is a list of Catalog Node Entries.
  137  */
  138 struct cat_entrylist {
  139         u_long  maxentries;    /* length of list */
  140         u_long  realentries;   /* valid entry count */
  141         struct cat_entry  entry[MAXCATENTRIES];   /* array of entries */
  142 };
  143 
  144 /*
  145  * Catalog Operations Hint
  146  *
  147  * lower 16 bits: count of B-tree insert operations
  148  * upper 16 bits: count of B-tree delete operations
  149  *
  150  */
  151 #define CAT_DELETE      0x00020000
  152 #define CAT_CREATE      0x00000002
  153 #define CAT_RENAME      0x00020002
  154 #define CAT_EXCHANGE    0x00020002
  155 
  156 typedef u_int32_t       catops_t;
  157 
  158 /*
  159  * The size of cat_cookie_t much match the size of
  160  * the nreserve struct (in BTreeNodeReserve.c).
  161  */
  162 typedef struct cat_cookie_t {
  163         char    opaque[24];
  164 } cat_cookie_t;
  165 
  166 /*
  167  * Catalog Interface
  168  *
  169  * These functions perform a catalog transactions. The
  170  * catalog b-tree is abstracted through this interface.
  171  * (please don't go around it)
  172  */
  173 
  174 struct hfsmount;
  175 
  176 extern void cat_releasedesc(struct cat_desc *descp);
  177 
  178 extern int cat_create ( struct hfsmount *hfsmp,
  179                         struct cat_desc *descp,
  180                         struct cat_attr *attrp,
  181                         struct cat_desc *out_descp);
  182 
  183 extern int cat_delete ( struct hfsmount *hfsmp,
  184                         struct cat_desc *descp,
  185                         struct cat_attr *attrp);
  186 
  187 extern int cat_lookup ( struct hfsmount *hfsmp,
  188                         struct cat_desc *descp,
  189                         int wantrsrc,
  190                         struct cat_desc *outdescp,
  191                         struct cat_attr *attrp,
  192                         struct cat_fork *forkp);
  193 
  194 extern int cat_idlookup (struct hfsmount *hfsmp,
  195                         cnid_t cnid,
  196                         struct cat_desc *outdescp,
  197                         struct cat_attr *attrp,
  198                         struct cat_fork *forkp);
  199 
  200 extern int cat_getentriesattr(
  201                         struct hfsmount *hfsmp,
  202                         struct cat_desc *prevdesc,
  203                         int index,
  204                         struct cat_entrylist *ce_list);
  205 
  206 extern int cat_rename ( struct hfsmount * hfsmp,
  207                         struct cat_desc * from_cdp,
  208                         struct cat_desc * todir_cdp,
  209                         struct cat_desc * to_cdp,
  210                         struct cat_desc * cdp);
  211 
  212 extern int cat_update ( struct hfsmount *hfsmp,
  213                         struct cat_desc *descp,
  214                         struct cat_attr *attrp,
  215                         struct cat_fork *dataforkp,
  216                         struct cat_fork *rsrcforkp);
  217 
  218 extern int cat_getdirentries(
  219                         struct hfsmount *hfsmp,
  220                         struct cat_desc *descp,
  221                         int entrycnt,
  222                         struct uio *uio,
  223                         int *eofflag,
  224                         u_long *cookies,
  225                         int ncookies);
  226 
  227 extern int cat_insertfilethread (
  228                         struct hfsmount *hfsmp,
  229                         struct cat_desc *descp);
  230 
  231 extern int cat_preflight(
  232                         struct hfsmount *hfsmp,
  233                         catops_t ops,
  234                         cat_cookie_t *cookie,
  235                         struct proc *p);
  236 
  237 extern void cat_postflight(
  238                         struct hfsmount *hfsmp,
  239                         cat_cookie_t *cookie,
  240                         struct proc *p);
  241 
  242 extern int cat_binarykeycompare(
  243                         HFSPlusCatalogKey *searchKey,
  244                         HFSPlusCatalogKey *trialKey);
  245 
  246 #endif /* __APPLE_API_PRIVATE */
  247 #endif /* KERNEL */
  248 #endif /* __HFS_CATALOG__ */

Cache object: 7513d2e33a13d3f191e493805d77e125


[ 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.