nvm_subsystem_controller_management pci_bridge
API Reference Manual  /  4 Model-to-Model Interfaces  / 

nvme_namespace_management

Description
This interface is intended for implementing NVMe namespace management.

create_namespace creates a new NVMe namespace with the specified size and backing file. Returns 0 on success, or a negative error code on failure.

Parameters: - size: The size of the namespace in bytes. If 0, and file is not NULL, the size of the backing file is used. - file: Path to the backing file for the namespace. If NULL, a sparse backing store is used.

delete_namespace deletes an existing namespace identified by the given namespace ID. Returns 0 on success, or a negative error code on failure.

Parameters: - nsid: The namespace identifier to delete

delete_all_namespaces deletes all existing namespaces.

attach_namespace attaches a namespace to one or more controllers. Returns 0 on success, or a negative error code on failure.

Parameters: - nsid: The namespace identifier to attach - cntids: List of controller IDs to attach the namespace to

detach_namespace detaches a namespace from one or more controllers. Returns 0 on success, or a negative error code on failure.

Parameters: - nsid: The namespace identifier to detach - cntids: List of controller IDs to detach the namespace from

get_max_namespaces returns the maximum number of namespaces supported by the NVM subsystem.

get_namespaces returns a list of all currently active namespace identifiers in the subsystem. The returned attribute is a list that is structured as follows: `[image object, namespace id, uuid string, attached controllers list]`. The caller must free the returned attribute.

get_namespace_uuid retrieves the UUID of the specified namespace. Returns the UUID as a string, or NULL if the namespace doesn't exist.

Parameters: - nsid: The namespace identifier

get_namespace_size retrieves the size in bytes of the specified namespace. Returns the size, or 0 if the namespace doesn't exist.

Parameters: - nsid: The namespace identifier

get_total_disk_capacity returns the total disk capacity in bytes available to the NVM subsystem.

get_free_disk_capacity returns the free (unallocated) disk capacity in bytes available for new namespaces.

sanitize performs a sanitize operation on the NVM subsystem using the specified action. Returns 0 on success, or a negative error code on failure.

Parameters: - sanitize_action: The sanitize action to perform

SIM_INTERFACE(nvme_namespace_management)
{
        int (*create_namespace)(conf_object_t *obj, uint64 size, char *file);
        int (*delete_namespace)(conf_object_t *obj, uint32 nsid);
        void (*delete_all_namespaces)(conf_object_t *obj);
        int (*attach_namespace)(conf_object_t *obj, uint32 nsid,
                                attr_value_t *cntids);
        int (*detach_namespace)(conf_object_t *obj, uint32 nsid,
                                attr_value_t *cntids);
        uint32 (*get_max_namespaces)(conf_object_t *obj);
        attr_value_t (*get_namespaces)(conf_object_t *obj);
        bytes_t (*get_namespace_uuid)(conf_object_t *obj, uint32 nsid);
        uint64 (*get_namespace_size)(conf_object_t *obj, uint32 nsid);
        uint64 (*get_total_disk_capacity)(conf_object_t *obj);
        uint64 (*get_free_disk_capacity)(conf_object_t *obj);
        int (*sanitize)(conf_object_t *obj, uint8 sanitize_action);
};

#define NVME_NAMESPACE_MANAGEMENT_INTERFACE "nvme_namespace_management"

Execution Context
Cell Context for all methods.

nvm_subsystem_controller_management pci_bridge