sysfile.c
int
sys_link(void)
{
  char /*name[DIRSIZ],*/ *new, *old;
  //struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
    return -1;

  //begin_op();
  /*if((ip = namei(old)) == 0){
    end_op();
    return -1;
  }

  ilock(ip);
  if(ip->type == T_DIR){
    iunlockput(ip);
    end_op();
    return -1;
  }

  ip->nlink++;
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
  ilock(dp);
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
    iunlockput(dp);
    goto bad;
  }
  iunlockput(dp);
  iput(ip);*/

  //end_op();

  return 0;

//bad:
  /*ilock(ip);
  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);*/
  //end_op();
  return -1;
}
// Create the path new as a link to the same inode as old.
Create the path new as a link to the same inode as old.
Create the path new as a link to the same inode as old .
int
sys_link(void)
{
  char  *new, *old;
  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
    return -1;
  return 0;
  return -1;
}
int sys_link ( void ) { char * new , * old ; if ( argstr ( 0 , & old ) < 0 || argstr ( 1 , & new ) < 0 ) return -1 ; return 0 ; return -1 ; }
Create the path new as a link to the same inode as old.
Create the path new as a link to the same inode as old .
/*name[DIRSIZ],*/ //struct inode *dp, *ip; //begin_op(); /*if((ip = namei(old)) == 0){
    end_op();
    return -1;
  }

  ilock(ip);
  if(ip->type == T_DIR){
    iunlockput(ip);
    end_op();
    return -1;
  }

  ip->nlink++;
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
  ilock(dp);
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
    iunlockput(dp);
    goto bad;
  }
  iunlockput(dp);
  iput(ip);*/ //end_op(); //bad: /*ilock(ip);
  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);*/ //end_op();