source: mainline/uspace/srv/fs/udf/udf.h@ 48e3190

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 48e3190 was 48e3190, checked in by Martin Decky <martin@…>, 13 years ago

cherrypick UDF file system driver implementation (originally by Julia Medvedeva)
with coding style improvements and minor changes

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2008 Jakub Jermar
3 * Copyright (c) 2012 Julia Medvedeva
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - 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 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup fs
31 * @{
32 */
33
34#ifndef UDF_UDF_H_
35#define UDF_UDF_H_
36
37#include <fibril_synch.h>
38#include <libfs.h>
39#include <atomic.h>
40#include <sys/types.h>
41#include <bool.h>
42#include "../../vfs/vfs.h"
43#include "udf_types.h"
44
45#define UDF_NODE(node) \
46 ((node) ? (udf_node_t *) (node)->data : NULL)
47
48#define FS_NODE(node) \
49 ((node) ? (fs_node_t *) ((node)->fs_node) : NULL)
50
51#define BS_BLOCK 0
52#define MIN_SIZE 512
53#define MAX_SIZE 8192
54#define DEFAULT_VOL 0
55
56#define NODE_DIR 0
57#define NODE_FILE 1
58
59#define MAX_FILE_NAME_LEN 512
60
61#define MIN_FID_LEN 38
62
63#define SPACE_TABLE 0
64#define SPACE_BITMAP 1
65
66typedef struct udf_partition {
67 /* Partition info */
68 uint16_t number;
69 uint32_t access_type;
70 uint32_t start;
71 uint32_t lenght;
72} udf_partition_t;
73
74typedef struct udf_lvolume {
75 udf_partition_t **partitions;
76 size_t partition_cnt;
77 uint32_t logical_block_size;
78 fs_index_t root_dir;
79} udf_lvolume_t;
80
81typedef struct {
82 service_id_t service_id;
83 size_t open_nodes_count;
84 udf_charspec_t charset;
85
86 uint32_t sector_size;
87 udf_lvolume_t *volumes;
88 udf_partition_t *partitions;
89 size_t partition_cnt;
90 udf_unallocated_space_descriptor_t *uasd;
91 uint64_t uaspace_start;
92 uint64_t uaspace_lenght;
93 uint8_t space_type;
94} udf_instance_t;
95
96typedef struct udf_allocator {
97 uint32_t length;
98 uint32_t position;
99} udf_allocator_t;
100
101typedef struct udf_node {
102 udf_instance_t *instance;
103 fs_node_t *fs_node;
104 fibril_mutex_t lock;
105
106 fs_index_t index; /* FID logical block */
107 link_t link;
108 size_t ref_cnt;
109 size_t link_cnt;
110
111 uint8_t type; /* 1 - file, 0 - directory */
112 uint64_t data_size;
113 uint8_t *data;
114 udf_allocator_t *allocators;
115 size_t alloc_size;
116} udf_node_t;
117
118extern vfs_out_ops_t udf_ops;
119extern libfs_ops_t udf_libfs_ops;
120
121#endif
122
123/**
124 * @}
125 */
Note: See TracBrowser for help on using the repository browser.