// CreateDirectory uses Create to create a directory named s under inodeOperations.
CreateDirectory uses Create to create a directory named s under inodeOperations.
// CreateDirectory uses Create to create a directory named s under inodeOperations .
func (i *inodeOperations) CreateDirectory(ctx context.Context, dir *fs.Inode, s string, perm fs.FilePermissions) error {
	if len(s) > maxFilenameLen {
		return syserror.ENAMETOOLONG
	}
	owner := fs.FileOwnerFromContext(ctx)
	parentUattr, err := dir.UnstableAttr(ctx)
	if err != nil {
		return err
	}
	if parentUattr.Perms.SetGID {
		owner.GID = parentUattr.Owner.GID
		perm.SetGID = true
	}
	if _, err := i.fileState.file.mkdir(ctx, s, p9.FileMode(perm.LinuxMode()), p9.UID(owner.UID), p9.GID(owner.GID)); err != nil {
		return err
	}
	if i.session().cachePolicy.cacheUAttrs(dir) {
		 N.B. This will update the modification time.
		i.cachingInodeOps.IncLinks(ctx)
	}
	if i.session().cachePolicy.cacheReaddir() {
		 Invalidate readdir cache.
		i.markDirectoryDirty()
	}
	return nil
}
func ( i * inodeOperations ) CreateDirectory ( ctx context . Context , dir * fs . Inode , s string , perm fs . FilePermissions ) error { if len ( s ) > maxFilenameLen { return syserror . ENAMETOOLONG } owner := fs . FileOwnerFromContext ( ctx ) parentUattr , err := dir . UnstableAttr ( ctx ) if err != nil { return err } if parentUattr . Perms . SetGID { owner . GID = parentUattr . Owner . GID perm . SetGID = true } if _ , err := i . fileState . file . mkdir ( ctx , s , p9 . FileMode ( perm . LinuxMode ( ) ) , p9 . UID ( owner . UID ) , p9 . GID ( owner . GID ) ) ; err != nil { return err } if i . session ( ) . cachePolicy . cacheUAttrs ( dir ) { i . cachingInodeOps . IncLinks ( ctx ) } if i . session ( ) . cachePolicy . cacheReaddir ( ) { i . markDirectoryDirty ( ) } return nil }
CreateDirectory uses Create to create a directory named s under inodeOperations.
CreateDirectory uses Create to create a directory named s under inodeOperations .
// If the parent directory has setgid enabled, change the new directory's // owner and enable setgid. // Increase link count. // // N.B. This will update the modification time. // Invalidate readdir cache.