tools/usb/usbip/src/utils.c
Source file repositories/reference/linux-study-clean/tools/usb/usbip/src/utils.c
File Facts
- System
- Linux kernel
- Corpus path
tools/usb/usbip/src/utils.c- Extension
.c- Size
- 1028 bytes
- Lines
- 44
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
errno.hstdio.hstring.husbip_common.hutils.hsysfs_utils.h
Detected Declarations
function Copyright
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
* 2005-2007 Takahiro Hirofuchi
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "usbip_common.h"
#include "utils.h"
#include "sysfs_utils.h"
int modify_match_busid(char *busid, int add)
{
char attr_name[] = "match_busid";
char command[SYSFS_BUS_ID_SIZE + 4];
char match_busid_attr_path[SYSFS_PATH_MAX];
int rc;
int cmd_size;
snprintf(match_busid_attr_path, sizeof(match_busid_attr_path),
"%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH, SYSFS_BUS_NAME,
SYSFS_BUS_TYPE, SYSFS_DRIVERS_NAME, USBIP_HOST_DRV_NAME,
attr_name);
if (add)
cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "add %s",
busid);
else
cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s",
busid);
rc = write_sysfs_attribute(match_busid_attr_path, command,
cmd_size);
if (rc < 0) {
dbg("failed to write match_busid: %s", strerror(errno));
return -1;
}
return 0;
}
Annotation
- Immediate include surface: `errno.h`, `stdio.h`, `string.h`, `usbip_common.h`, `utils.h`, `sysfs_utils.h`.
- Detected declarations: `function Copyright`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.