Next Debian release
[rrq/maintain_lilo.git] / src / device.h
1 /* device.h  -  Device access
2  * 
3  * Copyright 1992-1996 Werner Almesberger
4  * Copyright 1999-2004 John Coffman
5  * Copyright 2009-2011 Joachim Wiedorn
6  * All rights reserved.
7  * 
8  * Licensed under the terms contained in the file 'COPYING'
9  * in the source directory.
10  */
11
12 #ifndef DEVICE_H
13 #define DEVICE_H
14
15 #include <sys/stat.h>
16
17
18 typedef struct {
19     int fd;
20     struct stat st;
21     char *name;
22     int delete;
23 } DEVICE;
24
25
26 int dev_open(DEVICE *dev,int number,int flags);
27
28 /* Searches /dev for a block device with the specified number. If no device
29    can be found, a temporary device is created. The device is opened with
30    the specified access mode and the file descriptor is returned. If flags
31    are -1, the device is not opened. */
32
33
34
35 void dev_close(DEVICE *dev);
36
37 /* Closes a device that has previously been opened by dev_open. If the device
38    had to be created, it is removed now. */
39
40
41
42 void preload_dev_cache(void);
43
44 /* Preloads the device number to name cache. */
45
46
47
48 int make_backup(char *backup_file, int force_backup, BOOT_SECTOR *bsect,
49         unsigned int device, char *id);
50
51 /* make a backup, returning the timestamp of the backup file */
52
53
54
55 unsigned int register_bios(int bios, int device);
56
57 /* registers the bios to device association by serial number */
58
59
60 void dump_serial_nos(void);
61
62 /* debugging dump of the Volume Serial number table */
63
64
65 int serial_valid(unsigned int serial, int disk_bios);
66 /* determine validity of serial number; liberally if disk_bios==0x80 */
67
68
69 int pf_hard_disk_scan(void);
70 /* scan /proc/partitions for devices & partitions */
71
72 int yesno(char *prompt, int expect);
73 /* prompt the user for a yes/no response */
74
75 int new_serial(int device);
76 /* generate a new volumeID */
77
78 #endif