Skip to content

Commit aaabf50

Browse files
committed
Add new public facing API nvc_nvcaps_style()
It returns what type of nvidia-capabilities are supported. Choices are {none, proc-based, dev-based}. Signed-off-by: Kevin Klues <[email protected]>
1 parent c9bfd1c commit aaabf50

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

pkg/deb/libnvidia-container@[email protected]

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ libnvidia-container.so.1 libnvidia-container1 #MINVER#
1010
nvc_context_new@NVC_1.0 1.2.0~rc.3
1111
nvc_device_info_free@NVC_1.0 1.2.0~rc.3
1212
nvc_device_info_new@NVC_1.0 1.2.0~rc.3
13+
nvc_nvcaps_style@NVC_1.0 1.2.0~rc.3
1314
nvc_nvcaps_device_from_proc_path@NVC_1.0 1.2.0~rc.3
1415
nvc_device_mount@NVC_1.0 1.2.0~rc.3
1516
nvc_mig_device_access_caps_mount@NVC_1.0 1.2.0~rc.3

src/libnvidia-container.lds

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ VERSION {
3333
nvc_device_info_free;
3434
nvc_driver_mount;
3535
nvc_device_mount;
36+
nvc_nvcaps_style;
3637
nvc_nvcaps_device_from_proc_path;
3738
nvc_mig_device_access_caps_mount;
3839
nvc_mig_config_global_caps_mount;

src/nvc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ extern "C" {
2020

2121
#define NVC_ARG_MAX 256
2222

23+
#define NVC_NVCAPS_STYLE_NONE 0
24+
#define NVC_NVCAPS_STYLE_PROC 1
25+
#define NVC_NVCAPS_STYLE_DEV 2
26+
2327
struct nvc_context;
2428
struct nvc_container;
2529

@@ -121,6 +125,8 @@ void nvc_driver_info_free(struct nvc_driver_info *);
121125
struct nvc_device_info *nvc_device_info_new(struct nvc_context *, const char *);
122126
void nvc_device_info_free(struct nvc_device_info *);
123127

128+
int nvc_nvcaps_style(void);
129+
124130
int nvc_nvcaps_device_from_proc_path(struct nvc_context *, const char *, struct nvc_device_node *);
125131

126132
int nvc_driver_mount(struct nvc_context *, const struct nvc_container *, const struct nvc_driver_info *);

src/nvc_info.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,16 @@ nvc_device_info_free(struct nvc_device_info *info)
790790
free(info);
791791
}
792792

793+
int
794+
nvc_nvcaps_style(void)
795+
{
796+
if (nvidia_get_chardev_major(NV_CAPS_MODULE_NAME) >= 0)
797+
return NVC_NVCAPS_STYLE_DEV;
798+
if (file_exists(NULL, NV_PROC_DRIVER_CAPS) >= 0)
799+
return NVC_NVCAPS_STYLE_PROC;
800+
return NVC_NVCAPS_STYLE_NONE;
801+
}
802+
793803
int
794804
nvc_nvcaps_device_from_proc_path(struct nvc_context *ctx, const char *cap_path, struct nvc_device_node *node)
795805
{

0 commit comments

Comments
 (0)