X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ffd-tracker%2Finode.c;h=f105f5bd334df020e3d4800257ca3c0690f072eb;hp=b894f8fbf6d6d41073cd14a94ea63a5d7285e3b0;hb=9604bd17bfb1f116b6d4e56ab1d95e08cde17a06;hpb=d05a3d937ddc2b666b153e6adaf9610800772b68 diff --git a/src/common/fd-tracker/inode.c b/src/common/fd-tracker/inode.c index b894f8fbf..f105f5bd3 100644 --- a/src/common/fd-tracker/inode.c +++ b/src/common/fd-tracker/inode.c @@ -245,11 +245,15 @@ static void lttng_inode_get(struct lttng_inode *inode) urcu_ref_get(&inode->ref); } -struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( +LTTNG_HIDDEN struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( const char *path) { struct lttng_unlinked_file_pool *pool = zmalloc(sizeof(*pool)); + if (!pool) { + goto error; + } + if (!path || *path != '/') { ERR("Unlinked file pool must be created with an absolute path, path = \"%s\"", path ? path : "NULL"); @@ -268,7 +272,7 @@ error: return NULL; } -void lttng_unlinked_file_pool_destroy( +LTTNG_HIDDEN void lttng_unlinked_file_pool_destroy( struct lttng_unlinked_file_pool *pool) { if (!pool) { @@ -281,12 +285,13 @@ void lttng_unlinked_file_pool_destroy( free(pool); } -void lttng_inode_put(struct lttng_inode *inode) +LTTNG_HIDDEN void lttng_inode_put(struct lttng_inode *inode) { urcu_ref_put(&inode->ref, lttng_inode_release); } -struct lttng_directory_handle *lttng_inode_get_location_directory_handle( +LTTNG_HIDDEN struct lttng_directory_handle * +lttng_inode_get_location_directory_handle( struct lttng_inode *inode) { if (inode->location.directory_handle) { @@ -298,7 +303,7 @@ struct lttng_directory_handle *lttng_inode_get_location_directory_handle( return inode->location.directory_handle; } -void lttng_inode_borrow_location(struct lttng_inode *inode, +LTTNG_HIDDEN void lttng_inode_borrow_location(struct lttng_inode *inode, const struct lttng_directory_handle **out_directory_handle, const char **out_path) { @@ -310,7 +315,7 @@ void lttng_inode_borrow_location(struct lttng_inode *inode, } } -int lttng_inode_rename( +LTTNG_HIDDEN int lttng_inode_rename( struct lttng_inode *inode, struct lttng_directory_handle *old_directory_handle, const char *old_path, @@ -380,7 +385,7 @@ end: return ret; } -int lttng_inode_unlink(struct lttng_inode *inode) +LTTNG_HIDDEN int lttng_inode_unlink(struct lttng_inode *inode) { int ret = 0; @@ -446,7 +451,7 @@ end: return inode; } -struct lttng_inode_registry *lttng_inode_registry_create(void) +LTTNG_HIDDEN struct lttng_inode_registry *lttng_inode_registry_create(void) { struct lttng_inode_registry *registry = zmalloc(sizeof(*registry)); @@ -473,7 +478,8 @@ error: return NULL; } -void lttng_inode_registry_destroy(struct lttng_inode_registry *registry) +LTTNG_HIDDEN void lttng_inode_registry_destroy( + struct lttng_inode_registry *registry) { if (!registry) { return; @@ -486,7 +492,7 @@ void lttng_inode_registry_destroy(struct lttng_inode_registry *registry) free(registry); } -struct lttng_inode *lttng_inode_registry_get_inode( +LTTNG_HIDDEN struct lttng_inode *lttng_inode_registry_get_inode( struct lttng_inode_registry *registry, struct lttng_directory_handle *handle, const char *path, @@ -522,6 +528,10 @@ struct lttng_inode *lttng_inode_registry_get_inode( inode = lttng_inode_create(&id, registry->inodes, unlinked_file_pool, handle, path); + if (!inode) { + goto end_unlock; + } + node = cds_lfht_add_unique(registry->inodes, lttng_inode_id_hash(&inode->id), lttng_inode_match, &inode->id, &inode->registry_node);