int register_blockdriver(const char *path, const struct block_operations *bops, mode_t mode, void *priv) { struct inode *node; int ret = -ENOMEM; /* Insert an inode for the device driver -- we need to hold the inode semaphore * to prevent access to the tree while we this. This is because we will have a * momentarily bad true until we populate the inode with valid data. */ inode_semtake(); node = inode_reserve(path); if (node != NULL) { /* We have it, now populate it with block driver specific * information. */ INODE_SET_BLOCK(node); node->u.i_bops = bops; #ifdef CONFIG_FILE_MODE node->i_mode = mode; #endif node->i_private = priv; ret = OK; } inode_semgive(); return ret; }
int register_blockdriver(FAR const char *path, FAR const struct block_operations *bops, mode_t mode, FAR void *priv) { FAR struct inode *node; int ret; /* Insert an inode for the device driver -- we need to hold the inode * semaphore to prevent access to the tree while we this. This is because * we will have a momentarily bad true until we populate the inode with * valid data. */ inode_semtake(); ret = inode_reserve(path, &node); if (ret >= 0) { /* We have it, now populate it with block driver specific information. * NOTE that the initial reference count on the new inode is zero. */ INODE_SET_BLOCK(node); node->u.i_bops = bops; #ifdef CONFIG_FILE_MODE node->i_mode = mode; #endif node->i_private = priv; ret = OK; } inode_semgive(); return ret; }