File: dvhlib.h

package info (click to toggle)
dvhtool 1.0.1-5
  • links: PTS
  • area: main
  • in suites: bullseye, buster, etch, etch-m68k, jessie, jessie-kfreebsd, lenny, squeeze, stretch, wheezy
  • size: 472 kB
  • ctags: 209
  • sloc: ansic: 1,517; sh: 896; makefile: 14
file content (49 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download | duplicates (4)
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
#include "config.h"

#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
typedef unsigned int uint32_t;		/* A guess ...  */
#endif

#include "dvh.h"

#ifndef HAVE___ATTRIBUTE__
#define __attribute__(x)
#endif

#ifndef HAVE_PREAD

extern ssize_t pread(int fd, void *buf, size_t nbytes, off_t offset);
extern ssize_t pwrite(int fd, __const void *buf, size_t n, off_t offset);

#endif

/*
 * Disk Volume Header Library
 */
struct dvh_handle {
	int dvh_fd;
	union {
		struct volume_header vh;
		uint32_t cs[sizeof(struct volume_header) / sizeof(uint32_t)];
	} dvh_vc;
};

#define dvh_vh dvh_vc.vh
#define dvh_cs dvh_vc.cs

#define DVH_READONLY 1
#define DVH_READWRITE 2

extern struct dvh_handle * dvh_open(const char *vh, int mode);
void extern dvh_close(struct dvh_handle *dvh);
extern void dvh_vh_remove(struct dvh_handle *dvh, const char *vh_name);
extern void dvh_vh_to_file(const struct dvh_handle *dvh, const char *vh_name,
                           const char *u_name);
extern void dvh_file_to_vh(struct dvh_handle *dvh, const char *u_name,
                           const char *dvh_name);
extern void dvh_print_vh(const struct dvh_handle *vh);
extern void dvh_print_vd(const struct dvh_handle *vh);
extern void dvh_print_pt(const struct dvh_handle *vh);
extern void __attribute__((noreturn)) die(const char *message);