File: sdext_flags.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 (73 lines) | stat: -rw-r--r-- 1,809 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
/* Copyright (C) 2001-2005 by Hans Reiser, licensing governed by
   reiser4progs/COPYING.
   
   sdext_flags.c -- inode flags stat data extension plugin. */

#include "sdext_flags.h"

reiser4_core_t *sdext_flags_core = NULL;

/* Stat data extension length. */
static uint32_t sdext_flags_length(stat_entity_t *stat, void *hint) {
	return sizeof(sdext_flags_t);
}

#ifndef ENABLE_MINIMAL
/* Loads all extension fields to passed @hint. */
static errno_t sdext_flags_open(stat_entity_t *stat, void *hint) {
	sdext_flags_t *ext;
	sdhint_flags_t *flagsh;
    
	aal_assert("umka-3077", stat != NULL);
	aal_assert("umka-3078", hint != NULL);

	ext = (sdext_flags_t *)stat_body(stat);
	flagsh = (sdhint_flags_t *)hint;
	flagsh->flags = sdext_flags_get_flags(ext);
    
	return 0;
}

/* Saves all fields to passed extension @body. */
static errno_t sdext_flags_init(stat_entity_t *stat, void *hint) {
	sdhint_flags_t *flagsh;
    
	aal_assert("umka-3079", stat != NULL);
	aal_assert("umka-3080", hint != NULL);
	
	flagsh = (sdhint_flags_t *)hint;
    
	sdext_flags_set_flags((sdext_flags_t *)stat_body(stat),
			      flagsh->flags);

	return 0;
}

extern void sdext_flags_print(stat_entity_t *stat, 
			      aal_stream_t *stream,
			      uint16_t options);

extern errno_t sdext_flags_check_struct(stat_entity_t *stat,
					repair_hint_t *hint);
#endif

reiser4_sdext_plug_t sdext_flags_plug = {
	.p = {
		.id    = {SDEXT_FLAGS_ID, 0, SDEXT_PLUG_TYPE},
#ifndef ENABLE_MINIMAL
		.label = "sdext_flags",
		.desc  = "Inode flags stat data extension plugin.",
#endif
	},

#ifndef ENABLE_MINIMAL
	.open	   	= sdext_flags_open,
	.init	   	= sdext_flags_init,
	.print     	= sdext_flags_print,
	.check_struct	= sdext_flags_check_struct,
#else
	.open	   	= NULL,
#endif
	.info		= NULL,
	.length	   	= sdext_flags_length
};