[BACK]Return to udf.h CVS log [TXT][DIR] Up to [local] / sys / isofs / udf

Annotation of sys/isofs/udf/udf.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: udf.h,v 1.11 2006/07/12 14:26:44 pedro Exp $  */
                      2:
                      3: /*
                      4:  * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     17:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     18:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     19:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
                     20:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     21:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     22:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     23:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     24:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     25:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     26:  * SUCH DAMAGE.
                     27:  *
                     28:  * $FreeBSD: src/sys/fs/udf/udf.h,v 1.9 2004/10/29 10:40:58 phk Exp $
                     29:  */
                     30:
                     31: /*
                     32:  * Ported to OpenBSD by Pedro Martelletto <pedro@openbsd.org> in February 2005.
                     33:  */
                     34:
                     35: #define UDF_HASHTBLSIZE 100
                     36:
                     37: struct unode {
                     38:        LIST_ENTRY(unode) u_le;
                     39:        struct vnode *u_vnode;
                     40:        struct vnode *u_devvp;
                     41:        struct umount *u_ump;
                     42:        struct lock u_lock;
                     43:        dev_t u_dev;
                     44:        ino_t u_ino;
                     45:        union {
                     46:                long u_diroff;
                     47:                long u_vatlen;
                     48:        } un_u;
                     49:        struct file_entry *u_fentry;
                     50: };
                     51:
                     52: #define        u_diroff        un_u.u_diroff
                     53: #define        u_vatlen        un_u.u_vatlen
                     54:
                     55: struct umount {
                     56:        int um_flags;
                     57:        struct mount *um_mountp;
                     58:        struct vnode *um_devvp;
                     59:        dev_t um_dev;
                     60:        int um_bsize;
                     61:        int um_bshift;
                     62:        int um_bmask;
                     63:        uint32_t um_start;
                     64:        uint32_t um_len;
                     65:        struct unode *um_vat;
                     66:        struct long_ad um_root_icb;
                     67:        LIST_HEAD(udf_hash_lh, unode) *um_hashtbl;
                     68:        u_long um_hashsz;
                     69:        struct mutex um_hashmtx;
                     70:        int um_psecs;
                     71:        int um_stbl_len;
                     72:        struct udf_sparing_table *um_stbl;
                     73: };
                     74:
                     75: #define        UDF_MNT_FIND_VAT        0x01    /* Indicates a VAT must be found */
                     76: #define        UDF_MNT_USES_VAT        0x02    /* Indicates a VAT must be used */
                     77:
                     78: struct udf_dirstream {
                     79:        struct unode    *node;
                     80:        struct umount   *ump;
                     81:        struct buf      *bp;
                     82:        uint8_t         *data;
                     83:        uint8_t         *buf;
                     84:        int             fsize;
                     85:        int             off;
                     86:        int             this_off;
                     87:        int             offset;
                     88:        int             size;
                     89:        int             error;
                     90:        int             fid_fragment;
                     91: };
                     92:
                     93: #define        VFSTOUDFFS(mp)  ((struct umount *)((mp)->mnt_data))
                     94: #define        VTOU(vp)        ((struct unode *)((vp)->v_data))
                     95:
                     96: /*
                     97:  * The block layer refers to things in terms of 512 byte blocks by default.
                     98:  * btodb() is expensive, so speed things up.
                     99:  * Can the block layer be forced to use a different block size?
                    100:  */
                    101: #define        RDSECTOR(devvp, sector, size, bp) \
                    102:        bread(devvp, sector << (ump->um_bshift - DEV_BSHIFT), size, NOCRED, bp)
                    103:
                    104: static __inline int
                    105: udf_readlblks(struct umount *ump, int sector, int size, struct buf **bp)
                    106: {
                    107:        return (RDSECTOR(ump->um_devvp, sector,
                    108:                         (size + ump->um_bmask) & ~ump->um_bmask, bp));
                    109: }
                    110:
                    111: /*
                    112:  * Produce a suitable file number from an ICB.  The passed in ICB is expected
                    113:  * to be in little endian (meaning that it hasn't been swapped for big
                    114:  * endian machines yet).
                    115:  * If the fileno resolves to 0, we might be in big trouble.
                    116:  * Assumes the ICB is a long_ad.  This struct is compatible with short_ad,
                    117:  *     but not ext_ad.
                    118:  */
                    119: static __inline ino_t
                    120: udf_getid(struct long_ad *icb)
                    121: {
                    122:        return (letoh32(icb->loc.lb_num));
                    123: }
                    124:
                    125: int udf_allocv(struct mount *, struct vnode **, struct proc *);
                    126: int udf_hashlookup(struct umount *, ino_t, int, struct vnode **);
                    127: int udf_hashins(struct unode *);
                    128: int udf_hashrem(struct unode *);
                    129: int udf_checktag(struct desc_tag *, uint16_t);
                    130:
                    131: typedef        uint16_t unicode_t;

CVSweb