Changeset View
Standalone View
sys/sys/disk.h
Show All 13 Lines | |||||
#ifndef _SYS_DISK_H_ | #ifndef _SYS_DISK_H_ | ||||
#define _SYS_DISK_H_ | #define _SYS_DISK_H_ | ||||
#include <sys/ioccom.h> | #include <sys/ioccom.h> | ||||
#include <sys/kerneldump.h> | #include <sys/kerneldump.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/disk_zone.h> | #include <sys/disk_zone.h> | ||||
#include <sys/socket.h> | |||||
#include <net/if.h> | |||||
#include <netinet/in.h> | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#ifndef _SYS_CONF_H_ | #ifndef _SYS_CONF_H_ | ||||
#include <sys/conf.h> /* XXX: temporary to avoid breakage */ | #include <sys/conf.h> /* XXX: temporary to avoid breakage */ | ||||
#endif | #endif | ||||
void disk_err(struct bio *bp, const char *what, int blkdone, int nl); | void disk_err(struct bio *bp, const char *what, int blkdone, int nl); | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | union { | ||||
int i; | int i; | ||||
uint16_t u16; | uint16_t u16; | ||||
} value; | } value; | ||||
}; | }; | ||||
#define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg) | #define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg) | ||||
#define DIOCZONECMD _IOWR('d', 143, struct disk_zone_args) | #define DIOCZONECMD _IOWR('d', 143, struct disk_zone_args) | ||||
struct diocskerneldump_arg_freebsd12 { | |||||
uint8_t kda12_enable; | |||||
uint8_t kda12_compression; | |||||
uint8_t kda12_encryption; | |||||
uint8_t kda12_key[KERNELDUMP_KEY_MAX_SIZE]; | |||||
uint32_t kda12_encryptedkeysize; | |||||
uint8_t *kda12_encryptedkey; | |||||
}; | |||||
#define DIOCSKERNELDUMP_FREEBSD12 \ | |||||
_IOW('d', 144, struct diocskerneldump_arg_freebsd12) | |||||
/* | |||||
* Sentinel values for kda_index. | |||||
* | |||||
* If kda_index is KDA_REMOVE_ALL, all dump configurations are cleared. | |||||
* | |||||
* If kda_index is KDA_REMOVE_DEV, all dump configurations for the specified | |||||
* device are cleared. | |||||
* | |||||
* If kda_index is KDA_REMOVE, only the specified dump configuration for the | |||||
* given device is removed from the list of fallback dump configurations. | |||||
* | |||||
* If kda_index is KDA_APPEND, the dump configuration is added after all | |||||
* existing dump configurations. | |||||
* | |||||
* Otherwise, the new configuration is inserted into the fallback dump list at | |||||
* index 'kda_index'. | |||||
*/ | |||||
#define KDA_REMOVE UINT8_MAX | |||||
#define KDA_REMOVE_ALL (UINT8_MAX - 1) | |||||
#define KDA_REMOVE_DEV (UINT8_MAX - 2) | |||||
#define KDA_APPEND (UINT8_MAX - 3) | |||||
struct diocskerneldump_arg { | struct diocskerneldump_arg { | ||||
uint8_t kda_enable; | uint8_t kda_index; | ||||
uint8_t kda_compression; | uint8_t kda_compression; | ||||
uint8_t kda_encryption; | uint8_t kda_encryption; | ||||
uint8_t kda_key[KERNELDUMP_KEY_MAX_SIZE]; | uint8_t kda_key[KERNELDUMP_KEY_MAX_SIZE]; | ||||
uint32_t kda_encryptedkeysize; | uint32_t kda_encryptedkeysize; | ||||
uint8_t *kda_encryptedkey; | uint8_t *kda_encryptedkey; | ||||
char kda_iface[IFNAMSIZ]; | |||||
struct in_addr kda_server; | |||||
struct in_addr kda_client; | |||||
struct in_addr kda_gateway; | |||||
markj: We will probably want to permit these to be IPv6 addresses. That can be done as a separate… | |||||
cemAuthorUnsubmitted Done Inline ActionsHm, it'll be another ABI break too. That's a bit unfortunate; I'd like to avoid a second round of compatibility ABI for older versions of head. Maybe we should just make that change now (without adding ipv6 support to dumpon/netdump, just adding union types to the ABI interface)? It'd require minor fiddling in NETDUMPGCONF_FREEBSD12, but otherwise should be straightforward, I think. (I don't see any good named union type for in_addr+in6_addr — outside of ofed's cma_ip_addr — but it's a widely used construct in the tree — nfs, tcp_lro, tcp_fastopen, ip_fw, pf, if_llatbl all seem to have some kind of definition.) There's in_dependaddr but I'm not sure in_addr_4in6 is the most appropriate spelling of in_addr given the way we would use it. I'm leaning towards defining a new type. cem: Hm, it'll be another ABI break too. That's a bit unfortunate; I'd like to avoid a second round… | |||||
markjUnsubmitted Done Inline ActionsWe don't provide compatibility guarantees in head, so we can just break the interface. (Hence "before 13.0.") I think we can (ab)use struct sockaddr? markj: We don't provide compatibility guarantees in head, so we can just break the interface. (Hence… | |||||
cemAuthorUnsubmitted Done Inline ActionsSure, but I'm only adding "12" abi compatibility for slightly older head, not because I actually care about running 12 world (dumpon in particular) on a 13 kernel. The idea is to make the transition less painful for head consumers / crashboxes that regularly up/downgrade kernels, so the single step seems better to me. Sockaddr isn't big enough and/or doesn't represent the right thing. It's the same size as in6_addr but doesn't logically represent an in6_addr. sockaddr_storage is closer, but huge overkill. sockaddr_in / sockaddr_in6 have a lot of redundant stuff we don't care about for this use, I think. I'll put something together. cem: Sure, but I'm only adding "12" abi compatibility for slightly older head, not because I… | |||||
markjUnsubmitted Not Done Inline ActionsI don't see what's wrong with sockaddr_storage. It's larger than is needed but that doesn't matter for a rarely executed ioctl, and it's standard to use that in code that is address family-agnostic. And sys/_sockaddr_storage.h will introduce less pollution in sys/disk.h. markj: I don't see what's wrong with sockaddr_storage. It's larger than is needed but that doesn't… | |||||
cemAuthorUnsubmitted Done Inline ActionsNothing wrong with sockaddr_storage, really. Mostly it just makes the interface more general in a way that isn't helpful (requires more boilerplate to check for EINVAL input). We can use it instead, if you would prefer. cem: Nothing wrong with sockaddr_storage, really. Mostly it just makes the interface more general… | |||||
markjUnsubmitted Not Done Inline ActionsI think I'd still prefer it to a hand-rolled structure. Is the extra boilerplate just that we have to check the AF of each field instead of one? markj: I think I'd still prefer it to a hand-rolled structure. Is the extra boilerplate just that we… | |||||
cemAuthorUnsubmitted Done Inline ActionsYeah. And whatever ambiguity surrounds other fields that matter for sockets but not hosts, eg flowid, port, etc. cem: Yeah. And whatever ambiguity surrounds other fields that matter for sockets but not hosts, eg… | |||||
cemAuthorUnsubmitted Done Inline ActionsAlso that sockaddr_storage is an array type rather than a union and all real access requires ugly casting; and we don't save anything in header includes because we need net/if.h which means we pull in the in/in6 addr types already. cem: Also that sockaddr_storage is an array type rather than a union and all real access requires… | |||||
cemAuthorUnsubmitted Done Inline ActionsI've rototilled sockaddr_storage into just dumpon alone (to give it a shot) and it is really really ugly. And there would be a large number of additional churn involving sockaddr_in casts in netdump_client.c to finish the job. I don't think sockaddr_storage is a suitable type for this use case (and it's only used with BSD sockets for legacy API reasons). So I don't plan to continue converting to sockaddr_storage — I'll just leave it with the address union instead. cem: I've rototilled sockaddr_storage into just dumpon alone (to give it a shot) and it is really… | |||||
}; | }; | ||||
#define DIOCSKERNELDUMP _IOW('d', 144, struct diocskerneldump_arg) | _Static_assert(__offsetof(struct diocskerneldump_arg, kda_iface) == | ||||
sizeof(struct diocskerneldump_arg_freebsd12), "simplifying assumption"); | |||||
#define DIOCSKERNELDUMP _IOW('d', 145, struct diocskerneldump_arg) | |||||
/* | /* | ||||
* Enable/Disable the device for kernel core dumps. | * Enable/Disable the device for kernel core dumps. | ||||
*/ | |||||
#define DIOCGKERNELDUMP _IOWR('d', 146, struct diocskerneldump_arg) | |||||
/* | |||||
* Get current kernel netdump configuration details for a given index. | |||||
*/ | */ | ||||
#endif /* _SYS_DISK_H_ */ | #endif /* _SYS_DISK_H_ */ |
We will probably want to permit these to be IPv6 addresses. That can be done as a separate change before 13.0.