186d7f5d3SJohn Marino /* $NetBSD: dm-log-userspace.h,v 1.1.1.1 2009/12/02 00:25:40 haad Exp $ */ 286d7f5d3SJohn Marino 386d7f5d3SJohn Marino /* 486d7f5d3SJohn Marino * Copyright (C) 2006-2009 Red Hat, Inc. 586d7f5d3SJohn Marino * 686d7f5d3SJohn Marino * This file is released under the LGPL. 786d7f5d3SJohn Marino */ 886d7f5d3SJohn Marino 986d7f5d3SJohn Marino #ifndef __DM_LOG_USERSPACE_H__ 1086d7f5d3SJohn Marino #define __DM_LOG_USERSPACE_H__ 1186d7f5d3SJohn Marino 1286d7f5d3SJohn Marino #include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ 1386d7f5d3SJohn Marino 1486d7f5d3SJohn Marino /* 1586d7f5d3SJohn Marino * The device-mapper userspace log module consists of a kernel component and 1686d7f5d3SJohn Marino * a user-space component. The kernel component implements the API defined 1786d7f5d3SJohn Marino * in dm-dirty-log.h. Its purpose is simply to pass the parameters and 1886d7f5d3SJohn Marino * return values of those API functions between kernel and user-space. 1986d7f5d3SJohn Marino * 2086d7f5d3SJohn Marino * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. 2186d7f5d3SJohn Marino * These request types represent the different functions in the device-mapper 2286d7f5d3SJohn Marino * dirty log API. Each of these is described in more detail below. 2386d7f5d3SJohn Marino * 2486d7f5d3SJohn Marino * The user-space program must listen for requests from the kernel (representing 2586d7f5d3SJohn Marino * the various API functions) and process them. 2686d7f5d3SJohn Marino * 2786d7f5d3SJohn Marino * User-space begins by setting up the communication link (error checking 2886d7f5d3SJohn Marino * removed for clarity): 2986d7f5d3SJohn Marino * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); 3086d7f5d3SJohn Marino * addr.nl_family = AF_NETLINK; 3186d7f5d3SJohn Marino * addr.nl_groups = CN_IDX_DM; 3286d7f5d3SJohn Marino * addr.nl_pid = 0; 3386d7f5d3SJohn Marino * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); 3486d7f5d3SJohn Marino * opt = addr.nl_groups; 3586d7f5d3SJohn Marino * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); 3686d7f5d3SJohn Marino * 3786d7f5d3SJohn Marino * User-space will then wait to receive requests form the kernel, which it 3886d7f5d3SJohn Marino * will process as described below. The requests are received in the form, 3986d7f5d3SJohn Marino * ((struct dm_ulog_request) + (additional data)). Depending on the request 4086d7f5d3SJohn Marino * type, there may or may not be 'additional data'. In the descriptions below, 4186d7f5d3SJohn Marino * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The 4286d7f5d3SJohn Marino * 'Payload-to-userspace' is what the kernel sends in 'additional data' as 4386d7f5d3SJohn Marino * necessary parameters to complete the request. The 'Payload-to-kernel' is 4486d7f5d3SJohn Marino * the 'additional data' returned to the kernel that contains the necessary 4586d7f5d3SJohn Marino * results of the request. The 'data_size' field in the dm_ulog_request 4686d7f5d3SJohn Marino * structure denotes the availability and amount of payload data. 4786d7f5d3SJohn Marino */ 4886d7f5d3SJohn Marino 4986d7f5d3SJohn Marino /* 5086d7f5d3SJohn Marino * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): 5186d7f5d3SJohn Marino * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, 5286d7f5d3SJohn Marino * unsigned argc, char **argv); 5386d7f5d3SJohn Marino * 5486d7f5d3SJohn Marino * Payload-to-userspace: 5586d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 5686d7f5d3SJohn Marino * Payload-to-kernel: 5786d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 5886d7f5d3SJohn Marino * 5986d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is the reference that 6086d7f5d3SJohn Marino * will be used by all request types to a specific log. The constructor must 6186d7f5d3SJohn Marino * record this assotiation with instance created. 6286d7f5d3SJohn Marino * 6386d7f5d3SJohn Marino * When the request has been processed, user-space must return the 6486d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 6586d7f5d3SJohn Marino * 'data_size' appropriately. 6686d7f5d3SJohn Marino */ 6786d7f5d3SJohn Marino #define DM_ULOG_CTR 1 6886d7f5d3SJohn Marino 6986d7f5d3SJohn Marino /* 7086d7f5d3SJohn Marino * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): 7186d7f5d3SJohn Marino * void (*dtr)(struct dm_dirty_log *log); 7286d7f5d3SJohn Marino * 7386d7f5d3SJohn Marino * Payload-to-userspace: 7486d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 7586d7f5d3SJohn Marino * Payload-to-kernel: 7686d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 7786d7f5d3SJohn Marino * 7886d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 7986d7f5d3SJohn Marino * necessary to identify the log instance being destroyed. There is no 8086d7f5d3SJohn Marino * payload data. 8186d7f5d3SJohn Marino * 8286d7f5d3SJohn Marino * When the request has been processed, user-space must return the 8386d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 8486d7f5d3SJohn Marino * 'data_size' appropriately. 8586d7f5d3SJohn Marino */ 8686d7f5d3SJohn Marino #define DM_ULOG_DTR 2 8786d7f5d3SJohn Marino 8886d7f5d3SJohn Marino /* 8986d7f5d3SJohn Marino * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): 9086d7f5d3SJohn Marino * int (*presuspend)(struct dm_dirty_log *log); 9186d7f5d3SJohn Marino * 9286d7f5d3SJohn Marino * Payload-to-userspace: 9386d7f5d3SJohn Marino * None. 9486d7f5d3SJohn Marino * Payload-to-kernel: 9586d7f5d3SJohn Marino * None. 9686d7f5d3SJohn Marino * 9786d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 9886d7f5d3SJohn Marino * necessary to identify the log instance being presuspended. There is no 9986d7f5d3SJohn Marino * payload data. 10086d7f5d3SJohn Marino * 10186d7f5d3SJohn Marino * When the request has been processed, user-space must return the 10286d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 10386d7f5d3SJohn Marino * 'data_size' appropriately. 10486d7f5d3SJohn Marino */ 10586d7f5d3SJohn Marino #define DM_ULOG_PRESUSPEND 3 10686d7f5d3SJohn Marino 10786d7f5d3SJohn Marino /* 10886d7f5d3SJohn Marino * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): 10986d7f5d3SJohn Marino * int (*postsuspend)(struct dm_dirty_log *log); 11086d7f5d3SJohn Marino * 11186d7f5d3SJohn Marino * Payload-to-userspace: 11286d7f5d3SJohn Marino * None. 11386d7f5d3SJohn Marino * Payload-to-kernel: 11486d7f5d3SJohn Marino * None. 11586d7f5d3SJohn Marino * 11686d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 11786d7f5d3SJohn Marino * necessary to identify the log instance being postsuspended. There is no 11886d7f5d3SJohn Marino * payload data. 11986d7f5d3SJohn Marino * 12086d7f5d3SJohn Marino * When the request has been processed, user-space must return the 12186d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 12286d7f5d3SJohn Marino * 'data_size' appropriately. 12386d7f5d3SJohn Marino */ 12486d7f5d3SJohn Marino #define DM_ULOG_POSTSUSPEND 4 12586d7f5d3SJohn Marino 12686d7f5d3SJohn Marino /* 12786d7f5d3SJohn Marino * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): 12886d7f5d3SJohn Marino * int (*resume)(struct dm_dirty_log *log); 12986d7f5d3SJohn Marino * 13086d7f5d3SJohn Marino * Payload-to-userspace: 13186d7f5d3SJohn Marino * None. 13286d7f5d3SJohn Marino * Payload-to-kernel: 13386d7f5d3SJohn Marino * None. 13486d7f5d3SJohn Marino * 13586d7f5d3SJohn Marino * The UUID contained in the dm_ulog_request structure is all that is 13686d7f5d3SJohn Marino * necessary to identify the log instance being resumed. There is no 13786d7f5d3SJohn Marino * payload data. 13886d7f5d3SJohn Marino * 13986d7f5d3SJohn Marino * When the request has been processed, user-space must return the 14086d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 14186d7f5d3SJohn Marino * 'data_size' appropriately. 14286d7f5d3SJohn Marino */ 14386d7f5d3SJohn Marino #define DM_ULOG_RESUME 5 14486d7f5d3SJohn Marino 14586d7f5d3SJohn Marino /* 14686d7f5d3SJohn Marino * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): 14786d7f5d3SJohn Marino * uint32_t (*get_region_size)(struct dm_dirty_log *log); 14886d7f5d3SJohn Marino * 14986d7f5d3SJohn Marino * Payload-to-userspace: 15086d7f5d3SJohn Marino * None. 15186d7f5d3SJohn Marino * Payload-to-kernel: 15286d7f5d3SJohn Marino * uint64_t - contains the region size 15386d7f5d3SJohn Marino * 15486d7f5d3SJohn Marino * The region size is something that was determined at constructor time. 15586d7f5d3SJohn Marino * It is returned in the payload area and 'data_size' is set to 15686d7f5d3SJohn Marino * reflect this. 15786d7f5d3SJohn Marino * 15886d7f5d3SJohn Marino * When the request has been processed, user-space must return the 15986d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field appropriately. 16086d7f5d3SJohn Marino */ 16186d7f5d3SJohn Marino #define DM_ULOG_GET_REGION_SIZE 6 16286d7f5d3SJohn Marino 16386d7f5d3SJohn Marino /* 16486d7f5d3SJohn Marino * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): 16586d7f5d3SJohn Marino * int (*is_clean)(struct dm_dirty_log *log, region_t region); 16686d7f5d3SJohn Marino * 16786d7f5d3SJohn Marino * Payload-to-userspace: 16886d7f5d3SJohn Marino * uint64_t - the region to get clean status on 16986d7f5d3SJohn Marino * Payload-to-kernel: 17086d7f5d3SJohn Marino * int64_t - 1 if clean, 0 otherwise 17186d7f5d3SJohn Marino * 17286d7f5d3SJohn Marino * Payload is sizeof(uint64_t) and contains the region for which the clean 17386d7f5d3SJohn Marino * status is being made. 17486d7f5d3SJohn Marino * 17586d7f5d3SJohn Marino * When the request has been processed, user-space must return the 17686d7f5d3SJohn Marino * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or 17786d7f5d3SJohn Marino * 1 (clean), setting 'data_size' and 'error' appropriately. 17886d7f5d3SJohn Marino */ 17986d7f5d3SJohn Marino #define DM_ULOG_IS_CLEAN 7 18086d7f5d3SJohn Marino 18186d7f5d3SJohn Marino /* 18286d7f5d3SJohn Marino * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): 18386d7f5d3SJohn Marino * int (*in_sync)(struct dm_dirty_log *log, region_t region, 18486d7f5d3SJohn Marino * int can_block); 18586d7f5d3SJohn Marino * 18686d7f5d3SJohn Marino * Payload-to-userspace: 18786d7f5d3SJohn Marino * uint64_t - the region to get sync status on 18886d7f5d3SJohn Marino * Payload-to-kernel: 18986d7f5d3SJohn Marino * int64_t - 1 if in-sync, 0 otherwise 19086d7f5d3SJohn Marino * 19186d7f5d3SJohn Marino * Exactly the same as 'is_clean' above, except this time asking "has the 19286d7f5d3SJohn Marino * region been recovered?" vs. "is the region not being modified?" 19386d7f5d3SJohn Marino */ 19486d7f5d3SJohn Marino #define DM_ULOG_IN_SYNC 8 19586d7f5d3SJohn Marino 19686d7f5d3SJohn Marino /* 19786d7f5d3SJohn Marino * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): 19886d7f5d3SJohn Marino * int (*flush)(struct dm_dirty_log *log); 19986d7f5d3SJohn Marino * 20086d7f5d3SJohn Marino * Payload-to-userspace: 20186d7f5d3SJohn Marino * None. 20286d7f5d3SJohn Marino * Payload-to-kernel: 20386d7f5d3SJohn Marino * None. 20486d7f5d3SJohn Marino * 20586d7f5d3SJohn Marino * No incoming or outgoing payload. Simply flush log state to disk. 20686d7f5d3SJohn Marino * 20786d7f5d3SJohn Marino * When the request has been processed, user-space must return the 20886d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 20986d7f5d3SJohn Marino * 'data_size' appropriately. 21086d7f5d3SJohn Marino */ 21186d7f5d3SJohn Marino #define DM_ULOG_FLUSH 9 21286d7f5d3SJohn Marino 21386d7f5d3SJohn Marino /* 21486d7f5d3SJohn Marino * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): 21586d7f5d3SJohn Marino * void (*mark_region)(struct dm_dirty_log *log, region_t region); 21686d7f5d3SJohn Marino * 21786d7f5d3SJohn Marino * Payload-to-userspace: 21886d7f5d3SJohn Marino * uint64_t [] - region(s) to mark 21986d7f5d3SJohn Marino * Payload-to-kernel: 22086d7f5d3SJohn Marino * None. 22186d7f5d3SJohn Marino * 22286d7f5d3SJohn Marino * Incoming payload contains the one or more regions to mark dirty. 22386d7f5d3SJohn Marino * The number of regions contained in the payload can be determined from 22486d7f5d3SJohn Marino * 'data_size/sizeof(uint64_t)'. 22586d7f5d3SJohn Marino * 22686d7f5d3SJohn Marino * When the request has been processed, user-space must return the 22786d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 22886d7f5d3SJohn Marino * 'data_size' appropriately. 22986d7f5d3SJohn Marino */ 23086d7f5d3SJohn Marino #define DM_ULOG_MARK_REGION 10 23186d7f5d3SJohn Marino 23286d7f5d3SJohn Marino /* 23386d7f5d3SJohn Marino * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): 23486d7f5d3SJohn Marino * void (*clear_region)(struct dm_dirty_log *log, region_t region); 23586d7f5d3SJohn Marino * 23686d7f5d3SJohn Marino * Payload-to-userspace: 23786d7f5d3SJohn Marino * uint64_t [] - region(s) to clear 23886d7f5d3SJohn Marino * Payload-to-kernel: 23986d7f5d3SJohn Marino * None. 24086d7f5d3SJohn Marino * 24186d7f5d3SJohn Marino * Incoming payload contains the one or more regions to mark clean. 24286d7f5d3SJohn Marino * The number of regions contained in the payload can be determined from 24386d7f5d3SJohn Marino * 'data_size/sizeof(uint64_t)'. 24486d7f5d3SJohn Marino * 24586d7f5d3SJohn Marino * When the request has been processed, user-space must return the 24686d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 24786d7f5d3SJohn Marino * 'data_size' appropriately. 24886d7f5d3SJohn Marino */ 24986d7f5d3SJohn Marino #define DM_ULOG_CLEAR_REGION 11 25086d7f5d3SJohn Marino 25186d7f5d3SJohn Marino /* 25286d7f5d3SJohn Marino * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): 25386d7f5d3SJohn Marino * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); 25486d7f5d3SJohn Marino * 25586d7f5d3SJohn Marino * Payload-to-userspace: 25686d7f5d3SJohn Marino * None. 25786d7f5d3SJohn Marino * Payload-to-kernel: 25886d7f5d3SJohn Marino * { 25986d7f5d3SJohn Marino * int64_t i; -- 1 if recovery necessary, 0 otherwise 26086d7f5d3SJohn Marino * uint64_t r; -- The region to recover if i=1 26186d7f5d3SJohn Marino * } 26286d7f5d3SJohn Marino * 'data_size' should be set appropriately. 26386d7f5d3SJohn Marino * 26486d7f5d3SJohn Marino * When the request has been processed, user-space must return the 26586d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field appropriately. 26686d7f5d3SJohn Marino */ 26786d7f5d3SJohn Marino #define DM_ULOG_GET_RESYNC_WORK 12 26886d7f5d3SJohn Marino 26986d7f5d3SJohn Marino /* 27086d7f5d3SJohn Marino * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): 27186d7f5d3SJohn Marino * void (*set_region_sync)(struct dm_dirty_log *log, 27286d7f5d3SJohn Marino * region_t region, int in_sync); 27386d7f5d3SJohn Marino * 27486d7f5d3SJohn Marino * Payload-to-userspace: 27586d7f5d3SJohn Marino * { 27686d7f5d3SJohn Marino * uint64_t - region to set sync state on 27786d7f5d3SJohn Marino * int64_t - 0 if not-in-sync, 1 if in-sync 27886d7f5d3SJohn Marino * } 27986d7f5d3SJohn Marino * Payload-to-kernel: 28086d7f5d3SJohn Marino * None. 28186d7f5d3SJohn Marino * 28286d7f5d3SJohn Marino * When the request has been processed, user-space must return the 28386d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and clearing 28486d7f5d3SJohn Marino * 'data_size' appropriately. 28586d7f5d3SJohn Marino */ 28686d7f5d3SJohn Marino #define DM_ULOG_SET_REGION_SYNC 13 28786d7f5d3SJohn Marino 28886d7f5d3SJohn Marino /* 28986d7f5d3SJohn Marino * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): 29086d7f5d3SJohn Marino * region_t (*get_sync_count)(struct dm_dirty_log *log); 29186d7f5d3SJohn Marino * 29286d7f5d3SJohn Marino * Payload-to-userspace: 29386d7f5d3SJohn Marino * None. 29486d7f5d3SJohn Marino * Payload-to-kernel: 29586d7f5d3SJohn Marino * uint64_t - the number of in-sync regions 29686d7f5d3SJohn Marino * 29786d7f5d3SJohn Marino * No incoming payload. Kernel-bound payload contains the number of 29886d7f5d3SJohn Marino * regions that are in-sync (in a size_t). 29986d7f5d3SJohn Marino * 30086d7f5d3SJohn Marino * When the request has been processed, user-space must return the 30186d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 30286d7f5d3SJohn Marino * 'data_size' appropriately. 30386d7f5d3SJohn Marino */ 30486d7f5d3SJohn Marino #define DM_ULOG_GET_SYNC_COUNT 14 30586d7f5d3SJohn Marino 30686d7f5d3SJohn Marino /* 30786d7f5d3SJohn Marino * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): 30886d7f5d3SJohn Marino * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, 30986d7f5d3SJohn Marino * char *result, unsigned maxlen); 31086d7f5d3SJohn Marino * 31186d7f5d3SJohn Marino * Payload-to-userspace: 31286d7f5d3SJohn Marino * None. 31386d7f5d3SJohn Marino * Payload-to-kernel: 31486d7f5d3SJohn Marino * Character string containing STATUSTYPE_INFO 31586d7f5d3SJohn Marino * 31686d7f5d3SJohn Marino * When the request has been processed, user-space must return the 31786d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 31886d7f5d3SJohn Marino * 'data_size' appropriately. 31986d7f5d3SJohn Marino */ 32086d7f5d3SJohn Marino #define DM_ULOG_STATUS_INFO 15 32186d7f5d3SJohn Marino 32286d7f5d3SJohn Marino /* 32386d7f5d3SJohn Marino * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): 32486d7f5d3SJohn Marino * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, 32586d7f5d3SJohn Marino * char *result, unsigned maxlen); 32686d7f5d3SJohn Marino * 32786d7f5d3SJohn Marino * Payload-to-userspace: 32886d7f5d3SJohn Marino * None. 32986d7f5d3SJohn Marino * Payload-to-kernel: 33086d7f5d3SJohn Marino * Character string containing STATUSTYPE_TABLE 33186d7f5d3SJohn Marino * 33286d7f5d3SJohn Marino * When the request has been processed, user-space must return the 33386d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 33486d7f5d3SJohn Marino * 'data_size' appropriately. 33586d7f5d3SJohn Marino */ 33686d7f5d3SJohn Marino #define DM_ULOG_STATUS_TABLE 16 33786d7f5d3SJohn Marino 33886d7f5d3SJohn Marino /* 33986d7f5d3SJohn Marino * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): 34086d7f5d3SJohn Marino * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); 34186d7f5d3SJohn Marino * 34286d7f5d3SJohn Marino * Payload-to-userspace: 34386d7f5d3SJohn Marino * uint64_t - region to determine recovery status on 34486d7f5d3SJohn Marino * Payload-to-kernel: 34586d7f5d3SJohn Marino * { 34686d7f5d3SJohn Marino * int64_t is_recovering; -- 0 if no, 1 if yes 34786d7f5d3SJohn Marino * uint64_t in_sync_hint; -- lowest region still needing resync 34886d7f5d3SJohn Marino * } 34986d7f5d3SJohn Marino * 35086d7f5d3SJohn Marino * When the request has been processed, user-space must return the 35186d7f5d3SJohn Marino * dm_ulog_request to the kernel - setting the 'error' field and 35286d7f5d3SJohn Marino * 'data_size' appropriately. 35386d7f5d3SJohn Marino */ 35486d7f5d3SJohn Marino #define DM_ULOG_IS_REMOTE_RECOVERING 17 35586d7f5d3SJohn Marino 35686d7f5d3SJohn Marino /* 35786d7f5d3SJohn Marino * (DM_ULOG_REQUEST_MASK & request_type) to get the request type 35886d7f5d3SJohn Marino * 35986d7f5d3SJohn Marino * Payload-to-userspace: 36086d7f5d3SJohn Marino * A single string containing all the argv arguments separated by ' 's 36186d7f5d3SJohn Marino * Payload-to-kernel: 36286d7f5d3SJohn Marino * None. ('data_size' in the dm_ulog_request struct should be 0.) 36386d7f5d3SJohn Marino * 36486d7f5d3SJohn Marino * We are reserving 8 bits of the 32-bit 'request_type' field for the 36586d7f5d3SJohn Marino * various request types above. The remaining 24-bits are currently 36686d7f5d3SJohn Marino * set to zero and are reserved for future use and compatibility concerns. 36786d7f5d3SJohn Marino * 36886d7f5d3SJohn Marino * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the 36986d7f5d3SJohn Marino * request type from the 'request_type' field to maintain forward compatibility. 37086d7f5d3SJohn Marino */ 37186d7f5d3SJohn Marino #define DM_ULOG_REQUEST_MASK 0xFF 37286d7f5d3SJohn Marino #define DM_ULOG_REQUEST_TYPE(request_type) \ 37386d7f5d3SJohn Marino (DM_ULOG_REQUEST_MASK & (request_type)) 37486d7f5d3SJohn Marino 37586d7f5d3SJohn Marino struct dm_ulog_request { 37686d7f5d3SJohn Marino /* 37786d7f5d3SJohn Marino * The local unique identifier (luid) and the universally unique 37886d7f5d3SJohn Marino * identifier (uuid) are used to tie a request to a specific 37986d7f5d3SJohn Marino * mirror log. A single machine log could probably make due with 38086d7f5d3SJohn Marino * just the 'luid', but a cluster-aware log must use the 'uuid' and 38186d7f5d3SJohn Marino * the 'luid'. The uuid is what is required for node to node 38286d7f5d3SJohn Marino * communication concerning a particular log, but the 'luid' helps 38386d7f5d3SJohn Marino * differentiate between logs that are being swapped and have the 38486d7f5d3SJohn Marino * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) 38586d7f5d3SJohn Marino */ 38686d7f5d3SJohn Marino uint64_t luid; 38786d7f5d3SJohn Marino char uuid[DM_UUID_LEN]; 38886d7f5d3SJohn Marino char padding[7]; /* Padding because DM_UUID_LEN = 129 */ 38986d7f5d3SJohn Marino 39086d7f5d3SJohn Marino int32_t error; /* Used to report back processing errors */ 39186d7f5d3SJohn Marino 39286d7f5d3SJohn Marino uint32_t seq; /* Sequence number for request */ 39386d7f5d3SJohn Marino uint32_t request_type; /* DM_ULOG_* defined above */ 39486d7f5d3SJohn Marino uint32_t data_size; /* How much data (not including this struct) */ 39586d7f5d3SJohn Marino 39686d7f5d3SJohn Marino char data[0]; 39786d7f5d3SJohn Marino }; 39886d7f5d3SJohn Marino 39986d7f5d3SJohn Marino #endif /* __DM_LOG_USERSPACE_H__ */ 400