tools/usb/usbip/libsrc/sysfs_utils.c
Source file repositories/reference/linux-study-clean/tools/usb/usbip/libsrc/sysfs_utils.c
File Facts
- System
- Linux kernel
- Corpus path
tools/usb/usbip/libsrc/sysfs_utils.c- Extension
.c- Size
- 562 bytes
- Lines
- 33
- 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
sys/types.hsys/stat.hfcntl.herrno.hsysfs_utils.husbip_common.h
Detected Declarations
function write_sysfs_attribute
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "sysfs_utils.h"
#include "usbip_common.h"
int write_sysfs_attribute(const char *attr_path, const char *new_value,
size_t len)
{
int fd;
int length;
fd = open(attr_path, O_WRONLY);
if (fd < 0) {
dbg("error opening attribute %s", attr_path);
return -1;
}
length = write(fd, new_value, len);
if (length < 0) {
dbg("error writing to attribute %s", attr_path);
close(fd);
return -1;
}
close(fd);
return 0;
}
Annotation
- Immediate include surface: `sys/types.h`, `sys/stat.h`, `fcntl.h`, `errno.h`, `sysfs_utils.h`, `usbip_common.h`.
- Detected declarations: `function write_sysfs_attribute`.
- 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.