libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
inode.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include<libtransistor/types.h>
13 #include<stdlib.h>
14 
15 struct trn_inode_ops_t;
16 
17 typedef struct {
18  void *data;
19  struct trn_inode_ops_t *ops;
20 } trn_inode_t; // libTRaNsistor INODE
21 
22 typedef struct {
23  char name[256];
24  size_t name_size;
25 } trn_dirent_t;
26 
27 typedef struct {
28  result_t (*rewind)(void *dir);
29  result_t (*next)(void *dir, trn_dirent_t *dirent);
30  void (*close)(void *dir);
32 
33 typedef struct {
34  void *data;
35  trn_dir_ops_t *ops;
36 } trn_dir_t;
37 
38 typedef struct trn_inode_ops_t {
39  result_t (*is_dir)(void *inode, bool *out);
40  result_t (*lookup)(void *inode, trn_inode_t *out, const char *name, size_t name_length);
41  result_t (*release)(void *inode);
42  result_t (*create_file)(void *inode, const char *name);
43  result_t (*create_directory)(void *inode, const char *name);
44  result_t (*remove_file)(void *inode);
45  result_t (*remove_empty_directory)(void *inode);
46  result_t (*rename)(void *inode, const char *newname);
47 
48  /*
49  Objects returned from these functions must not be invalidated if the inode is closed
50  before they are.
51  */
52  result_t (*open_as_file)(void *inode, int mode, int *fd);
53  result_t (*open_as_dir)(void *inode, trn_dir_t *out);
55 
56 #ifdef __cplusplus
57 }
58 #endif
Definition: inode.h:33
Various system types.
Definition: inode.h:22
Definition: inode.h:38
uint32_t result_t
Function result.
Definition: types.h:51
Definition: inode.h:17
Definition: inode.h:27