source: mainline/uspace/srv/fs/udf/udf.h

Last change on this file was 7ae01d5, checked in by Jiri Svoboda <jiri@…>, 14 months ago

Remove unused comm_size parameter of block_init()

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2024 Jiri Svoboda
3 * Copyright (c) 2008 Jakub Jermar
4 * Copyright (c) 2012 Julia Medvedeva
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 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - 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 * - The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/** @addtogroup udf
32 * @{
33 */
34
35#ifndef UDF_UDF_H_
36#define UDF_UDF_H_
37
38#include <fibril_synch.h>
39#include <libfs.h>
40#include <stddef.h>
41#include <stdint.h>
42#include <stdbool.h>
43#include "../../vfs/vfs.h"
44#include "udf_types.h"
45#include <adt/hash_table.h>
46
47#define UDF_NODE(node) \
48 ((node) ? (udf_node_t *) (node)->data : NULL)
49
50#define FS_NODE(node) \
51 ((node) ? (fs_node_t *) ((node)->fs_node) : NULL)
52
53#define BS_BLOCK 0
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 length;
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_length;
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 ht_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.