// Remove implements InodeOperations.Remove.
Remove implements InodeOperations.Remove.
// Remove implements InodeOperations . Remove .
func (i *inodeOperations) Remove(ctx context.Context, dir *fs.Inode, name string) error {
	if len(name) > maxFilenameLen {
		return syserror.ENAMETOOLONG
	}
	var key *device.MultiDeviceKey
	if i.session().overrides != nil {
		if d, err := i.Lookup(ctx, dir, name); err == nil {
			defer d.DecRef(ctx)
			if fs.IsSocket(d.Inode.StableAttr) || fs.IsPipe(d.Inode.StableAttr) {
				switch iops := d.Inode.InodeOperations.(type) {
				case *inodeOperations:
					key = &iops.fileState.key
				case *fifo:
					key = &iops.fileIops.fileState.key
				}
				unlock := i.session().overrides.lock()
				defer unlock()
			}
		}
	}
	if err := i.fileState.file.unlinkAt(ctx, name, 0); err != nil {
		return err
	}
	if key != nil {
		i.session().overrides.remove(ctx, *key)
	}
	i.touchModificationAndStatusChangeTime(ctx, dir)
	return nil
}
func ( i * inodeOperations ) Remove ( ctx context . Context , dir * fs . Inode , name string ) error { if len ( name ) > maxFilenameLen { return syserror . ENAMETOOLONG } var key * device . MultiDeviceKey if i . session ( ) . overrides != nil { if d , err := i . Lookup ( ctx , dir , name ) ; err == nil { defer d . DecRef ( ctx ) if fs . IsSocket ( d . Inode . StableAttr ) || fs . IsPipe ( d . Inode . StableAttr ) { switch iops := d . Inode . InodeOperations . ( type ) { case * inodeOperations : key = & iops . fileState . key case * fifo : key = & iops . fileIops . fileState . key } unlock := i . session ( ) . overrides . lock ( ) defer unlock ( ) } } } if err := i . fileState . file . unlinkAt ( ctx , name , 0 ) ; err != nil { return err } if key != nil { i . session ( ) . overrides . remove ( ctx , * key ) } i . touchModificationAndStatusChangeTime ( ctx , dir ) return nil }
Remove implements InodeOperations.Remove.
Remove implements InodeOperations . Remove .
// Find out if file being deleted is a socket or pipe that needs to be // removed from endpoint map. // Stabilize the override map while deletion is in progress.