55 if (
ops ==
NULL || name ==
NULL || supportedTypes == 0)
108 factory->
type = type;
177 LOG_WARN(
"socket family %s not found for unregistration\n", name);
197 if (family ==
NULL || outPath ==
NULL)
#define MAX_NAME
Maximum length of names.
void path_set(path_t *path, mount_t *mount, dentry_t *dentry)
Set a path.
#define BUFFER_READ(buffer, count, offset, src, size)
Helper macros for implementing file operations dealing with simple buffers.
#define LOG_WARN(format,...)
#define LOG_INFO(format,...)
uint64_t socket_family_register(const socket_family_ops_t *ops, const char *name, socket_type_t supportedTypes)
Register a socket family.
uint64_t socket_family_get_dir(socket_family_t *family, path_t *outPath)
Get the directory of a socket family.
void socket_family_unregister(const char *name)
Unregister a socket family.
socket_family_t * socket_family_get(const char *name)
Get a socket family by name.
const char * socket_type_to_string(socket_type_t type)
Convert a socket type to a string.
socket_type_t
Socket type enumeration.
socket_t * socket_new(socket_family_t *family, socket_type_t type, path_flags_t flags)
Create a new socket.
mount_t * net_get_mount(void)
Retrieve the mount for the networking subsystem.
#define LOCK_CREATE
Create a lock initializer. @macro LOCK_CREATE.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static void lock_release(lock_t *lock)
Releases a lock.
static void lock_acquire(lock_t *lock)
Acquires a lock, blocking until it is available.
#define DEREF(ptr)
Decrement reference count.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define LIST_FOR_EACH(elem, list, member)
Iterates over a list.
#define LIST_CREATE(name)
Creates a list initializer.
#define LIST_FOR_EACH_SAFE(elem, temp, list, member)
Safely iterates over a list, allowing for element removal during iteration.
static void list_remove(list_t *list, list_entry_t *entry)
Removes a list entry from its current list.
static void list_push(list_t *list, list_entry_t *entry)
Pushes an entry to the end of the list.
static void list_entry_init(list_entry_t *entry)
Initializes a list entry.
static void list_init(list_t *list)
Initializes a list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
EFI_PHYSICAL_ADDRESS buffer
static socket_family_ops_t ops
static uint64_t socket_factory_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
static socket_family_t * socket_family_get_and_remove(const char *name)
static void socket_factory_close(file_t *file)
static uint64_t socket_factory_open(file_t *file)
static file_ops_t fileOps
#define atomic_init(obj, value)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
_PUBLIC char * strncpy(char *_RESTRICT s1, const char *_RESTRICT s2, size_t n)
_PUBLIC size_t strlen(const char *s)
_PUBLIC int strcmp(const char *s1, const char *s2)
File operations structure.
uint64_t(* read)(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
A simple ticket lock implementation.
dentry_t * root
The root dentry of the mounted filesystem.
Socket Factory structure.
Socket Family operations structure.
uint64_t(* init)(socket_t *sock)
void(* deinit)(socket_t *sock)
const socket_family_ops_t * ops
socket_type_t supportedTypes
dentry_t * sysfs_dir_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private)
Create a new directory inside a mounted SysFS instance.
dentry_t * sysfs_file_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, const file_ops_t *fileOps, void *private)
Create a new file inside a mounted SysFS instance.