1 #ifndef __OBD_SNAP_SUPP_H
2 #define __OBD_SNAP_SUPP_H
4 /* What we use to point to IDs in the obdmd data for snapshots. If we use
5 * obd_id (8 bytes) instead of ino_t (4 bytes), we halve the number of
6 * available snapshot slots (14 in 56 bytes vs. 7 in 56 bytes until we
7 * increase the size of OBD_OBDMDSZ).
11 /* maximum number of snapshot tables we maintain in the kernel */
12 #define SNAP_MAX_TABLES 8
14 /* maximum number of snapshots per device
15 must fit in "o_obdmd" area of struct obdo */
16 #define SNAP_MAX ((OBD_OBDMDSZ - sizeof(uint32_t))/sizeof(snap_id))
20 snap_id m_ids[SNAP_MAX]; /* id of snaps; slot 0 has current id */
24 /* if time is 0 this designates the "current" snapshot, i.e.
32 /* snap ioctl data for attach: current always in first slot of this array */
33 struct snap_obd_data {
34 int snap_dev; /* which device contains the data */
35 unsigned int snap_index;/* which snapshot is ours */
36 unsigned int snap_table;/* which table do we use */
40 /* snap ioctl data for table fiddling */
41 struct snap_table_data {
42 int tblcmd_no; /* which table */
43 unsigned int tblcmd_count; /* how many snaps */
44 struct snap tblcmd_snaps[SNAP_MAX]; /* sorted times! */
50 unsigned int tbl_count; /* how many snapshots exist in this table*/
51 int tbl_used; /* bitmap of snaps in use by a device */
52 time_t tbl_times[SNAP_MAX];
53 int tbl_index[SNAP_MAX];
56 struct snap_iterdata {
57 struct obd_conn *conn;
58 struct obd_conn *ch_conn;
66 inline struct obd_conn *child_conn(struct obd_conn *conn);
67 int snap_deleteobj(obd_id id, obd_gr group, void *data);
68 int snap_restoreobj(obd_id id, obd_gr group, void *data);
69 int snap_printobj(obd_id id, obd_gr group, void *data);
70 int snap_iocontrol(int cmd, struct obd_conn *conn, int len, void *karg, void *uarg);
72 /* In the future, this function may have to deal with offsets into the obdmd.
73 * Currently, we assume we have the whole obdmd struct.
75 static __inline__ struct snap_md *snap_obdmd(struct obdo *oa)
77 return ((struct snap_md *)(&oa->o_obdmd));