Lines Matching refs:db_node

57 	struct files_db_s *db_node;  in files_db_lookup_byfileno()  local
60 db_node = h->files_db_buckets[hash]; in files_db_lookup_byfileno()
61 while (db_node != NULL) { in files_db_lookup_byfileno()
62 if (db_node->fileno == fileno) in files_db_lookup_byfileno()
64 db_node = db_node->next; in files_db_lookup_byfileno()
66 return db_node; in files_db_lookup_byfileno()
73 struct files_db_s *db_node; in files_db_add_byfileno() local
75 db_node = (struct files_db_s *) in files_db_add_byfileno()
77 if (db_node == NULL) { in files_db_add_byfileno()
78 db_node = malloc(sizeof(struct files_db_s)); in files_db_add_byfileno()
79 db_node->fileno = fileno; in files_db_add_byfileno()
80 db_node->filename = NULL; in files_db_add_byfileno()
81 db_node->readonly = readonly; in files_db_add_byfileno()
82 db_node->size = 0; in files_db_add_byfileno()
83 db_node->fd = -1; in files_db_add_byfileno()
84 db_node->next = h->files_db_buckets[hash]; in files_db_add_byfileno()
85 h->files_db_buckets[hash] = db_node; in files_db_add_byfileno()
92 return db_node; in files_db_add_byfileno()
99 struct files_db_s *db_node; in files_db_fsync_discard_files() local
103 db_node = h->files_db_buckets[i]; in files_db_fsync_discard_files()
104 while (db_node != NULL) { in files_db_fsync_discard_files()
107 if (db_node->fd == -1) { in files_db_fsync_discard_files()
116 if (files_db_readonly(db_node)) in files_db_fsync_discard_files()
120 fd = open(files_db_get_filename(db_node), in files_db_fsync_discard_files()
125 progname, db_node->filename, in files_db_fsync_discard_files()
129 db_node->fd = fd; in files_db_fsync_discard_files()
131 if (!db_node->readonly && fsync(db_node->fd) < 0) { in files_db_fsync_discard_files()
133 __func__, db_node->filename); in files_db_fsync_discard_files()
136 if (posix_fadvise(db_node->fd, 0, 0, in files_db_fsync_discard_files()
140 __func__, db_node->filename); in files_db_fsync_discard_files()
144 close(db_node->fd); in files_db_fsync_discard_files()
145 db_node->fd = -1; in files_db_fsync_discard_files()
147 db_node = db_node->next; in files_db_fsync_discard_files()
155 struct files_db_s *db_node = (struct files_db_s *)node; in files_db_update_fd() local
157 db_node->fd = fd; in files_db_update_fd()
163 struct files_db_s *db_node = (struct files_db_s *)node; in files_db_close_fd() local
165 if (db_node->fd != -1) in files_db_close_fd()
166 close(db_node->fd); in files_db_close_fd()
167 db_node->fd = -1; in files_db_close_fd()
174 struct files_db_s *db_node; in files_db_close_files() local
178 db_node = h->files_db_buckets[i]; in files_db_close_files()
179 while (db_node != NULL) { in files_db_close_files()
180 if ((db_node->fd != -1) && close(db_node->fd) < 0) { in files_db_close_files()
182 __func__, db_node->filename); in files_db_close_files()
185 db_node->fd = -1; in files_db_close_files()
186 db_node = db_node->next; in files_db_close_files()
195 struct files_db_s *db_node; in files_db_unlink_files() local
199 db_node = h->files_db_buckets[i]; in files_db_unlink_files()
200 while (db_node != NULL) { in files_db_unlink_files()
201 if ((db_node->fd != -1) && close(db_node->fd) < 0) { in files_db_unlink_files()
203 __func__, db_node->filename); in files_db_unlink_files()
206 db_node->fd = -1; in files_db_unlink_files()
207 if (is_readonly_mount(db_node->filename, db_node->size) == 0) { in files_db_unlink_files()
208 if (unlink(db_node->filename) < 0) { in files_db_unlink_files()
210 __func__, db_node->filename); in files_db_unlink_files()
214 db_node = db_node->next; in files_db_unlink_files()
223 struct files_db_s *db_node, *tmp; in files_db_free_memory() local
227 db_node = h->files_db_buckets[i]; in files_db_free_memory()
228 while (db_node != NULL) { in files_db_free_memory()
229 tmp = db_node; in files_db_free_memory()
230 db_node = db_node->next; in files_db_free_memory()