1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
4 * 2005-2007 Takahiro Hirofuchi
11 #include "usbip_common.h"
13 #include "sysfs_utils.h"
15 int modify_match_busid(char *busid
, int add
)
17 char attr_name
[] = "match_busid";
18 char command
[SYSFS_BUS_ID_SIZE
+ 4];
19 char match_busid_attr_path
[SYSFS_PATH_MAX
];
23 snprintf(match_busid_attr_path
, sizeof(match_busid_attr_path
),
24 "%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH
, SYSFS_BUS_NAME
,
25 SYSFS_BUS_TYPE
, SYSFS_DRIVERS_NAME
, USBIP_HOST_DRV_NAME
,
29 cmd_size
= snprintf(command
, SYSFS_BUS_ID_SIZE
+ 4, "add %s",
32 cmd_size
= snprintf(command
, SYSFS_BUS_ID_SIZE
+ 4, "del %s",
35 rc
= write_sysfs_attribute(match_busid_attr_path
, command
,
38 dbg("failed to write match_busid: %s", strerror(errno
));