<commit_before>package driver

import (
	"fmt"
	"os"
	"path/filepath"
	"syscall"

	"github.com/concourse/baggageclaim/volume"
	"github.com/concourse/baggageclaim/volume/copy"
)

var mountOpts string

func init() {
	if metacopySupported() {
		mountOpts = "lowerdir=%s,upperdir=%s,workdir=%s,metacopy=on"
	} else {
		mountOpts = "lowerdir=%s,upperdir=%s,workdir=%s"
	}
}

// Metacopy is an overlayfs feature. If all you're doing is chown/chmod'ing a
// file then it will not create a copy of the file. Files will only be copied
// when they are written to.
func metacopySupported() bool {
	_, err := os.Stat("/sys/module/overlay/parameters/metacopy")
	return !os.IsNotExist(err)
}

type OverlayDriver struct {
	OverlaysDir string
}<commit_msg>os.IsNotExist() -> errors.Is()<commit_after>package driver

import (
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"syscall"

	"github.com/concourse/baggageclaim/volume"
	"github.com/concourse/baggageclaim/volume/copy"
)

var mountOpts string

func init() {
	if metacopySupported() {
		mountOpts = "lowerdir=%s,upperdir=%s,workdir=%s,metacopy=on"
	} else {
		mountOpts = "lowerdir=%s,upperdir=%s,workdir=%s"
	}
}

// Metacopy is an overlayfs feature. If all you're doing is chown/chmod'ing a
// file then it will not create a copy of the file. Files will only be copied
// when they are written to.
func metacopySupported() bool {
	_, err := os.Stat("/sys/module/overlay/parameters/metacopy")
	if err != nil {
		return !errors.Is(err, os.ErrNotExist)
	}
	return true
}

type OverlayDriver struct {
	OverlaysDir string
}
{'fraction_non_alphanumeric': 0.1337620578778135, 'fraction_numerical': 0.0, 'mean_word_length': 4.402777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '221008', 'n_tokens_mistral': 588, 'n_tokens_neox': 573, 'n_words': 140}