static int local_unlinkat(FsContext *ctx, V9fsPath *dir,

                          const char *name, int flags)

{

    int ret;

    V9fsString fullname;

    char buffer[PATH_MAX];



    v9fs_string_init(&fullname);



    v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name);

    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        if (flags == AT_REMOVEDIR) {

            /*

             * If directory remove .virtfs_metadata contained in the

             * directory

             */

            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s", ctx->fs_root,

                     fullname.data, VIRTFS_META_DIR);

            ret = remove(buffer);

            if (ret < 0 && errno != ENOENT) {

                /*

                 * We didn't had the .virtfs_metadata file. May be file created

                 * in non-mapped mode ?. Ignore ENOENT.

                 */

                goto err_out;

            }

        }

        /*

         * Now remove the name from parent directory

         * .virtfs_metadata directory.

         */

        ret = remove(local_mapped_attr_path(ctx, fullname.data, buffer));

        if (ret < 0 && errno != ENOENT) {

            /*

             * We didn't had the .virtfs_metadata file. May be file created

             * in non-mapped mode ?. Ignore ENOENT.

             */

            goto err_out;

        }

    }

    /* Remove the name finally */

    ret = remove(rpath(ctx, fullname.data, buffer));



err_out:

    v9fs_string_free(&fullname);

    return ret;

}

static int local_unlinkat(FsContext *ctx, V9fsPath *dir,

                          const char *name, int flags)

{

    int ret;

    V9fsString fullname;

    char buffer[PATH_MAX];



    v9fs_string_init(&fullname);



    v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name);

    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        if (flags == AT_REMOVEDIR) {

            







            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s", ctx->fs_root,

                     fullname.data, VIRTFS_META_DIR);

            ret = remove(buffer);

            if (ret < 0 && errno != ENOENT) {

                







                goto err_out;

            }

        }

        







        ret = remove(local_mapped_attr_path(ctx, fullname.data, buffer));

        if (ret < 0 && errno != ENOENT) {

            







            goto err_out;

        }

    }

    

    ret = remove(rpath(ctx, fullname.data, buffer));



err_out:

    v9fs_string_free(&fullname);

    return ret;

}

static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,

                          const char *VAR_2, int VAR_3)

{

    int VAR_4;

    V9fsString fullname;

    char VAR_5[PATH_MAX];



    v9fs_string_init(&fullname);



    v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2);

    if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {

        if (VAR_3 == AT_REMOVEDIR) {

            







            snprintf(VAR_5, ARRAY_SIZE(VAR_5), "%s/%s/%s", VAR_0->fs_root,

                     fullname.data, VIRTFS_META_DIR);

            VAR_4 = remove(VAR_5);

            if (VAR_4 < 0 && errno != ENOENT) {

                







                goto err_out;

            }

        }

        







        VAR_4 = remove(local_mapped_attr_path(VAR_0, fullname.data, VAR_5));

        if (VAR_4 < 0 && errno != ENOENT) {

            







            goto err_out;

        }

    }

    

    VAR_4 = remove(rpath(VAR_0, fullname.data, VAR_5));



err_out:

    v9fs_string_free(&fullname);

    return VAR_4;

}

static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,
const char *VAR_2, int VAR_3)
{ int VAR_4; V9fsString fullname; char VAR_5[PATH_MAX]; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2); if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { if (VAR_3 == AT_REMOVEDIR) { snprintf(VAR_5, ARRAY_SIZE(VAR_5), "%s/%s/%s", VAR_0->fs_root,
fullname.data, VIRTFS_META_DIR); VAR_4 = remove(VAR_5); if (VAR_4 < 0 && errno != ENOENT) { goto err_out; } } VAR_4 = remove(local_mapped_attr_path(VAR_0, fullname.data, VAR_5)); if (VAR_4 < 0 && errno != ENOENT) { goto err_out; } } VAR_4 = remove(rpath(VAR_0, fullname.data, VAR_5)); err_out:
v9fs_string_free(&fullname); return VAR_4; }