// Add a file input to a pending linker invocation
505307
func (link *LinkState) AddFile(input JITInputType, path string, options ...JITOption) error {
	argcount, args, argvals := link.encodeArguments(options)

	cpath := C.CString(path)
	err := result(C.cuLinkAddFile(
		link.state, C.CUjitInputType(input),
		cpath,
		argcount, args, argvals,
	))
	C.free(unsafe.Pointer(cpath))
	return err
}
790500
func (c *Config) AddFile(path string, level ConfigLevel, force bool) error {
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), nil, cbool(force))
	runtime.KeepAlive(c)
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}
1002401
func (adder *Adder) AddAllAndPin(file files.Node) (ipld.Node, error) {
	if adder.Pin {
		adder.unlocker = adder.gcLocker.PinLock()
	}
	defer func() {
		if adder.unlocker != nil {
			adder.unlocker.Unlock()
		}
	}()

	switch tf := file.(type) {
	case files.Directory:
		// Iterate over each top-level file and add individually. Otherwise the
		// single files.File f is treated as a directory, affecting hidden file
		// semantics.
		it := tf.Entries()
		for it.Next() {
			if err := adder.addFileNode(it.Name(), it.Node()); err != nil {
				return nil, err
			}
		}
		if it.Err() != nil {
			return nil, it.Err()
		}
		break
	default:
		if err := adder.addFileNode("", file); err != nil {
			return nil, err
		}
		break
	}

	// copy intermediary nodes from editor to our actual dagservice
	nd, err := adder.Finalize()
	if err != nil {
		return nil, err
	}

	if !adder.Pin {
		return nd, nil
	}
	return nd, adder.PinRoot()
}
845127
func (cl FileChangelist) Add(c Change) error {
	cJSON, err := json.Marshal(c)
	if err != nil {
		return err
	}
	filename := fmt.Sprintf("%020d_%s.change", time.Now().UnixNano(), uuid.Generate())
	return ioutil.WriteFile(filepath.Join(cl.dir, filename), cJSON, 0644)
}
100985
func (f *Folder) AddFile(name string, contentType string) error {
	return f.addFile(strings.Split(name, sep), contentType)
}
828328
func IOOpen(l *State) int {
	NewLibrary(l, ioLibrary)

	NewMetaTable(l, fileHandle)
	l.PushValue(-1)
	l.SetField(-2, "__index")
	SetFunctions(l, fileHandleMethods, 0)
	l.Pop(1)

	registerStdFile(l, os.Stdin, input, "stdin")
	registerStdFile(l, os.Stdout, output, "stdout")
	registerStdFile(l, os.Stderr, "", "stderr")

	return 1
}
498080
func AddImageStreamImageRefEdge(g osgraph.MutableUniqueGraph, node *imagegraph.ImageStreamImageNode) {
	dockImgRef, _ := reference.Parse(node.Name)
	imageStream := &imagev1.ImageStream{}
	imageStream.Namespace = node.Namespace
	imageStream.Name = dockImgRef.Name

	imageStreamNode := imagegraph.FindOrCreateSyntheticImageStreamNode(g, imageStream)
	g.AddEdge(node, imageStreamNode, ReferencedImageStreamImageGraphEdgeKind)
}
69165
func (ix *IndexWriter) AddFile(name string) {
	f, err := os.Open(name)
	if err != nil {
		log.Print(err)
		return
	}
	defer f.Close()
	ix.Add(name, f)
}
1323066
func (c *Client) AddStickerToSetFile(userID int, name, filename, emojis string, opts ...sendOption) error {
	req := url.Values{}
	req.Set("user_id", fmt.Sprint(userID))
	req.Set("name", name)
	req.Set("emojis", emojis)
	for _, opt := range opts {
		opt(req)
	}
	var added bool
	return c.doRequestWithFiles("addStickerToSet", req, &added, inputFile{field: "png_sticker", name: filename})
}
407608
func (bh *CephBackupHandle) AddFile(ctx context.Context, filename string, filesize int64) (io.WriteCloser, error) {
	if bh.readOnly {
		return nil, fmt.Errorf("AddFile cannot be called on read-only backup")
	}
	reader, writer := io.Pipe()
	bh.waitGroup.Add(1)
	go func() {
		defer bh.waitGroup.Done()

		// ceph bucket name is where the backups will go
		//backup handle dir field contains keyspace/shard value
		bucket := alterBucketName(bh.dir)

		// Give PutObject() the read end of the pipe.
		object := objName(bh.dir, bh.name, filename)
		_, err := bh.client.PutObjectWithContext(ctx, bucket, object, reader, -1, minio.PutObjectOptions{ContentType: "application/octet-stream"})
		if err != nil {
			// Signal the writer that an error occurred, in case it's not done writing yet.
			reader.CloseWithError(err)
			// In case the error happened after the writer finished, we need to remember it.
			bh.errors.RecordError(err)
		}
	}()
	// Give our caller the write end of the pipe.
	return writer, nil
}
1080955
func (fs *MockFilesystem) Add(name string) *MockFile {
	f := &MockFile{
		Seq: -1,
		fd:  uintptr(time.Now().UnixNano() & 0xffff),
		fs:  fs,
	}
	fs.Files[name] = f
	return f
}
1310385
func (r *FileRef) AddRef() File {
	if r == nil {
		return nil
	}

	r.m.Lock()
	r.refs++
	file := r.file
	r.m.Unlock()

	return file
}
222207
func (d EnhancedArchive) Add(name, path string) error {
	name = strings.Replace(filepath.Join(d.wrap, name), "\\", "/", -1)
	log.Debugf("adding file: %s as %s", path, name)
	if _, ok := d.files[name]; ok {
		return fmt.Errorf("file %s already exists in the archive", name)
	}
	d.files[name] = path
	return d.a.Add(name, path)
}
642847
func (c *Closer) Add(f CloseFunc) {
	c.m.Lock()
	defer c.m.Unlock()
	c.fs = append([]CloseFunc{f}, c.fs...)
}
132524
func addFileAttribute(a *dokan.Stat, fa dokan.FileAttribute) {
	// FileAttributeNormal is valid only if no other attribute is set.
	// Thus clear the normal flag (if set) from the attributes and or
	// the new flag.
	a.FileAttributes = (a.FileAttributes &^ dokan.FileAttributeNormal) | fa
}
1100553
func (m *M) AddFunc(mimetype string, minifier MinifierFunc) {
	m.mutex.Lock()
	m.literal[mimetype] = minifier
	m.mutex.Unlock()
}
804254
func (f *Filesystem) add(name string, fi os.FileInfo) (err error) {
	var file ReadableFile

	if runtime.GOOS == "darwin" {
		// When a file system is HFS+, its filepath is in NFD form.
		name = norm.NFC.String(name)
	}

	file = f.SourceSpec.NewFileInfo(f.Base, name, false, fi)
	f.files = append(f.files, file)

	return err
}