Merging upstream version 1.14.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
868b5312e8
commit
d6fd2fdea9
305 changed files with 20664 additions and 6099 deletions
59
plugins/amzn/amzn-nvme.c
Normal file
59
plugins/amzn/amzn-nvme.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "linux/nvme_ioctl.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "nvme.h"
|
||||
#include "nvme-print.h"
|
||||
#include "nvme-ioctl.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include "argconfig.h"
|
||||
#include "suffix.h"
|
||||
|
||||
#define CREATE_CMD
|
||||
#include "amzn-nvme.h"
|
||||
|
||||
struct nvme_vu_id_ctrl_field {
|
||||
__u8 bdev[32];
|
||||
__u8 reserved0[992];
|
||||
};
|
||||
|
||||
static void json_amzn_id_ctrl(struct nvme_vu_id_ctrl_field *id,
|
||||
char *bdev,
|
||||
struct json_object *root)
|
||||
{
|
||||
json_object_add_value_string(root, "bdev", bdev);
|
||||
}
|
||||
|
||||
static void amzn_id_ctrl(__u8 *vs, struct json_object *root)
|
||||
{
|
||||
struct nvme_vu_id_ctrl_field* id = (struct nvme_vu_id_ctrl_field *)vs;
|
||||
|
||||
char bdev[32] = { 0 };
|
||||
|
||||
int len = 0;
|
||||
while (len < 31) {
|
||||
if (id->bdev[++len] == ' ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
snprintf(bdev, len+1, "%s", id->bdev);
|
||||
|
||||
if (root) {
|
||||
json_amzn_id_ctrl(id, bdev, root);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("bdev : %s\n", bdev);
|
||||
}
|
||||
|
||||
static int id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
{
|
||||
return __id_ctrl(argc, argv, cmd, plugin, amzn_id_ctrl);
|
||||
}
|
17
plugins/amzn/amzn-nvme.h
Normal file
17
plugins/amzn/amzn-nvme.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#undef CMD_INC_FILE
|
||||
#define CMD_INC_FILE plugins/amzn/amzn-nvme
|
||||
|
||||
#if !defined(AMZN_NVME) || defined(CMD_HEADER_MULTI_READ)
|
||||
#define AMZN_NVME
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
PLUGIN(NAME("amzn", "Amazon vendor specific extensions"),
|
||||
COMMAND_LIST(
|
||||
ENTRY("id-ctrl", "Send NVMe Identify Controller", id_ctrl)
|
||||
)
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#include "define_cmd.h"
|
Loading…
Add table
Add a link
Reference in a new issue