1*86d7f5d3SJohn Marino /* $NetBSD: dm-log-userspace.h,v 1.1.1.1 2009/12/02 00:25:40 haad Exp $ */ 2*86d7f5d3SJohn Marino 3*86d7f5d3SJohn Marino /* 4*86d7f5d3SJohn Marino * Copyright (C) 2006-2009 Red Hat, Inc. 5*86d7f5d3SJohn Marino * 6*86d7f5d3SJohn Marino * This file is released under the LGPL. 7*86d7f5d3SJohn Marino */ 8*86d7f5d3SJohn Marino 9*86d7f5d3SJohn Marino #ifndef __DM_LOG_USERSPACE_H__ 10*86d7f5d3SJohn Marino #define __DM_LOG_USERSPACE_H__ 11*86d7f5d3SJohn Marino 12*86d7f5d3SJohn Marino #include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ 13*86d7f5d3SJohn Marino 14*86d7f5d3SJohn Marino /* 15*86d7f5d3SJohn Marino * The device-mapper userspace log module consists of a kernel component and 16*86d7f5d3SJohn Marino * a user-space component. The kernel component implements the API defined 17*86d7f5d3SJohn Marino * in dm-dirty-log.h. Its purpose is simply to pass the parameters and 18*86d7f5d3SJohn Marino * return values of those API functions between kernel and user-space. 19*86d7f5d3SJohn Marino * 20*86d7f5d3SJohn Marino * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. 21*86d7f5d3SJohn Marino * These request types represent the different functions in the device-mapper 22*86d7f5d3SJohn Marino * dirty log API. Each of these is described in more detail below. 23*86d7f5d3SJohn Marino * 24*86d7f5d3SJohn Marino * The user-space program must listen for requests from the kernel (representing 25*86d7f5d3SJohn Marino * the various API functions) and process them. 26*86d7f5d3SJohn Marino * 27*86d7f5d3SJohn Marino * User-space begins by setting up the communication link (error checking 28*86d7f5d3SJohn Marino * removed for clarity): 29*86d7f5d3SJohn Marino * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); 30*86d7f5d3SJohn Marino * addr.nl_family = AF_NETLINK; 31*86d7f5d3SJohn Marino * addr.nl_groups = CN_IDX_DM; 32*86d7f5d3SJohn Marino * addr.nl_pid = 0; 33*86d7f5d3SJohn Marino * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); 34*86d7f5d3SJohn Marino * opt = addr.nl_groups; 35*86d7f5d3SJohn Marino * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); 36*86d7f5d3SJohn Marino * 37*86d7f5d3SJohn Marino * User-space will then wait to receive requests form the kernel, which it 38*86d7f5d3SJohn Marino * will process as described below. The requests are received in the form, 39*86d7f5d3SJohn Marino * ((struct dm_ulog_request) + (additional data)). Depending on the request 40*86d7f5d3SJohn Marino * type, there may or may not be 'additional data'. In the descriptions below, 41*86d7f5d3SJohn Marino * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The 42*86d7f5d3SJohn Marino * 'Payload-to-userspace' is what the kernel sends in 'additional data' as 43*86d7f5d3SJohn Marino * necessary parameters to complete the request. The 'Payload-to-kernel' is 44*86d7f5d3SJohn Marino * the 'additional data' returned to the kernel that contains the necessary 45*86d7f5d3SJohn Marino * results of the request. The 'data_size' field in the dm_ulog_request 46*86d7f5d3SJohn Marino * structure denotes the availability and amount of payload data. 47*86d7f5d3SJohn Marino */ 48*86d7f5d3SJohn Marino 49*86d7f5d3SJohn Marino /* 50*86d7f5d3SJohn Marino * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): 51*86d7f5d3SJohn Marino * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, 52*86d7f5d3SJohn Marino * unsigned argc, char **argv); 53*86d7f5d3SJohn Marino * 54*86d7f5d3SJohn Marino * Payload-to-userspace: 55*86d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 56*86d7f5d3SJohn Marino * Payload-to-kernel: 57*86d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 58*86d7f5d3SJohn Marino * 59*86d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is the reference that 60*86d7f5d3SJohn Marino * will be used by all request types to a specific log. The constructor must 61*86d7f5d3SJohn Marino * record this assotiation with instance created. 62*86d7f5d3SJohn Marino * 63*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 64*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 65*86d7f5d3SJohn Marino * 'data_size' appropriately. 66*86d7f5d3SJohn Marino */ 67*86d7f5d3SJohn Marino #define DM_ULOG_CTR 1 68*86d7f5d3SJohn Marino 69*86d7f5d3SJohn Marino /* 70*86d7f5d3SJohn Marino * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): 71*86d7f5d3SJohn Marino * void (*dtr)(struct dm_dirty_log *log); 72*86d7f5d3SJohn Marino * 73*86d7f5d3SJohn Marino * Payload-to-userspace: 74*86d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 75*86d7f5d3SJohn Marino * Payload-to-kernel: 76*86d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 77*86d7f5d3SJohn Marino * 78*86d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 79*86d7f5d3SJohn Marino * necessary to identify the log instance being destroyed. There is no 80*86d7f5d3SJohn Marino * payload data. 81*86d7f5d3SJohn Marino * 82*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 83*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 84*86d7f5d3SJohn Marino * 'data_size' appropriately. 85*86d7f5d3SJohn Marino */ 86*86d7f5d3SJohn Marino #define DM_ULOG_DTR 2 87*86d7f5d3SJohn Marino 88*86d7f5d3SJohn Marino /* 89*86d7f5d3SJohn Marino * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): 90*86d7f5d3SJohn Marino * int (*presuspend)(struct dm_dirty_log *log); 91*86d7f5d3SJohn Marino * 92*86d7f5d3SJohn Marino * Payload-to-userspace: 93*86d7f5d3SJohn Marino * None. 94*86d7f5d3SJohn Marino * Payload-to-kernel: 95*86d7f5d3SJohn Marino * None. 96*86d7f5d3SJohn Marino * 97*86d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 98*86d7f5d3SJohn Marino * necessary to identify the log instance being presuspended. There is no 99*86d7f5d3SJohn Marino * payload data. 100*86d7f5d3SJohn Marino * 101*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 102*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 103*86d7f5d3SJohn Marino * 'data_size' appropriately. 104*86d7f5d3SJohn Marino */ 105*86d7f5d3SJohn Marino #define DM_ULOG_PRESUSPEND 3 106*86d7f5d3SJohn Marino 107*86d7f5d3SJohn Marino /* 108*86d7f5d3SJohn Marino * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): 109*86d7f5d3SJohn Marino * int (*postsuspend)(struct dm_dirty_log *log); 110*86d7f5d3SJohn Marino * 111*86d7f5d3SJohn Marino * Payload-to-userspace: 112*86d7f5d3SJohn Marino * None. 113*86d7f5d3SJohn Marino * Payload-to-kernel: 114*86d7f5d3SJohn Marino * None. 115*86d7f5d3SJohn Marino * 116*86d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 117*86d7f5d3SJohn Marino * necessary to identify the log instance being postsuspended. There is no 118*86d7f5d3SJohn Marino * payload data. 119*86d7f5d3SJohn Marino * 120*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 121*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 122*86d7f5d3SJohn Marino * 'data_size' appropriately. 123*86d7f5d3SJohn Marino */ 124*86d7f5d3SJohn Marino #define DM_ULOG_POSTSUSPEND 4 125*86d7f5d3SJohn Marino 126*86d7f5d3SJohn Marino /* 127*86d7f5d3SJohn Marino * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): 128*86d7f5d3SJohn Marino * int (*resume)(struct dm_dirty_log *log); 129*86d7f5d3SJohn Marino * 130*86d7f5d3SJohn Marino * Payload-to-userspace: 131*86d7f5d3SJohn Marino * None. 132*86d7f5d3SJohn Marino * Payload-to-kernel: 133*86d7f5d3SJohn Marino * None. 134*86d7f5d3SJohn Marino * 135*86d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 136*86d7f5d3SJohn Marino * necessary to identify the log instance being resumed. There is no 137*86d7f5d3SJohn Marino * payload data. 138*86d7f5d3SJohn Marino * 139*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 140*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 141*86d7f5d3SJohn Marino * 'data_size' appropriately. 142*86d7f5d3SJohn Marino */ 143*86d7f5d3SJohn Marino #define DM_ULOG_RESUME 5 144*86d7f5d3SJohn Marino 145*86d7f5d3SJohn Marino /* 146*86d7f5d3SJohn Marino * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): 147*86d7f5d3SJohn Marino * uint32_t (*get_region_size)(struct dm_dirty_log *log); 148*86d7f5d3SJohn Marino * 149*86d7f5d3SJohn Marino * Payload-to-userspace: 150*86d7f5d3SJohn Marino * None. 151*86d7f5d3SJohn Marino * Payload-to-kernel: 152*86d7f5d3SJohn Marino * uint64_t - contains the region size 153*86d7f5d3SJohn Marino * 154*86d7f5d3SJohn Marino * The region size is something that was determined at constructor time. 155*86d7f5d3SJohn Marino * It is returned in the payload area and 'data_size' is set to 156*86d7f5d3SJohn Marino * reflect this. 157*86d7f5d3SJohn Marino * 158*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 159*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field appropriately. 160*86d7f5d3SJohn Marino */ 161*86d7f5d3SJohn Marino #define DM_ULOG_GET_REGION_SIZE 6 162*86d7f5d3SJohn Marino 163*86d7f5d3SJohn Marino /* 164*86d7f5d3SJohn Marino * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): 165*86d7f5d3SJohn Marino * int (*is_clean)(struct dm_dirty_log *log, region_t region); 166*86d7f5d3SJohn Marino * 167*86d7f5d3SJohn Marino * Payload-to-userspace: 168*86d7f5d3SJohn Marino * uint64_t - the region to get clean status on 169*86d7f5d3SJohn Marino * Payload-to-kernel: 170*86d7f5d3SJohn Marino * int64_t - 1 if clean, 0 otherwise 171*86d7f5d3SJohn Marino * 172*86d7f5d3SJohn Marino * Payload is sizeof(uint64_t) and contains the region for which the clean 173*86d7f5d3SJohn Marino * status is being made. 174*86d7f5d3SJohn Marino * 175*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 176*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or 177*86d7f5d3SJohn Marino * 1 (clean), setting 'data_size' and 'error' appropriately. 178*86d7f5d3SJohn Marino */ 179*86d7f5d3SJohn Marino #define DM_ULOG_IS_CLEAN 7 180*86d7f5d3SJohn Marino 181*86d7f5d3SJohn Marino /* 182*86d7f5d3SJohn Marino * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): 183*86d7f5d3SJohn Marino * int (*in_sync)(struct dm_dirty_log *log, region_t region, 184*86d7f5d3SJohn Marino * int can_block); 185*86d7f5d3SJohn Marino * 186*86d7f5d3SJohn Marino * Payload-to-userspace: 187*86d7f5d3SJohn Marino * uint64_t - the region to get sync status on 188*86d7f5d3SJohn Marino * Payload-to-kernel: 189*86d7f5d3SJohn Marino * int64_t - 1 if in-sync, 0 otherwise 190*86d7f5d3SJohn Marino * 191*86d7f5d3SJohn Marino * Exactly the same as 'is_clean' above, except this time asking "has the 192*86d7f5d3SJohn Marino * region been recovered?" vs. "is the region not being modified?" 193*86d7f5d3SJohn Marino */ 194*86d7f5d3SJohn Marino #define DM_ULOG_IN_SYNC 8 195*86d7f5d3SJohn Marino 196*86d7f5d3SJohn Marino /* 197*86d7f5d3SJohn Marino * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): 198*86d7f5d3SJohn Marino * int (*flush)(struct dm_dirty_log *log); 199*86d7f5d3SJohn Marino * 200*86d7f5d3SJohn Marino * Payload-to-userspace: 201*86d7f5d3SJohn Marino * None. 202*86d7f5d3SJohn Marino * Payload-to-kernel: 203*86d7f5d3SJohn Marino * None. 204*86d7f5d3SJohn Marino * 205*86d7f5d3SJohn Marino * No incoming or outgoing payload. Simply flush log state to disk. 206*86d7f5d3SJohn Marino * 207*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 208*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 209*86d7f5d3SJohn Marino * 'data_size' appropriately. 210*86d7f5d3SJohn Marino */ 211*86d7f5d3SJohn Marino #define DM_ULOG_FLUSH 9 212*86d7f5d3SJohn Marino 213*86d7f5d3SJohn Marino /* 214*86d7f5d3SJohn Marino * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): 215*86d7f5d3SJohn Marino * void (*mark_region)(struct dm_dirty_log *log, region_t region); 216*86d7f5d3SJohn Marino * 217*86d7f5d3SJohn Marino * Payload-to-userspace: 218*86d7f5d3SJohn Marino * uint64_t [] - region(s) to mark 219*86d7f5d3SJohn Marino * Payload-to-kernel: 220*86d7f5d3SJohn Marino * None. 221*86d7f5d3SJohn Marino * 222*86d7f5d3SJohn Marino * Incoming payload contains the one or more regions to mark dirty. 223*86d7f5d3SJohn Marino * The number of regions contained in the payload can be determined from 224*86d7f5d3SJohn Marino * 'data_size/sizeof(uint64_t)'. 225*86d7f5d3SJohn Marino * 226*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 227*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 228*86d7f5d3SJohn Marino * 'data_size' appropriately. 229*86d7f5d3SJohn Marino */ 230*86d7f5d3SJohn Marino #define DM_ULOG_MARK_REGION 10 231*86d7f5d3SJohn Marino 232*86d7f5d3SJohn Marino /* 233*86d7f5d3SJohn Marino * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): 234*86d7f5d3SJohn Marino * void (*clear_region)(struct dm_dirty_log *log, region_t region); 235*86d7f5d3SJohn Marino * 236*86d7f5d3SJohn Marino * Payload-to-userspace: 237*86d7f5d3SJohn Marino * uint64_t [] - region(s) to clear 238*86d7f5d3SJohn Marino * Payload-to-kernel: 239*86d7f5d3SJohn Marino * None. 240*86d7f5d3SJohn Marino * 241*86d7f5d3SJohn Marino * Incoming payload contains the one or more regions to mark clean. 242*86d7f5d3SJohn Marino * The number of regions contained in the payload can be determined from 243*86d7f5d3SJohn Marino * 'data_size/sizeof(uint64_t)'. 244*86d7f5d3SJohn Marino * 245*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 246*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 247*86d7f5d3SJohn Marino * 'data_size' appropriately. 248*86d7f5d3SJohn Marino */ 249*86d7f5d3SJohn Marino #define DM_ULOG_CLEAR_REGION 11 250*86d7f5d3SJohn Marino 251*86d7f5d3SJohn Marino /* 252*86d7f5d3SJohn Marino * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): 253*86d7f5d3SJohn Marino * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); 254*86d7f5d3SJohn Marino * 255*86d7f5d3SJohn Marino * Payload-to-userspace: 256*86d7f5d3SJohn Marino * None. 257*86d7f5d3SJohn Marino * Payload-to-kernel: 258*86d7f5d3SJohn Marino * { 259*86d7f5d3SJohn Marino * int64_t i; -- 1 if recovery necessary, 0 otherwise 260*86d7f5d3SJohn Marino * uint64_t r; -- The region to recover if i=1 261*86d7f5d3SJohn Marino * } 262*86d7f5d3SJohn Marino * 'data_size' should be set appropriately. 263*86d7f5d3SJohn Marino * 264*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 265*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field appropriately. 266*86d7f5d3SJohn Marino */ 267*86d7f5d3SJohn Marino #define DM_ULOG_GET_RESYNC_WORK 12 268*86d7f5d3SJohn Marino 269*86d7f5d3SJohn Marino /* 270*86d7f5d3SJohn Marino * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): 271*86d7f5d3SJohn Marino * void (*set_region_sync)(struct dm_dirty_log *log, 272*86d7f5d3SJohn Marino * region_t region, int in_sync); 273*86d7f5d3SJohn Marino * 274*86d7f5d3SJohn Marino * Payload-to-userspace: 275*86d7f5d3SJohn Marino * { 276*86d7f5d3SJohn Marino * uint64_t - region to set sync state on 277*86d7f5d3SJohn Marino * int64_t - 0 if not-in-sync, 1 if in-sync 278*86d7f5d3SJohn Marino * } 279*86d7f5d3SJohn Marino * Payload-to-kernel: 280*86d7f5d3SJohn Marino * None. 281*86d7f5d3SJohn Marino * 282*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 283*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 284*86d7f5d3SJohn Marino * 'data_size' appropriately. 285*86d7f5d3SJohn Marino */ 286*86d7f5d3SJohn Marino #define DM_ULOG_SET_REGION_SYNC 13 287*86d7f5d3SJohn Marino 288*86d7f5d3SJohn Marino /* 289*86d7f5d3SJohn Marino * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): 290*86d7f5d3SJohn Marino * region_t (*get_sync_count)(struct dm_dirty_log *log); 291*86d7f5d3SJohn Marino * 292*86d7f5d3SJohn Marino * Payload-to-userspace: 293*86d7f5d3SJohn Marino * None. 294*86d7f5d3SJohn Marino * Payload-to-kernel: 295*86d7f5d3SJohn Marino * uint64_t - the number of in-sync regions 296*86d7f5d3SJohn Marino * 297*86d7f5d3SJohn Marino * No incoming payload. Kernel-bound payload contains the number of 298*86d7f5d3SJohn Marino * regions that are in-sync (in a size_t). 299*86d7f5d3SJohn Marino * 300*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 301*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 302*86d7f5d3SJohn Marino * 'data_size' appropriately. 303*86d7f5d3SJohn Marino */ 304*86d7f5d3SJohn Marino #define DM_ULOG_GET_SYNC_COUNT 14 305*86d7f5d3SJohn Marino 306*86d7f5d3SJohn Marino /* 307*86d7f5d3SJohn Marino * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): 308*86d7f5d3SJohn Marino * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, 309*86d7f5d3SJohn Marino * char *result, unsigned maxlen); 310*86d7f5d3SJohn Marino * 311*86d7f5d3SJohn Marino * Payload-to-userspace: 312*86d7f5d3SJohn Marino * None. 313*86d7f5d3SJohn Marino * Payload-to-kernel: 314*86d7f5d3SJohn Marino * Character string containing STATUSTYPE_INFO 315*86d7f5d3SJohn Marino * 316*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 317*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 318*86d7f5d3SJohn Marino * 'data_size' appropriately. 319*86d7f5d3SJohn Marino */ 320*86d7f5d3SJohn Marino #define DM_ULOG_STATUS_INFO 15 321*86d7f5d3SJohn Marino 322*86d7f5d3SJohn Marino /* 323*86d7f5d3SJohn Marino * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): 324*86d7f5d3SJohn Marino * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, 325*86d7f5d3SJohn Marino * char *result, unsigned maxlen); 326*86d7f5d3SJohn Marino * 327*86d7f5d3SJohn Marino * Payload-to-userspace: 328*86d7f5d3SJohn Marino * None. 329*86d7f5d3SJohn Marino * Payload-to-kernel: 330*86d7f5d3SJohn Marino * Character string containing STATUSTYPE_TABLE 331*86d7f5d3SJohn Marino * 332*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 333*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 334*86d7f5d3SJohn Marino * 'data_size' appropriately. 335*86d7f5d3SJohn Marino */ 336*86d7f5d3SJohn Marino #define DM_ULOG_STATUS_TABLE 16 337*86d7f5d3SJohn Marino 338*86d7f5d3SJohn Marino /* 339*86d7f5d3SJohn Marino * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): 340*86d7f5d3SJohn Marino * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); 341*86d7f5d3SJohn Marino * 342*86d7f5d3SJohn Marino * Payload-to-userspace: 343*86d7f5d3SJohn Marino * uint64_t - region to determine recovery status on 344*86d7f5d3SJohn Marino * Payload-to-kernel: 345*86d7f5d3SJohn Marino * { 346*86d7f5d3SJohn Marino * int64_t is_recovering; -- 0 if no, 1 if yes 347*86d7f5d3SJohn Marino * uint64_t in_sync_hint; -- lowest region still needing resync 348*86d7f5d3SJohn Marino * } 349*86d7f5d3SJohn Marino * 350*86d7f5d3SJohn Marino * When the request has been processed, user-space must return the 351*86d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 352*86d7f5d3SJohn Marino * 'data_size' appropriately. 353*86d7f5d3SJohn Marino */ 354*86d7f5d3SJohn Marino #define DM_ULOG_IS_REMOTE_RECOVERING 17 355*86d7f5d3SJohn Marino 356*86d7f5d3SJohn Marino /* 357*86d7f5d3SJohn Marino * (DM_ULOG_REQUEST_MASK & request_type) to get the request type 358*86d7f5d3SJohn Marino * 359*86d7f5d3SJohn Marino * Payload-to-userspace: 360*86d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 361*86d7f5d3SJohn Marino * Payload-to-kernel: 362*86d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 363*86d7f5d3SJohn Marino * 364*86d7f5d3SJohn Marino * We are reserving 8 bits of the 32-bit 'request_type' field for the 365*86d7f5d3SJohn Marino * various request types above. The remaining 24-bits are currently 366*86d7f5d3SJohn Marino * set to zero and are reserved for future use and compatibility concerns. 367*86d7f5d3SJohn Marino * 368*86d7f5d3SJohn Marino * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the 369*86d7f5d3SJohn Marino * request type from the 'request_type' field to maintain forward compatibility. 370*86d7f5d3SJohn Marino */ 371*86d7f5d3SJohn Marino #define DM_ULOG_REQUEST_MASK 0xFF 372*86d7f5d3SJohn Marino #define DM_ULOG_REQUEST_TYPE(request_type) \ 373*86d7f5d3SJohn Marino (DM_ULOG_REQUEST_MASK & (request_type)) 374*86d7f5d3SJohn Marino 375*86d7f5d3SJohn Marino struct dm_ulog_request { 376*86d7f5d3SJohn Marino /* 377*86d7f5d3SJohn Marino * The local unique identifier (luid) and the universally unique 378*86d7f5d3SJohn Marino * identifier (uuid) are used to tie a request to a specific 379*86d7f5d3SJohn Marino * mirror log. A single machine log could probably make due with 380*86d7f5d3SJohn Marino * just the 'luid', but a cluster-aware log must use the 'uuid' and 381*86d7f5d3SJohn Marino * the 'luid'. The uuid is what is required for node to node 382*86d7f5d3SJohn Marino * communication concerning a particular log, but the 'luid' helps 383*86d7f5d3SJohn Marino * differentiate between logs that are being swapped and have the 384*86d7f5d3SJohn Marino * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) 385*86d7f5d3SJohn Marino */ 386*86d7f5d3SJohn Marino uint64_t luid; 387*86d7f5d3SJohn Marino char uuid[DM_UUID_LEN]; 388*86d7f5d3SJohn Marino char padding[7]; /* Padding because DM_UUID_LEN = 129 */ 389*86d7f5d3SJohn Marino 390*86d7f5d3SJohn Marino int32_t error; /* Used to report back processing errors */ 391*86d7f5d3SJohn Marino 392*86d7f5d3SJohn Marino uint32_t seq; /* Sequence number for request */ 393*86d7f5d3SJohn Marino uint32_t request_type; /* DM_ULOG_* defined above */ 394*86d7f5d3SJohn Marino uint32_t data_size; /* How much data (not including this struct) */ 395*86d7f5d3SJohn Marino 396*86d7f5d3SJohn Marino char data[0]; 397*86d7f5d3SJohn Marino }; 398*86d7f5d3SJohn Marino 399*86d7f5d3SJohn Marino #endif /* __DM_LOG_USERSPACE_H__ */ 400