File: obj40.h

package info (click to toggle)
reiser4progs 1.0.7-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,352 kB
  • ctags: 3,699
  • sloc: ansic: 33,483; sh: 8,489; makefile: 1,001
file content (154 lines) | stat: -rw-r--r-- 4,786 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* Copyright (C) 2001-2005 by Hans Reiser, licensing governed by
   reiser4progs/COPYING.
   
   obj40.h -- reiser4 file plugins common structures. */

#ifndef OBJ40_H
#define OBJ40_H

#include <sys/stat.h>

#ifndef ENABLE_MINIMAL
#  include <time.h>
#  include <unistd.h>
#endif

#include "reiser4/plugin.h"

extern reiser4_core_t *obj40_core;

#define STAT_PLACE(o) \
        (&((o)->info.start))

/* Returns the file position offset. */
static inline uint64_t obj40_offset(reiser4_object_t *obj) {
	return objcall(&obj->position, get_offset);
}

extern errno_t obj40_fini(reiser4_object_t *obj);
extern errno_t obj40_update(reiser4_object_t *obj);

extern uint64_t obj40_get_size(reiser4_object_t *obj);

extern bool_t obj40_valid_item(reiser4_place_t *place);
extern errno_t obj40_fetch_item(reiser4_place_t *place);

extern lookup_t obj40_belong(reiser4_place_t *place, reiser4_key_t *key);

extern lookup_t obj40_find_item(reiser4_object_t *obj, 
				reiser4_key_t *key, 
				lookup_bias_t bias, 
				coll_func_t func, 
				coll_hint_t *hint, 
				reiser4_place_t *place);

extern int64_t obj40_read(reiser4_object_t *obj, trans_hint_t *hint,
			  void *buff, uint64_t off, uint64_t count);

extern errno_t obj40_read_ext(reiser4_object_t *obj, rid_t id, void *data);

extern errno_t obj40_load_stat(reiser4_object_t *obj, stat_hint_t *hint);
extern errno_t obj40_save_stat(reiser4_object_t *obj, stat_hint_t *hint);

extern errno_t obj40_open(reiser4_object_t *obj);
extern errno_t obj40_seek(reiser4_object_t *obj, uint64_t offset);
extern errno_t obj40_reset(reiser4_object_t *obj);

typedef errno_t (*obj_func_t) (reiser4_object_t *, void *);

extern lookup_t obj40_update_body(reiser4_object_t *obj, 
				  obj_func_t adjust_func);

extern lookup_t obj40_next_item(reiser4_object_t *obj);

#ifndef ENABLE_MINIMAL
extern errno_t obj40_write_ext(reiser4_object_t *obj, rid_t id, void *data);

extern errno_t obj40_touch(reiser4_object_t *obj, int64_t size, int64_t bytes);

extern uint64_t obj40_extmask(reiser4_place_t *sd);
extern uint16_t obj40_get_mode(reiser4_object_t *obj);
extern int64_t  obj40_get_nlink(reiser4_object_t *obj, int update);
extern uint32_t obj40_get_atime(reiser4_object_t *obj);
extern uint32_t obj40_get_mtime(reiser4_object_t *obj);
extern uint64_t obj40_get_bytes(reiser4_object_t *obj);

extern errno_t obj40_clobber(reiser4_object_t *obj);

extern errno_t obj40_link(reiser4_object_t *obj);
extern errno_t obj40_unlink(reiser4_object_t *obj);
extern bool_t obj40_linked(reiser4_object_t *obj);

extern errno_t obj40_set_mode(reiser4_object_t *obj, uint16_t mode);
extern errno_t obj40_set_size(reiser4_object_t *obj, uint64_t size);
extern errno_t obj40_set_nlink(reiser4_object_t *obj, uint32_t nlink);
extern errno_t obj40_set_atime(reiser4_object_t *obj, uint32_t atime);
extern errno_t obj40_set_mtime(reiser4_object_t *obj, uint32_t mtime);
extern errno_t obj40_set_bytes(reiser4_object_t *obj, uint64_t bytes);

extern errno_t obj40_layout(reiser4_object_t *obj,
			    region_func_t region_func,
			    obj_func_t obj_func,
			    void *data);

extern errno_t obj40_metadata(reiser4_object_t *obj,
			      place_func_t place_func,
			      void *data);

extern errno_t obj40_traverse(reiser4_object_t *obj, 
			      place_func_t place_func, 
			      obj_func_t obj_func,
			      void *data);

extern errno_t obj40_remove(reiser4_object_t *obj, 
			    reiser4_place_t *place,
			    trans_hint_t *hint);

extern int64_t obj40_insert(reiser4_object_t *obj, 
			    reiser4_place_t *place,
			    trans_hint_t *hint, 
			    uint8_t level);

extern int64_t obj40_write(reiser4_object_t *obj, 
			   trans_hint_t *hint,
			   void *buff,
			   uint64_t off, 
			   uint64_t count, 
			   reiser4_item_plug_t *item_plug, 
			   place_func_t func,
			   void *data);

extern int64_t obj40_convert(reiser4_object_t *obj, conv_hint_t *hint);

extern int64_t obj40_cut(reiser4_object_t *obj, 
			 trans_hint_t *hint, 
			 uint64_t off, uint64_t count,
			 region_func_t func, void *data);

extern int64_t obj40_truncate(reiser4_object_t *obj, uint64_t n, 
			      reiser4_item_plug_t *item_plug);

extern errno_t obj40_stat_unix_init(stat_hint_t *stat, 
				    sdhint_unix_t *unixh, 
				    uint64_t bytes, 
				    uint64_t rdev);

extern errno_t obj40_stat_lw_init(reiser4_object_t *obj, 
				  stat_hint_t *stat, 
				  sdhint_lw_t *lwh, 
				  uint64_t size,  
				  uint32_t nlink, 
				  uint16_t mode);


extern errno_t obj40_inherit(object_info_t *info, object_info_t *parent);

extern errno_t obj40_create(reiser4_object_t *obj, object_hint_t *hint);

extern errno_t obj40_create_stat(reiser4_object_t *obj, 
				 uint64_t size, uint64_t bytes, 
				 uint64_t rdev, uint32_t nlink, 
				 uint16_t mode, char *path);

#endif
#endif