static int local_remove(FsContext *ctx, const char *path)

{

    int err;

    struct stat stbuf;

    char buffer[PATH_MAX];



    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        err =  lstat(rpath(ctx, path, buffer), &stbuf);

        if (err) {

            goto err_out;

        }

        /*

         * If directory remove .virtfs_metadata contained in the

         * directory

         */

        if (S_ISDIR(stbuf.st_mode)) {

            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s",

                     ctx->fs_root, path, VIRTFS_META_DIR);

            err = remove(buffer);

            if (err < 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

         */

        err = remove(local_mapped_attr_path(ctx, path, buffer));

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

            /*

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

             * in non-mapped mode ?. Ignore ENOENT.

             */

            goto err_out;

        }

    }

    return remove(rpath(ctx, path, buffer));

err_out:

    return err;

}

static int local_remove(FsContext *ctx, const char *path)

{

    int err;

    struct stat stbuf;

    char buffer[PATH_MAX];



    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        err =  lstat(rpath(ctx, path, buffer), &stbuf);

        if (err) {

            goto err_out;

        }

        







        if (S_ISDIR(stbuf.st_mode)) {

            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s",

                     ctx->fs_root, path, VIRTFS_META_DIR);

            err = remove(buffer);

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

                







                goto err_out;

            }

        }

        







        err = remove(local_mapped_attr_path(ctx, path, buffer));

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

            







            goto err_out;

        }

    }

    return remove(rpath(ctx, path, buffer));

err_out:

    return err;

}

static int FUNC_0(FsContext *VAR_0, const char *VAR_1)

{

    int VAR_2;

    struct stat VAR_3;

    char VAR_4[PATH_MAX];



    if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {

        VAR_2 =  lstat(rpath(VAR_0, VAR_1, VAR_4), &VAR_3);

        if (VAR_2) {

            goto err_out;

        }

        







        if (S_ISDIR(VAR_3.st_mode)) {

            snprintf(VAR_4, ARRAY_SIZE(VAR_4), "%s/%s/%s",

                     VAR_0->fs_root, VAR_1, VIRTFS_META_DIR);

            VAR_2 = remove(VAR_4);

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

                







                goto err_out;

            }

        }

        







        VAR_2 = remove(local_mapped_attr_path(VAR_0, VAR_1, VAR_4));

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

            







            goto err_out;

        }

    }

    return remove(rpath(VAR_0, VAR_1, VAR_4));

err_out:

    return VAR_2;

}

static int FUNC_0(FsContext *VAR_0, const char *VAR_1)
{ int VAR_2; struct stat VAR_3; char VAR_4[PATH_MAX]; if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { VAR_2 =  lstat(rpath(VAR_0, VAR_1, VAR_4), &VAR_3); if (VAR_2) { goto err_out; } if (S_ISDIR(VAR_3.st_mode)) { snprintf(VAR_4, ARRAY_SIZE(VAR_4), "%s/%s/%s",
VAR_0->fs_root, VAR_1, VIRTFS_META_DIR); VAR_2 = remove(VAR_4); if (VAR_2 < 0 && errno != ENOENT) { goto err_out; } } VAR_2 = remove(local_mapped_attr_path(VAR_0, VAR_1, VAR_4)); if (VAR_2 < 0 && errno != ENOENT) { goto err_out; } } return remove(rpath(VAR_0, VAR_1, VAR_4)); err_out:
return VAR_2; }