File: sdext_flags_repair.c

package info (click to toggle)
reiser4progs 1.0.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,348 kB
  • ctags: 3,714
  • sloc: ansic: 33,468; sh: 8,489; makefile: 1,012
file content (52 lines) | stat: -rw-r--r-- 1,392 bytes parent folder | download | duplicates (5)
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
/* Copyright 2001-2005 by Hans Reiser, licensing governed by
   reiser4progs/COPYING.
   
   sdext_flags_repair.c -- inode flags stat data extension plugin recovery
   code. */

#ifndef ENABLE_MINIMAL
#include "sdext_flags.h"
#include <repair/plugin.h>

#include "sdext_flags.h"

errno_t sdext_flags_check_struct(stat_entity_t *stat, repair_hint_t *hint) {
	aal_assert("umka-3081", stat != NULL);
	aal_assert("umka-3082", stat->plug != NULL);
	
	if (stat->offset + sizeof(sdext_flags_t) > stat->place->len) {
		fsck_mess("Node (%llu), item (%u), [%s]: does not look "
			  "like a valid (%s) statdata extension.", 
			  place_blknr(stat->place), stat->place->pos.item,
			  print_key(sdext_flags_core, &stat->place->key),
			  stat->plug->p.label);
		return RE_FATAL;
	}
	
	return 0;
}

/* Prints extension into passed @stream. */
void sdext_flags_print(stat_entity_t *stat, 
		       aal_stream_t *stream,
		       uint16_t options)
{
	sdext_flags_t *ext;
	
	aal_assert("umka-3083", stat != NULL);
	aal_assert("umka-3084", stream != NULL);

	ext = (sdext_flags_t *)stat_body(stat);

	if (sizeof(sdext_flags_t) + stat->offset > stat->place->len) {
		aal_stream_format(stream, "No enough space (%u bytes) "
				  "for the flags extention body.\n", 
				  stat->place->len - stat->offset);
		return;
	}
	
	aal_stream_format(stream, "flags:\t\t%u\n",
			  sdext_flags_get_flags(ext));
}

#endif